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
Detects nested lists and only add carets as necessary before: Docs after: Docs
def add_carets(node) if node.tag_name == "li" if node.children("ul").size > 0 node.prepend('<span class="caret caret-down"></span>') else node.prepend('<span class="caret caret-spacing"></span>') end end node.children.each do |child| add_carets(child) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_docbook_simple_lists( text )\n orig_text = text.dup\n delimiter = \"\"\n text.gsub!( LISTS_RE ) do |match|\n lines = match.split( /\\n/ )\n last_line = -1\n depth = []\n lines.each_with_index do |line, line_id|\n if line =~ /^([_]+)(#{A}#{C}) (.*)$/m\n tl,atts,content = $~[1..4]\n if depth.last\n if depth.last.length > tl.length\n (depth.length - 1).downto(0) do |i|\n break if depth[i].length == tl.length\n lines[line_id - 1] << \"</member>\\n</simplelist>\\n\"\n depth.pop\n end\n end\n if depth.last.length == tl.length\n lines[line_id - 1] << \"</member>\"\n end\n end\n unless depth.last == tl\n depth << tl\n atts = docbook_pba( atts )\n atts = shelve( atts ) if atts\n lines[line_id] = \"<simplelist#{ atts }>\\n<member>#{ content.gsub(\"<\",\"&lt;\").gsub(\">\",\"&gt;\") }\"\n else\n lines[line_id] = \"<member>#{ content.gsub(\"<\",\"&lt;\").gsub(\">\",\"&gt;\") }\"\n end\n last_line = line_id\n\n else\n last_line = line_id\n end\n if line_id - last_line > 1 or line_id == lines.length - 1\n depth.delete_if do |v|\n lines[last_line] << \"</member>\\n</simplelist>\"\n end\n end\n end\n lines.join( \"\\n\" )\n end\n text != orig_text\n end", "def block_docbook_lists( text )\n orig_text = text.dup\n delimiter = \"\"\n text.gsub!( LISTS_RE ) do |match|\n lines = match.split( /\\n/ )\n last_line = -1\n depth = []\n lines.each_with_index do |line, line_id|\n if line =~ LISTS_CONTENT_RE \n tl,continuation,atts,content = $~[1..4]\n if depth.last\n if depth.last.length > tl.length\n (depth.length - 1).downto(0) do |i|\n break if depth[i].length == tl.length\n lines[line_id - 1] << \"</para></listitem>\\n</#{ lD( depth[i] ) }>\\n\"\n depth.pop\n end\n end\n if depth.last.length == tl.length\n lines[line_id - 1] << \"</para></listitem>\"\n end\n end\n unless depth.last == tl\n depth << tl\n atts = docbook_pba( atts )\n atts = shelve( atts ) if atts\n delimiter = lD(tl)\n lines[line_id] = \"<#{ delimiter }#{ atts }>\\n<listitem><para>#{ content.gsub(\"<\",\"&lt;\").gsub(\">\",\"&gt;\") }\"\n else\n lines[line_id] = \"<listitem><para>#{ content.gsub(\"<\",\"&lt;\").gsub(\">\",\"&gt;\") }\"\n end\n last_line = line_id\n\n else\n last_line = line_id\n end\n if line_id - last_line > 1 or line_id == lines.length - 1\n depth.delete_if do |v|\n lines[last_line] << \"</para></listitem>\\n</#{ lD( v ) }>\"\n end\n end\n end\n lines.join( \"\\n\" )\n end\n text != orig_text\n end", "def test_nested_list\n items = [\n 'Item 1',\n 'Item 1a',\n 'Item 1a1',\n 'Item 1a1a',\n 'Item 1a1a1',\n 'Item 1a1a1a',\n 'Item 1a1a1a1',\n 'Item 1a1a1a1a',\n 'Item 1a1a1a1a1',\n 'Item 1a1a1a1a1a'\n ]\n\n pre = -3\n markdown = items.inject('') do |md, item|\n pre += 3\n md.concat(' '*pre + '+ ' + item + \"\\n\")\n end\n\n html = GitHub::Markdown.render(markdown)\n parsed = Nokogiri::HTML::DocumentFragment.parse(html)\n\n items.inject(parsed) do |node, expected_item|\n child = node.xpath('.//ul/li')\n child_item = child.children.detect{|e| e.text?}.text.strip\n assert_equal expected_item, child_item\n node = child\n end\n end", "def process_lists\n @doc.css('ul', 'ol').each do |list|\n\n # If we get a list (ol/ul) which is not a root, we stop processing.\n if list.ancestors('ul').count > 0 || list.ancestors('ol').count > 0\n return\n end\n\n textile_list = []\n\n list.css('li').each do |li|\n process_li(li, textile_list)\n end\n\n list.replace(\"\\n\\n\" + textile_list.join(\"\\n\") + \"\\n\\n\")\n end\n end", "def test_nested_ordered_list_incorrect\n assert_nothing_raised do\n parser = Juli::Parser.new\n parser.parse(data_path('t005.txt'), Juli::Visitor::Tree.new)\n end\n end", "def handled_labeled_list(line, level, margin, offset, prefix)\n prefix_length = prefix.length\n text = line.text\n flag = nil\n\n case prefix\n when /^\\[/ then\n flag = :LABELED\n prefix = prefix[1, prefix.length-2]\n when /:$/ then\n flag = :NOTE\n prefix.chop!\n else\n raise \"Invalid List Type: #{self.inspect}\"\n end\n\n # body is on the next line\n if text.length <= offset then\n original_line = line\n line = @lines.next\n return false unless line\n text = line.text\n\n for i in 0..margin\n if text[i] != SPACE\n @lines.unget\n return false\n end\n end\n\n i = margin\n i += 1 while text[i] == SPACE\n\n if i >= text.length then\n @lines.unget\n return false\n else\n offset = i\n prefix_length = 0\n\n if text[offset..-1] =~ SIMPLE_LIST_RE then\n @lines.unget\n line = original_line\n line.text = ''\n else\n @lines.delete original_line\n end\n end\n end\n\n line.stamp :LIST, level+1, prefix, flag\n text[margin, prefix_length] = \" \" * prefix_length\n assign_types_to_lines(offset, level + 1)\n return true\n end", "def html_filter_definition_lists\n # process all unordered lists depth-first\n @html.search('ul').to_a.reverse_each do |ul|\n items = ul.search('li')\n next if items.any? { |item| item.inner_text.strip.split(\"\\n\", 2).first !~ /:$/ }\n\n dl = Nokogiri::XML::Node.new 'dl', html\n items.each do |item|\n # This processing is specific to how Markdown generates definition lists\n term, definition = item.inner_html.strip.split(\":\\n\", 2)\n term = term.sub(/^<p>/, '')\n\n dt = Nokogiri::XML::Node.new 'dt', html\n dt.children = Nokogiri::HTML.fragment(term)\n dt.attributes['class'] = 'flush' if dt.inner_text.length <= 7\n\n dd = Nokogiri::XML::Node.new 'dd', html\n dd_contents = Nokogiri::HTML.fragment(definition)\n dd.children = dd_contents\n\n dl.add_child(dt)\n dl.add_child(dd)\n end\n ul.replace(dl)\n end\n end", "def nest_blocklists(doc)\n logger.info(\"Nesting blocklists\")\n\n Slaw::Parse::Blocklists.nest_blocklists(doc)\n end", "def nestable_list_recursive(items, block)\n content_tag(:ol, class: 'dd-list') do\n tags = items.map do |item|\n content_tag(:li, class: 'dd-item', data: { id: item.to_param }) do\n content = capture_with_haml { block.call(item) }\n recurse = if item.children.empty?\n ''.html_safe\n else\n nestable_list_recursive(item.children, block)\n end\n\n content.html_safe + recurse\n end\n end\n\n tags.join.html_safe\n end\n end", "def termdef_unnest_cleanup(xmldoc)\n desgn = \"//p/admitted | //p/deprecates | //p/preferred | //p//related\"\n nodes = xmldoc.xpath(desgn)\n while !nodes.empty?\n nodes[0].parent.replace(nodes[0].parent.children)\n nodes = xmldoc.xpath(desgn)\n end\n end", "def build_list margin\n p :list_start => margin if @debug\n\n list = RDoc::Markup::List.new\n label = nil\n\n until @tokens.empty? do\n type, data, column, = get\n\n case type\n when *LIST_TOKENS then\n if column < margin || (list.type && list.type != type) then\n unget\n break\n end\n\n list.type = type\n peek_type, _, column, = peek_token\n\n case type\n when :NOTE, :LABEL then\n label = [] unless label\n\n if peek_type == :NEWLINE then\n # description not on the same line as LABEL/NOTE\n # skip the trailing newline & any blank lines below\n while peek_type == :NEWLINE\n get\n peek_type, _, column, = peek_token\n end\n\n # we may be:\n # - at end of stream\n # - at a column < margin:\n # [text]\n # blah blah blah\n # - at the same column, but with a different type of list item\n # [text]\n # * blah blah\n # - at the same column, with the same type of list item\n # [one]\n # [two]\n # In all cases, we have an empty description.\n # In the last case only, we continue.\n if peek_type.nil? || column < margin then\n empty = true\n elsif column == margin then\n case peek_type\n when type\n empty = :continue\n when *LIST_TOKENS\n empty = true\n else\n empty = false\n end\n else\n empty = false\n end\n\n if empty then\n label << data\n next if empty == :continue\n break\n end\n end\n else\n data = nil\n end\n\n if label then\n data = label << data\n label = nil\n end\n\n list_item = RDoc::Markup::ListItem.new data\n parse list_item, column\n list << list_item\n\n else\n unget\n break\n end\n end\n\n p :list_end => margin if @debug\n\n if list.empty? then\n return nil unless label\n return nil unless [:LABEL, :NOTE].include? list.type\n\n list_item = RDoc::Markup::ListItem.new label, RDoc::Markup::BlankLine.new\n list << list_item\n end\n\n list\n end", "def nested_list(hash, options={})\n ordered = options[:ordered] || false\n options.delete(:ordered)\n\n content_tag(ordered ? 'ol' : 'ul', options) do\n hash.map do |concept, rels|\n rels.empty? ? content_tag('li', concept) : content_tag('li') do\n h(concept) + nested_list(rels, ordered: ordered) # NB: recursive\n end\n end.join(\"\\n\").html_safe\n end\n end", "def accept_list_start list\n case list.type\n when :BULLET, :LABEL, :NOTE then\n @list_index << nil\n when :LALPHA, :NUMBER, :UALPHA then\n @list_index << 1\n else\n raise RDoc::Error, \"invalid list type #{list.type}\"\n end\n\n @list_width << 4\n @list_type << list.type\n end", "def top_level_li\n lambda do |env|\n name, node = env[:node_name], env[:node]\n if name == LIST_ITEM && !node.ancestors.any? { |n| LISTS.include?(n.name) }\n node.replace(node.children)\n end\n end\n end", "def rearrange_docs!; end", "def block_textile_lists( text ) \n text.gsub!( LISTS_RE ) do |match|\n lines = match.split( /\\n/ )\n last_line = -1\n depth = []\n lines.each_with_index do |line, line_id|\n if line =~ LISTS_CONTENT_RE \n tl,atts,content = $~[1..3]\n if depth.last\n if depth.last.length > tl.length\n (depth.length - 1).downto(0) do |i|\n break if depth[i].length == tl.length\n lines[line_id - 1] << \"</li>\\n\\t</#{ lT( depth[i] ) }l>\\n\\t\"\n depth.pop\n end\n end\n if depth.last and depth.last.length == tl.length\n lines[line_id - 1] << '</li>'\n end\n end\n unless depth.last == tl\n depth << tl\n atts = pba( atts )\n atts = shelve( atts ) if atts\n lines[line_id] = \"\\t<#{ lT(tl) }l#{ atts }>\\n\\t<li>#{ content }\"\n else\n lines[line_id] = \"\\t\\t<li>#{ content }\"\n end\n last_line = line_id\n\n else\n last_line = line_id\n end\n if line_id - last_line > 1 or line_id == lines.length - 1\n depth.delete_if do |v|\n lines[last_line] << \"</li>\\n\\t</#{ lT( v ) }l>\"\n end\n end\n end\n lines.join( \"\\n\" )\n end\n end", "def too_nested\n \"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{nil}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"\nend", "def postprocess(doc)\n normalise_headings(doc)\n find_short_title(doc)\n link_definitions(doc)\n nest_blocklists(doc)\n\n doc\n end", "def assign_types_to_lines(margin = 0, level = 0)\n while line = @lines.next\n if line.blank? then\n line.stamp :BLANK, level\n next\n end\n\n # if a line contains non-blanks before the margin, then it must belong\n # to an outer level\n\n text = line.text\n\n for i in 0...margin\n if text[i] != SPACE\n @lines.unget\n return\n end\n end\n\n active_line = text[margin..-1]\n\n # Rules (horizontal lines) look like\n #\n # --- (three or more hyphens)\n #\n # The more hyphens, the thicker the rule\n #\n\n if /^(---+)\\s*$/ =~ active_line\n line.stamp :RULE, level, $1.length-2\n next\n end\n\n # Then look for list entries. First the ones that have to have\n # text following them (* xxx, - xxx, and dd. xxx)\n\n if SIMPLE_LIST_RE =~ active_line\n offset = margin + $1.length\n prefix = $2\n prefix_length = prefix.length\n\n flag = case prefix\n when \"*\",\"-\" then :BULLET\n when /^\\d/ then :NUMBER\n when /^[A-Z]/ then :UPPERALPHA\n when /^[a-z]/ then :LOWERALPHA\n else raise \"Invalid List Type: #{self.inspect}\"\n end\n\n line.stamp :LIST, level+1, prefix, flag\n text[margin, prefix_length] = \" \" * prefix_length\n assign_types_to_lines(offset, level + 1)\n next\n end\n\n if LABEL_LIST_RE =~ active_line\n offset = margin + $1.length\n prefix = $2\n prefix_length = prefix.length\n\n next if handled_labeled_list(line, level, margin, offset, prefix)\n end\n\n # Headings look like\n # = Main heading\n # == Second level\n # === Third\n #\n # Headings reset the level to 0\n\n if active_line[0] == ?= and active_line =~ /^(=+)\\s*(.*)/\n prefix_length = $1.length\n prefix_length = 6 if prefix_length > 6\n line.stamp :HEADING, 0, prefix_length\n line.strip_leading(margin + prefix_length)\n next\n end\n\n # If the character's a space, then we have verbatim text,\n # otherwise\n\n if active_line[0] == SPACE\n line.strip_leading(margin) if margin > 0\n line.stamp :VERBATIM, level\n else\n line.stamp :PARAGRAPH, level\n end\n end\n end", "def fix_for_toc_entry(elements); end", "def footnotes_list(root, opts)\n ol = Kramdown::Element.new(:ol)\n @footnotes.values.each do |footnote|\n value, index = *footnote\n options = { index: index, parent: ol }\n li = Kramdown::Element.new(:li, nil, {}, options.merge(opts))\n li.children = Marshal.load(Marshal.dump(value.children))\n ol.children << li\n end\n convert_ol(ol, { parent: root }.merge(opts))\n end", "def build_list margin\n p :list_start => margin if @debug\n\n list = RDoc::Markup::List.new\n\n until @tokens.empty? do\n type, data, column, = get\n\n case type\n when :BULLET, :LABEL, :LALPHA, :NOTE, :NUMBER, :UALPHA then\n list_type = type\n\n if column < margin then\n unget\n break\n end\n\n if list.type and list.type != list_type then\n unget\n break\n end\n\n list.type = list_type\n\n case type\n when :NOTE, :LABEL then\n _, indent, = get # SPACE\n if :NEWLINE == peek_token.first then\n get\n peek_type, new_indent, peek_column, = peek_token\n indent = new_indent if\n peek_type == :INDENT and peek_column >= column\n unget\n end\n else\n data = nil\n _, indent, = get\n end\n\n list_item = build_list_item(margin + indent, data)\n\n list << list_item if list_item\n else\n unget\n break\n end\n end\n\n p :list_end => margin if @debug\n\n return nil if list.empty?\n\n list\n end", "def add_comments(item, typed_object)\n if @keep_original_comments\n typed_object.add_comments(item.docstring.all.split(\"\\n\"))\n else\n parser = YARD::Docstring.parser\n parser.parse(item.docstring.all)\n\n docs_array = parser.text.split(\"\\n\")\n\n # Add @param tags if there are any with names and descriptions.\n params = parser.tags.select { |tag| tag.tag_name == 'param' && tag.is_a?(YARD::Tags::Tag) && !tag.name.nil? }\n # Add a blank line if there's anything before the params.\n docs_array << '' if docs_array.length.positive? && params.length.positive?\n params.each do |param|\n docs_array << '' if docs_array.last != '' && docs_array.length.positive?\n # Output params in the form of:\n # _@param_ `foo` — Lorem ipsum.\n # _@param_ `foo`\n if param.text.nil? || param.text == ''\n docs_array << \"_@param_ `#{param.name}`\"\n else\n docs_array << \"_@param_ `#{param.name}` — #{param.text.gsub(\"\\n\", \" \")}\"\n end\n end\n\n # Add @return tags (there could possibly be more than one, despite this not being supported)\n returns = parser.tags.select { |tag| tag.tag_name == 'return' && tag.is_a?(YARD::Tags::Tag) && !tag.text.nil? && tag.text.strip != '' }\n # Add a blank line if there's anything before the returns.\n docs_array << '' if docs_array.length.positive? && returns.length.positive?\n returns.each do |retn|\n docs_array << '' if docs_array.last != '' && docs_array.length.positive?\n # Output returns in the form of:\n # _@return_ — Lorem ipsum.\n docs_array << \"_@return_ — #{retn.text}\"\n end\n\n # Iterate through the @example tags for a given YARD doc and output them in Markdown codeblocks.\n examples = parser.tags.select { |tag| tag.tag_name == 'example' && tag.is_a?(YARD::Tags::Tag) }\n examples.each do |example|\n # Only add a blank line if there's anything before the example.\n docs_array << '' if docs_array.length.positive?\n # Include the example's 'name' if there is one.\n docs_array << example.name unless example.name.nil? || example.name == \"\"\n docs_array << \"```ruby\"\n docs_array.concat(example.text.split(\"\\n\"))\n docs_array << \"```\"\n end if examples.length.positive?\n\n # Add @note and @deprecated tags.\n notice_tags = parser.tags.select { |tag| ['note', 'deprecated'].include?(tag.tag_name) && tag.is_a?(YARD::Tags::Tag) }\n # Add a blank line if there's anything before the params.\n docs_array << '' if docs_array.last != '' && docs_array.length.positive? && notice_tags.length.positive?\n notice_tags.each do |notice_tag|\n docs_array << '' if docs_array.last != ''\n # Output note/deprecated/see in the form of:\n # _@note_ — Lorem ipsum.\n # _@note_\n if notice_tag.text.nil?\n docs_array << \"_@#{notice_tag.tag_name}_\"\n else\n docs_array << \"_@#{notice_tag.tag_name}_ — #{notice_tag.text}\"\n end\n end\n\n # Add @see tags.\n see_tags = parser.tags.select { |tag| tag.tag_name == 'see' && tag.is_a?(YARD::Tags::Tag) }\n # Add a blank line if there's anything before the params.\n docs_array << '' if docs_array.last != '' && docs_array.length.positive? && see_tags.length.positive?\n see_tags.each do |see_tag|\n docs_array << '' if docs_array.last != ''\n # Output note/deprecated/see in the form of:\n # _@see_ `B` — Lorem ipsum.\n # _@see_ `B`\n if see_tag.text.nil?\n docs_array << \"_@see_ `#{see_tag.name}`\"\n else\n docs_array << \"_@see_ `#{see_tag.name}` — #{see_tag.text}\"\n end\n end\n\n # fix: yard text may contains multiple line. should deal \\n.\n # else generate text will be multiple line and only first line is commented\n docs_array = docs_array.flat_map {|line| line.empty? ? [\"\"] : line.split(\"\\n\")}\n typed_object.add_comments(docs_array)\n end\n end", "def break_out_of_lists(block)\n b = block\n last_list = nil\n while (b) do\n last_list = b if b.type == 'List'\n b = b.parent;\n end\n\n if (last_list)\n while (block != last_list) do\n finalize(block, @line_number);\n block = block.parent;\n end\n finalize(last_list, @line_number);\n @tip = last_list.parent;\n end\n end", "def add_ly!(nested_stuff)\n counter = 0\n while counter < nested_stuff.length\n if nested_stuff[counter].kind_of?(Array)\n add_ly!(nested_stuff[counter])\n else\n nested_stuff[counter] += \"ly\"\n end\n counter += 1\n end\n\n nested_stuff\nend", "def block_textile_lists( text )\n orig_text = text.dup\n \n # Take care of _*'s and _#'s to turn them into paragraphs\n text.gsub!(/([\\*#] )((.*?\\n\\s*_[\\*#].*?)+)/) do |m|\n \"#{$1}<p>\"+$2.split(/_[\\*#]/).map{|w|w.strip}.delete_if{|w|w.empty?}.join(\"</p><p>\")+\"</p>\"\n end\n \n @last_line ||= -1\n \n text.gsub!( LISTS_RE ) do |match|\n if text =~ /^#([_0-9]+).*/m\n if $1 == $1.to_i.to_s # then it is a number, so use it\n @last_line = $1.to_i - 2\n end\n else\n @last_line = -1\n end\n lines = match.split( /\\n/ )\n depth = []\n lines.each_with_index do |line, line_id|\n if line =~ LISTS_CONTENT_RE \n \n tl,continuation,atts,content = $~[1..4]\n @last_line += 1 if tl.length == 1\n \n unless depth.last.nil?\n if depth.last.length > tl.length\n (depth.length - 1).downto(0) do |i|\n break if depth[i].length == tl.length\n lines[line_id - 1] << \"</li>\\n#{\"\\t\"*(depth.size-1)}</#{ lT( depth[i] ) }l>\"\n depth.pop\n tab_in = true\n end\n end\n if depth.last && depth.last.length == tl.length\n lines[line_id - 1] << \"</li>\"\n end\n end\n unless depth.last == tl\n depth << tl\n atts = pba( atts )\n atts << \" start=\\\"#{@last_line + 1}\\\"\" if lT(tl) == \"o\" && !continuation.empty? && @last_line > 0\n atts = shelve( atts ) if atts\n lines[line_id] = \"#{\"\\t\"*(depth.size-1)}<#{ lT(tl) }l#{ atts }>\\n#{\"\\t\"*depth.size}<li>#{ content }\"\n else\n lines[line_id] = \"#{\"\\t\"*depth.size}<li>#{ content }\"\n end\n elsif line =~ /^([_]+)(#{A}#{C}) (.*)$/m\n @last_line += 1\n tl = \"u\"\n atts,content = $~[2..3]\n \n unless depth.last.nil?\n if depth.last.length > tl.length\n (depth.length - 1).downto(0) do |i|\n break if depth[i].length == tl.length\n lines[line_id - 1] << \"</li>\\n#{\"\\t\"*(depth.size-1)}</#{ lT( depth[i] ) }l>\"\n depth.pop\n tab_in = true\n end\n end\n if depth.last and depth.last.length == tl.length\n lines[line_id - 1] << \"</li>\"\n end\n end\n unless depth.last == tl\n depth << tl\n atts = pba( atts )\n atts = shelve( \"#{atts} style=\\\"list-style-type:none;\\\"\" )\n lines[line_id] = \"#{\"\\t\"*(depth.size-1)}<#{ lT(tl) }l#{ atts }>\\n#{\"\\t\"*depth.size}<li>#{ content }\"\n else\n lines[line_id] = \"#{\"\\t\"*depth.size}<li>#{ content }\"\n end\n end\n \n if line_id == lines.length - 1\n tabs = depth.size-1\n depth.reverse.delete_if do |v|\n lines[-1] << \"</li>\\n#{\"\\t\"*tabs}</#{ lT( v ) }l>\"\n tabs -= 1\n end\n end\n end\n lines.join( \"\\n\" )\n end\n \n text != orig_text\n end", "def as_nestable_list(roots, &block)\n content_tag(:div, class: 'dd') do\n nestable_list_recursive(roots, block)\n end\n end", "def accept_list_item_start list_item\n case @list_type.last\n when :NOTE, :LABEL then\n Array(list_item.label).map do |label|\n tt_sections label\n end.flatten\n end\n end", "def nesting() end", "def remove_paragraphs_from_list_items!\n @document.tree.search('li p').each { |node| node.node_name = 'span' }\n end", "def accept_list_start list\n case list.type\n when :BULLET then\n @list_index << nil\n @list_width << 1\n when :LABEL, :NOTE then\n @list_index << nil\n @list_width << 2\n when :LALPHA then\n @list_index << 'a'\n @list_width << list.items.length.to_s.length\n when :NUMBER then\n @list_index << 1\n @list_width << list.items.length.to_s.length\n when :UALPHA then\n @list_index << 'A'\n @list_width << list.items.length.to_s.length\n else\n raise RDoc::Error, \"invalid list type #{list.type}\"\n end\n\n @list_type << list.type\n end", "def rearrange_docs!\n docs_table = {}\n custom_order = {}\n\n # pre-sort to normalize default array across platforms and then proceed to create a Hash\n # from that sorted array.\n docs.sort.each do |doc|\n docs_table[doc.relative_path] = doc\n end\n\n metadata[\"order\"].each do |entry|\n custom_order[File.join(relative_directory, entry)] = nil\n end\n\n result = Jekyll::Utils.deep_merge_hashes(custom_order, docs_table).values\n result.compact!\n self.docs = result\n end", "def saw_begin_list(list); end", "def parse_list; end", "def parse_list; end", "def transform_list_items( str, rs )\n\t\t\t@log.debug \" Transforming list items\"\n\n\t\t\t# Trim trailing blank lines\n\t\t\tstr = str.sub( /\\n{2,}\\z/, \"\\n\" )\n\t\t\tstr.gsub( ListItemRegexp ) {|line|\n\t\t\t\t@log.debug \" Found item line %p\" % line\n\t\t\t\tleading_line, item = $1, $4\n\t\t\t\tseparating_lines = $5\n\n\t\t\t\tif leading_line or /\\n{2,}/.match(item) or not separating_lines.empty? then\n\t\t\t\t\t@log.debug \" Found leading line or item has a blank\"\n\t\t\t\t\titem = apply_block_transforms( outdent(item), rs )\n\t\t\t\telse\n\t\t\t\t\t# Recursion for sub-lists\n\t\t\t\t\t@log.debug \" Recursing for sublist\"\n\t\t\t\t\titem = transform_lists( outdent(item), rs ).chomp\n\t\t\t\t\titem = apply_span_transforms( item, rs )\n\t\t\t\tend\n\n\t\t\t\t%{<li>%s</li>\\n} % item\n\t\t\t}\n\t\tend", "def start_special_list(list_type)\n end", "def add_empty_json_ld_schema(edited_document, schema, schema_name, schema_type, yaml) #:nodoc\r\n data = {}\r\n doc = DcJsonLd.new\r\n doc.name = schema_name\r\n doc.type = schema_type\r\n \r\n edited_document.dc_json_lds << doc\r\n schema.each do |element_name, element|\r\n next if element_name == 'level' # skip level element\r\n if yaml[element['type']]\r\n if element['n'].to_s == '1'\r\n # single element\r\n doc_1 = yaml[element['type'] ]\r\n data[element_name] = doc_1\r\n else\r\n # array\r\n add_empty_json_ld_schema(doc, yaml[element['type']], element_name, element['type'], yaml)\r\n end\r\n else\r\n data[element_name] = element['text']\r\n end\r\n end\r\n doc.data = data.to_yaml\r\n doc.save\r\nend", "def list_tight\n if self.type != :list\n raise NodeError, \"can't get list_tight for non-list\"\n end\n CMark.node_get_list_tight(@pointer)\n end", "def sanitize_json(json)\n IndexerCommonConfig.do_not_index.each do |k, v|\n if json[\"jsonmodel_type\"] == k\n # subrec is a reference used to navigate inside of the JSON as specified by the v[:location] to find the part of the tree to sanitize\n subrec = json\n\n v[:location].each do |l|\n unless subrec.nil?\n subrec = subrec[l]\n end\n end\n\n unless subrec.nil?\n subrec[v[:to_clean]] = []\n end\n end\n end\n\n return json\n end", "def normalize_docs(docs)\n if docs.first.is_a?(::Hash)\n docs.map do |doc|\n attributes = { _association: _association, _parent: _base }\n attributes.merge!(doc)\n Factory.build(klass, attributes)\n end\n else\n docs\n end\n end", "def preload_nested(nested_inclusions, docs)\n nested_inclusions.group_by(&:from).each do |from, inclusions|\n preload(inclusions, docs.flat_map(&from).compact)\n end\n end", "def reorganize\n list = params[:list]\n prev_page = nil\n last_root = nil\n list.each_with_index do |item, i|\n item_params = item[1]\n\n page = Page.find(item_params['id'].to_i)\n \n # if root of tree on rails side\n if item_params['parent_id'] == ''\n page.parent_id = nil\n if last_root\n page.move_to_right_of(last_root.id)\n end\n last_root = page\n page.save\n\n else\n page.parent_id = item_params['parent_id'].to_i\n page.save\n \n # shift to the right of previous element if parent is the same\n if prev_page.parent_id == page.parent_id\n page.move_to_right_of(prev_page.id)\n else\n\n # iterate backwards to find last sibling\n current_index = i - 1 \n found_sibling = false\n keys = list.keys\n\n while found_sibling == false and current_index > 0 do\n if list[keys[current_index]]['parent_id'] == item_params['parent_id']\n page.move_to_right_of(list[keys[current_index]]['id'])\n found_sibling = true\n else\n current_index -= 1\n end\n end\n\n end\n end\n\n # set previous item\n prev_page = page\n\n end\n\n respond_to do |format|\n format.json { head :ok } \n end\n end", "def denest(nested_list)\n len = nested_list.split('for')[1..-1].length\n nested_list_array = nested_list.split('for')[1..-1]\n nested_list_array[-1] = nested_list_array[-1][0..-4.3*len]\n nested_list_array.map(&->x{\"[#{x[1..-1]}end]\"})\nend", "def check_for_too_nested\n\t\tif commentable && commentable.parent_comment?\n\t\t\terrors.add(:base, \"Нельзя создать комментарий с уровнем вложенности больше 1 (считая с 0).\")\n\t\t\tthrow :abort\n\t\tend\n\tend", "def group_by_depth(arr)\n output = []\n\n nested = false\n arr.each do |x|\n\n if output.last\n\n last_line = output.last[-1]\n\n if line_depth(last_line) == line_depth(x)\n\n if x =~ /Features:/ && last_line =~ /Page: \\d/\n nested = true\n end\n\n if nested\n output.last << x\n else\n output << [x]\n end\n\n elsif line_depth(last_line) > line_depth(x)\n # we are outdenting\n nested = false\n output << [x]\n\n elsif line_depth(last_line) < line_depth(x)\n # we are indenting further\n nested = true\n output.last << x\n end\n else\n output << [x]\n end\n end\n\n output\n end", "def body_list\n self.body.unshift :rlist\n end", "def trim_checklist_for_self_audit\n \n self.trim_checklist_for_design_type\n self.checklist.sections.each do |section|\n section.subsections.each do |subsection|\n subsection.checks.delete_if { |check| !check.is_self_check? }\n end\n end\n \n # Lop off any empty sections and subsections\n self.checklist.sections.delete_if { |section| section.check_count == 0 }\n self.checklist.sections.each do |section|\n section.subsections.delete_if { |subsection| subsection.check_count == 0 }\n end\n \n end", "def process_doc(doc, verbose, check_parser, canonize_only,\n show_unconf_elts)\n\n init_doc_vars\n\n # Perform lexical parse to split document into list of tokens\n warn \"Parsing document...\\n\" if verbose\n shallow_parse(doc)\n\n if (check_parser)\n warn \"Checking parser...\\n\" if verbose\n # concatentation of tokens should be identical to original document\n if doc == tokens.join(\"\")\n puts \"Parser is okay\"\n else\n puts \"PARSER ERROR: document token concatenation differs from document\"\n end\n return nil\n end\n\n # Assign input line number to each token\n assign_line_numbers\n\n # Look for and report any error tokens returned by parser\n warn \"Checking document for errors...\\n\" if verbose\n if report_errors > 0\n warn \"Cannot continue processing document.\\n\"\n return nil\n end\n\n # Convert the token list to a tree structure\n warn \"Convert document tokens to tree...\\n\" if verbose\n if tokens_to_tree > 0\n warn \"Cannot continue processing document.\\n\"\n return nil\n end\n\n # Check: Stringify the tree to convert it back to a single string,\n # then compare to original document string (should be identical)\n # (This is an integrity check on the validity of the to-tree and stringify\n # operations; if one or both do not work properly, a mismatch should occur.)\n #str = tree_stringify\n #print str\n #warn \"ERROR: mismatch between document and resulting string\\n\" if doc != str\n\n # Canonize tree to remove extraneous whitespace\n warn \"Canonizing document tree...\\n\" if verbose\n tree_canonize\n\n if (canonize_only)\n puts tree_stringify\n return nil\n end\n\n # One side-effect of canonizing the tree is that the formatting\n # options are looked up for each element in the document. That\n # causes the list of elements that have no explicit configuration\n # to be built. Display the list and return if user requested it.\n\n if show_unconf_elts\n display_unconfigured_elements\n return nil\n end\n\n # Format the tree to produce formatted XML as a single string\n warn \"Formatting document tree...\\n\" if verbose\n tree_format\n\n # If the document is not empty, add a newline and emit a warning if\n # reformatting failed to add a trailing newline. This shouldn't\n # happen if the *DOCUMENT options are set up with exit-break = 1,\n # which is the reason for the warning rather than just silently\n # adding the newline.\n\n str = out_doc\n if !str.empty? && str !~ /\\n\\z/\n warn \"LOGIC ERROR: trailing newline had to be added\\n\"\n str << \"\\n\"\n end\n\n return str\n end", "def add_list_definition(style); end", "def work_definition_lists!\n @html.css('p').each do |para|\n if para.inner_html.match(/^(.*?)\\s+::\\s+(.*)$/m)\n para.name = 'dl'\n para.inner_html = \"<dt>#{$1}</dt><dd>#{$2}</dd>\"\n end\n end\n end", "def extract_ingredients_structured\n # NOTE manish 9/17/12 This is for food52 http://www.food52.com/recipes/4175_gin_spritz\n # Interestingly it has to be evaluated before li[contains(@itemprop]!)]\n ingredients = @doc.xpath(\"//p[contains(@itemprop, 'ingredients')]\").collect { |s| clean_text(s.text)}\n\n ingredients = @doc.xpath(\"//div[contains(@class, 'ingredients')]//li\").collect { |s| clean_text(s.text)\n } if ingredients.empty?\n ingredients = @doc.xpath(\"//div[contains(@id, 'ingredients')]//li\").collect { |s| clean_text(s.text)} if ingredients.empty?\n\n # READ READ READ READ: a lot of these patterns have no test. You can remove two or three of these\n # patterns and the test will still pass. In the future if you add a pattern, document the website\n # or page for which you are adding the pattern\n\n ingredients = @doc.xpath(\"//li[contains(@class,'ingredient')]\").collect { |s| clean_text(s.text)} if ingredients.empty?\n ingredients = @doc.xpath(\"//li[contains(@itemprop,'ingredient')]\").collect { |s| clean_text(s.text)} if ingredients.empty?\n ingredients = @doc.xpath(\"//span[contains(@class, 'ingredient')]\").collect { |s| clean_text(s.text)} if ingredients.empty?\n ingredients = @doc.css(\"div.ingredients-section li\").collect { |s| clean_text(s.text)} if ingredients.empty?\n ingredients\n end", "def is_link_list?(st)\n if st =~ /<(?:ul|dl|ol)(.+?)<\\/(?:ul|dl|ol)>/im\n listpart = $1\n outside = st.gsub(/<(?:ul|dl)(.+?)<\\/(?:ul|dl)>/imn, '').gsub(/<.+?>/mn, '').gsub(/\\s+/, ' ')\n list = listpart.split(/<li[^>]*>/)\n list.shift\n rate = evaluate_list(list)\n outside.length <= st.length / (45 / rate)\n end\n end", "def accept_list_start(list)\n @list << list.type\n @res << html_list_name(list.type, true)\n @in_list_entry.push false\n end", "def block_docbook_defs( text )\n text.gsub!(/^-\\s+(.*?):=(.*?)=:\\s*$/m) do |m|\n \"- #{$1.strip} := <para>\"+$2.split(/\\n/).map{|w|w.strip}.delete_if{|w|w.empty?}.join(\"</para><para>\")+\"</para>\"\n end\n \n text.gsub!( DEFS_RE ) do |match|\n lines = match.split( /\\n/ )\n lines.each_with_index do |line, line_id|\n if line =~ DEFS_CONTENT_RE \n dl,continuation,dt,dd = $~[1..4]\n \n atts = pba( atts )\n atts = shelve( atts ) if atts\n lines[line_id] = line_id == 0 ? \"<variablelist>\" : \"\"\n lines[line_id] << \"\\n\\t<varlistentry><term>#{ dt.strip }</term>\\n\\t<listitem><para>#{ dd.strip }</para></listitem></varlistentry>\"\n\n end\n\n if line_id == lines.length - 1\n lines[-1] << \"\\n</variablelist>\"\n end\n end\n lines.join( \"\\n\" )\n end\n end", "def transform_lists( str, rs )\n\t\t\t@log.debug \" Transforming lists at %p\" % (str[0,100] + '...')\n\n\t\t\tstr.gsub( ListRegexp ) {|list|\n\t\t\t\t@log.debug \" Found list %p\" % list\n\t\t\t\tbullet = $1\n\t\t\t\tlist_type = (ListMarkerUl.match(bullet) ? \"ul\" : \"ol\")\n\n\t\t\t\t%{<%s>\\n%s</%s>\\n} % [\n\t\t\t\t\tlist_type,\n\t\t\t\t\ttransform_list_items( list, rs ),\n\t\t\t\t\tlist_type,\n\t\t\t\t]\n\t\t\t}\n\t\tend", "def accept_list_start list\n @list << list.type\n @res << html_list_name(list.type, true)\n @in_list_entry.push ''\n end", "def format_list(items); end", "def toc_ordered_docs\n @toc_ordered_docs ||= tocs.nested_tree.includes(:doc).collect(&:doc).compact\n end", "def map\n solr_docs = []\n solr_docs << create_summary_doc\n solr_docs << create_desc_item('bioghist', 'Biography/History')\n solr_docs << create_desc_item('scopecontent', 'Scope and Content')\n solr_docs << create_desc_item('arrangement', 'Arrangement')\n solr_docs << create_desc_item('fileplan', 'File Plan')\n solr_docs += create_item_docs\n solr_docs.compact!\n solr_docs.collect do |doc|\n # clean all values...\n doc.each_pair do |k,v|\n doc[k] = to_one_line(v)\n if k == :hierarchy\n # elminate sequences of >= 3 :\n doc[k] = v.join('::').gsub(/:{3,}/, '::')\n end\n end\n end\n end", "def comment_list(list, base_indent='')\n commented_list = \"\"\n ids = list.split(/,/)\n ids.each do |id|\n id.gsub!(/\\s*$/, '')\n id.gsub!(/^\\s*/, '')\n list_id = \"#{id}\"\n list_id += ',' if id != ids.last\n id.gsub!(/\\=.*$/, '') \n id.gsub!(/\\[.*\\]/, '') \n id.gsub!(/\\s*$/, '')\n id.gsub!(/^\\s*/, '') \n id.gsub!(/;/, '') \n id.gsub!(/\\s*\\:\\s*\\d+/,'') \n doc_id = id.split(/\\s/).last\n doc_id.gsub!(/\\*/, '') \n commented_list += \"#{base_indent}\" if id != ids.first \n commented_list += \"#{@indent}\\t#{list_id} /**< <##{doc_id} description#> */\"\n commented_list += \"\\n\" if id != ids.last \n end\n commented_list \n end", "def safelists; end", "def semanticize!\n # Convert unnumbered list paragraphs to actual unnumbered lists\n doc.css(\".#{LI_SELECTORS.join(\",.\")}\").each { |node| node.node_name = \"li\" }\n\n # Try to guess heading where implicit bassed on font size\n implicit_headings.each do |element|\n heading = guess_heading element\n element.node_name = heading unless heading.nil?\n end\n\n # Removes paragraphs from tables\n doc.search(\"td p\").each { |node| node.node_name = \"span\" }\n end", "def remove_unicode_bullets_from_list_items!\n path = WordToMarkdown.soffice.major_version == '5' ? 'li span span' : 'li span'\n @document.tree.search(path).each do |span|\n span.inner_html = span.inner_html.gsub(/^([#{UNICODE_BULLETS.join}]+)/, '')\n end\n end", "def deep_complex_nesting?(entity) # rubocop:disable Lint/UnusedMethodArgument\n false\n end", "def parse_definition_list; end", "def normalize_to_list!(obj, key, nested_key: ActiveSupport::Inflector.singularize(key))\n if obj[key].is_a?(Hash)\n if obj[key][nested_key].is_a?(Hash)\n obj[key] = [obj[key][nested_key]]\n else\n obj[key] = obj[key][nested_key]\n end\n elsif obj[key].is_a?(String)\n obj[key] = []\n end\n end", "def test_list_nested_items\n h, r = @elfinder.run(:cmd => 'open', :init => 'true', :target => '', :tree => true)\n assert_equal 1, r[:tree][:dirs].count\n end", "def render_klist(source, *document_ids)\n with_sphinx_schema(source) { |xml|\n xml[:sphinx].killlist {\n document_ids.each { |doc|\n xml.id_(doc) { xml.parent.namespace = nil }\n } # id\n } # killlist\n }\n end", "def deep_update(ope, concat = false)\n super\n cmt\n end", "def sub_collection\n if match = @result.match(/\\[#{@field}\\](.*)\\[\\/#{@field}\\]/m) # the /m makes the dot match newlines, too!\n whole_group = match[0]\n inner_placeholders = match[1]\n inner_result = ''\n # Let the referenced object do the expanding by recursion if the collection knows placeholders\n @cur_collection.each do |item|\n inner_result << item.expand_placeholders(inner_placeholders)\n end if @cur_collection.first.respond_to?(:expand_placeholders)\n @result.gsub!(whole_group, inner_result)\n else\n @result.gsub!(@placeholder, \"END MISSING FOR #{@field}\")\n end\n end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def saw_end_list(list); end", "def remove_footnotes(elements); end", "def test_headlines_nested\n\n # load page\n page = Wiki::Api::Page.new name: \"program\"\n assert page.is_a?(Wiki::Api::Page), \"expected Page object\"\n headline = page.root_headline\n assert headline.is_a?(Wiki::Api::PageHeadline), \"expected PageHeadline object\"\n assert headline.name == \"program\", \"expected developer headline\"\n\n # search nested headline: english\n english = headline.headline(\"english\").first\n assert english.is_a?(Wiki::Api::PageHeadline), \"expected PageHeadline object\"\n\n # search nested headline: noun\n noun = english.headline(\"noun\").first\n assert noun.is_a?(Wiki::Api::PageHeadline), \"expected PageHeadline object\"\n\n # get block\n block = noun.block\n assert block.is_a?(Wiki::Api::PageBlock), \"expected PageBlock object\"\n\n # list items\n block.list_items.each do |list_item|\n assert list_item.is_a?(Wiki::Api::PageListItem), \"expected PageListItem object\"\n # links\n list_item.links.each do |link|\n assert link.is_a?(Wiki::Api::PageLink), \"expected PageListItem object\"\n end\n end\n\n # links\n block.links.each do |link|\n assert link.is_a?(Wiki::Api::PageLink), \"expected PageListItem object\"\n end\n end", "def repeated_descriptions(node); end", "def list_style(item); end", "def handle_notes(notes)\n\n notes.each do |note|\n\n prefix = case note['type']\n when 'dimensions'; \"Dimensions\"\n when 'physdesc'; \"Physical Description note\"\n when 'materialspec'; \"Material Specific Details\"\n when 'physloc'; \"Location of resource\"\n when 'phystech'; \"Physical Characteristics / Technical Requirements\"\n when 'physfacet'; \"Physical Facet\"\n #when 'processinfo'; \"Processing Information\"\n when 'separatedmaterial'; \"Materials Separated from the Resource\"\n else; nil\n end\n\n marc_args = case note['type']\n\n when 'arrangement', 'fileplan'\n ['351', 'a']\n # Remove processinfo from 500\n when 'odd', 'dimensions', 'physdesc', 'materialspec', 'physloc', 'phystech', 'physfacet', 'separatedmaterial'\n ['500','a']\n # we would prefer that information from both the note and subnote appear in subfields of a 506 element, like this:\n # <datafield ind1=\"1\" ind2=\" \" tag=\"506\">\n # <subfield code=\"a\">Restricted until 2020</subfield> <!-- from the subnote/text/content field -->\n # <subfield code=\"f\">Available</subfield> <!-- from the category list -->\n # </datafield>\n when 'accessrestrict'\n ind1 = note['publish'] ? '1' : '0'\n if note['publish'] || @include_unpublished\n if note['rights_restriction']\n result = note['rights_restriction']['local_access_restriction_type']\n if result != []\n result.each do |lart|\n df('506', ind1).with_sfs(['a', note['subnotes'][0]['content']], ['f', lart])\n end\n else\n df('506', ind1).with_sfs(['a', note['subnotes'][0]['content']])\n end\n else\n ['506', ind1 ,'', 'a']\n end\n end\n when 'scopecontent'\n ['520', '2', ' ', 'a']\n when 'abstract'\n ['520', '3', ' ', 'a']\n when 'prefercite'\n ['524', ' ', ' ', 'a']\n when 'acqinfo'\n ind1 = note['publish'] ? '1' : '0'\n ['541', ind1, ' ', 'a']\n when 'relatedmaterial'\n ['544','d']\n when 'bioghist'\n ['545','a']\n when 'custodhist'\n ind1 = note['publish'] ? '1' : '0'\n ['561', ind1, ' ', 'a']\n # Add processinfo to 583\n when 'appraisal', 'processinfo'\n ind1 = note['publish'] ? '1' : '0'\n ['583', ind1, ' ', 'a']\n when 'accruals'\n ['584', 'a']\n when 'altformavail'\n ['535', '2', ' ', 'a']\n when 'originalsloc'\n ['535', '1', ' ', 'a']\n when 'userestrict', 'legalstatus'\n ['540', 'a']\n when 'langmaterial'\n ['546', 'a']\n else\n nil\n end\n\n unless marc_args.nil?\n text = prefix ? \"#{prefix}: \" : \"\"\n text += ASpaceExport::Utils.extract_note_text(note, @include_unpublished)\n\n # only create a tag if there is text to show (e.g., marked published or exporting unpublished) and if there are not multiple local access restriction types (if there are, that's already handled above)\n unless note['type'] == 'accessrestrict' && note['rights_restriction']\n if text.length > 0\n df!(*marc_args[0...-1]).with_sfs([marc_args.last, *Array(text)])\n end\n end\n end\n\n end\n end", "def child_is_list(level, child_data)\n child_data.is_a?(Array) \\\n && (!level.key?(:comparison) \\\n || level[:comparison].compare(child_data.count))\nend", "def remove_initial_and_format_change(info) # removes middle initial for space_names and pipe_names AND puts comma_names into nested arrays\n if !info[0].include?(\"|\") && !info[0].include?(\",\")\n info.map! {|element| element.split(\" \")}\n info.each {|element| element.slice!(-4)} \n info\n elsif info[0].include?(\"|\")\n info.map! {|element| element.split(\" | \")}\n info.each {|element| element.slice!(-4)} \n info\n else\n info.map! {|element| element.split(\", \" )} \n end\nend", "def look_deeper contexts, deep, max_item_depth = 9, max_aspect_depth = 9, item_depth = 0\n unless item_depth == 0\n deep = look_wider contexts, deep, max_aspect_depth, 0\n deep[:row] += 1\n end\n deep[:indents] ||= []\n # deep[:numberings] ||= []\n deep[:indents ][deep[:row]] = item_depth || 0\n # deep[:numberings][deep[:row]] = self.class.numbering_list || []\n self.class.numbering_push\n unless (item_depth += 1) >= max_item_depth\n items.each do |item|\n self.class.numbering_increment\n deep = (item.recursive_ref || item).look_deeper contexts, deep, max_item_depth, max_aspect_depth, item_depth\n end\n end\n self.class.numbering_pop\n item_depth -= 1\n deep\n end", "def accept_list_item_start list_item\n type = @list_type.last\n\n case type\n when :NOTE, :LABEL then\n bullets = Array(list_item.label).map do |label|\n attributes(label).strip\n end.join \"\\n\"\n\n bullets << \"\\n:\"\n\n @prefix = ' ' * @indent\n @indent += 4\n @prefix << bullets + (' ' * (@indent - 1))\n else\n bullet = type == :BULLET ? '*' : @list_index.last.to_s + '.'\n @prefix = (' ' * @indent) + bullet.ljust(4)\n\n @indent += 4\n end\n end", "def nested_array\n curr = @nested\n @list.each do |num|\n r = rand(3)\n if r == 1\n curr << num\n elsif r == 2\n curr << []\n curr = curr[curr.length - 1]\n curr << num\n else\n curr = @nested\n curr << num\n end\n end\n @nested\n end", "def parse_first_list_line(indentation, content); end", "def build_implicit_folders_list(cms_list)\n folder_list = {}\n STDERR.puts \"\\n\"\n cms_list.each do |key, entry|\n if key.include?(File::SEPARATOR)\n Pathname.new(key).dirname.descend { |directory|\n directory_name = directory.to_s\n\n if directory_name =~ /[A-Z]/\n STDERR.puts \"Warning: The #{entry[:kind]} path '#{key}' with title: '#{entry[:title]}' contains uppercase characters. Reccomend to avoid using them in CMS 'path' and 'system_names'\"\n end\n\n unless cms_list[directory_name]\n folder_list[directory_name] = directory_name\n STDERR.puts \"Warning: The #{entry[:kind]} in CMS '#{key}' with title: '#{entry[:title]}' includes a folder '#{directory_name}' that is not a section in the CMS\" unless entry[:kind] == :template && entry[:type] == 'partial'\n end\n }\n end\n end\n folder_list\n end", "def parse_list\n super\n current_list = @tree.children.select { |element| LIST_TYPES.include?(element.type) }.last\n\n is_tasklist = false\n box_unchecked = '<input type=\"checkbox\" class=\"task-list-item-checkbox\" disabled=\"disabled\" />'\n box_checked = '<input type=\"checkbox\" class=\"task-list-item-checkbox\" ' \\\n 'disabled=\"disabled\" checked=\"checked\" />'\n\n current_list.children.each do |li|\n list_items = li.children\n next unless !list_items.empty? && list_items[0].type == :p\n\n # li -> p -> raw_text\n descendant = list_items[0].children[0].value\n checked = descendant.gsub!(/\\A\\s*\\[ \\]\\s+/, box_unchecked)\n unchecked = descendant.gsub!(/\\A\\s*\\[x\\]\\s+/i, box_checked)\n is_tasklist ||= checked || unchecked\n\n li.attr['class'] = 'task-list-item' if is_tasklist\n end\n\n current_list.attr['class'] = 'task-list' if is_tasklist\n\n true\n end", "def make_list_from_nested(list, flatten = false)\n all = []\n list.each do |item|\n all.concat(make_list_from_item(item, flatten))\n end\n return all\n end", "def parse_el(el, parent_numbers = [])\n\n # get element subtype from $subtypes\n el_type = el.name\n binding.pry if el_type.nil?\n return nil if el_type.nil?\n\n begin\n num = el.children.first.attributes['value'].text\n rescue\n binding.pry\n end\n # binding.pry if num.nil? || num == \"\"\n return nil if num.nil?\n\n # not sure if this will still have previous elements on recurse\n # so if I add a paragraph_number once, will it still be there on recurse\n # parent numbers can't do path, unless it's an array\n\n if !parent_numbers.find_index{ |n| n.keys.first.to_s == \"#{el_type}_number\" }.nil?\n # binding.pry\n i = parent_numbers.find_index{ |n| n.keys.first.to_s == \"#{el_type}_number\" }\n parent_numbers[i] = { \"#{el_type}_number\": num } unless num.nil?\n # binding.pry\n else\n # binding.pry\n parent_numbers << { \"#{el_type}_number\": num } unless num.nil?\n # binding.pry\n end\n binding.pry if parent_numbers.size > 10\n\n # identifier is path supplied by uscode\n begin\n identifier = el.attributes['identifier']\n identifier = identifier.value unless identifier.nil?\n rescue\n binding.pry\n end\n\n # path is hierarchy of element types built from parent_numbers\n path = build_path_from_parent_numbers(parent_numbers)\n\n heading = el.css('heading').first\n heading = heading.text.strip unless heading.nil?\n\n # chapeaus will be in span in div\n chapeau = el.css('chapeau').first if el_type != 'section'\n chapeau = chapeau.text.strip unless chapeau.nil?\n\n continuation = el.css('continuation').first if el_type != 'section'\n continuation = continuation.text.strip unless continuation.nil?\n\n # need to verify at bottom most el, and if not chapeau\n el_text = el.css('content').first\n el_text = el_text.text.strip unless el_text.nil? || el_text == \"\"\n\n # create a new node of the subtype\n # klass = el_type.titleize.constantize\n n = Node.find_by(identifier: identifier, path: path, type: el_type, num: num, title_number: parent_numbers.first[:title_number])\n\n if !n.nil?\n puts \"Node already exists, skipping\".colorize(:red)\n return nil\n end\n\n klass = Node.new({\n type: el_type,\n num: num,\n parent_numbers: parent_numbers,\n identifier: identifier,\n path: path,\n heading: heading,\n chapeau: chapeau,\n continuation: continuation,\n text: el_text,\n title_number: parent_numbers.first[:title_number]\n })\n if klass.save!\n puts \"Node created #{path} at #{DateTime.now.in_time_zone(\"Eastern Time (US & Canada)\")} for Title #{parent_numbers.first[:title_number]}\".colorize(:green)\n end\n\n # add the subtype to a parent subtype\n # sections have no parents only children\n if el_type != 'section'\n parent = Node.find_by(path: get_base_path(parent_numbers)) # need up-one-level path\n parent.children << klass\n end\n\n el.children.each do |child|\n child_name = child.name\n next if child_name.nil? || child_name.blank?\n if $subtypes.any? { |t| child_name.include?(t) } # is the child a subtype?\n parse_el(child, parent_numbers.dup) # use .dup to remove a reference\n end\n end\n end", "def build_toc_list(entries, last_ul_used: false)\n i = 0\n toc_list = ''\n min_h_num = entries.map { |e| e[:h_num] }.min\n\n while i < entries.count\n entry = entries[i]\n if entry[:h_num] == min_h_num\n # If the current entry should not be indented in the list, add the entry to the list\n toc_list << %(<li class=\"toc-entry toc-#{entry[:node_name]}\"><a href=\"##{entry[:id]}#{entry[:uniq]}\">#{entry[:text]}</a>)\n # If the next entry should be indented in the list, generate a sublist\n if i + 1 < entries.count\n next_entry = entries[i + 1]\n if next_entry[:h_num] > min_h_num\n nest_entries = get_nest_entries(entries[i + 1, entries.count], min_h_num)\n toc_list << %(\\n<ul>\\n#{build_toc_list(nest_entries, last_ul_used: true)}</ul>\\n)\n i += nest_entries.count\n end\n end\n # Add the closing tag for the current entry in the list\n toc_list << %(</li>\\n)\n elsif entry[:h_num] > min_h_num\n # If the current entry should be indented in the list, generate a sublist\n nest_entries = get_nest_entries(entries[i, entries.count], min_h_num)\n if last_ul_used\n toc_list << build_toc_list(nest_entries, last_ul_used: true)\n else\n toc_list << %(<ul>\\n#{build_toc_list(nest_entries, last_ul_used: true)}</ul>\\n)\n end\n i += nest_entries.count - 1\n end\n i += 1\n end\n\n toc_list\n end", "def create_items items\n list = RDoc::Markup::List.new :NOTE\n\n items.each do |item|\n item =~ /\\A(.*?(?:\\([^)]+\\))?):\\s*/\n\n title = $1\n body = $'\n\n paragraph = RDoc::Markup::Paragraph.new body\n list_item = RDoc::Markup::ListItem.new title, paragraph\n list << list_item\n end\n\n list\n end", "def create_items items\n list = RDoc::Markup::List.new :NOTE\n\n items.each do |item|\n item =~ /\\A(.*?(?:\\([^)]+\\))?):\\s*/\n\n title = $1\n body = $'\n\n paragraph = RDoc::Markup::Paragraph.new body\n list_item = RDoc::Markup::ListItem.new title, paragraph\n list << list_item\n end\n\n list\n end", "def on_array(*body)\n @last_sexp =\n super(*body).tap do |sexp|\n next unless SPECIAL_LITERALS.include?(body.dig(0, :type))\n\n comments = sexp.dig(:body, 0).delete(:comments)\n sexp.merge!(comments: comments) if comments\n end\n end", "def ordered_list; end", "def by_fixing\n findings = @findings.dup\n @fixing_lists.map do |_class|\n _class.search('listitem').map do |item|\n # if 'finding' reference = item mentioned index (extracted from text 'See section' ),\n # then return the finding object\n findings.select{|finding| finding.index == item.text.match(/\\d+\\.\\d+/).to_s.to_f}[0]\n end\n end\n end", "def trim_checklist_for_design_type\n \n design = self.design\n \n # Remove the sections that are not used in the audit.\n self.checklist.sections.delete_if { |section| !design.belongs_to(section) }\n \n self.checklist.sections.each do |section|\n \n # Remove the subsections that are not used in the audit.\n section.subsections.delete_if { |subsection| !design.belongs_to(subsection) }\n \n section.subsections.each do |subsection|\n # Remove the checks that are not used in the audit.\n subsection.checks.delete_if { |check| !design.belongs_to(check) }\n end\n end\n \n end", "def test_fix_nested_array\n array = [1, [2], [3, [4,[5]]], 6]\n array = array.flatten\n assert_equal [1,2,3,4,5,6], array\n end", "def preproccess_toc(cfg, err_box)\n if ! cfg['have_nav'] \n return\n end\n # parse the toc root doc.\n @menu_list = []\n @img_hash = {} # it is possible that a nav doc has images\n if cfg['nested'] \n Dir.chdir(cfg['doc_home']) { |p|\n f = \"#{p}/#{cfg['toc']['root']}\"\n puts \"process toc #{f}\"\n pre_toc = Kramdown::Document.new(File.read(f, encoding: \"UTF-8\"),\n { img_hash: @img_hash, menu_list: @menu_list, input: cfg['input_format']\n }).to_menuparse\n }\n else \n f = \"#{cfg['doc_home']}/#{cfg['toc']['root']}\"\n pre_toc = Kramdown::Document.new(File.read(f, encoding: \"UTF-8\"),\n { img_hash: @img_hash, menu_list: @menu_list, input: cfg['input_format']\n }).to_menuparse\n end\n \n if cfg['nested']\n # move nav files from section to toc\n #puts \"first level #{@menu_list}\"\n cfg['toc']['section_order'] = []\n cfg['toc']['files'] = []\n @menu_list.each { |md| \n cfg['sections'].each { |sect_k, sect_v| \n sect_files = cfg['sections'][sect_k][:files]\n pos = sect_files.find_index(md)\n if pos \n puts \"Found #{md} in #{sect_k}\"\n cfg['toc']['section_order'] << sect_k\n cfg['toc']['files'] << md\n sect_files.delete_at(pos)\n end\n }\n }\n # now parse the md files inside section order and and remove them\n # from section display_order.\n cfg['toc']['section_order'].each_index { |i|\n d = cfg['toc']['section_order'][i]\n sect = cfg['sections'][d]\n f = cfg['toc']['files'][i]\n @menu_list = []\n @img_hash = {} \n @err_box.append \"toc process #{d}/#{f}\\n\"\n pre_toc = Kramdown::Document.new(File.read(\"#{cfg['doc_home']}/#{d}/#{f}\", encoding: \"UTF-8\"),\n { img_hash: @image_hash, menu_list: @menu_list, input: cfg['input_format']\n }).to_menuparse\n cfg['sections'][d][:display_order] = []\n @menu_list.each { |md|\n cfg['sections'][d][:display_order] << md\n pos = cfg['sections'][d][:files].find_index(md)\n if pos\n cfg['sections'][d][:files].delete_at(pos)\n end\n }\n }\n else\n # single directory with one nav doc\n puts \"doing nothing more for only one nav doc\"\n end\n # download images and set cfg[images]\n download_images(cfg, @img_hash)\n end", "def list( elem, context = XSDContext.new )\n\n parent = nil\n \n if( context.parent )\n # We already have Type for the List in system - so create new Composer, adding to parent\n\n parent = ReadFromXSD::add_composer( @asset, elem.attributes['name'], context.parent, :type => ListComposer)\n\n unless( ctype = BasicType.multi_find_by_name(elem.attributes['itemType'], 'xsd') )\n ctype = Composer.find_by_xml_name( @project, elem.attributes['itemType'] )\n end\n\n parent.create_composer_type( :klass => ctype ) if ctype\n\n else\n #TODO - create exception log which can be re processed at end\n # so that if Type not found now, but defined later in file we can sort out issue\n # @missing[]\n puts \"WARNING PROCESSING list : TYPE #{elem.attributes['itemType']} NOT FOUND IN SYSTEM\"\n end\n\n @context.parent = parent\n descend_tree( elem, @context )\n\n end" ]
[ "0.6608037", "0.65959847", "0.6397161", "0.6011906", "0.60066706", "0.5820863", "0.56875163", "0.5590006", "0.5567761", "0.55540615", "0.5523628", "0.5480896", "0.5474238", "0.54586685", "0.54418725", "0.5418801", "0.53959775", "0.5324092", "0.5275564", "0.5249979", "0.5235138", "0.52076703", "0.5200177", "0.514175", "0.51194566", "0.5104082", "0.5092227", "0.5083981", "0.5081248", "0.5073267", "0.5058123", "0.50508904", "0.50413245", "0.5021982", "0.5021982", "0.5004984", "0.5003212", "0.49654445", "0.49547258", "0.49493128", "0.49465993", "0.49424824", "0.4901621", "0.4901533", "0.48963332", "0.48879698", "0.4885948", "0.4875603", "0.4863731", "0.48607215", "0.48556566", "0.48449892", "0.48447788", "0.48401326", "0.48391235", "0.4834969", "0.4831689", "0.48182335", "0.47988173", "0.4792866", "0.47915554", "0.47893816", "0.47891182", "0.4770454", "0.4759925", "0.4757004", "0.47528705", "0.47422132", "0.4724323", "0.47240096", "0.47214264", "0.47132438", "0.47132438", "0.47132438", "0.4711432", "0.47078082", "0.46906096", "0.46816844", "0.46784717", "0.46780872", "0.46507075", "0.46478438", "0.46442154", "0.46417397", "0.4641673", "0.4640665", "0.46383438", "0.46376297", "0.46356744", "0.4633607", "0.4633187", "0.46305105", "0.46305105", "0.46159315", "0.46155307", "0.46072984", "0.45996192", "0.45827687", "0.45800236", "0.45770934" ]
0.46062627
96
click on the all carets to initially close them
def init_carets @sidenav.children.each do |child| next unless child.tag_name == "li" carets = child.find("span.caret") carets.click end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_popups\n return if driver.doc.at('.cb_close').nil?\n driver.first('.cb_close').click\n end", "def close_tour(check_closed=true)\n # Close tour only if it is visible\n if page.has_css? 'div.hopscotch-bubble'\n find('div.hopscotch-bubble .hopscotch-bubble-close').click\n end\nend", "def close_all_dialogs\n append_to_script \"close_all_dialogs\"\n end", "def close_all_tabs\n #The collection has the activate tab first and then the rest sorted on number, so resort to get on descending position\n quick_tabbuttons(\"Browser Window\").sort {|t1, t2| (t2.position <=> t1.position) }.each do |btn|\n #Tab button is in Browser window which is prob not the active window,\n #so we cannot do this the easy way \n #btn.quick_button(:name, \"pb_CloseButton\").close_window_with_click(\"Document Window\") unless btn.position == 0\n #puts \"Current tab = #{btn}\"\n if btn.position != 0 or btn.value > 1 then\n quick_window(:name, \"Browser Window\").quick_tab(:pos, btn.position).quick_button(:name, \"pb_CloseButton\").close_window_with_click(\"Document Window\")\n end \n end\n end", "def cookie_popup_close\n get_elem_and_click(:xpath, \"//core-icon[@icon-id='glyphs.close']\")\n end", "def exibir_lojas()\n lojas.click\n end", "def close_all_tabs\n #The collection has the activate tab first and then the rest sorted on number, so resort to get on descending position\n quick_tabbuttons(\"Browser Window\").sort {|t1, t2| (t2.position <=> t1.position) }.each do |btn|\n #Tab button is in Browser window which is prob not the active window,\n #so we cannot do this the easy way\n #btn.quick_button(:name, \"pb_CloseButton\").close_window_with_click(\"Document Window\") unless btn.position == 0\n #puts \"Current tab = #{btn}\"\n if btn.position != 0 or btn.value > 1 then\n quick_window(:name, \"Browser Window\").quick_tab(:pos, btn.position).quick_button(:name, \"pb_CloseButton\").close_window_with_click(\"Document Window\")\n end\n end\n end", "def close_all_menus\n i = 6 #Just some number\n while quick_menus.delete_if { |menu| menu.name == \"Main Menu\" }.length > 0\n close_menu\n i-=1\n break if i == 0\n end\n end", "def closeeye()\n\t\t@opened_eye = false\n\tend", "def close_fee_popup\n if self.btnOK_element.present?\n self.btnOK_element.when_present.click\n end\n end", "def close_import_alert\n find('#start-info #import-process-state button.close', visible: true).click\nend", "def close_export_alert\n find('#start-info #export-process-state button.close', visible: true).click\nend", "def close_lid()\n \"Click the <b>Close Lid</b> button\"\n end", "def cancel_button_clicked\n\t\t\t@path = nil\n\t\t\tclose_and_cleanup\n\t\tend", "def close_fries_link\n fries_popup.find(:span_class, 'close').find(:link_href, '#')\n end", "def closeeye()\n\t\t@pintar = false\n\tend", "def close_window\n end", "def close_menu\n pending\n perform_action('drag', 20, 0, 10, 10, 10)\n end", "def close_menu\n touch_screen_element 'Close menu Button', close_menu_button\n end", "def click; end", "def click; end", "def click; end", "def on_category_cancel\n @command_window.activate\n #@dummy_window.show\n @category_window.hide\n @sell_window.hide\n end", "def close_all_browsers\r\n\t\t\t@web_browser.close_all_browsers\r\n end", "def clicked\n # @cancel.clicked\n end", "def close_lid\n 'Click the <b>Close Lid</b> button'\n end", "def close_lid\n 'Click the <b>Close Lid</b> button'\n end", "def close_popup\n popup.deactivate\n x = Graphics.width\n y = @help_window.height\n if $imported[\"H87_SmoothMovements\"]\n @option_window.smooth_move(0, y)\n popup.smooth_move(x, y)\n else\n @option_window.x = 0\n popup.x = x\n end\n @option_window.activate\n @popup_index = nil\n end", "def close_popup\n popup.deactivate\n x = Graphics.width\n y = @help_window.height\n if $imported[\"H87_SmoothMovements\"]\n @option_window.smooth_move(0, y)\n popup.smooth_move(x, y)\n else\n @option_window.x = 0\n popup.x = x\n end\n @option_window.activate\n @popup_index = nil\n end", "def close_all_browsers\n if is_firefox?\n FireWatir::Firefox.close_all\n else\n Watir::IE.close_all\n end\n end", "def disable_close()\n #This is a stub, used for indexing\n end", "def close_other_windows\n cur_window = browser.window_handle\n browser.window_handles.each do |window|\n next if window.eql?(cur_window)\n\n browser.switch_to.window(window)\n browser.close\n end\n browser.switch_to.window(cur_window)\n end", "def keep_clicking(classes)\n while true\n begin\n BR.link(:class => classes).click()\n rescue\n break\n end\n end\nend", "def close_cvv_help_popup\n close_cvv_help_link.click\n end", "def close\n return if closed?\n\n nocbreak\n close_screen\n end", "def test_openClose\n @w_openToggle = Window_Base.new(400, 250, 100, 50)\n @w_openToggle.animationSpeed = 2000\n openToggle()\n return true\n end", "def clicked\n @cancel.clicked\n end", "def on_buy_cancel\n @command_window.activate\n #@dummy_window.show\n @buy_window.hide\n @status_window.hide\n @status_window.item = nil\n @help_window.clear\n end", "def close_default_trello_lists!\n @trello_board.lists.each do |list|\n list.close!\n end\n end", "def buttonCancel__clicked(*a)\n @builder[:window1].destroy\n end", "def on_click\n @status_window_tb.hide\n $game_map.clear_next_highlights\n reset_aoe_follows\n #@spriteset.remove_group(DISPLAY_TB) # @spriteset.dispose_highlights_tb\n remove_show_hls\n end", "def close_when_complete!\n @options[:close] = true\n end", "def close_search\n close_search_bar.click\n end", "def close_all_dialogs\n win_id = driver.getActiveQuickWindowID()\n until quick_window(:id, win_id).type != :dialog do\n win = quick_window(:id, driver.getActiveQuickWindowID())\n if win.type == :dialog\n close_dialog(win.name)\n if (driver.getActiveQuickWindowID() != win_id)\n win_id = driver.getActiveQuickWindowID()\n else\n break\n end\n end\n end\n end", "def click\n @mech.click self\n end", "def close_all_dialogs\n win_id = driver.getActiveWindowID()\n until quick_window(:id, win_id).type != :dialog do\n win = quick_window(:id, driver.getActiveWindowID())\n if win.type == :dialog\n close_dialog(win.name)\n if (driver.getActiveWindowID() != win_id)\n win_id = driver.getActiveWindowID()\n else\n break\n end\n end\n end\n end", "def cancel_command()\n # Switch Window\n @list_window.active = true\n @list_window.visible = true\n @content_window.active = false\n end", "def close\n @w.each{|w|\n w.close\n }\n end", "def clicar_mais\n botao_mais.click\n end", "def reset_close_action\n if self.close_action && self.close_action =~ /^no/i\n self.mandated = nil\n self.close_reason = nil\n self.mandated_advocate = nil\n elsif self.close_action && self.close_action =~ /^close/i\n # we might be fine, attributes were already set\n end\n end", "def clicar(element)\n element.click\n end", "def close_cookies_alert\n if page.has_css? '#cookie-notice'\n within '#cookie-notice' do\n find('button.close').click\n end\n expect(page).not_to have_css '#cookie-notice', visible: true\n end\nend", "def elimina_elemento(i)\n @popups[i][0].dispose unless @popups[i][0].disposed?\n @popups[i][1].dispose unless @popups[i][1].disposed?\n end", "def on_uio_cancel\n @unit_list_swap_items.hide\n @basic_text_win.hide\n deactivate_all_but(@place_coms)\n @place_coms.activate\n @place_coms.show\n end", "def clicked\n @question.clicked\n @cancel.clicked\n end", "def close_tutorial\n\t\tself.close_tutorial_button_element.when_present(Utils::LONG_TIMEOUT)\n\t\tself.close_tutorial_button\n\tend", "def cancel\n case\n when @browser.div(:id=>\"accountpreferences_preferContainer\").visible?\n @browser.div(:id=>\"accountpreferences_preferContainer\").button(:class=>\"s3d-link-button s3d-bold accountpreferences_cancel\").click\n when @browser.div(:id=>\"accountpreferences_changePrivacyContainer\").visible?\n @browser.div(:id=>\"accountpreferences_changePrivacyContainer\").button(:class=>\"s3d-link-button s3d-bold accountpreferences_cancel\").click\n when @browser.div(:id=>\"accountpreferences_changePassContainer\").visible?\n @browser.div(:id=>\"accountpreferences_changePassContainer\").button(:class=>\"s3d-link-button s3d-bold accountpreferences_cancel\").click\n else\n puts \"\\nCouldn't find the cancel button!\\n\"\n end\n end", "def muda_aba\n window = page.driver.browser.window_handles\n if window.size > 1 \n page.driver.browser.switch_to.window(window.first)\n page.driver.browser.close\n page.driver.browser.switch_to.window(window.last) \n end\n end", "def button_down(id)\r\n if id == Gosu::KB_ESCAPE\r\n close\r\n else\r\n super\r\n end\r\n end", "def clicked;end", "def close\n @graphic.ungetch(?q.ord)\n end", "def end_rune_selection\n @rune_stack_window.hide\n @rune_window.hide\n #@rune_stack_window = nil\n #@rune_window.help_window = nil\n #@rune_window.dispose\n #@rune_window = nil\n @help_window.hide\n end", "def check_forced_close\n return if @esc_counter > 0 or !open?\n if Input.legacy_trigger?(:B)\n Sound.play_cancel\n close\n end\n end", "def close_toybox\n p 'close_toybox'\n dismissModalViewControllerAnimated(true, completion: nil) \n end", "def close_notification\n self.div(:class=>\"gritter-item\").hover\n self.div(:class=>\"gritter-close\").fire_event \"onclick\"\n end", "def button_down(id)\r\n if id == Gosu::KB_ESCAPE\r\n close\r\n else\r\n super\r\n end\r\n end", "def close_blank_windows\n @driver.window_handles.each do |handle|\n @driver.switch_to.window(handle)\n @driver.close if @driver.current_url == 'about:blank'\n end\n end", "def close\n javascript = ''\n each_with_rescue(@notes) do |note|\n next unless note.fieldset?\n javascript << close_helper(note)\n end\n javascript\n end", "def click()\n mouse_down\n mouse_up\n stall :click\n end", "def cancel_command()\n @command_window.active = true\n @party_order_window.clean_indexes()\n @party_order_window.active = false\n @party_order_window.index = -1\n @battle_formations_window.active = false\n @battle_formation_details_window.window_update(nil)\n @battle_formation_details_window.visible = false\n @help_window.window_update(\"\")\n @help_window.visible = true\n end", "def can_close?; end", "def close_toybox\n dismissModalViewControllerAnimated(true, completion: nil)\n end", "def close\r\n command 'close'\r\n end", "def close\r\n command 'close'\r\n end", "def button_down(id)\n\t\tcase id\n\t\twhen Gosu::KbEscape\n\t\t\tclose\n\t\tend\n\tend", "def close_browsers_and_delete_cookies\n $tracer.trace(\"PowerUpRewardsDSL : #{__method__}, Line : #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n close_all\n m = $options.silent_mode\n $options.silent_mode = true\n if (os_name == \"mswin32\")\n ie\n mozilla\n elsif (os_name == \"darwin\")\n safari\n end\n for i in 0..(browser_count - 1)\n browser(i).cookie.all.delete\n end\n close_all\n $options.silent_mode = m\n end", "def on_pou_cancel\n @unit_list_swap_items.show\n @unit_list_swap_items.select(0)\n deactivate_all_but(@unit_list_swap_items)\n @unit_list_swap_items.activate\n @unit_list_swap_items.refresh\n @basic_text_win.show\n @party_or_unit_win.hide\n end", "def close_refresh_feed_job_alert(job_id)\n find(\"#start-info #job-states #refresh-state-#{job_id} button.close\", visible: true).click\nend", "def Comreturn\n @commande_window.hide\n @commande_window.deactivate\n @commande_list_window.activate\n end", "def unclicked(e)\n puts \"Unclicked!\"\n end", "def unclicked(mouse_event)\n end", "def double_click()\n double_click_at :center, :center\n end", "def on_close\n @closebacks.each {|closeback| closeback.call}\n end", "def close\n\t\t\t\t@wrappers.each(&:close)\n\t\t\t\t@wrappers.clear\n\t\t\tend", "def deactivate_all tf=true\n $deactivate_dividers = tf\n @focusable = !tf\n end", "def close \n #Self trigger window lost focus, since we are going to home\n focus_changed false, @screen_width, @screen_height\n @showing = false\n @activity.moveTaskToBack(true)\n end", "def auto_close?\n false\n end", "def dispose_popups\n @popups.each_value{|p| p.dispose}\n end", "def click\n `#{@el}.click() || Opal.nil`\n end", "def on_deactivate_all\n Sound.play_ok\n @actor.active_capacities.each{ |capacity| @actor.deactivate_capacity(capacity) }\n @status_window.refresh\n @sp_window.refresh\n @capacities_list_window.refresh\n end", "def close\n close_filehandles\n close_keydir\n end", "def on_click\n\t\tend", "def close\n\t remove_common_event_handlers\n\t remove_specific_event_handlers\n\t sleep 0.2\n Phidgets::FFI::Common.close(@handle) \n\t delete\n true\n end", "def cancel_command()\n @command_window.active = true\n @command_window.visible = true\n @buy_window.active = false\n @buy_window.visible = false\n @buy_window.reset_number_select()\n @buy_window.index = 0\n @sell_window.active = false\n @sell_window.visible = false\n @sell_window.reset_number_select()\n @sell_window.index = 0\n @status_window.visible = false\n @status_window.window_item_update(nil)\n @item_details_window.window_update(nil)\n @item_details_window.visible = false\n @help_window.window_update(\"\")\n @help_window.visible = false\n @transaction_window.visible = false\n @transaction_window.window_update(nil, nil)\n end", "def close(fill=false)\n show(\n {\n :done => fill && !state.total.is_a?(Symbol) ? state.total : state.done,\n :tty => {\n :finite => { :show_eta => false },\n :infinite => { :show_eta => false },\n },\n :notty => {\n :finite => { :show_eta => false },\n :infinite => { :show_eta => false },\n },\n }, true)\n scope.output.call(scope.template.close) unless scope.template.close.nil?\n state.closed = true\n end", "def close_data_retention_section\n data_retention_close_btn.click\n end", "def alert_close\n MenuControllerContracts.invariant(self)\n @alert_view = nil\n MenuControllerContracts.invariant(self)\n end", "def click_yes_to_all_js_popup(title)\n click_button_popup(title, \"Yes To &All\")\nend", "def close_browsers_and_delete_cookies\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n close_all\n m = $options.silent_mode\n $options.silent_mode = true\n if (os_name == \"mswin32\")\n ie\n mozilla\n elsif (os_name == \"darwin\")\n safari\n end\n for i in 0..(browser_count - 1)\n browser(i).cookie.all.delete\n end\n close_all\n $options.silent_mode = m\n end", "def button_down(id)\n if id == Gosu::Button::KbEscape\n close\n end\n end" ]
[ "0.6829381", "0.61322427", "0.60186976", "0.59532416", "0.59463257", "0.59354156", "0.5908544", "0.5907754", "0.58829623", "0.5816998", "0.5788251", "0.5737297", "0.57227063", "0.5716071", "0.57139194", "0.57015586", "0.5686884", "0.56865543", "0.5656771", "0.5634313", "0.5634313", "0.5634313", "0.56157094", "0.56019527", "0.5585646", "0.5557015", "0.5557015", "0.5541745", "0.5541745", "0.5502197", "0.5495658", "0.5491683", "0.5491233", "0.5486741", "0.54835624", "0.54806596", "0.54635984", "0.5463251", "0.54377127", "0.5436614", "0.5434697", "0.541919", "0.541315", "0.54050726", "0.5390852", "0.53837174", "0.5376764", "0.5366515", "0.53609955", "0.5358131", "0.53503424", "0.53487587", "0.5342377", "0.5335928", "0.53346145", "0.5329781", "0.5311971", "0.53096706", "0.5308381", "0.53010416", "0.52981925", "0.5290476", "0.52896124", "0.52884823", "0.5282189", "0.5275582", "0.5274238", "0.52680176", "0.52618825", "0.52560306", "0.52504265", "0.5230512", "0.5229589", "0.5229589", "0.5216835", "0.5216077", "0.5215459", "0.5212386", "0.5208134", "0.5199942", "0.5197538", "0.5192609", "0.5189256", "0.5187", "0.51838773", "0.5183515", "0.51829696", "0.5174868", "0.5172328", "0.51674765", "0.5166825", "0.5165329", "0.5158157", "0.5150094", "0.51388836", "0.5138342", "0.5137527", "0.5136551", "0.5136087", "0.5132864" ]
0.52939725
61
Find current link associate with the currently viewed page, then walk up the parents and show
def expand_to_current current_location = $window.location.path # `window.location.pathname` # walk down tree links = @sidenav.find("a") current_link = links.select do |l| l.attr("href") == current_location end.first return unless current_link current_link.add_class("current-page") # walk back up tree starting with the sibling sibling = current_link.prev("span") sibling.click if sibling # walk back up rest of the tree uls = current_link.parents("ul") uls.each do |ul| span = ul.prevAll("span").first span.click if span end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @parent_path = set_parent_path\n end", "def find_pages_for_parents_list\n @pages_for_parents_list = []\n Page.find_all_by_parent_id(nil, :order => \"position ASC\").each do |page|\n @pages_for_parents_list << page\n @pages_for_parents_list += add_pages_branch_to_parents_list(page)\n end\n @pages_for_parents_list.flatten.compact!\n\n # We need to remove all references to the current page or any of its decendants or we get a nightmare.\n @pages_for_parents_list.reject! do |page|\n page.id == @page.id or @page.descendants.include?(page)\n end unless @page.nil? or @page.new_record?\n end", "def show\n @link = Link.find(params[:id])\n @comments = print_parents(@link)\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @link }\n end\n end", "def parent\n page\n end", "def quick_links_for(object)\n case object\n when :welcome\n links = StaticPage.find_by_url(\"parent-resources\").try(:links) || []\n return_links = Array.new([[\"Parent Resources\"]])\n links.each do |link|\n return_links << [link.name, link.url]\n end\n return_links\n end\n end", "def find_my_direct_parent\n \t\n \t self.findpapa\n \t directparents = @@directparent.dup\n \t @@directparent.clear\n \t \n \t return directparents\n \t \n end", "def show\n @page = Page.find(\"#{params[:path]}/#{params[:id]}\".split('/').last)\n\n if @page.try(:live?) || (refinery_user? && current_user.authorized_plugins.include?(\"refinery_pages\"))\n # if the admin wants this to be a \"placeholder\" page which goes to its first child, go to that instead.\n if @page.skip_to_first_child && (first_live_child = @page.children.order('lft ASC').live.first).present?\n redirect_to first_live_child.url and return\n elsif @page.link_url.present?\n redirect_to @page.link_url and return\n end\n else\n error_404\n end\n end", "def show\n @page = Page.find(\"#{params[:path]}/#{params[:id]}\".split('/').last)\n\n if @page.try(:live?) || (refinery_user? && current_user.authorized_plugins.include?(\"refinery_pages\"))\n # if the admin wants this to be a \"placeholder\" page which goes to its first child, go to that instead.\n if @page.skip_to_first_child && (first_live_child = @page.children.order('lft ASC').live.first).present?\n redirect_to first_live_child.url and return\n elsif @page.link_url.present?\n redirect_to @page.link_url and return\n end\n else\n error_404\n end\n end", "def show\n @page = if params[:path]\n Page.find(params[:path].split('/').last, :include => [:parts, :slugs])\n else\n Page.find(params[:id], :include => [:parts, :slugs])\n end\n\n if @page.try(:live?) or\n (refinery_user? and\n current_user.authorized_plugins.include?(\"refinery_pages\"))\n # if the admin wants this to be a \"placeholder\" page which goes to its first child, go to that instead.\n if @page.skip_to_first_child\n first_live_child = @page.children.find_by_draft(false, :order => \"position ASC\")\n redirect_to first_live_child.url if first_live_child.present?\n end\n else\n error_404\n end\n end", "def traverse\n link = @remaining_links.first\n if link\n @remaining_links.shift\n yield link\n @links[link]\n else\n @father\n end\n end", "def show\r\n set_page\r\n @current_account_id = current_account.id\r\n unless @current_account.followings.nil?\r\n r = @current_account.followingships.select{|f| f[:following_id] == @profile.account_id}\r\n if r.any?\r\n @followingship = r[0]\r\n else\r\n @followingship = nil\r\n end\r\n else\r\n @followingship = nil\r\n end\r\n @links = Link.where(['account_id = (?)', @current_account_id]).to_a\r\n sort_links\r\n update_page_states\r\n end", "def getCurrentLines\n session[\"currentpage\"] = session[\"story\"].select do |line|\n line.parent_id == session[\"startline\"].id\n end \n session[\"currentpage\"]\nend", "def parent\n return @links[:parent]\n end", "def trace\n \n path = WikiPath.new\n \n page = self\n\n wikipage = Wikipedia.find(title)\n\n # If page has a parent we must stop (we can fetch the cached path or it's a loop)\n # If there's no page... we reached the end of the road\n while !page.blank? and page.parent_id.blank? \n \n path.pages << page\n \n # We must get rid of infoboxes, metadata and Image and FIle links before we get the link title\n first_link_title = wikipage.content.gsub(\"\\n\", \"\").gsub(/\\{\\{[^\\}]*\\}\\}/, \"\").gsub(\"[[Image:\", \"\").gsub(\"[[File:\", \"\").match(/\\[\\[[^\\]]*\\]\\]/)[0]\n first_link_title = first_link_title.split(\"|\").first.gsub(\"]\", \"\").gsub(\"[\", \"\") unless first_link_title.nil?\n\n if first_link_title.nil?\n page.update_attributes :is_root => true\n page = nil\n else\n\n wikipage = Wikipedia.find(first_link_title)\n\n parent_page = WikiPage.find_by_title(first_link_title)\n parent_page ||= WikiPage.create :url => \"\", :title => first_link_title, :fetched_at => Time.now\n\n page.update_attributes :parent_id => parent_page.id\n\n\n page = parent_page \n end\n end\n\n unless page.blank?\n path.pages << page\n unless page.parent_id.blank?\n \n parent_pos = path.pages.index page.parent\n # If parent is not in the path then we have a cached path\n if parent_pos.nil?\n path.pages.concat(page.ancestors.reverse)\n else # If parent is in the path then we have a loop\n\n # remove pages from path\n roots = path.pages.slice! parent_pos, path.pages.length - parent_pos\n\n # create a tree\n tree = WikiTree.create :name => roots.map(&:title).join(\" - \")\n # we remove the parent page to every root and indicate it's a root\n roots.each do |root|\n root.update_attributes :is_root => true, :parent_id => nil\n end\n\n end\n\n end\n end\n\n path.pages.each do |page|\n tree.pages << page\n page.reload\n end\n\n path\n\n end", "def next_screen\n # print \"nxt: \" + id.to_s + \" - \" + title + \"\\n\"\n return children.all(:order => :position).first.first_screen if has_children?\n sibling_screen\n end", "def show\n # Find the page by the newer 'path' or fallback to the page's id if no path.\n @page = Page.find(params[:path] ? params[:path].to_s.split('/').last : params[:id])\n\n if @page.try(:live?) or (refinery_user? and current_user.authorized_plugins.include?(\"refinery_pages\"))\n # if the admin wants this to be a \"placeholder\" page which goes to its first child, go to that instead.\n if @page.skip_to_first_child and (first_live_child = @page.children.order('lft ASC').where(:draft=>false).first).present?\n redirect_to first_live_child.url\n end\n else\n error_404\n end\n end", "def show\n page = Page.where(id: params[:id]).with_hierarchy.first\n redirect_to(controller: 'application', action: 'route_not_found') if page.nil?\n @page = PageDecorator.decorate(page)\n @page_title = @page.name\n # get_media # NOTE: we're not *currently* showing them, but we will.\n # TODO: we should really only load Associations if we need to:\n build_associations(@page.data)\n # Required mostly for paginating the first tab on the page (kaminari\n # doesn't know how to build the nested view...)\n respond_to do |format|\n format.html {}\n end\n end", "def parent_link\n link = {}\n if collection_hierarchy.length > 1\n parent_name = collection_hierarchy[-2].class.name.downcase\n link[parent_name] = {\n href: @controller.polymorphic_url(collection_hierarchy[0..-2])\n }\n end\n link\n end", "def show\n if should_skip_to_first_child?\n redirect_to refinery.url_for(first_live_child.url) and return\n elsif page.link_url.present?\n redirect_to page.link_url and return\n elsif should_redirect_to_friendly_url?\n redirect_to refinery.url_for(page.url), :status => 301 and return\n end\n\n render_with_templates?\n end", "def show\n if should_skip_to_first_child?\n redirect_to refinery.url_for(first_live_child.url) and return\n elsif page.link_url.present?\n redirect_to page.link_url and return\n elsif should_redirect_to_friendly_url?\n redirect_to refinery.url_for(page.url), :status => 301 and return\n end\n\n render_with_templates?\n end", "def local_pages\n @link_collector.local_pages\n end", "def show\n @referential = @publication.referential\n breadcrumb\n end", "def current\n pages.current\n end", "def current_list_page\n param_hash_to_link_hash params\n end", "def parent_of( page )\n dir = page.directory\n\n loop do\n if @db.has_key? dir\n parent = @db[dir].find {|p| p.filename == 'index'}\n return parent unless parent.nil? or parent == page\n end\n\n break if dir.empty?\n dir = ::File.dirname(dir)\n dir = '' if dir == '.'\n end\n\n return\n end", "def fetch_starting_page\n case @source\n when 'site' then page_repository.root\n when 'parent' then page_repository.parent_of(current_page) || current_page\n when 'page' then current_page\n else\n page_repository.by_fullpath(@source)\n end\n end", "def if_ancestor_or_self\n local_page_id = self[:id].to_s\n ids = @global_page.ancestor_ids + [@global_page.id.to_s]\n ids.include?(local_page_id)\n end", "def path\n html = ''\n a = []\n m = DcBigMenu.find( @parent.page.menu_id )\n a << m\n while m.parent \n m = DcBigMenu.find( m.parent )\n a << m\n end\n# \n (a.size - 1).downto(0) do |i| \n html << \"<span id=menu-path-#{a.size - 1 - i}>\"\n html << link_4menu(a[i]) \n html << (i > 0 ? ' &raquo; ' : '') #&rsaquo;&#10132;\n html << '</span>'\n end\n# Save level to parents params object\n @parent.params[:menu_level] = a.size\n html\nend", "def in_hierarchy(source, page_dir, paginate_path); end", "def find_object_from_link(parent_object, id)\n find_object(parent_object, id)\n end", "def links_to_follow(page)\n @page = page # need below, sorry\n links = @focus_crawl_block ? instance_eval(@focus_crawl_block).call(page) : page.links\n links.select { |link| visit_link?(link, page) }.map { |link| link.dup }\n end", "def links_to_follow(page)\n @page = page # need below, sorry\n links = @focus_crawl_block ? instance_eval(@focus_crawl_block).call(page) : page.links\n links.select { |link| visit_link?(link, page) }.map { |link| link.dup }\n end", "def parents\n page, parents = self, Array.new\n while page.parent\n page = page.parent\n parents << page\n end\n parents\n end", "def list_page_for_current\n list_page_for params[:model]\n end", "def url_for_parent_video\n model = @afdoc.part_of.first.class.to_s.underscore.pluralize\n pid = @afdoc.part_of.first.pid\n return url_for_asset(model, {:id=>pid}).html_safe\n end", "def show\n @page = Page.find(params[:id])\n #this is how we find every page by its id\n end", "def link_to_page_unless_current( *args )\n name, page, link_opts = _find_page(args)\n return name if @page == page\n\n self.link_to(name, page, link_opts)\n rescue ::Webby::Error => err\n return yield if block_given?\n raise err\n end", "def linkToPageIDFrom(toPageID, fromPageID)\n puts \"Link #{toPageID} to #{fromPageID}\"\n link = $links[toPageID]\n if link == nil\n\tputs \"Bad link for #{toPageID}\"\n end\n if toPageID == fromPageID\n return link\n elsif fromPageID == \"toc\"\n link = \"pages/\" + link\n elsif toPageID == \"toc\" and fromPageID\n link = \"../\" + link\n end\n return link\nend", "def find_recur_target\n @parent.find_recur_target\n end", "def show\n #require \"debugger\"\n #debugger\n @category = Category.find(params[:id])\n current_category = @category\n #@parent_stack = []\n # \n #while current_category.parent do\n # @parent_stack.unshift(current_category.parent)\n # current_category = current_category.parent\n #end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape(url)\n next_link = page.xpath(\".//a[@title='Go to next page']\")\n puts next_link\n if next_link && next_link[0]\n puts next_link[0]['href']\n next_url = BASE_URL + next_link[0]['href']\n puts next_url\n scrape_and_look_for_next_link(next_url)\n end\nend", "def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape(url)\n next_link = page.xpath(\".//a[@title='Go to next page']\")\n puts next_link\n if next_link && next_link[0]\n puts next_link[0]['href']\n next_url = BASE_URL + next_link[0]['href']\n puts next_url\n scrape_and_look_for_next_link(next_url)\n end\nend", "def links_to_follow(page)\n links = @focus_crawl_block ? @focus_crawl_block.call(page) : page.links\n links.select { |link| visit_link?(link, page) }\n end", "def is_parent_page_active(page)\n current_page.url.match(page)\n end", "def crawl\n recursive_explore([@origin_url],1)\n end", "def find_selected #:nodoc:\n ret = DcBigMenu.find( @parent.page.menu_id ) if @parent.page.menu_id\n while ret and ret.parent != nil\n ret = DcBigMenu.find( ret.parent )\n end\n# return first if not found (something is wrong)\n# p ret\n ret ||= DcBigMenu.where(dc_site_id: @site._id, parent: nil, active: true).limit(1).first\nend", "def show\n #binding.pry\n add_breadcrumb \"Articles\",articles_path\n cat=@article.category\n if cat\n cat.ancestors.reverse_each { |a| add_breadcrumb a.name,category_path(a) }\n add_breadcrumb cat.name,category_path(cat)\n end\n add_breadcrumb @article.title,article_path\n #ASK how to make this more DRY\n end", "def show\n @links = @tag.links\n .includes(:tags, :domain, :user)\n .order(created_at: :desc)\n .where(user_id: current_user.id)\n .page(params[:page])\n .load\n end", "def show\n @title = @page.title\n @pages = @page.find_related_tags\n @case_studies = CaseStudy.tagged_with(@page.tag_list, :any => true)\n @locked = REDIS.exists(\"locks:pages:#{@page.id}\")\n if params[:mercury_frame] == 'true' && !@locked\n REDIS.setex(\"locks:pages:#{@page.id}\", 300, @page.canonical_title)\n elsif params[:mercury_frame] == 'true'\n render(text: \"<html><body><script type='text/javascript' charset='utf-8'>window.parent.document.location.href = '#{page_path(@page)}';</script></body></html>\", content_type: :html) and return\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 parser_url\n @pages_tree = session[:pages_tree]\n @pages_menu = session[:pages_menu]\n page_id = @pages_tree.index(\"/\" + params[:url].to_s)\n if page_id.nil?\n respond_to do |format|\n format.html { redirect_to @pages_tree[((Page.where([\"parent_id is NULL\"])).minimum(:id)).to_s], notice: \"Page #{params[:url].to_s} not exists.\" }\n end\n else\n @page = Page.find(page_id)\n end\n end", "def show\n if @link\n @link.clicked!(:referrer => request.referrer)\n redirect_to @link.url\n else\n render text: \"No such link.\", status: 404\n end\n end", "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 show\n @title = t('view.firefighters.show_title')\n @firefighter = Firefighter.find(params[:id])\n @relatives = @firefighter.relatives\n @dockets = @firefighter.dockets.order(:id).page(params[:page])\n end", "def page_for_url(url)\n logger.debug(\"checking if this page url \" + self.url.to_s + \" == \" + url.to_s);\n if (self.url == url)\n logger.debug(\"true, match found\");\n return self\n else\n children.each do |child|\n if (url =~ Regexp.compile( '^' + Regexp.quote(child.url)))\n found = child.page_for_url(url)\n return found if found\n end\n end\n end\n return nil;\n end", "def show_next\n get_item\n @pcp_subject = @pcp_item.pcp_subject\n # try to find next item, check access to remaining item later\n ps = @pcp_item # save original record\n loop do\n pi = @pcp_item.find_next\n if pi.nil? then\n flash.now[ :notice ] = t( 'pcp_items.msg.last_reached' )\n @pcp_item = ps # revert back to original record\n else\n @pcp_item = pi\n @pcp_step = @pcp_subject.current_step\n next unless user_has_permission?( :to_access )\n next unless user_may_view_item?\n end\n break\n end\n # now check permissions - worst case: original item was already inaccessible!\n @pcp_step = @pcp_subject.current_step\n unless user_has_permission?( :to_access )\n render_bad_logic t( 'pcp_items.msg.nop_to_view' )\n return\n end\n unless user_may_view_item? \n render_bad_logic t( 'pcp_items.msg.nop_not_yet' )\n return\n end\n parent_breadcrumb( :pcp_subject, pcp_subject_path( @pcp_subject ))\n set_breadcrumb_path( pcp_subject_pcp_items_path( @pcp_subject ))\n set_final_breadcrumb( :show )\n get_item_details\n render :show\n end", "def current_sublink\n @current_sublink ||= current_menu_link_group.parent || InternalTab.new\n end", "def parents\n in_edges.each{|e| e.src}\n end", "def explore \n current_link = @source_link\n while(current_link.downcase != \"[[philosophy]]\")\n link_in_database = Link.first(:link_name => current_link) \n #If already in database then break the loop.\n unless link_in_database.nil?\n update_hash_from_db(link_in_database)\n break;\n end\n \n #if link already encountered then its a cycle. \n unless path_hash[current_link].nil?\n @type = \"cycle\"\n break;\n end \n #Get the page and its contents.\n page = Wikipedia.find(current_link.gsub(/\\[/,'').gsub(/\\]/,''))\n if page.nil?\n @type = \"dead-end\"\n break;\n end \n content = page.content\n if content.nil?\n @type = \"dead-end\"\n break;\n end\n #Get the first link from the content.\n next_link = get_first_link(content)\n if next_link.nil?\n @type = \"dead-end\"\n break;\n end\n \n insert_link_update_path_hash(current_link, next_link)\n current_link = next_link\n next_link = nil\n end #end while\n\n #If type is nil then it succesfully found philosophy.\n if @type.nil?\n @type = \"philosophy\"\n end\n \n save_to_db\n \n unless link_in_database.nil?\n get_database_path(link_in_database)\n @type = @database_path.first.type\n end\n end", "def show_links\n @resume = current_user.resumes.find(params[:id])\n end", "def sub_pages(dir)\n sitemap.resources.select do |r|\n r.url.start_with? \"/#{dir}\"\n end\n end", "def show\n @containers_pages = @page.containers_pages \n end", "def find_current_child\n if adds_deep_link?\n child_id = local_value_for_path(param(:deep_link))\n else\n child_id = param(param_name)\n end\n \n find_child(child_id) || find_child(@current_child_id) || default_child\n end", "def show(data, c)\n puts \"+++++++++++++++ Page #{data.current_page} of #{data.total_pages} (#{data.total_entries} entries). #{data.size} now. ++++++++\"\n puts\n data.each do |pp|\n puts \"#{c}.- #{pp[:id]}: #{pp[:name]}. Forks: #{pp[:forks]}. URL: #{pp[:url]}\"\n c += 1\n end\n puts\n p [:next, data.next_page, data.total_entries]\n if data.has_next_page? # recurse\n show data.paginate(:page => data.next_page, :per_page => 20), c\n end\nend", "def show\n @event = Event.find(params[:id])\n @approved_parents = approved_parents(@event)\n end", "def show\n session[:pa_parent] = params[:id]\n\n redirect_to photoalbums_url\n end", "def current_parents\n self.class\n .for_target(self.target)\n .where(group_id: group_id)\n end", "def top_link_for(label, page)\n if page && page.root.slug == label.parameterize\n link_to label, page_path(label.parameterize), class: \"top-active\"\n else\n link_to_unless_current label, page_path(label.parameterize) do\n link_to label, \"#\", class: \"top-active\"\n end\n end\n end", "def then_i_see_home_and_parent_links\n within \".gem-c-contextual-breadcrumbs\" do\n expect(page).to have_link(\"Home\")\n expect(page).to have_link(@parent[\"title\"])\n end\n end", "def show_links\r\n links = Document.new(self).get_links\r\n puts \"There are #{links.length} links\"\r\n index = 1\r\n links.each do |l|\r\n puts \"link: name: #{l.name}\"\r\n puts \" id: #{l.id}\"\r\n puts \" href: #{l.href}\"\r\n puts \" index: #{index}\"\r\n index += 1\r\n end\r\n end", "def next_page; link 'next' end", "def parent_object\n @site\n end", "def show\n @page_structure = Page.find_by(parent_path: '', csv_id: @page.csv_id).subtree.arrange\n end", "def link\n\t\tpage_id.present? ? short_page_path(Page.find(page_id)) : href\n\tend", "def remote_pages\n @link_collector.remote_pages\n end", "def sitemapFolderLink(page)\n return '' if page.level == 1\n if page.folded?(current_user.id)\n css_class = 'folded'\n title = _t('Show childpages')\n else\n css_class = 'collapsed'\n title = _t('Hide childpages')\n end\n link_to(\n '',\n alchemy.fold_admin_page_path(page),\n :remote => true,\n :method => :post,\n :class => \"page_folder #{css_class}\",\n :title => title,\n :id => \"fold_button_#{page.id}\"\n )\n end", "def site_pages \n Rails.application.reload_routes!\n page_routes = Rails.application.routes.routes.select do |route|\n route.verb == \"GET\" && !route.name.blank? && !route.name.match(/^edit/) && !route.name.match(\"translat\") && !route.name.match(\"external_author\")\n end\n\n @paths = []\n @errors = []\n @errors << \"Skipping translation and external author pages because these areas are in-progress.\"\n\n page_routes.each do |r|\n path = r.path.split('(').first\n while (path.match(/:([^\\/]+)_id\\//)) do\n id = get_id(path, current_user, $1.singularize)\n if id\n path.gsub!(\":#{$1}_id\", \"#{id}\") if id\n @last_id = id\n else\n @errors << \"Couldn't find object for #{path}, #{$1}\"\n break\n end\n end\n\n if (path.match(/\\/([^\\/]+)\\/:id/))\n id = get_id(path, current_user, $1.singularize)\n if id\n path.gsub!(\":id\", \"#{id}\")\n @last_id = id\n else\n @errors << \"Couldn't find object for #{path}, id\"\n end\n end\n\n @paths << [path, r.name]\n end\n \n render :action => \"site_pages\", :layout => \"application\"\n end", "def auto_path\n cur_page.auto_path\n end", "def parent_object\n # hack by sean to allow permalink parents\n parent? && !parent_singleton? ? parent_model_find(parent_param) : nil\n end", "def parentage\n get_parents unless @already_fetched_parents\n @already_fetched_parents = true\n super\n end", "def current_parent\n\t Parent.where(id: session[\"parent_id\"]).first\n\tend", "def depth_of_page_in_url(link)\n @dpus[link]\n end", "def show\n\t\t@current_link = Rlink.find(params[:id])\n\tend", "def pages(treeish = nil)\n tree_list(treeish || @ref, true, false)\n end", "def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape_table(page)\n next_link = page.at_css('a.next')\n if next_link \n puts next_link\n next_url = BASE_URL + next_link['href']\n puts next_url\n scrape_and_look_for_next_link(next_url)\n end\nend", "def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape_table(page)\n next_link = page.at_css('a.next')\n if next_link \n puts next_link\n next_url = BASE_URL + next_link['href']\n puts next_url\n scrape_and_look_for_next_link(next_url)\n end\nend", "def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape_table(page)\n next_link = page.at_css('a.next')\n if next_link \n puts next_link\n next_url = BASE_URL + next_link['href']\n puts next_url\n scrape_and_look_for_next_link(next_url)\n end\nend", "def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape_table(page)\n next_link = page.at_css('a.next')\n if next_link \n puts next_link\n next_url = BASE_URL + next_link['href']\n puts next_url\n scrape_and_look_for_next_link(next_url)\n end\nend", "def link_selected(link_path)\n current_controller = params[:controller]\n if current_controller == \"pages\"\n current_page?(link_path)\n else\n link_controller = \"\"\n begin\n link_controller = Rails.application.routes.recognize_path(link_path)[:controller]\n rescue ActionController::RoutingError\n end\n current_controller == link_controller\n end\n end", "def current_page_link(path)\n \"current-page\" if current_page?(path)\n end", "def crawl\n completed = {}\n to_crawl = [Spidey::Page.new(@initial_url)]\n\n while page = to_crawl.shift do\n break if page.depth == @max_depth\n\n if !completed.has_key?(page.uri.to_s)\n STDERR.puts \"Fetching #{page.uri.to_s}\" if Spidey.log_requests\n page.scan.links.each do |link|\n to_crawl << Spidey::Page.new(@initial_url.merge(link), page.depth + 1)\n end\n completed[page.uri.to_s] = page\n end\n end\n\n completed\n end", "def links_to_follow(page)\n links = @focus_crawl_block ? @focus_crawl_block.call(page) : page.links\n links.select { |link| visit_link?(link, page) }.map { |link| link.dup }\n end", "def links_to_follow(page)\n links = @focus_crawl_block ? @focus_crawl_block.call(page) : page.links\n links.select { |link| visit_link?(link, page) }.map { |link| link.dup }\n end", "def show\n @page = Page.find params[:id]\n @feeds = @key_master.feeds(@page.external_id)[0..9]\n rescue\n # API calls have their own damage control mechanism\n # this is only to avoid any quirky things with a messy page id\n redirect_to root_url\n end", "def jump_next_view \n current, views = Subtlext::View.current, Subtlext::View.all \n views.each_with_index{|view,idx| views[ (idx+1 >= views.size) ? 0 : idx+1 ].jump if view == current } \nend", "def current_page; end", "def current_page; 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 get_page\n begin\n puts \"@@@@@@@@@@@@@ Visiting: #{@url} from #{@parent_page.address if @parent_page.present?}\"\n require 'nokogiri'\n require 'open-uri'\n @page = Nokogiri::HTML(open(@url))\n @page_title = (title_container = @page.css('title').first) ? title_container.content : \"Title unknown\"\n @links = @page.css(\"a\")\n\n return true\n rescue => exc\n puts \"==Problem with URL #{@url} == #{ exc.message}\"\n return false\n end\n end", "def external_link_inventory # make this an object attribute for every page object, along with base url, and other helpful state info\n []\n end", "def get_all_pages\n list_of_pages = Array.new\n list_of_pages[0] = @current_page\n pos = 1\n while @agent.page.links.find { |l| l.text == \"Next →\" } == nil ? false : true\n list_of_pages[pos] = @agent.page.links.find { |l| l.text == \"Next →\" }.click\n pos += 1\n end\n list_of_pages\n end" ]
[ "0.6093502", "0.6035832", "0.6018221", "0.59428567", "0.58233255", "0.58202976", "0.57773834", "0.57773834", "0.57730484", "0.5717951", "0.56842506", "0.5655622", "0.5608482", "0.5592796", "0.55838126", "0.55795807", "0.554585", "0.5516596", "0.55038357", "0.55038357", "0.5489031", "0.54803705", "0.54783577", "0.5474828", "0.54721516", "0.54668677", "0.54640955", "0.54622203", "0.5455899", "0.5443002", "0.54353905", "0.54353905", "0.5434993", "0.53975457", "0.5395916", "0.5388772", "0.5365524", "0.53633505", "0.5346063", "0.53360564", "0.5327643", "0.5327643", "0.5319705", "0.5311431", "0.5301243", "0.5288507", "0.52876735", "0.5282285", "0.5279078", "0.5273366", "0.52714115", "0.52702045", "0.5268853", "0.5244055", "0.5238502", "0.5228179", "0.5221895", "0.5218727", "0.5211553", "0.5206078", "0.52022415", "0.51919436", "0.5186453", "0.51651067", "0.51638305", "0.5157951", "0.5146506", "0.5144408", "0.5138204", "0.5137881", "0.5137085", "0.5133957", "0.51241153", "0.51177955", "0.5116766", "0.5113719", "0.51119375", "0.51036924", "0.5102343", "0.5099542", "0.50985104", "0.509781", "0.5093567", "0.50891715", "0.50891715", "0.50891715", "0.50891715", "0.50742894", "0.50738174", "0.50735444", "0.5071917", "0.5071917", "0.5067252", "0.50655735", "0.5063921", "0.5063921", "0.50605613", "0.50576216", "0.5056211", "0.50526416" ]
0.6291414
0
Backup wallet to image file, it contain accounts image, assets image and keys image.
def backup_wallet client.make_request('/backup-wallet', 'post', params: {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backup_image\n case provider\n when :libvirt\n system \"sudo virt-clone -o #{IMAGE_NAME} -n #{IMAGE_NAME}_sav --file /var/lib/libvirt/images/#{IMAGE_NAME}_sav.qcow2\"\n when :virtualbox\n # Shutdown the system\n system \"VBoxManage controlvm #{IMAGE_NAME} acpipowerbutton\"\n sleep SLEEP_TIME_AFTER_SHUTDOWN\n system \"VBoxManage controlvm #{IMAGE_NAME} poweroff\"\n\n # Copy the virtual machine (this is the only way of having an identical system)\n vm_config = `VBoxManage showvminfo #{IMAGE_NAME} | grep \"Config file\" | cut -f2 -d:`.strip\n vm_dir = File.dirname(vm_config)\n system \"VBoxManage unregistervm #{IMAGE_NAME}\"\n FileUtils.mv vm_dir, \"#{vm_dir}.sav\"\n system \"sync\"\n end\n end", "def backupImage\n Find.find(\"./image/\") do |image|\n next unless FileTest.file?(image) && (image =~ /\\.jpg\\Z/ || image =~ /\\.jpeg\\Z/ ||\n image =~ /\\.png\\Z/ || image =~ /\\.gif\\Z/)\n FileUtils.mv(image, \"./bkimage\")\n end\n end", "def backup account\n backup_file File.join(@ssh_home, @ssh_id), File.join(@ssh_home, account + \".identity\")\n backup_file File.join(@ssh_home, @ssh_id + \".pub\"), File.join(@ssh_home, account + \".identity.pub\")\n @shell.say \"SSH identity backed up to account: #{account}.\"\n end", "def restore_wallet(account_image: {}, asset_image: {}, key_images: {})\n params = {\n account_image: account_image,\n asset_image: asset_image,\n key_images: key_images\n }\n client.make_request('/restore-wallet', 'post', params: params)\n end", "def backupwallet(destination)\n coind.backupwallet destination\n end", "def backup!(file=nil)\n file = file || FILENAME\n dir = root + BACKUP_DIRECTORY\n FileUtils.mkdir(dir.dirname) unless dir.dirname.directory?\n FileUtils.mkdir(dir) unless dir.directory?\n save!(dir + FILENAME)\n end", "def backup\n FileUtils.cp options[:file], backup_file if File.file? options[:file]\n end", "def backupwallet(destination)\n @api.request 'backupwallet', destination\n end", "def backup!(file=nil)\n file = file || FILENAME\n dir = root + BACKUP_DIRECTORY\n FileUtils.mkdir(dir.dirname) unless dir.dirname.directory?\n FileUtils.mkdir(dir) unless dir.directory?\n save!(dir + DOTRUBY_FILENAME)\n end", "def export\n\t\t\t\tFile.open(File.join(@env[\"export.temp_dir\"], 'Vagrantfile'), \"w\") do |f|\n\t\t\t\t\tf.write(TemplateRenderer.render_string(PACKAGE_VAGRANTFILE, {\n\t\t\t\t\t\t:image => @image.id,\n\t\t\t\t\t\t:region => @env[\"vm\"].config.aws.region\n\t\t\t\t\t}))\n\t\t\t\tend\n\t\t\t\tFile.open(File.join(@env[\"export.temp_dir\"], 'image.json'), \"w\") do |f|\n\t\t\t\t\tf.write(@image.to_json)\n\t\t\t\tend\n\t\t\tend", "def backupwallet(destination)\n request(:backupwallet, destination)\n end", "def backup\n self.keep_backup && !File.exists?( backup_path ) && FileUtils.cp( self.resource.path, backup_path )\n end", "def backup_file\n \"#{@file}.bak\"\n end", "def create_and_copy_backup(backup_options = nil,backup_name = nil)\n\n end", "def backup_file(uploaded_file)\n uploaded_file(uploaded_file.to_json) do |file|\n file.data[\"storage\"] = backup_storage.to_s\n end\n end", "def backup_file\n \"#{options[:file]}.bak\"\n end", "def make_backup\n @backup = editor.create_snapshot\n end", "def backup_template( template )\n filename = \"./templates/#{template['id']}.json\"\n file = File.new(filename, \"w\")\n puts \"Backing up #{filename} ...\"\n file.write( template )\n file.close\n end", "def backup account\n return unless valid_argument?(account, \"backup\")\n @heroku_credentials.backup account\n @ssh_identity.backup account\n end", "def backup(file = nil)\n Chef::Util::Backup.new(new_resource, file).backup!\n end", "def backup(file = nil)\n Chef::Util::Backup.new(new_resource, file).backup!\n end", "def save\n path = UPLOADS_DIR.join(archive.original_filename)\n File.open(path, 'w') do |file| \n file.write(archive.read)\n end\n if backend = Instance.backend\n backend.deploy path\n end\n end", "def backup account\n backup_file @credentials_file, File.join(@heroku_home, account + '.' + CREDENTIALS)\n @shell.say \"Heroku credentials backed up to account: #{account}.\"\n end", "def backup2Drive(src,conf)\n dest = conf[:backupDrive]\n dest = dest + \"/\" unless dest [-1] =~ /[\\/\\\\]/\n dest = dest + src\n puts src\n puts dest\n FileUtils.mkdir_p(File.dirname(dest))\n FileUtils.cp(src, dest)\n puts aktTime()+\" archive copied\"\n cleanUp(conf) if conf[:generations]\n \nend", "def write_swap_file(filename, decoded_image)\n\n f = File.new \"./public/swap/#{filename}\", \"wb\"\n # f = File.new \"../public/swap/#{filename}\", \"wb\" # inline testing path\n f.write(decoded_image)\n f.close if f\n\nend", "def write_swap_file(filename, decoded_image)\n\n f = File.new \"./public/swap/#{filename}\", \"wb\"\n # f = File.new \"../public/swap/#{filename}\", \"wb\" # inline testing path\n f.write(decoded_image)\n f.close if f\n\nend", "def write_swap_file(filename, decoded_image)\n\n f = File.new \"./public/swap/#{filename}\", \"wb\"\n f.write(decoded_image)\n f.close if f\n\n end", "def backup \n begin\n check_if_db_exists\n is_allowed = @conn.exec(\"select datallowconn from pg_catalog.pg_database where datname='#{@options[:database]}'\")[0]['datallowconn']\n if is_allowed == 'f'\n # unquiece temporarily\n set_dataallowcon_to true\n end\n\n # Check to see if the directory for backups exists and if not, create it with parents\n unless File.exist?(@options[:bkdir])\n FileUtils.mkdir_p @options[:bkdir]\n end\n filename = \"postgresbk_#{@options[:database]}_#{Time.new.strftime(\"%m%d%y%H%M%S\")}.dump\"\n\n # The below system call assumes you have passwordless access as the user passed into the executable tool\n # either due to ~/.pgpass or pg_hba.conf has your user as a 'trust' auth method\n `pg_dump -U #{@options[:user]} #{@options[:database]} -F c -f #{@options[:bkdir]}/#{filename}`\n\n rescue Exception => e\n raise e\n ensure\n if is_allowed == 'f'\n # re quiesce \n set_dataallowcon_to false\n end\n end\n end", "def backup_account(user, opts = {})\n\t\ttar_file = File.join(backup_dir, \"#{user}.tar\")\n\n\t\tinvoke_and_log_cmd(\"#{@pkgacct_exe} --backup --skiphomedir --skipacctdb --nocompress #{user} #{backup_dir}\", 'pkgacct')\n\t\traise(UserBackupError, \"Failure while backing up #{user}\") unless $?.success?\n\n\t\tif opts[:append_sql_grants]\n\t\t\tsql_data = cpanel_dump_sql_data(Etc.getpwnam(user).uid)\n\t\t\tgrant_text = sql_data['dumpsql']\n\n\t\t\ttemp_user_dir = File.join(backup_dir, user)\n\t\t\tFileUtils.mkdir_p(temp_user_dir, :mode => 0700)\n\n\t\t\ttemp_mysql_file = \"#{temp_user_dir}/mysql.sql\"\n\n\t\t\tFile.open(temp_mysql_file, 'w', 0600) do |mfh|\n\t\t\t\tmfh.puts '-- cPanel mysql backup'\n\t\t\t\tmfh.puts grant_text\n\t\t\tend\n\n\t\t\tintegrate_into_tar(tar_file, \"#{user}/mysql.sql\", backup_dir)\n\n\t\t\tFileUtils.rm_rf(temp_user_dir)\n\t\tend\n\n\t\t\"#{user}.tar\"\n\tend", "def save_to_file image\n File.open('uml.png', 'wb') do |file|\n file << image.body\n end if image\n end", "def dump\n FileUtils.rm_rf(backup_builds_dir)\n # Ensure the parent dir of backup_builds_dir exists\n FileUtils.mkdir_p(Gitlab.config.backup.path)\n # Fail if somebody raced to create backup_builds_dir before us\n FileUtils.mkdir(backup_builds_dir, mode: 0700)\n FileUtils.cp_r(app_builds_dir, backup_dir)\n end", "def backup(path, options={})\n backup_path = \"#{path}.bak\"\n if options[:mv]\n mv_f path, backup_path\n else\n cp_f path, backup_path\n end\n \n chmod 644, backup_path\n\nend", "def save\n return if File.exists?(file)\n\n # Create parent directories\n FileUtils.mkdir_p(File.dirname(file))\n\n File.open(file, \"w\") do |f|\n f.write(compressed_contents)\n end\n\n puts \"Wrote blob #{file}\"\n end", "def system_backup\n\n\n end", "def backup filename=@app_file_path\n require 'fileutils'\n FileUtils.cp filename, \"#{filename}.org\"\n end", "def secret_backup(path, force: false)\n confirm! \"We'll run gpg to create an encrypted version of the secret file. You will be asked for a passphrase!\" unless force\n\n system \"gpg -o #{Shellwords.escape(path)} --symmetric --armor #{Shellwords.escape(Secret.path)}\"\n\n File.open path, \"a\" do |io|\n io.puts <<~MSG\n This is an encrypted envy(3) secret. To restore the secret please run\n envy secret:restore <path_to_this_file>.\n MSG\n end\n\n logger.success \"Created #{path}\"\n end", "def backup_config(name,format='binary')\n @log.info(\"Backup MikroTik configuration\")\n if format == 'binary'\n send_command(\"/system backup save name=#{name}\")\n elsif format == 'script'\n send_command(\"/export file=#{name}\")\n end\n @ssh_connect.close\n end", "def backup_data(src_file)\n backup_path = src_file + '.simplib_migration.bak.' + Time.now.strftime('%Y_%m_%d_%s')\n puts %Q(Making backup at #{backup_path})\n FileUtils.cp_r(src_file, backup_path)\nend", "def backup!\n return false unless File.exists?(app_dest) && File.exists?(prefs_dest)\n\n puts \" application: #{app_dest.inspect}\"\n FileUtils.rm_r(app_bak, secure: true) if File.exists?(app_bak)\n # FileUtils.cp_r(app_dest, app_bak)\n # the call to `FileUtils` was not copying the application icon, so I'm using\n # a call to `system` to properly copy application directories\n system(%Q/cp -r \"#{app_dest}\" \"#{app_bak}\"/)\n\n puts \" preferences: #{prefs_dest.inspect}\"\n FileUtils.rm_r(prefs_bak, secure: true) if File.exists?(prefs_bak)\n FileUtils.cp(prefs_dest, prefs_bak)\n\n true\n end", "def backup\n # solve override problem\n if backup_exist? && !@opt[:bkp_args][:quiet]\n while true\n print \"Already have backup in #{@cfg[:backup]},override?(y/n)\"\n opt = gets\n case opt\n when /^y/i\n break\n when /^n/i\n return\n else\n next\n end\n end\n end\n \n # do backup\n FileUtils.mkdir_p @cfg[:backup] unless File.directory? @cfg[:backup]\n CommonUtils.copy_files @cfg[:local_files], File.join(__dir__, @cfg[:backup]) do |src, dest|\n @logger.debug \"Copying #{src} to #{dest}\"\n puts \"Backup: #{File.basename src}\" unless @opt[:bkp_args][:quiet]\n end\n @logger.debug('Backup completed')\n puts \"Backup completed, saved in: #{@cfg[:backup]}\" unless @opt[:bkp_args][:quiet]\n end", "def backup_config_file\n File.join(source_directory,'installer','rails_installer_defaults.yml')\n end", "def backup(id)\n server = @connection.servers.get(id)\n ssh(server,'~/backup.sh')\n server.scp_download('backup/current.tar.gz','backup.tar.gz')\n end", "def create_backup\n files = []\n if @options.database\n db_backup = MySQLBackup.new(@options.database, \n @options.user,\n @options.password)\n files << db_backup.backup\n end\n \n files << @options.files if @options.files\n\n files.flatten!\n\n process = Process.new(@options.backup_folder,\n files, \n @options.override, \n @options.no_compress,\n @options.max_backups)\n process.backup\n puts \"--> backed up files\"\n puts \" #{files.join(\"\\n \")}\"\n puts \"--> to #{@options.backup_folder}\"\n\n File.delete files[0] if @options.database\n end", "def backup(file)\n raise(ArgumentError, \"File #{file} does not exist\") unless ::File.exist?(file)\n contents = IO.binread(file)\n begin\n file_bucket_file = Puppet::FileBucket::File.new(contents, :bucket_path => @local_path)\n files_original_path = absolutize_path(file)\n dest_path = \"#{@rest_path}#{file_bucket_file.name}/#{files_original_path}\"\n file_bucket_path = \"#{@rest_path}#{file_bucket_file.checksum_type}/#{file_bucket_file.checksum_data}/#{files_original_path}\"\n\n # Make a HEAD request for the file so that we don't waste time\n # uploading it if it already exists in the bucket.\n unless Puppet::FileBucket::File.indirection.head(file_bucket_path)\n Puppet::FileBucket::File.indirection.save(file_bucket_file, dest_path)\n end\n\n return file_bucket_file.checksum_data\n rescue => detail\n puts detail.backtrace if Puppet[:trace]\n raise Puppet::Error, \"Could not back up #{file}: #{detail}\"\n end\n end", "def generate_backup\n if Export.launch_export!\n current_user.update(\n last_backup_at: Time.zone.now,\n last_backup_entry_id: current_user.last_entry_id\n )\n redirect_to backup_succeeded_path\n else\n redirect_to backup_failed_path\n end\n end", "def save_to_file\n f = File.open(\"#{IMAGE_DATA_DIR}/#{self.id}\",\"w\")\n f.write(self.data)\n f.close\n end", "def dump(backup_file_name)\n @mysqlcmds ||= ::Rds::S3::Backup::MySqlCmds.new(backup_server.endpoint['Address'],\n @opts['mysql_username'],\n @opts['mysql_password'],\n @opts['mysql_database'])\n\n\n\n\n @mysqlcmds.dump(backup_file_path(backup_file_name)) # returns the dump file path\n end", "def backup\n return false if !@file || !backup_file\n FileUtils.cp @file, backup_file if File.file? @file\n true\n end", "def copy_to_backup\n FileUtils.cp(@original_file_path, @new_file_path)\n end", "def export(filename)\n @image.save(filename, interlace: true)\n end", "def save\r\n # Draw a frame.\r\n frame = Draw.new\r\n frame.stroke(\"black\")\r\n frame.stroke_width(2)\r\n frame.fill_opacity(0)\r\n frame.rectangle(0, 0, @image.columns-1, @image.rows-1)\r\n frame.draw(@image)\r\n \r\n @image.write(name + '.png')\r\n end", "def save_image(file)\n client = Appwrite::Client.new()\n\n client\n .set_endpoint(ENV['APPWRITE_ENDPOINT']) # Your API Endpoint\n .set_project(ENV['APPWRITE_FUNCTION_PROJECT_ID']) # Your project ID available by default\n .set_key(ENV['APPWRITE_API_KEY']) # Your secret API key\n\n storage = Appwrite::Storage.new(client)\n\n response = storage.create_file(file: Appwrite::File.new(file));\n\n puts response\nend", "def cmd_backup argv\n setup argv\n command = @hash['command']\n name = @hash['name']\n response = @api.backup(command, name)\n msg response\n return response\n end", "def save(file, overwrite: false, allow_negative_balance: false)\n raise 'You have to join at least one wallet in' if empty?\n before = ''\n wallet = Wallet.new(file)\n before = wallet.digest if wallet.exists?\n Tempfile.open([@id, Wallet::EXT]) do |f|\n temp = Wallet.new(f.path)\n temp.init(@id, @key, overwrite: overwrite, network: @network)\n File.open(f.path, 'a') do |t|\n @txns.each do |txn|\n next if Id::BANNED.include?(txn.bnf.to_s)\n t.print \"#{txn}\\n\"\n end\n end\n temp.refurbish\n if temp.balance.negative? && !temp.id.root? && !allow_negative_balance\n if wallet.exists?\n @log.info(\"The balance is negative, won't merge #{temp.mnemo} on top of #{wallet.mnemo}\")\n else\n @log.info(\"The balance is negative, won't save #{temp.mnemo}\")\n end\n else\n FileUtils.mkdir_p(File.dirname(file))\n IO.write(file, IO.read(f.path))\n end\n end\n before != wallet.digest\n end", "def generate_full_path_secure(filename, backup_type)\n generate_bucket_path(backup_type) + \"/\" + File.basename(filename) + \"-\" + SecureRandom.uuid\n end", "def save_backup_on_dup\n if self.duplicated_from && self.duplicated_from.restorable? && self.keep_backup\n FileUtils.mkdir_p( File.dirname( self.backup_path ))\n FileUtils.cp( self.duplicated_from.backup_path, self.backup_path )\n end\n end", "def dump(path, backup_id)\n raise NotImplementedError\n end", "def backup_file folder,file\n @manager ||= Conf::LocalFileManager.new\n newp = File.join(Conf::directories.backup,@curr_source.name.to_s,folder)\n file.zip! unless file.zip?\n @manager.move_files [file],newp\n end", "def backup(file_path)\n file_path = clean_path(file_path)\n\n begin\n dest_path = file_path\n dest_path = '/' + @namespace + file_path if @namespace\n dest_path = @repository_path + dest_path\n\n dirname = File.dirname(dest_path)\n\n # Make sure the path exists in the repo\n if !File.exists?(dirname)\n FileUtils.mkdir_p(dirname)\n end\n\n # Copy the file(s) to the repo\n if File.exists?(file_path)\n # Make sure we only copy the directory contents,\n # not the directory itself.\n if File.directory?(file_path)\n file_path += '/.'\n end\n\n # We pass remove_destination to avoid issues with symlinks\n FileUtils.cp_r file_path, dest_path, :remove_destination => true\n else\n puts \"ERROR: '#{file_path}' doesn't seem to exist.\"\n end\n rescue Errno::EACCES\n puts \"ERROR: '#{file_path}' doesn't seem to be readable and/or writable by this user.\"\n end\n end", "def copy_snapshots! snaps\n # account_snapshots = account.snapshots\n # backed_up_snapshots = self.snapshots\n # backed_up_snapshot_descriptions = backed_up_snapshots.collect { |bus| bus.description }\n if snaps.count > 0\n VfSnapshots.verbose \"\\n#{snaps.count} to copy, here we go.\"\n else\n VfSnapshots.verbose \"\\nNothing to copy.\"\n end\n begin\n tags = { tags: [\n {\n key: \"Account\",\n value: account.name,\n },\n ]\n }\n\n snaps.each_with_index do |snapshot,idx|\n VfSnapshots.verbose \"\\n[#{idx+1} of #{snaps.length}] Copying #{account.name} #{snapshot.description}\"\n\n # modify the source snapshot to share with the backup account\n snapshot.modify_attribute(attribute:'createVolumePermission', operation_type: 'add', user_ids: [ account.account_id ], create_volume_permission: { add: [{ user_id: account_id }] } )\n # get it in the backup account\n shared_snapshot = ec2.snapshot(snapshot.id)\n region = 'us-east-1'\n new_desc = \"#{account.name} #{snapshot.description}\"\n copy_response = shared_snapshot.copy(\n description: new_desc,\n source_region: region,\n destination_region: region,\n )\n ec2.snapshot(copy_response.snapshot_id).create_tags tags\n # puts \"Sleeping...\"\n # sleep 1\n # puts \"Woke!\"\n end\n rescue Aws::EC2::Errors::ResourceLimitExceeded\n VfSnapshots.verbose \"\\nThrottled!\"\n exit\n end\n end", "def store_screenshot(path)\n screenshot = screenshots.first\n if (screenshot)\n begin \n variant = screenshot.variant(resize_to_limit: [425, nil], resize_to_fill: [425, 250, { crop: :low }]).processed\n path = variant.blob.service.send(:path_for, variant.key)\n FileUtils.cp(path, \"/Users/jan.prill/Documents/workspace/msp/inviadorepo/web/js/gridsome/inviado/src/assets/images/inviado/#{id}.png\")\n rescue\n p \"There is a problem on #{variant}\"\n end\n end\n end", "def backup\n inexistent_files = check_for_inexistent_files\n unless inexistent_files.empty?\n STDERR.puts \"Cannot backup inexistent files\"\n STDERR.puts inexistent_files.join(\" \")\n exit 1\n end\n\n FileUtils.mkdir_p @backup_folder unless File.exists? @backup_folder\n\n if @no_compress \n copy_files \n delete_uncompressed_backups\n else\n compress_files_and_copy\n delete_compressed_backups\n end\n\n end", "def transfer!\n backup = connection.backups.create\n Logger.info \"Created backup [#{backup.id}]\"\n\n package.filenames.each do |filename|\n src = File.join(Config.tmp_path, filename)\n metadata = {}\n\n [:sha512sum, :sha1sum, :cksum].each do |cmd|\n if !`which #{cmd}`.empty?\n metadata[cmd] = %x|#{cmd} #{src}|.split.first\n break\n end\n end\n\n metadata[:size] = %x|ls -sh #{src}|.split.first\n\n backup_file = backup.files.create(filename: src, metadata: metadata)\n Logger.info \"Created backup file [#{backup_file.id}]\"\n\n Logger.info \"EngineYard performing upload of '#{File.join(src)}' to '#{backup_file.upload_url}' with metadata '#{metadata.inspect}'.\"\n\n backup_file.upload(file: src)\n end\n Logger.info \"Finished uploading files for backup [#{backup.id}]\"\n\n backup.finish!\n\n Logger.info \"Finished backup [#{backup.id}]\"\n end", "def write_data\n data = {}\n tmp_file = \"#{@wallet_file}.tmp\"\n\n @data.each do |item|\n next if item.empty?\n\n data.merge!(\n item.id => {\n 'id' => item.id,\n 'group' => item.group,\n 'user' => item.user,\n 'url' => item.url,\n 'comment' => item.comment,\n 'last_edit' => item.last_edit,\n 'created' => item.created\n }\n )\n end\n\n Gem::Package::TarWriter.new(File.open(tmp_file, 'w+')) do |tar|\n data_encrypt = encrypt(data.to_yaml)\n tar.add_file_simple('wallet/meta.gpg', 0400, data_encrypt.length) do |io|\n io.write(data_encrypt)\n end\n\n @passwords.each do |id, password|\n tar.add_file_simple(\"wallet/passwords/#{id}.gpg\", 0400, password.length) do |io|\n io.write(password)\n end\n end\n\n @otp_keys.each do |id, key|\n tar.add_file_simple(\"wallet/otp_keys/#{id}.gpg\", 0400, key.length) do |io|\n io.write(key)\n end\n end\n\n @keys.each do |id, key|\n tar.add_file_simple(\"wallet/keys/#{id}.pub\", 0400, key.length) do |io|\n io.write(key)\n end\n end\n end\n\n File.rename(tmp_file, @wallet_file)\n rescue => e\n File.unlink(tmp_file) if File.exist?(tmp_file)\n\n raise \"#{I18n.t('error.mpw_file.write_data')}\\n#{e}\"\n end", "def save\n ApplicationDatabase.new.save_compressed_to_file(@file.path)\n end", "def local_backup_path\n local_path\n end", "def image(file)\n entry = @defn[@latest.name]\n endian = @vm.bigendian ? \"be\" : \"le\"\n init_user(entry)\n File.open(file, 'w') do |f|\n f.puts \"// vmimage #{endian}#{@vm.databits}\"\n @vm.dump(0, @vm.dot, true) do |s|\n f.puts s\n end\n end\n end", "def create_ebs_backup(options = {})\n params = options.merge( { :commit => \"explicit\", :api_version => 1.0 } )\n STDERR.puts \"Performing RightScale API call to create a new snapshot\"\n json=nil\n SystemTimer.timeout_after(@api_snap_timeout) do\n body = RestClient.post @api_url+\"/create_ebs_backup.js\", params\n json = body.nil? ? nil: JSON.load(body)\n STDERR.puts \"CREATED_SNAPS: #{json}\"\n end\n json \n rescue Exception => e\n display_exception(e, \"create_ebs_backup(#{options.inspect})\")\n end", "def save_picture(data)\n File.open('public/images/areas/'+ self.profile_picture,'w') do |f|\n f.write data\n end\n end", "def tmpbkup(action=:create)\n bkup=@bkup\n begin\n if action == :create\n # Thx SO; https://stackoverflow.com/questions/88311/how-to-generate-a-random-string-in-ruby\n marker = (0...8).map { ('a'..'z').to_a[rand(26)] }.join\n\n Pem::Logger.logit(\"Creating backup of #{@location} to #{@location}#{marker}\")\n FileUtils.mv(@location,\"#{@location}#{marker}\")\n return \"#{@location}#{marker}\"\n elsif action == :restore\n Pem::Logger.logit(\"Backup cannot be nil!\", :fatal) if bkup.nil?\n raise('Backup cannot be nil!') if bkup.nil?\n\n Pem::Logger.logit(\"Restoring backup of #{@location} from #{bkup}\")\n FileUtils.rm_rf(@location)\n FileUtils.mv(bkup,@location)\n return nil\n elsif action == :purge\n Pem::Logger.logit(\"Backup cannot be nil!\", :fatal) if bkup.nil?\n raise('Backup cannot be nil!') if bkup.nil?\n\n Pem::Logger.logit(\"Purging backup of #{@location} from #{bkup}\")\n FileUtils.rm_rf(bkup)\n return nil\n end\n rescue StandardError => err\n Pem::Logger.logit(err, :fatal)\n raise(err)\n end\n end", "def create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n Image.generate_file(@image.name,@image.postgres,@image.redis,@image.nginx,@image.ruby_ver,current_user,@image.mysql)\n dpath=File.join(Rails.root,\"/public/uploads/user/dockerfile/\"+current_user.id.to_s+\"/Dockerfile\")\n cpath=File.join(Rails.root,\"/public/uploads/user/composefile/\"+current_user.id.to_s+\"/docker-compose.yml\")\n rpath=File.join(Rails.root,\"/public/readme.txt\")\n zipfile=File.join(Rails.root,\"/public/\"+@image.name+\".zip\")\n # send_file(dpath,:filename => \"Dockerfile\", :disposition => \"attachment\")\n\n Zip::File.open(zipfile,Zip::File::CREATE) do |zip|\n zip.add(\"docker-compose.yml\",cpath)\n zip.add(\"Dockerfile\",dpath)\n zip.add(\"readme.txt\",rpath)\n end\n # send_file(\"../../files/\",:filename => i.to_s)\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_raw_image(dest)\n execute!(\"cp #{@tempfile} #{dest}\")\n orig_user = `whoami`.strip\n execute!(\"chown #{orig_user} #{dest}\")\n end", "def write_backup(filename = nil)\n Doing.logger.benchmark(:_write_backup, :start)\n filename ||= Doing.setting('doing_file')\n\n unless File.exist?(filename)\n Doing.logger.debug('Backup:', \"original file doesn't exist (#{filename})\")\n return\n end\n\n backup_file = File.join(backup_dir, \"#{timestamp_filename}___#{File.basename(filename)}\")\n # compressed = Zlib::Deflate.deflate(content)\n # Zlib::GzipWriter.open(backup_file + '.gz') do |gz|\n # gz.write(IO.read(filename))\n # end\n\n FileUtils.cp(filename, backup_file)\n\n prune_backups(filename, Doing.setting('history_size').to_i)\n clear_undone(filename)\n Doing.logger.benchmark(:_write_backup, :finish)\n end", "def copy_offer_image_to_photo!\n self.copy_offer_image_to_photo\n self.save\n end", "def execute_backup_stripe(options={})\n @disk.sync\n\n# Ensure filesystem is frozen and uses retry\n raise \"FATAL: unable to freeze lvm filesystem!\" unless @disk.freeze\n\n create_opts = {\n :lineage => options[:lineage],\n :prefix_override => options[:lineage], #Make sure we use the volume_nickname \"lineage\" as the prefix for our snaps (even if the volume has a different, perhaps more descriptive name)\n :description => \"Snapshot created by RightScale DB tools on instance #{ENV['EC2_INSTANCE_ID']}.\",\n :max_snaps => options[:max_snapshots],\n :keep_dailies => options[:keep_dailies],\n :keep_weeklies => options[:keep_weeklies],\n :keep_monthlies => options[:keep_monthlies],\n :keep_yearlies => options[:keep_yearlies],\n :devices => options[:devices].join(\",\")\n }\n create_opts[:suffix] = options[:suffix] if options[:suffix]\n\n # TODO: retry on the http requests? sounds like a good idea to me\n result = self.create_ebs_backup(create_opts)\n raise \"FATAL: unable to create snapshots!\" if result.nil?\n aws_ids = result['aws_ids']\n raise \"FATAL: result not recognized #{result}\" unless aws_ids.is_a?(Array)\n\n# Ensure filesystem is unfrozen and uses retry\n raise \"FATAL: could not unfreeze filesystem!\" unless @disk.unfreeze\n\n aws_ids.each do |snap|\n # TODO: does this http call need to be retried also? \n self.update_snapshot(snap, \"committed\")\n end\n\n # e) - Perform snapshot cleanup\n lst = self.cleanup_snapshots_stripe(options[:cleanup_prefix],{:keep_last => options[:max_snapshots], :dailies => options[:keep_dailies], :weeklies => options[:keep_weeklies], :monthlies => options[:keep_monthlies], :yearlies => options[:keep_yearlies]})\n puts \"Cleanup resulted in deleting #{lst.length} snapshots : #{lst.inspect}\"\n \n end", "def backup_dir\n @backup_dir ||= create_backup_dir\n end", "def copy_assets; end", "def perform_backup\n \n add_memories_to_dropbox! if has_dropbox?\n\n # Clone the repo incase something is writing to it while we are backing up\n run \"cd #{@home} && git clone --bare #{@repo} #{@repo}.mirror\"\n output=run \"backup perform --trigger=daily_backup --log-path #{@dirs[:logs ]}\"\n run \"cd #{@home} && rm -fr #{@repo}.mirror\"\n \n get_timestamp(output)\n end", "def backup_and_download\n @config.each do |config|\n connect_to_host(config[:host],config[:port],config[:user],config[:password])\n backup_config(config[:name],config[:format])\n download_backup(config[:host],config[:port],config[:user],config[:password],config[:name],config[:path],config[:format])\n end\n return true\n end", "def exportImage(options={})\n if self.datatype.name!=\"image\"\n raise \"instancevalue has wrong data type\"\n end\n if self.data_binary.blank?\n raise \"no image data found\"\n end\n localOptions={:withColorPalette=>false}\n localOptions.merge!(options)\n imageBlob=trimBlob(self.data_binary)\n begin\n myImage=Magick::Image.from_blob(imageBlob)[0]\n rescue Magick::ImageMagickError\n raise \"instancevalue contains invalid image data\"\n end\n case localOptions[:exportFormat]\n when '1'\n exportFormat='BMP'\n when '2'\n exportFormat='TIF'\n when '3'\n exportFormat='JPG'\n when '4'\n exportFormat='PNG'\n when '5'\n exportFormat='GIF'\n when '6'\n exportFormat='TXT'\n else\n exportFormat='PNG'\n end\n if localOptions[:withColorPalette]\n paletteImg=Magick::Image.read(Rails.root.to_s+\"/app/assets/images/Rainbow.png\")\n myImage=myImage.clut_channel(paletteImg[0])\n end\n sendImage=myImage.to_blob { self.format=exportFormat }\n instanceName=self.instancevalueset.instance.name\n shotNr=self.instancevalueset.shot_id\n fileName=instanceName+'_'+shotNr.to_s+'.'+exportFormat.downcase\n return {:content=>sendImage, :format=>'image/'+exportFormat, :filename=>fileName}\n end", "def save(name, src=nil)\n raise ArgumentError, \"template name not given\" unless name\n\n src = src || Dir.pwd\n dir = Quarry.bank_folder + \"#{name}\" # silo_folder\n copier = Copier.new(src, dir, :backup=>false)\n copier.copy\n copyfile = dir + '.ore/copy.rb'\n if !copyfile.exist?\n File.open(copyfile, 'w'){ |f| f << 'copy all' }\n end\n dir\n end", "def generate_drupal_backup\n @process_runner.execute!(\"cd #{@working_directory} && docker-compose run --rm drupal_data_generator\")\n end", "def create_image\n code = string_generator.generate\n encrypted_code = encrypt(code)\n\n image_filename = \"#{encrypted_code}#{image_generator.file_extension}\"\n image_path = File.join(filesystem_dir, image_filename)\n image_bytes = image_generator.generate(code)\n\n File.open image_path, 'w' do |os|\n os.write image_bytes\n end\n\n return image_path, code\n end", "def capture_image(image_name, include_attached_storage = false, image_notes = '')\n image_notes = '' if !image_notes\n\n disk_filter = lambda { |disk| disk['device'] == '0' }\n disk_filter = lambda { |disk| disk['device'] != '1' } if include_attached_storage\n\n disks = self.blockDevices.select(&disk_filter)\n\n self.service.createArchiveTransaction(image_name, disks, image_notes) if disks && !disks.empty?\n end", "def backupItem\n\t\tif self.image_id\n\t\t\t@public_id = self.image_id.split('/').last\n\t\t\t@public_id = @public_id.split('#').first\n\t\t\t@public_id = @public_id.split('.').first\n\t\tend\n\tend", "def make_backup\n print_title('Data backup')\n\n @backup_type ||= prompt.select('What type of backup do you want?',\n 'Full (redmine root and database)' => :full,\n 'Only database' => :database,\n 'Nothing' => :nothing)\n\n logger.info(\"Backup type: #{@backup_type}\")\n\n # Dangerous option\n if @backup_type == :nothing\n if prompt.yes?('Are you sure you dont want backup?', default: false)\n logger.info('Backup option nothing was confirmed')\n return\n else\n @backup_type = nil\n return make_backup\n end\n end\n\n @backup_root ||= prompt.ask('Where to save backup:', required: true, default: DEFAULT_BACKUP_ROOT)\n @backup_root = File.expand_path(@backup_root)\n\n @backup_dir = File.join(@backup_root, Time.now.strftime('backup_%d%m%Y_%H%M%S'))\n create_dir(@backup_dir)\n\n files_to_backup = []\n Dir.chdir(root) do\n case @backup_type\n when :full\n files_to_backup = Dir.glob(File.join('**', '{*,.*}'))\n end\n end\n\n if files_to_backup.any?\n files_to_backup.delete_if do |path|\n path.start_with?(*BACKUP_EXCLUDE_FILES)\n end\n\n @backup_package = File.join(@backup_dir, 'redmine.zip')\n\n Dir.chdir(root) do\n puts\n puts 'Files backuping'\n Zip::File.open(@backup_package, Zip::File::CREATE) do |zipfile|\n progressbar = TTY::ProgressBar.new(PROGRESSBAR_FORMAT, total: files_to_backup.size, frequency: 2, clear: true)\n\n files_to_backup.each do |entry|\n zipfile.add(entry, entry)\n progressbar.advance(1)\n end\n\n progressbar.finish\n end\n end\n\n puts \"Files backed up on #{@backup_package}\"\n logger.info('Files backed up')\n end\n\n @database = Database.init(self)\n @database.make_backup(@backup_dir)\n\n puts \"Database backed up on #{@database.backup}\"\n logger.info('Database backed up')\n end", "def save_picture(data)\n File.open('public/images/'+ self.picture,'w') do |f|\n f.write data\n end\n end", "def backup\n\t\tunless (@options && @options[:path] && @options[:dataset])\n\t\t\traise OptionParser::InvalidArgument, \"Missing arguments for 'backup'.\"\n\t\tend\n\t\t# Only attempt backup if the service is running\n\t\tstate = false\n\t\tself.launch(\"/usr/sbin/serveradmin status postgres\") do |output|\n\t\t\tstate = ((/RUNNING/ =~ output) != nil)\n\t\tend\n\t\torig_state = state\n\t\t$log.debug(\"@options = #{@options.inspect}\")\n\t\tarchive_dir = @options[:path]\n\t\tunless (archive_dir[0] == ?/)\n\t\t\traise OptionParser::InvalidArgument, \"Paths must be absolute.\"\n\t\tend\n\t\twhat = @options[:dataset]\n\t\tunless self.class::DATASETS.include?(what)\n\t\t\traise OptionParser::InvalidArgument, \"Unknown data set '#{@options[:dataset]}' specified.\"\n\t\tend\n\t\t# The passed :archive_dir and :what are ignored because the dump is put\n\t\t# on the live data volume\n\t\tarchive_dir = self.backupDir\n\t\tdump_file = \"#{archive_dir}/#{BACKUP_FILE}\"\n\t\tdump_file_uncompressed = \"#{archive_dir}/#{BACKUP_FILE_UNCOMPRESSED}\"\n\t\t# Create the backup directory as necessary.\n\t\tunless File.directory?(archive_dir)\n\t\t\tif File.exists?(archive_dir)\n\t\t\t\t$log.info \"Moving aside #{archive_dir}...\\n\"\n\t\t\t\tFileUtils.mv(archive_dir, archive_dir + \".applesaved\")\n\t\t\tend\n\t\t\t$log.info \"Creating backup directory: #{archive_dir}...\\n\"\n\t\t\tFileUtils.mkdir_p(archive_dir, :mode => 0700)\n\t\t\t# _postgres:_postgres has uid:gid of 216:216\n\t\t\tFile.chown(216, 216, archive_dir)\n\t\tend\n\t\t# Backup only once a day\n\t\tmod_time = File.exists?(dump_file) ? File.mtime(dump_file) : Time.at(0)\n\t\tif (Time.now - mod_time) >= (24 * 60 * 60)\n\t\t\t# Attempt to start the service if needed\n\t\t\tif (! state)\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin start postgres\") do |output|\n\t\t\t\t\tstate = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\tend\n\t\t\tif (! state)\n\t\t\t\t$log.info \"PostgreSQL is not running, skipping database backup\"\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\t$log.info \"Creating dump file \\'#{dump_file}\\'...\"\n\t\t\tsystem(\"/usr/bin/sudo -u _postgres /usr/bin/pg_dumpall > #{dump_file_uncompressed.shellescape}\")\n\t\t\tif ($?.exitstatus != 0)\n\t\t\t\t$log.error \"...Backup failed on pg_dumpall, Status=#{$?.exitstatus}\"\n\t\t\telse\n\t\t\t\tsystem(\"/usr/bin/gzip #{dump_file_uncompressed.shellescape}\")\t\t\t\t\n\t\t\t\tif ($?.exitstatus == 0)\n\t\t\t\t\tFile.chmod(0640, dump_file)\n\t\t\t\t\tFile.chown(216, 216, dump_file)\n\t\t\t\t\t$log.info \"...Backup succeeded.\"\n\t\t\t\telse\n\t\t\t\t\t$log.error \"...Backup failed on gzip! Status=#{$?.exitstatus}\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Restore original service state\n\t\t\tif (! orig_state)\n\t\t\t\t# What if a dependent service was launched while we were backing up? We\n\t\t\t\t# don't want to shut down postgres in that case.\n\t\t\t\twiki_state = false\n\t\t\t\tcalendar_state = false\n\t\t\t\taddressbook_state = false\n\t\t\t\tdevicemgr_state = false\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin status wiki\") do |output|\n\t\t\t\t\twiki_state = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin status calendar\") do |output|\n\t\t\t\t\tcalendar_state = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin status addressbook\") do |output|\n\t\t\t\t\taddressbook_state = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\t\tself.launch(\"/usr/sbin/serveradmin status devicemgr\") do |output|\n\t\t\t\t\tdevicemgr_state = ((/RUNNING/ =~ output) != nil)\n\t\t\t\tend\n\t\t\t\tif (! (wiki_state || calendar_state || addressbook_state || devicemgr_state))\n\t\t\t\t\tself.launch(\"/usr/sbin/serveradmin stop postgres\")\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\t$log.info \"Dump file is less than 24 hours old; skipping.\"\n\t\tend\n\tend", "def save(opts = {})\n path = opts.delete(:path) { nil }\n password = opts.delete(:password) { nil }\n\n new_path = path || @path\n new_password = password || @password\n\n raise ArgumentError, 'File path is not set' if new_path.nil?\n raise ArgumentError, 'Password is not set' if new_password.nil?\n\n File.open(new_path, 'wb') do |file|\n file.write dump(new_password)\n end\n end", "def save_attached_files; end", "def save_attached_files; end", "def dump_database(app_name, instance_name)\n app_config = RailsPwnerer::Config[app_name, instance_name]\n db_name, db_user, db_pass = app_config[:db_name], app_config[:db_user], app_config[:db_pass]\n\n pwnerer_user = app_config[:pwnerer_user]\n pwnerer_uid = uid_for_username(pwnerer_user)\n pwnerer_gid = gid_for_username(pwnerer_user)\n \n timestamp = Time.now.strftime '%Y%m%d%H%M%S'\n dump_file = \"db/#{app_name}.#{instance_name}_#{timestamp}.sql\"\n Dir.chdir app_config[:backup_path] do\n system(\"mysqldump --add-drop-database --add-drop-table\" +\n \" --skip-extended-insert --single-transaction\" +\n \" -u#{db_user} -p#{db_pass} #{db_name} > #{dump_file}\")\n # lockdown the file\n File.chmod(0400, dump_file)\n File.chown(pwnerer_uid, pwnerer_gid, dump_file)\n end\n end", "def to_pwdump_file(path, &block)\n exporter = Metasploit::Credential::Exporter::Pwdump.new(workspace: workspace)\n\n output_file = File.open(path, 'w') do |file|\n file << exporter.rendered_output\n end\n output_file.path\n end", "def copy_backup project_id:, instance_id:, cluster_id:, backup_id:, source_backup:, expire_time:\n tables.copy_backup parent: \"projects/#{project_id}/instances/#{instance_id}/clusters/#{cluster_id}\",\n backup_id: backup_id,\n source_backup: source_backup,\n expire_time: expire_time\n end", "def export_from_veewee\n Dir.chdir(work_dir) do\n log.info \"Exporting #{veewee_provider} image into box file\"\n system \"veewee #{veewee_provider} export #{IMAGE_NAME} --force\"\n end\n end", "def backup_request(client, filename, message)\n filename = \"BACKUP_#{filename}\"\n aFile = File.open(filename, 'w+')\n if aFile\n File.write(filename, message)\n puts \"Updated: #{filename}\"\n else\n client.puts \"ERROR: Unable to open file #{filename}\"\n end\n aFile.close\n return\n end", "def save_image(url)\n file_name = get_filename(url)\n dir_name = '/vagrant/bookinfo/public/'\n file_path = dir_name + file_name\n\n mechanize = Mechanize.new\n page = mechanize.get(url)\n page.save_as(file_path)\n\n return file_path\n end", "def save\n begin\n requires :bytes\n\n request = BB::Facebook::Request.new(graph: BB::Facebook.graph)\n\n attributes = self.instance_values\n\n req_image_details = request.create_image(BB::Facebook::Account.id, attributes)\n\n unless req_image_details['error'].nil?\n raise BB::Errors::NotFound, \"#{req_image_details['error']['message']}: #{req_image_details['error']['error_user_msg']}\"\n end\n\n begin\n attributes = {\n hash: req_image_details['images']['bytes']['hash'],\n url: req_image_details['images']['bytes']['url']\n }\n rescue Exception => e\n raise BB::Errors::NotFound, \"Convert Image Error\"\n end\n\n image = BB::Facebook::Image.new(attributes)\n\n image.instance_values.each do |key, value|\n send(\"#{key.to_s}=\", value) rescue false\n end\n\n true\n\n rescue BB::Errors::NotFound => e\n self.errors = e\n false\n rescue Exception => e\n self.errors = e\n false \n end\n end", "def write_out\n File.delete(@path) if File.exist?(@path)\n File.open(@path, mode: 'w', encoding: @img_data.encoding) { |f| f.write(@img_data) }\n end", "def export!\n render_manifest_output_and_keys\n render_zip\n end" ]
[ "0.6659576", "0.6521543", "0.6456153", "0.6359973", "0.6324028", "0.61434317", "0.6099499", "0.6090482", "0.6048025", "0.60380983", "0.5915952", "0.59055", "0.58923364", "0.58662075", "0.58524704", "0.5797919", "0.57369727", "0.57351327", "0.5733402", "0.5711486", "0.5711486", "0.5705018", "0.57034403", "0.56899744", "0.5686046", "0.5686046", "0.5582109", "0.5495728", "0.54939276", "0.53951144", "0.53218967", "0.5312166", "0.5288081", "0.5280729", "0.52622086", "0.5247582", "0.5224858", "0.5217354", "0.52012074", "0.5193587", "0.51884514", "0.5185417", "0.5169191", "0.5162913", "0.51582795", "0.5157589", "0.5151201", "0.51447284", "0.51435405", "0.5138596", "0.5128272", "0.5117939", "0.5113917", "0.51017934", "0.50894856", "0.50784767", "0.50760084", "0.50718915", "0.50543046", "0.50480276", "0.50431925", "0.50411475", "0.50042367", "0.5003226", "0.4997517", "0.49837893", "0.496894", "0.4962118", "0.4956994", "0.49516192", "0.49413803", "0.49397308", "0.4930407", "0.49181375", "0.49129102", "0.49112827", "0.48996308", "0.48929822", "0.48927793", "0.4889692", "0.48845688", "0.48765475", "0.48665684", "0.4864465", "0.48621893", "0.48610902", "0.48557505", "0.4854871", "0.48458537", "0.48254332", "0.48254332", "0.48253724", "0.4819666", "0.4818424", "0.48175466", "0.48154378", "0.48129737", "0.4809983", "0.48069662", "0.48057774" ]
0.6738948
0
Restore wallet by image file.
def restore_wallet(account_image: {}, asset_image: {}, key_images: {}) params = { account_image: account_image, asset_image: asset_image, key_images: key_images } client.make_request('/restore-wallet', 'post', params: params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_from_save_image(save_image)\n return if save_image.nil?\n restore_items_from_save_image(:active, save_image[:active_items])\n restore_items_from_save_image(:saved, save_image[:saved_items])\n end", "def restore\n path = PathHelper.path(fid)\n begin\n $mg.store_file(dkey, classname, path)\n rescue => e\n raise e if $debug\n end\n end", "def restore_bitmap src_fname\n File.open(src_fname, \"rb\") do |f|\n parse f\n if data.first == \"PNG\"\n \"\\x89PNG\" +f.read(self.size-4)\n else\n bitmap_hdr + f.read(@palette_size + @imgdata_size)\n end\n end\n end", "def restore\n\t\tbegin\n\t\t\tcurrent_user\n\t\t\tif params[:file]\n\t\t\t\tfile_content = params[:file].read.to_s\n\t\t\t\tdata = file_content.decrypt(:symmetric, :algorithm => 'des-ecb', :password => params[:password])\n\t\t\t\teval(data)\n\t\t\telsif params[:api_type]\n\t\t\t\t@response, @headers, @url = amazon_request(\"Get\", \"/Favorites/\" + params[:api_type] + \"/\" + params[:api] + \"/\" + params[:email] + \"/\" + params[:name], \"\", \"\", :cloud => @s3)\n\t\t\t\teval(@response.body)\n\t\t\telsif params[:name]\n\t\t\t\t@response, @headers, @url = amazon_request(\"Get\", \"/Demos/\" + params[:email] + \"/\" + params[:name], \"\", \"\", :cloud => @s3)\n\t\t\t\teval(@response.body)\n\t\t\telse\n\t\t\t\t@response, @headers, @url = amazon_request(\"Get\", \"/\" + params[:email] + \"/\" + params[:key], \"\", \"\", :cloud => @s3)\n\t\t\t\tdata = @response.body.decrypt(:symmetric, :algorithm => 'des-ecb', :password => params[:password])\n\t\t\t\teval(data)\n\t\t\tend\n\t\trescue\n\t\t\tbegin\n\t\t\t\tputs file_content\n\t\t\t\teval(file_content)\n\t\t\trescue Exception => e\n\t\t\t\t@exception = e\n\t\t\tend\n\t\tend\n\tend", "def restore\n end", "def restore(file, opts = {})\n data, _status_code, _headers = restore_with_http_info(file, opts)\n data\n end", "def cmd_restore argv\n setup argv\n filepath = @hash['filepath']\n clear_existing = to_boolean(@hash['boolean'])\n response = @api.restore(filepath, clear_existing)\n msg response\n return response\n end", "def restore\n RESTORE\n end", "def restore_archive\n end", "def restore(id)\n server = @connection.servers.get(id)\n # copy the local backup file to remote id\n server.scp('backup.tar.gz','backup.tar.gz')\n # run the remote script to do the restore. \n ssh(server,'~/restore.sh')\n end", "def restore(restore_id, &block)\n get \"/restore/#{restore_id}/\", nil, &block\n end", "def restore(path, rev, opts = {})\n input_json = {\n path: path,\n rev: rev,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/restore\", input_json)\n Dropbox::API::File.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end", "def restore(cart_name)\n raise NotImplementedError(\"restore\")\n end", "def restore(options = {})\n self.class.restore(id, options)\n end", "def restore!\n if restorable?\n FileUtils.mv backup_path, self.resource.path\n self.asset_areas.destroy_all\n self.resource.reprocess!\n # The asset must be saved to refresh update_at field for a correct caching of the asset\n self.save!\n true\n end\n end", "def restore(account)\n # takes account as an arg\n memento = find account.id\n # uses the accounts id to find the relevant memento\n account.restore_state memento\n # calls the accounts restore method passing the memento as an arg\n end", "def restore_table( table_file )\n logger.info \"restoring from #{table_file}\"\n pump.table_name = table_file.basename.sub_ext('').sub_ext('').to_s.to_sym\n open_bz2 table_file do |io|\n pump.io = io\n pump.restore filename: table_file\n end\n end", "def restore_archive\n file_id = params[:id]\n file = Archive.find_by(id:file_id)\n file.is_deleted=false\n file.save\n redirect_to archives_show_path\n end", "def restore; end", "def restore_snapshot(vm, name)\n snapshot = enumerate_snapshots(vm).find { |s| s.name == name }\n\n # No snapshot matching \"name\"\n return nil if snapshot.nil?\n\n task = snapshot.snapshot.RevertToSnapshot_Task(suppressPowerOn: true)\n\n if block_given?\n task.wait_for_progress do |progress|\n yield progress unless progress.nil?\n end\n else\n task.wait_for_completion\n end\n end", "def restore(body = {}, params = {})\n response = client.post \"/_snapshot/{repository}/{snapshot}/_restore\", update_params(params, body: body, action: \"snapshot.restore\", rest_api: \"snapshot.restore\")\n response.body\n end", "def revert_to_snapshot(name)\n Fission::Action::Snapshot::Reverter.new(self).revert_to_snapshot(name)\n end", "def restore(path)\n raise NotImplementedError\n end", "def restore_asset_file(asset_model)\n # use the storage info from staging to figure out which local bucket it belongs in.\n local_storage_key = asset_model.file.data['storage'].to_sym\n unless @storage_map.has_key? local_storage_key\n raise RuntimeError, \"Unrecognized remote storage for asset #{asset_model.friendlier_id}: #{local_storage_key}\"\n end\n # OK - we have a local destination for the file; proceed.\n tracked_futures << Concurrent::Promises.future_on(thread_pool) do\n puts \" -> Copying original file for #{asset_model.class.name}/#{asset_model.friendlier_id}\\n\\n\"\n copy_file( key: local_storage_key, file: asset_model.file)\n rescue Aws::S3::Errors::NoSuchKey => e\n puts \" ERROR: Could not find ORIGINAL file to copy for asset `#{asset_model.friendlier_id}`\"\n end\n end", "def restore!(date, filename)\n\n object_name = \"#{date.strftime('%Y-%m-%d')}_#{filename}\"\n unless container.object_exists?(object_name)\n raise \"Object #{object_name} not found in container.\"\n end\n if File.exists?(filename)\n raise \"File #{filename} already exists locally, not overwriting.\"\n end\n\n object = container.object(object_name)\n object.save_to_filename(filename)\n\n puts \" -> Restored #{object_name} as #{filename} to the current directory\"\n\n end", "def restore(name)\n Session.instance.load name\n end", "def backupImage\n Find.find(\"./image/\") do |image|\n next unless FileTest.file?(image) && (image =~ /\\.jpg\\Z/ || image =~ /\\.jpeg\\Z/ ||\n image =~ /\\.png\\Z/ || image =~ /\\.gif\\Z/)\n FileUtils.mv(image, \"./bkimage\")\n end\n end", "def backup_image\n case provider\n when :libvirt\n system \"sudo virt-clone -o #{IMAGE_NAME} -n #{IMAGE_NAME}_sav --file /var/lib/libvirt/images/#{IMAGE_NAME}_sav.qcow2\"\n when :virtualbox\n # Shutdown the system\n system \"VBoxManage controlvm #{IMAGE_NAME} acpipowerbutton\"\n sleep SLEEP_TIME_AFTER_SHUTDOWN\n system \"VBoxManage controlvm #{IMAGE_NAME} poweroff\"\n\n # Copy the virtual machine (this is the only way of having an identical system)\n vm_config = `VBoxManage showvminfo #{IMAGE_NAME} | grep \"Config file\" | cut -f2 -d:`.strip\n vm_dir = File.dirname(vm_config)\n system \"VBoxManage unregistervm #{IMAGE_NAME}\"\n FileUtils.mv vm_dir, \"#{vm_dir}.sav\"\n system \"sync\"\n end\n end", "def restore_snapshot(snapshot_name)\n execute(:restore_snapshot, VmId: vm_id, SnapName: snapshot_name)\n end", "def restore(source_file)\n OpenNebula.log_debug \"Restoring container from #{source_file}\"\n \n # firstly, get the container id\n # it's obtained by getting top level directory name which is number in our convention (see save method)\n files = OpenVZ::Util.execute \"sudo tar --exclude='*/*' -tf #{source_file}\"\n ctid = files.split(\"\\n\").find {|t| t=~ /\\d+\\//}.chomp('/')\n OpenNebula.log_debug \"During restoring found ctid: #{ctid}\"\n \n # unpack files to their corresponding dirs\n # TODO elimnate hardcoded paths\n checkpoint_file = \"/tmp/#{ctid}-checkpoint\" \n files = %W(#{checkpoint_file} /etc/vz/conf/#{ctid}.conf /vz/private/#{ctid})\n files_cmd = files.inject(\"\") {|current, f| current + \" -C \" + File.dirname(f) + \" \" + File.basename(f)}\n \n OpenNebula.exec_and_log \"sudo tar xzf #{source_file} #{files_cmd}\"\n \n container = OpenVZ::Container.new(ctid)\n container.restore checkpoint_file\n rescue RuntimeError => e\n raise OpenVzDriverError, \"Container #{container.ctid} can't be restored. Details: #{e.message}\"\n ensure\n OpenNebula.exec_and_log \"sudo rm -rf #{checkpoint_file}\" if checkpoint_file and File.exists? checkpoint_file\n end", "def restore( page )\n load page, take_snapshot: false\n end", "def restore_db\n\n begin\n self.rds.restore_db_instance_from_db_snapshot(new_snap.id,\n backup_server_id,\n {\"DBSubnetGroupName\" => @opts['db_subnet_group_name'],\n \"DBInstanceClass\" => @opts['db_instance_type'] } )\n rescue Exception => e\n raise MyRDSException.new(\"Error in #{self.class}:restore_db: #{e.class}: #{e}\")\n end\n\n end", "def restore(*args); end", "def restore!\n restore\n save!(validate: false)\n end", "def restore_previous_version(encrypted_channel_id, filename, version_id)\n owner_id, channel_id = storage_decrypt_channel_id(encrypted_channel_id)\n key = s3_path owner_id, channel_id, filename\n\n @s3.copy_object(bucket: @bucket, key: key, copy_source: \"#{@bucket}/#{key}?versionId=#{version_id}\")\n end", "def restore_volume(id, restore_point, opts = {})\n data, _status_code, _headers = restore_volume_with_http_info(id, restore_point, opts)\n data\n end", "def fetch_image(host,old_file,new_file)\n\t`rm #{old_file}` \n\t`mv #{new_file} #{old_file}`\t\n\topen('assets/images/radar/new.png', 'wb') do |file|\n\t\tfile << open('host').read\n\tend\n\tnew_file\nend", "def restore(id)\n http.put(\"#{endpoint_base}/#{id}/restore\") do |response|\n respond_with_object response\n end\n end", "def revert_to_snapshot(name)\n unless exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n if Fusion.running?\n message = 'It looks like the Fusion GUI is currently running. '\n message << 'A VM cannot be reverted to a snapshot when the Fusion GUI is running. '\n message << 'Exit the Fusion GUI and try again.'\n return Response.new :code => 1, :message => message\n end\n\n conf_file_response = conf_file\n return conf_file_response unless conf_file_response.successful?\n\n snapshots_response = snapshots\n return snapshots_response unless snapshots_response.successful?\n\n unless snapshots_response.data.include? name\n message = \"Unable to find a snapshot named '#{name}'.\"\n return Response.new :code => 1, :message => message\n end\n\n command = \"#{vmrun_cmd} revertToSnapshot \"\n command << \"#{conf_file_response.data} \\\"#{name}\\\" 2>&1\"\n\n Response.from_command(`#{command}`)\n end", "def restore path_to_database\n path_to_database.sub Dir.pwd, \"\"\n path_to_database.sub \"/\", \"\"\n \n @database ||= Database.new(path_to_database, @log)\n @entries.each do |entry|\n unless @database[entry.sha512].nil?\n oldfile = entry.file\n entry.add_file @database[entry.sha512]\n @log.puts \"[II] restored #{ oldfile } => #{ entry.file }\"\n puts \"[II] restored #{ oldfile } => #{ entry.file }\" if $VERBOSE\n else\n @log.puts \"[WW] couldn't find and restore #{ entry.file } in Database\"\n puts \"[WW] couldn't find and restore #{ entry.file } in Database\" if $VERBOSE\n end\n end\n end", "def battleback(filename, _hue = 0)\n load_image(@battleback_cache, filename, BattleBacks_Path, @battleback_data)\n end", "def restore_checkpoint\n @api.send(\"world.checkpoint.restore()\")\n end", "def restore(snapshot, signatures, validation_token = nil, relations = nil)\n @snapshot = snapshot\n @signatures = signatures\n @validation_token = validation_token\n @relations = relations\n model = JSON.parse(Crypto::Bytes.new(snapshot).to_s)\n restore_from_snapshot_model(model)\n end", "def revert\n @name_1 = @ori_backdrop1\n @name_2 = @ori_backdrop2\n end", "def flip\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.flip!\n img.write('public' + @photo.attachment_url)\n end", "def restore\n update(archived_at: nil)\n end", "def restore_backup(backup_uuid)\n response = post \"storage/#{backup_uuid}/restore\"\n\n response\n end", "def restore\n db = resolve_db(:allow_default => true)\n to_name = db[:name]\n to_url = db[:url]\n\n backup_id = args.shift\n\n if backup_id =~ /^http(s?):\\/\\//\n from_url = backup_id\n from_name = \"EXTERNAL_BACKUP\"\n from_uri = URI.parse backup_id\n backup_id = from_uri.path.empty? ? from_uri : File.basename(from_uri.path)\n else\n if backup_id\n backup = pgbackup_client.get_backup(backup_id)\n abort(\"Backup #{backup_id} already deleted.\") if backup[\"destroyed_at\"]\n else\n backup = pgbackup_client.get_latest_backup\n to_uri = URI.parse backup[\"to_url\"]\n backup_id = File.basename(to_uri.path, '.*')\n backup_id = \"#{backup_id} (most recent)\"\n end\n\n from_url = backup[\"to_url\"]\n from_name = \"BACKUP\"\n end\n\n message = \"#{db[:pretty_name]} <---restore--- \"\n padding = \" \" * message.length\n display \"\\n#{message}#{backup_id}\"\n if backup\n display padding + \"#{backup['from_name']}\"\n display padding + \"#{backup['created_at']}\"\n display padding + \"#{backup['size']}\"\n end\n\n if confirm_command\n restore = transfer!(from_url, from_name, to_url, to_name)\n restore = poll_transfer!(restore)\n\n if restore[\"error_at\"]\n message = \" ! An error occurred and your restore did not finish.\"\n message += \"\\n ! The backup url is invalid. Use `pgbackups:url` to generate a new temporary URL.\" if restore['log'] =~ /Invalid dump format: .*: XML document text/\n abort(message)\n end\n end\n end", "def restore_from_backup(server,force)\n options = { \"EBS_MOUNT_POINT\" => \"text:#{@mount_point}\",\n \"OPT_DB_FORCE_RESTORE\" => \"text:#{force}\",\n \"EBS_LINEAGE\" => \"text:#{@lineage}\" }\n audit = server.run_executable(@scripts_to_run['restore'], options)\n audit.wait_for_completed\n end", "def reset!\n self.draft = find_original_file!.read\n save!\n end", "def restore_backup(backup_run_id, async: true)\n requires :identity\n\n data = service.restore_instance_backup(identity, backup_run_id)\n operation = Fog::Google::SQL::Operations.new(service: service).get(data.name)\n operation.tap { |o| o.wait_for { ready? } unless async }\n end", "def restore \n # pg_restore -c -U postgres -d dataslam -1 /tmp/out.dump\n begin\n check_if_db_exists\n is_allowed = @conn.exec(\"select datallowconn from pg_catalog.pg_database where datname='#{@options[:database]}'\")[0]['datallowconn']\n if is_allowed == 'f'\n # unquiece temporarily\n set_dataallowcon_to true\n end\n\n fn = get_latest_backup_fn\n\n if fn == \"\"\n raise NoBackupsAvailableException.new \"There are no backups available at the specified location or in the default location (/tmp/postgresbk)\"\n end\n\n # The below system call assumes you have passwordless access as the user passed into the executable tool\n # either due to ~/.pgpass or pg_hba.conf has your user as a 'trust' auth method\n `pg_restore -c -U #{@options[:user]} -d #{@options[:database]} -1 #{@options[:bkdir]}/#{fn}`\n\n rescue Exception => e\n raise e\n ensure\n if is_allowed == 'f'\n # re quiesce \n set_dataallowcon_to false\n end\n end\n end", "def revert_to_snapshot(name)\n raise Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n command = \"#{vmrun_cmd} revertToSnapshot #{vmx_path.shellescape} \\\"#{name}\\\" 2>&1\"\n output = `#{command}`\n\n response = Fission::Response.new :code => $?.exitstatus\n response.output = output unless response.successful?\n\n response\n end", "def restore_derivative_file(derivative_uploaded_file, asset_id:, derivative_key:)\n tracked_futures << Concurrent::Promises.future_on(thread_pool) do\n puts \" -> Copying derivative file for #{asset_id}/#{derivative_key}\\n\\n\"\n copy_file(key: derivative_uploaded_file.storage_key, file: derivative_uploaded_file)\n rescue Aws::S3::Errors::NoSuchKey => e\n puts \" ERROR: Could not find DERIVATIVE file to copy for asset #{asset_id}/#{derivative_key}`\"\n end\n end", "def restore(*args)\n argv = to_pointer([\"restore\"] + args)\n rrd_restore(args.size+1, argv) == 0\n ensure\n free_pointers\n end", "def restore\n p \"Doing a restore ...\"\n params = {:instance_href => \"/api/clouds/907/instances/#{@instance2_id}\"}\n id = @test_client.backups.index(:lineage => \"ns_backup_test_lineage\").first.show.href.split(\"/\")[-1] # => to get the id\n task = @test_client.backups(:id => id).show.restore(params)\n return task\nend", "def write_swap_file(filename, decoded_image)\n\n f = File.new \"./public/swap/#{filename}\", \"wb\"\n f.write(decoded_image)\n f.close if f\n\n end", "def revert_file(filename,commit_id,repo=self.repo)\n post_revert(\"#{filename}\",commit_id,repo)\n end", "def poke_back(filename, hue = 0)\n load_image(@poke_back_cache.fetch(hue), filename, Pokedex_PokeBack_Path.fetch(hue), @poke_back_data[hue])\n end", "def restore!\n record = self.restore\n record.save!\n self.destroy\n return record\n end", "def restore\n _update_hash = {}\n object.attributes.reject {|k,v| object.class.ignore_fields_on_restore.include?(k)}.each do |key, value|\n _update_hash.merge! get_restore_hash(key,value)\n end\n object.update_attributes(parameterize(_update_hash))\n end", "def restore_files(paths, snapshot, all)\n #\n # Basic args\n #\n args = %w(rsync --archive --numeric-ids --inplace --relative --compress)\n\n #\n # Add on the I/O-timeout\n #\n args += ['--timeout', @io_timeout.to_s ] unless ( @io_timeout.nil? )\n args += ['--rsh', \"ssh -o BatchMode=yes -x -a -i #{@ssh_key} -l #{@destination_user}\"]\n args << '--verbose' if @verbose\n args += ['--rsync-path', \"byteback-restore --fake-super --snapshot #{snapshot}\" + (all ? \" --all\" : \"\")]\n\n #\n # To add extra rsync flags, a file can be used. This can have flags all on one line, or one per line.\n #\n if File.exists?(\"/etc/byteback/rsync_flags\")\n args += File.readlines(\"/etc/byteback/rsync_flags\").map(&:chomp)\n end\n\n dst = \"#{@destination_user}@#{@destination_host}:\"\n\n paths.each do |path|\n path = Byteback::Restore.encode_args(path).first\n args << File.join(dst,path)\n dst = \":\"\n end\n\n args << \".\"\n puts args.join(\" \") if @verbose\n system(*args)\nend", "def restore_db(file)\n\t\t\t\tbegin\n\t\t\t\t\tif File.exists?(file)\n\t\t\t\t\t\tdelete_all(XSSF_WAITING_ATTACKS_DB)\n\t\t\t\t\t\tdelete_all(XSSF_LOG_DB)\n\t\t\t\t\t\tdelete_all(XSSF_VICTIM_DB)\n\t\t\t\t\t\tdelete_all(XSSF_SERVER_DB)\n\t\t\t\t\t\t\n\t\t\t\t\t\tctx = 0\n\t\t\t\t\t\t\n\t\t\t\t\t\tYAML.load_documents(File.read(file)) {|a|\n\t\t\t\t\t\t\tXSSF_SERVER_DB.concat(a) if (ctx == 0)\n\t\t\t\t\t\t\tXSSF_VICTIM_DB.concat(a) if (ctx == 1)\n\t\t\t\t\t\t\tXSSF_WAITING_ATTACKS_DB.concat(a) if (ctx == 2)\n\t\t\t\t\t\t\tXSSF_LOG_DB.concat(a) if (ctx == 3)\n\t\t\t\t\t\t \n\t\t\t\t\t\t\tctx = ctx + 1\n\t\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\traise \"File not found...\"\n\t\t\t\t\tend\n\t\t\t\trescue\n\t\t\t\t\tprint_error(\"Error 26: #{$!}\") if (XSSF_MODE[0] =~ /^Debug$/i)\n\t\t\t\tend\n\t\t\tend", "def replace_skin(skin_id, file: nil, **params)\n client.put do |request|\n request.url \"skins/#{skin_id}\", params\n if file\n request.headers[\"Content-Type\"] = \"application/zip\"\n request.body = File.read(file)\n end\n end\n end", "def restore(backup_name, dir)\n logger.info \"Downloading backup from FTP: #{worker.user_host_and_dir}\"\n @worker.connect_and_get_file backup_name, File.join(dir, backup_name)\n end", "def restore_test_data file_name\n fname = \"./spec/factories/#{file_name}.yml\"\n fname = \"./spec/factories/last_test_data.yml\" if fname.blank?\n YAML::load( IO.read(fname) )\n end", "def frontend_restore(backup)\n result = execute_direct(@@C_CONTROLLER, 'frontend-restore', {'--with-backup' => backup})\n parse_result(result)\n end", "def restore(server, options={})\n param = {\n :id => @id,\n :uniq_id => server.uniq_id\n }.merge options\n param[:force] = param[:force] ? 1 : 0\n data = Storm::Base::SODServer.remote_call '/Storm/Template/restore',\n param\n data[:reimaged]\n end", "def restore_from_archive(file_name = nil)\n file_name = archive_file_name if file_name == nil\n target_dir = File.dirname(file_name)\n \n tarball_name = file_name + \".tgz\"\n if File.exists?(tarball_name)\n `cd #{target_dir} && tar -xzf #{tarball_name}`\n end\n \n self.create_table()\n \n ActiveRecord::Base.connection.execute(\n \"LOAD DATA INFILE '#{file_name}' INTO TABLE #{table_name} \" +\n \"(log_ts, host_name, service_name, method_name, remote_ip, x_forwarded_for, source_ip, http_host_name, http_method, http_version, return_code, response_size_bytes, response_time_microsecs, user_agent, referrer, md5_checksum, query_string);\"\n )\n \n File.delete(file_name)\n if File.exists?(tarball_name)\n File.delete(tarball_name)\n end\n \n self.is_archived = false\n self.save()\n end", "def restore_patron\r\n Admin.restore params[:id]\r\n redirect_to :action => 'show_patrons' \r\n end", "def rollback!\n files.each { |file, contents| rollback_file(file, contents) }\n @files = {}\n end", "def restore_snapshot(uuid, snapshot_id)\n # Sometimes this command fails with 'Data synchronization is currently\n # in progress'. Just wait and retry.\n retryable(on: VagrantPlugins::Parallels::Errors::ExecutionError, tries: 2, sleep: 2) do\n execute_prlctl('snapshot-switch', uuid, '-i', snapshot_id)\n end\n end", "def restore_card(card_id)\n update_card(card_id, closed: false)\n end", "def restore(key, data_store = nil, default = nil)\n data_store.transaction do\n data_store[key.to_sym] || default\n end\n end", "def detach\n if @user&.image\n @user.update(image: nil)\n flash_notice(:runtime_profile_removed_image.t)\n end\n redirect_to(edit_account_profile_path)\n end", "def restorepassword\n @shadow_location = \"#{@home}/etc/#{domain}\"\n @shadow = \"#{@shadow_location}/shadow\"\n @backup = \"#{@shadow_location}/#{@email_account_without_domain}.mailtool\"\n @backup_shadow_account = `grep -w #{@email_account_without_domain} #{@backup} 2>/dev/null`.chomp\n @current_shadow_account = `grep -w #{@email_account_without_domain} #{@shadow} 2>/dev/null`.chomp\n if File.exist?(\"#{@backup}\")\n @replace = `replace '#{@current_shadow_account}' '#{@backup_shadow_account}' -- #{@shadow}`\n puts 'Sucessfully restored the password' if @replace\n File.delete(\"#{@backup}\")\n else\n puts 'No password backup found'\n end\n end", "def restore_agent\r\n Admin.restore params[:id]\r\n redirect_to :action => 'show_agents' \r\n end", "def restore\n if @hsa && @photo\n if (@face = @photo.faces.only_deleted.where(id: params[:id]).first)\n @face.restore # undo the logical deletion (TODO Why isn't this \"recover\"?)\n else\n @errors += ['Deleted face not found']\n end\n end\n if @errors.any?\n result = {status: 'fail', errors: @errors}\n render json: result, status: :bad_request\n else\n @named_faces = @hsa.named_faces.since(50.minutes.ago).to_a\n render :common_response\n end\n end", "def restore()\n state = @stack.pop()\n @angle = state[0]\n @pos = state[1]\n @down = state[2] \n end", "def bgm_restore\n bgm_play(@memorized_bgm)\n end", "def rescan_wallet\n client.make_request('/rescan-wallet', 'post', params: {})\n end", "def restore_from_snapshot_model(snapshot_model)\n self.identity = snapshot_model['identity']\n self.identity_type = snapshot_model['identity_type']\n self.public_key = snapshot_model['public_key']\n self.scope = snapshot_model['scope']\n self.data = snapshot_model.fetch('data', {})\n self.info = snapshot_model['info']\n end", "def remove_previously_stored_image\n begin\n super\n rescue Fog::Storage::Rackspace::NotFound\n @previous_model_for_image = nil\n end\n end", "def revert_sandbox_file_commit\n unless original_committed_file_location\n raise Chef::Exceptions::IllegalChecksumRevert, \"Checksum #{self.inspect} cannot be reverted because the original sandbox file location is not known\"\n end\n\n Chef::Log.warn(\"Reverting sandbox file commit: moving #{@storage} back to #{original_committed_file_location}\")\n @storage.revert(original_committed_file_location)\n cdb_destroy\n end", "def restore_source_files source\n dir = Conf::directories\n base = File.join(dir.data)\n source.folders.each do |fold|\n url = File.join(dir.backup,source.name.to_s,fold)\n files = ls(url).map { |f| CDR::File.new(::File.join(url,f),search: true)}\n nurl = File.join(dir.store,source.name.to_s,fold)\n download_all_files(files,nurl) unless files.empty?\n end\n Logger.<<(__FILE__,\"INFO\",\"Restored file from backup & server for #{source.name.to_s}\")\n end", "def write_swap_file(filename, decoded_image)\n\n f = File.new \"./public/swap/#{filename}\", \"wb\"\n # f = File.new \"../public/swap/#{filename}\", \"wb\" # inline testing path\n f.write(decoded_image)\n f.close if f\n\nend", "def write_swap_file(filename, decoded_image)\n\n f = File.new \"./public/swap/#{filename}\", \"wb\"\n # f = File.new \"../public/swap/#{filename}\", \"wb\" # inline testing path\n f.write(decoded_image)\n f.close if f\n\nend", "def revert\n end", "def image(file)\n entry = @defn[@latest.name]\n endian = @vm.bigendian ? \"be\" : \"le\"\n init_user(entry)\n File.open(file, 'w') do |f|\n f.puts \"// vmimage #{endian}#{@vm.databits}\"\n @vm.dump(0, @vm.dot, true) do |s|\n f.puts s\n end\n end\n end", "def rollback!\n restore_attributes\n end", "def backup_wallet\n client.make_request('/backup-wallet', 'post', params: {})\n end", "def restore\n\t\tunless (@options && @options[:path] && @options[:dataset] && @options[:target])\n\t\t\traise OptionParser::InvalidArgument, \"Missing arguments for 'restore'.\"\n\t\tend\n\t\t$log.debug(\"@options = #{@options.inspect}\")\n\t\tsource_dir = @options[:path]\n\t\tunless (source_dir[0] == ?/)\n\t\t\traise OptionParser::InvalidArgument, \"Paths must be absolute.\"\n\t\tend\n\t\twhat = @options[:dataset]\n\t\tunless self.class::DATASETS.include?(what)\n\t\t\traise OptionParser::InvalidArgument, \"Unknown data set '#{@options[:dataset]}' specified.\"\n\t\tend\n\t\tif (what.to_sym == :configuration)\n\t\t\t$log.info \"Configuration is part of the data set; nothing to restore.\"\n\t\t\treturn\n\t\tend\n\t\ttarget = @options[:target]\n\t\tunless (target == \"/\")\n\t\t\traise RuntimeError, \"Databases can only be restored to a running service.\"\n\t\tend\n\n\t\t# Point to the root volume if :path points to the secret restore path.\n\t\tif (source_dir == SECRET_DIR)\n\t\t\tsource_dir = \"\"\n\t\tend\n\n\t\t# Create the log file if it doesn't exist.\n\t\tlog_file = self.logFile\n\t\tif !File.exists?(log_file)\n\t\t\t$log.warn \"Recreating #{log_file}.\"\n\t\t\tFileUtils.touch(log_file)\n\t\tend\n\t\t# Always ensure the permissions & ownership are correct.\n\t\tFileUtils.chmod(0660, log_file)\n\t\t# _postgres has uid of 216; using instead of string in case user db hasn't yet been restored\n\t\tFileUtils.chown(216, \"admin\", log_file)\n\n\t\t# Create the socket directory if it doesn't exist.\n\t\tsocket_dir = self.socketDir\n\t\tif !File.exists?(socket_dir)\n\t\t\t$log.warn \"Recreating #{socket_dir}.\"\n\t\t\tFileUtils.mkdir_p(socket_dir, :mode => 0750)\n\t\t\tFileUtils.chown(216, 216, socket_dir)\n\t\tend\n\n\t\t# Bail if the restore file is not present.\n\t\tarchive_dir = self.backupDir\n\t\tdump_file = \"#{source_dir}#{archive_dir}/#{BACKUP_FILE}\"\n\t\t$log.info \"Restoring \\'#{dump_file}\\' to \\'#{target}\\'...\"\n\t\tunless File.file?(dump_file)\n\t\t\traise RuntimeError, \"Backup file not present in source volume! Nothing to restore!\"\n\t\tend\n\n\t\t# Recall if the service was previously enabled\n\t\tdb_dir = self.dataDir\n\t\tstate = false\n\t\tself.launch(\"/usr/sbin/serveradmin status postgres\") do |output|\n\t\t\tstate = ((/RUNNING/ =~ output) != nil)\n\t\tend\n\t\tself.launch(\"/usr/sbin/serveradmin stop postgres\") if state\n\t\tif (File.directory?(db_dir))\n\t\t\t$log.info \"...moving aside previous database...\"\n\t\t\tFileUtils.mv(db_dir, \"#{db_dir}.pre-restore-#{Time.now.strftime('%Y-%m-%d_%H:%M:%S_%Z')}\")\n\t\tend\n\t\t$log.info \"...creating an empty database at #{db_dir}...\"\n\t\tFileUtils.mkdir_p(db_dir, :mode => 0700)\n\t\t# _postgres:_postgres has uid:gid of 216:216\n\t\tFile.chown(216, 216, db_dir)\n\t\tself.launch(\"/usr/bin/sudo -u _postgres /usr/bin/initdb --encoding UTF8 -D #{db_dir.shellescape}\")\n\t\tself.launch(\"/usr/sbin/serveradmin start postgres\")\n\t\t$log.info \"...replaying database contents (this may take a while)...\"\n\t\tsystem(\"/usr/bin/gzcat #{dump_file.shellescape} | /usr/bin/sudo -u _postgres /usr/bin/psql postgres\")\n\t\tself.launch(\"/usr/sbin/serveradmin stop postgres\") unless state\n\t\t$log.info \"...Restore succeeded.\"\n\tend", "def revert_vapp_snapshot(vmId)\n revert_snapshot_action(vmId, :vapp)\n end", "def restore(path, rev)\n params = {\n 'rev' => rev.to_s\n }\n\n response = @session.do_post build_url(\"/restore/#{@root}#{format_path(path)}\", params)\n parse_response(response)\n end", "def revert_snapshot(snap_id)\n snapshot_list = self['snapshot.rootSnapshotList']\n snapshot = find_snapshot_in_list(snapshot_list, snap_id)\n\n return unless snapshot\n\n begin\n revert_snapshot_hash = { :_this => snapshot }\n snapshot\n .RevertToSnapshot_Task(\n revert_snapshot_hash\n ).wait_for_completion\n rescue StandardError => e\n error = \"Cannot revert snapshot of VM: #{e.message}.\"\n\n if VCenterDriver::CONFIG[:debug_information]\n error += \"\\n\\n#{e.backtrace.join(\"\\n\")}\"\n end\n\n raise error\n end\n end", "def unload_image(image_handle)\n end", "def restore_transparency(img_path, transparency_map)\n print_status(\"Restoring transparency for #{img_path}\")\n img = ChunkyPNG::Image.from_file(img_path)\n transparency_map.each do |i|\n img.pixels[i] = ChunkyPNG::Color::TRANSPARENT\n end\n img.save(img_path)\nend", "def image(key)\n return @data[key].clone\n end", "def restore_snapshot(project_id, snapshot_id)\n params = { query: [project_id, snapshot_id] }\n\n response = endpoint(name: 'Snapshots', params: params).do_post\n\n # We restore a project so its endpoint is different\n response.patch_endpoint_with endpoint(name: 'Projects', params: { query: [project_id] })\n\n resource 'Project', response\n end", "def do_restore\n devs = AppleDevice.available_devices\n\n if devs[0].kind_of?(RestoreMode)\n restore = devs[0].open\n \n progress_callback = proc do |operation, progress|\n steps = {\n 11 => \"Waiting for storage device\",\n 12 => \"Creating partition map\",\n 13 => \"Creating filesystem\",\n 14 => \"Restoring image\",\n 15 => \"Verifying restore\",\n 16 => \"Checking filesystems\",\n 17 => \"Mounting filesystems\",\n 19 => \"Flashing NOR\",\n 20 => \"Updating baseband\",\n 21 => \"Finalizing NAND epoch update\",\n 26 => \"Modifying persistent boot-args\",\n 27 => \"Unmounting filesystems\",\n 28 => \"Partition NAND device\",\n 29 => \"Waiting for NAND\",\n 30 => \"Waiting for device\",\n 33 => \"Loading kernelcache\",\n 36 => \"Loading NOR data to flash\",\n # return \"Unknown operation\";\n }\n puts \"#{steps[operation]} (#{operation}) with progress #{progress}\"\n end\n \n p \"starting restore\"\n restore.start_restore(progress_callback) do |data_type|\n puts \"DataRequest callback\"\n \n if data_type == \"SystemImageData\"\n puts \"Got request for system image data\"\n \n Thread.new do\n puts \"Started ASR thread\" \n File.open(FILE_RESTOREDMG) do |f|\n # asr = ASRService.new(12345, f)\n asr = ASRService.new(PORT_ASR, f)\n asr.start\n end\n end\n \n nil\n elsif data_type == \"NORData\"\n puts \"Got request for NOR data\"\n \n other_nor_data = File.open(FILE_MANIFEST).each_line.reject{|x| x =~ /^LLB/}.map do |line|\n # buffer = File.read(path)\n # OSX::NSData.alloc.initWithBytes_length(buffer, buffer.size)\n fullpath = File.join(FILE_IMGDIR, line.split(\"\\n\")[0])\n StringIO.new(File.open(fullpath).read)\n end\n\n response = { \"LlbImageData\" => StringIO.new(File.open(FILE_LLB).read), \"NorImageData\" => other_nor_data }\n \n response\n \n elsif data_type == \"KernelCache\"\n puts \"Got request for KernelCache data\"\n \n response = { \"KernelCacheFile\" => StringIO.new(File.open(FILE_KERNELCACHE).read)}\n \n response\n end \n end\n \n p \"reboot...\"\n #restore.reboot\n \n end\nend" ]
[ "0.65408355", "0.61610854", "0.5873707", "0.58466434", "0.58148724", "0.5642125", "0.5641162", "0.5640173", "0.5584143", "0.5551671", "0.54848903", "0.54710484", "0.5460013", "0.5453181", "0.5422977", "0.5416861", "0.54148245", "0.5402313", "0.5390177", "0.5317422", "0.53171766", "0.53134876", "0.5310626", "0.5295243", "0.52505094", "0.523829", "0.5232887", "0.52083516", "0.5189561", "0.51860255", "0.51840854", "0.5182406", "0.51691544", "0.51586044", "0.5142531", "0.5106001", "0.508999", "0.50886935", "0.50781894", "0.5076899", "0.50676435", "0.5063745", "0.50513244", "0.5041174", "0.50330746", "0.50084955", "0.49856108", "0.49787503", "0.49715483", "0.4956553", "0.49500605", "0.49360183", "0.49223694", "0.49130097", "0.4897837", "0.4884082", "0.48605826", "0.4858632", "0.48482648", "0.4844446", "0.48265192", "0.4816326", "0.48109105", "0.48093644", "0.48075053", "0.47950205", "0.47930142", "0.47916713", "0.47865883", "0.47773573", "0.477564", "0.47746143", "0.4767009", "0.47669238", "0.47591743", "0.47564986", "0.47523144", "0.4745088", "0.47432822", "0.47406238", "0.47395238", "0.47252768", "0.47250748", "0.47103694", "0.47096598", "0.46977597", "0.46977597", "0.46919763", "0.46842", "0.46752915", "0.46726313", "0.46564037", "0.46552497", "0.46509042", "0.46414942", "0.4631095", "0.46254605", "0.46254414", "0.4615177", "0.46103552" ]
0.7391284
0
Trigger to rescan block information into related wallet.
def rescan_wallet client.make_request('/rescan-wallet', 'post', params: {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_rescan\n EM.defer { @node.store.rescan }\n {:state => \"Rescanning ...\"}\n end", "def process( wallet )\n\t\tself.add_block do\n\t\t\tself.add_transaction( from: GENESIS_WALLET, to: wallet, amount: MINING_REWARD )\n\t\tend\n\tend", "def refresh(wallet_id)\n\t\t\t\tJuspayCheckout::ExpressCheckout.request(\"/wallets/#{wallet_id}\", 'post', {command: 'refresh'})\n\t\t\tend", "def append_verified_block(block)\n @chain << block\n @ledger.write(block)\n\n if block.index % BLOCK_REBALANCE_OFFSET == 0\n rebalance_difficulty\n end\n end", "def rehash\n send_data(\"REHASH\")\n end", "def reapply_blocks\n @reapply_blocks ||= []\n end", "def on_recovery(&block)\n self.redefine_callback(:after_recovery, &block)\n end", "def on_recovery(&block)\n self.redefine_callback(:after_recovery, &block)\n end", "def sweep_once\n if @source.updated_balance_available?\n result = sweep\n puts \"REZULT\"\n puts result\n return \"OK: #{result}\"\n else\n return \"OK: No balance detected.\"\n end\n end", "def after_redeem() end", "def update_block_stats\n self.block.calculate_stats\n end", "def run!\n cnt = addresses.size\n\n addresses.each_slice(1) do |addies|\n before = nil\n get_txrefs_batched(addies).each do |tr|\n addy = tr['address']\n txrefs = [tr['txrefs']]\n\n # Insert global address meta-data\n db.query(get_address_query(tr))\n\n while tr['hasMore']\n puts \"Address #{addy} has more transactions, fetching moar before block #{txrefs.last.last['block_height']}\"\n sleep(19)\n tr = get_txrefs(addy, txrefs.last.last['block_height'])\n txrefs << tr['txrefs']\n end\n\n txs = Hash.new { 0 }\n blocks = {}\n\n txrefs.flatten.each do |t|\n m = t['spent'] ? -1 : 1\n txs[t['tx_hash']] += m * BigDecimal(t['value']) / (10 ** 8)\n blocks[t['tx_hash']] ||= t['block_height']\n end\n\n txs.each do |txid, amt|\n db.query(insert_tx(addy, amt, txid, blocks[txid], nil))\n end\n\n sleep(19)\n end\n end\n end", "def rebalance\n Result.new(call(CMD_REBALANCE))\n end", "def run!\n start = skip_blocks + 1\n finish = n_blocks ? start + (n_blocks - 1): bitcoin.getinfo['blocks'].to_i\n puts \" -- Starting blockchain exploration of blocks #{start} to #{finish}, make yourself comfortable...\"\n\n n_processed = 0\n total_processing_time ||= 0\n\n # For each block\n (start..finish).each do |i|\n @cache_hit = 0\n @cache_miss = 0\n\n start_time = Time.now.to_f\n\n blk = bitcoin.get_block(bitcoin.get_block_hash(i))\n\n # For each transaction inside this block\n blk['tx'].map { |txid| get_tx(txid) }.each do |tx|\n idxs_with_data = []\n funds_from = []\n funds_to = []\n\n # Look into each input to see if send funds from an address we're interested in\n tx['vin'].each do |vin|\n unless vin['coinbase']\n input = get_tx(vin['txid'])['vout'][vin['vout']]\n addy = input['scriptPubKey'] && input['scriptPubKey']['addresses'].first\n\n if addy && has_address?(addresses, addy)\n addr_idx = addresses.index(addy)\n funds_from[addr_idx] ||= 0\n funds_from[addr_idx] += input['value']\n idxs_with_data << addr_idx\n end\n end\n end\n\n # Look into each out to see if we're paying any of the addresses we're interested in\n tx['vout'].each do |out|\n addy = out['scriptPubKey'] && out['scriptPubKey']['addresses'] && (out['scriptPubKey']['addresses'].first)\n\n if addy && has_address?(addresses, addy)\n addr_idx = addresses.index(addy)\n funds_to[addr_idx] ||= 0\n funds_to[addr_idx] += out['value']\n idxs_with_data << addr_idx\n end\n end\n\n idxs_with_data.uniq.each do |idx|\n addy = addresses[idx]\n net_change = (funds_to[idx] || 0) - (funds_from[idx] || 0)\n\n unless net_change.zero?\n db.query(insert_tx(addy, net_change, tx['txid'], i, blk['hash']))\n end\n end\n end\n\n end_time = Time.now.to_f\n\n n_processed += 1\n total_processing_time += end_time - start_time\n eta = (finish - i) * (total_processing_time.to_f / n_processed)\n elapsed = end_time - start_time\n\n puts \"[#{'%.2f' % (((i - start).to_f * 100) / (finish - start))}%] Block ##{i} <#{blk['hash']}> (#{'%.2f' % elapsed}s, ETA: #{\"%.3f\" % (eta / 3600)} hours), cache efficiency: #{'%.2f' % ((@cache_hit.to_f * 100)/(@cache_hit+@cache_miss))}%, processing speed: #{'%.2f' % ((blk['size'].to_f / (1024 * 1024)) / elapsed)} mb/s\"\n end\n end", "def reconcile\n done = 0\n errors = 0\n all(show_empty: true).each do |a|\n after = @sibit.balance(a[:address])\n unless after == a[:value]\n set(a[:address], after)\n yield(a[:address], a[:value], after, a[:hot])\n end\n done += 1\n rescue Sibit::Error => e\n @log.info(\"Failed to reconcile #{a[:address]} Bitcoin address: #{e.message}\")\n errors += 1\n end\n @log.info(\"Reconciled #{done} Bitcoin addresses (#{errors} errors)\")\n end", "def do_backed_up\n self.update_attributes(:needs_initial_scan => false)\n update_last_backup_times\n end", "def archive_transactions_and_reset_wallet\n #add transaction so that both transaction updates need to be successful\n #or else everything does a rollback\n ActiveRecord::Base.transaction do\n #loop through all transactions that belong to this reservation \n #that are not archived\n transactions.get_unarchived.each do |transaction|\n #get diff in balance change\n diff = transaction.final_balance - transaction.original_balance\n\n #get concernable (user or restaurant) information\n concernable = transaction.concernable\n wallet = concernable.wallet\n balance = wallet.balance \n\n #reset concernable balance \n new_balance = wallet.balance - diff\n wallet.update(balance: new_balance)\n\n #archive transaction\n transaction.update(archived: true)\n end\n end\n end", "def change_blocks(block_json)\n\n #Removal of old blocks is rolled back on errors\n Article.transaction do\n blocks.destroy_all\n block_json.each do |block|\n create_block_from_sir_trevor(block)\n end\n end\n end", "def reset!\n @latest_block_number = nil\n end", "def post_transaction_process\n bet_wallet.persist_wallet!\n end", "def call\n bank_request = context.bank_request\n change_amount = context.provided_amount.to_i.positive? ? context.provided_amount.to_i : bank_request.requested_amount\n bank_cell = BankCell.find_by(bank: bank_request.bank, game_item: bank_request.game_item)\n context.fail!(message: 'Bank cell does not exist') if bank_cell.nil?\n context.fail!(message: 'Too many items') if bank_cell.amount < change_amount\n ActiveRecord::Base.transaction do\n bank_request.update!(status: 2)\n bank_cell.update!(amount: bank_cell.amount - change_amount)\n end\n context.bank_cell = bank_cell\n rescue StandardError\n context.fail!(message: 'Bank request can not be updated')\n end", "def after_update(flatseeker)\n expire_flatseeker_cache(flatseeker)\n end", "def process_refresh!\n case self.transaction_type.to_sym\n when :preauth\n do_preauth_refresh\n when :payout\n do_payout_refresh\n when :payin_refund\n do_refund_refresh\n when :payin\n do_payin_refresh\n else\n LOG.error message: \"Cannot refresh this type of transaction\", financial_transaction_id: self.id, transaction_type: self.transaction_type\n raise \"Cannot refresh this type of transaction\"\n end\n end", "def reload\n converge_it(\"Reloading #{new_resource.device}\") do\n adapter.disable\n sleep 5\n adapter.enable\n end\n end", "def before_recovery(&block)\n self.redefine_callback(:before_recovery, &block)\n end", "def before_recovery(&block)\n self.redefine_callback(:before_recovery, &block)\n end", "def complete_scan()\n enqueue_eos_marker()\n end", "def record_block\n @block = true\n end", "def reload\n UI.info \"Reloading Guard::TiShadow\"\n stop\n start\n end", "def refresh_peers(node, &block)\n node.peers.each do |node|\n block.call(node) unless seeds.include?(node)\n peers.push(node) unless peers.include?(node)\n end\n end", "def private_reset!\n @balance = 0\n end", "def rescan?\n @rescan_required\nend", "def run_on_changes(_)\n restart\n end", "def btc_arrived\n item = read\n item['active'] = 2\n item['assigned'] = Time.now.to_i\n @aws.put_item(table_name: 'zold-wallets', item: item)\n end", "def repair!\n update!\n end", "def perform\n # Since `is_txn_confirmations_gte_10` is the only field that may change, we can limit our query\n # to use that as a starting block\n earliest_unconfirmed_block_number = StakedCofiTransaction\n .where(is_txn_confirmations_gte_10: false)\n .order(txn_block_number: :asc)\n .select(:txn_block_number)\n .first\n &.txn_block_number\n latest_block_number = StakedCofiTransaction\n .order(txn_block_number: :desc)\n .select(:txn_block_number)\n .first\n &.txn_block_number\n start_block = earliest_unconfirmed_block_number || latest_block_number || 0\n\n transaction_items = fetch_token_transactions(start_block: start_block)\n puts \"Found #{transaction_items.length} transactions\"\n\n ActiveRecord::Base.transaction do\n transaction_items.each do |transaction_item|\n transaction = StakedCofiTransaction.find_by(txn_hash: transaction_item['hash'])\n # Check if we even need to update at all\n if transaction && transaction.is_txn_confirmations_gte_10\n puts \"Already saved transaction #{transaction_item['hash']}\"\n next\n end\n\n transaction ||= StakedCofiTransaction.new(\n txn_block_number: transaction_item['blockNumber'],\n txn_timestamp: DateTime.strptime(transaction_item['timeStamp'], '%s'),\n txn_hash: transaction_item['hash'],\n txn_block_hash: transaction_item['blockHash'],\n txn_from: transaction_item['from'],\n txn_to: transaction_item['to'],\n txn_value: transaction_item['value'],\n txn_token_decimal: transaction_item['tokenDecimal'].to_i,\n )\n transaction.is_txn_confirmations_gte_10 = (transaction_item['confirmations'].to_i >= 10)\n\n if transaction.changed?\n transaction.save!\n puts \"Created/Updated transaction #{transaction_item['hash']}\"\n end\n end\n end\n\n associate_transactions_service = AssociateUnassignedStakedCofiTransactionsService.call\n puts \"Associated #{associate_transactions_service.staked_cofi_transactions_updated.length} unassigned staked COFI transactions\"\n end", "def update_blocks!\n RevisionRegister.new(page, user: author, blocks_attributes: page.blocks_attributes).save!\n\n assign_blocks\n page.save!\n end", "def reindex\n Transaction.current.reindex(self)\n end", "def scan_block(client, blocknum)\n bhash = client.getblockhash(blocknum)\n block = client.getblock(bhash)\n txhashes = block['tx']\n\n # Many blocks contain > 2k transactions, so batching this\n # can cause read timeouts on slower hardware.\n # The timeout can be adjusted in btcrpcclient if needed.\n calls = txhashes.map { |txhash| ['getrawtransaction', txhash, 1] }\n txs = client.batch(calls)\n return txs.inject([]) {|findings, tx| findings += scan_tx(client, tx) }\nend", "def recovery_wallet(xpubs: [])\n client.make_request('/recovery-wallet', 'post', params: {xpubs: xpubs})\n end", "def record_wallet_transfer(block, transaction)\n WalletTransfer.new(\n id: transaction[\"id\"],\n from_address: transaction[\"message\"][\"from\"] && Digest::SHA256.hexdigest(transaction[\"message\"][\"from\"]),\n destination_address: transaction[\"message\"][\"destination\"],\n amount: transaction[\"message\"][\"amount\"],\n fee: transaction[\"message\"][\"fee\"],\n block_height: block.height,\n ).insert\n end", "def after_recover\n end", "def on_refresh(&block)\n @connection.on_refresh_cb = block\n end", "def reset\n\t\t@block_type = nil\n\tend", "def run_reapply_blocks\n self.reapply_blocks.each do |target, block|\n context(target, &block)\n end\n end", "def reload!\n transfer = find_or_create_transfer\n transfer.transfer_items.destroy_all\n load!\n end", "def update_airdrop_contract_address\n\n data = @critical_chain_interaction_log.response_data['data']\n return if data.blank? || data['transaction_receipt'].blank?\n\n contract_address = data['transaction_receipt']['contractAddress']\n\n return if contract_address.blank?\n\n ClientToken.where(id: @critical_chain_interaction_log.client_token_id).\n update_all(airdrop_contract_addr: contract_address)\n\n CacheManagement::ClientTokenSecure.new([@critical_chain_interaction_log.client_token_id]).clear\n\n end", "def execute\n listen_for_changes\n @block.call\n end", "def make_block_reservation(hotel)\n show_blocks(hotel)\n return if hotel.blocks.size == 0\n puts \"\\nEnter the data for the block reservation.\"\n start_date = get_date(\"Start date: \")\n end_date = get_date(\"End date: \")\n room = get_integer(\"Room to reserve: \", 1, 20)\n begin\n block = hotel.blocks_by_room(start_date, end_date, room).first\n rescue => exception\n puts \"Error: #{exception.message}\"\n block = nil\n end\n if block == nil\n puts \"\\nCould not find that block.\"\n else\n begin\n hotel.reserve_from_block(block, room)\n rescue => exception\n puts \"Error: #{exception.message}\"\n end\n end\nend", "def recover(instance_id, backup_path, handles, &blk)\n @logger.debug(\"Recover instance: #{instance_id} from #{backup_path} with handles #{handles.inspect}.\")\n prov_handle, binding_handles = find_instance_handles(instance_id, handles)\n @logger.debug(\"Provsion handle: #{prov_handle.inspect}. Binding_handles: #{binding_handles.inspect}\")\n request = prov_handle[\"configuration\"]\n provision_service(request, prov_handle) do |msg|\n if msg['success']\n updated_prov_handle = msg['response']\n # transfrom handle format\n updated_prov_handle[:configuration] = updated_prov_handle[:data]\n updated_prov_handle.delete(:data)\n updated_prov_handle = hash_sym_key_to_str(updated_prov_handle)\n @logger.info(\"Recover: Success re-provision instance. Updated handle:#{updated_prov_handle}\")\n @update_handle_callback.call(updated_prov_handle) do |update_res|\n if not update_res\n @logger.error(\"Recover: Update provision handle failed.\")\n blk.call(internal_fail)\n else\n @logger.info(\"Recover: Update provision handle success.\")\n restore_instance(instance_id, backup_path) do |res|\n if res['success']\n @logger.info(\"Recover: Success restore instance data.\")\n barrier = VCAP::Services::Base::Barrier.new(:timeout => @node_timeout, :callbacks => binding_handles.length) do |responses|\n @logger.debug(\"Response from barrier: #{responses}.\")\n updated_handles = responses.select{|i| i[0] }\n if updated_handles.length != binding_handles.length\n @logger.error(\"Recover: re-bind or update handle failed. Expect #{binding_handles.length} successful responses, got #{updated_handles.length} \")\n blk.call(internal_fail)\n else\n @logger.info(\"Recover: recover instance #{instance_id} complete!\")\n result = {\n 'success' => true,\n 'response' => \"{}\"\n }\n blk.call(result)\n end\n end\n @logger.info(\"Recover: begin rebind binding handles.\")\n bcb = barrier.callback\n binding_handles.each do |handle|\n bind_instance(instance_id, nil, handle) do |bind_res|\n if bind_res['success']\n updated_bind_handle = bind_res['response']\n updated_bind_handle = hash_sym_key_to_str(updated_bind_handle)\n @logger.info(\"Recover: success re-bind binding: #{updated_bind_handle}\")\n @update_handle_callback.call(updated_bind_handle) do |update_res|\n if update_res\n @logger.error(\"Recover: success to update handle: #{updated_prov_handle}\")\n bcb.call(updated_bind_handle)\n else\n @logger.error(\"Recover: failed to update handle: #{updated_prov_handle}\")\n bcb.call(false)\n end\n end\n else\n @logger.error(\"Recover: failed to re-bind binding handle: #{handle}\")\n bcb.call(false)\n end\n end\n end\n else\n @logger.error(\"Recover: failed to restore instance: #{instance_id}.\")\n blk.call(internal_fail)\n end\n end\n end\n end\n else\n @logger.error(\"Recover: failed to re-provision instance. Handle: #{prov_handle}.\")\n blk.call(internal_fail)\n end\n end\n rescue => e\n @logger.warn(e)\n blk.call(internal_fail)\n end", "def activerecord_reload\n record.transaction { yield record.clone.reload(lock: true) }\n end", "def monitor(seen, max: 1)\n raise \"Wrong BTC address '#{seen}'\" unless seen.length == 64\n nxt = @sibit.next_of(seen)\n return seen if nxt.nil?\n return seen unless nxt.start_with?('00000000')\n ours = Set.new(@pgsql.exec('SELECT address FROM asset').map { |r| r['address'] })\n @sibit.scan(nxt, max: max) do |receiver, hash, satoshi|\n next unless ours.include?(receiver)\n if seen?(hash)\n @log.info(\"Hash #{hash} has already been seen, ignoring now...\")\n next\n end\n set(receiver, @sibit.balance(receiver))\n yield(receiver, hash, satoshi)\n true\n end\n end", "def modify_wallet(bet)\n $wallet -= bet\n if $wallet < 0\n $wallet += bet\n puts \"Oops! Looks like you do not have enough money for that.\".red\n first_spin\n end\n end", "def update_from_blockchain\n # Originally this simply compared current time with order expiry time to decide whether order had expired.\n # The problem with that, is a situation can occur when someone pays before expiry but a problem prevents this\n # routine from running and checking for payment until after expiry.\n # That would result in the order being marked as expired even though payment was received before the expiry time.\n # Therefore, getreceivedbyaddress_at_time() function added to lib/bitcoinrpc.rb to look at the block time the payment(s) got their first confirmation.\n # If the payment(s) got their first confirmation before the expiry time then that is sufficient to avoid expiring.\n # It is possible for the required number of confirmations to occur after expiry time but the order will still be marked as paid\n # provided all the payment(s) got their first confirmation before expiry time. The RPC doesn't easily allow finding the specific\n # block time that a transaction received N confirmations but can easily see when it got one confirmation.\n if payment_method.is_bitcoin?\n rpc = Market_bitcoinrpc\n elsif payment_method.is_litecoin?\n rpc = Market_litecoinrpc\n else\n raise\n end\n confirmations = Rails.configuration.blockchain_confirmations\n expire_at = created_at + Rails.configuration.expire_unpaid_order_duration\n receivedbtc_before_expiry = rpc.getreceivedbyaddress_at_time(btc_address.address, confirmations, expire_at)\n receivedbtc = rpc.getreceivedbyaddress(btc_address.address, confirmations)\n receivedbtc_with_unconfirmed = rpc.getreceivedbyaddress(btc_address.address, 0)\n payments_pending_confirmation = receivedbtc_with_unconfirmed - receivedbtc # any payments that don't have sufficient number of confirmations.\n ScriptLog.info(\"order_id: #{id}, addr: #{btc_address.address} [#{payment_method.code}] receivedbtc_before_expiry: #{receivedbtc_before_expiry}, receivedbtc: #{receivedbtc}\")\n\n # It is possible for a blockchain re-org to cause a balance to reduce. Also if you have confirmations set at zero, the customer may\n # send a payment greater than required, but another smaller payment is the one that gets confirmed in a block, with the first larger payment being discarded.\n # This has happened before where the order was marked paid and payment_received had a much bigger value than what was actually received.\n # The situation is only a problem if balance reduces after order state progressed\n # to/past PAID or EXPIRED because the vendor may ship unpaid product or in case of expired, the buyer could be refunded more than what they paid.\n # In this unusual scenario, lock the order readonly and don't process any payouts of locked orders in order payouts api code.\n # Vendor should be made aware that order is now locked so they don't ship. This is done in views with message saying locked.\n # Admin has a button to unlock orders.\n # If erroneous results are being received from RPC and orders locking, read comment in update_orders_from_blockchain.rb for possible reasons.\n if receivedbtc < payment_received && status != PAYMENT_PENDING && locked == false\n ScriptLog.warn(\"WARNING order_id #{id} balance reduced. Locking order.\")\n update!(locked: true)\n elsif locked == false\n # Whenever order's payment_received is being updated, log the change. Sometimes receivedbtc can go from non-zero to zero and want this logged.\n if receivedbtc != payment_received\n ScriptLog.info(\"order_id #{id} [#{payment_method.code}] balance changed #{btc_address.address}: #{payment_received} -> #{receivedbtc}\")\n end\n\n # Regardless of current state, ensure we update however much was paid because more payments might come in.\n # payment_unconfirmed becomes 0 when payments have sufficient confirmations.\n update!(payment_received: receivedbtc, payment_unconfirmed: payments_pending_confirmation)\n\n # Payments received after expiry need to be refunded. Not interested in handling additional payments received to the order after refund already processed.\n # This should be the only case where an OrderPayout btc_amount changes after creation.\n if status == EXPIRED && receivedbtc > 0 && !buyer_payout.paid\n self.buyer_payout.update!(btc_amount: receivedbtc)\n end\n\n if status == PAYMENT_PENDING\n if receivedbtc_before_expiry >= btc_price\n update_status_paid()\n else\n # We haven't (yet) received sufficient payment before the expiry time.\n if created_at < Time.now - Rails.configuration.expire_unpaid_order_duration\n # The current time is past the expiry time on the order.\n update!(status: EXPIRED)\n ScriptLog.info(\"order_id #{id} is now EXPIRED #{btc_address.address}:#{payment_received}\")\n else\n # Leave it in same state.\n ScriptLog.info(\"order_id #{id} unchanged - status: #{status}\")\n end\n end\n end\n end\n end", "def reset\n @blocks = @original_blocks\n end", "def perform\n\n begin\n\n while true\n set_data_for_current_iteration\n\n get_block_transactions\n\n r = validate_response\n return r unless r.success?\n\n if blocks_trail_count >= MIN_BLOCK_DIFFERENCE\n\n process_transactions\n\n update_last_processed_block_number\n\n verify_token_count if blocks_trail_count == MIN_BLOCK_DIFFERENCE\n\n end\n\n return if blocks_trail_count <= MIN_BLOCK_DIFFERENCE\n return if GlobalConstant::SignalHandling.sigint_received?\n end\n\n rescue StandardError => e\n puts e.inspect\n Rails.logger.error(e)\n return\n end\n\n end", "def rescan\n scan if self.last_scan_at.nil? || ((self.last_scan_at.to_time + (60 * 30)) < Time.now)\n true\n end", "def reload\n @reloaded = true\n restart\n end", "def modify_SCAN(inst_inf,mode,new_signal_db)\n signal = XMLParse::get_PortList(@root,inst_inf.ModuleName)\n if signal.size == 0 && new_signal_db != nil\n signal = new_signal_db\n end\n signal_db = Hash.new\n signal.each do |key,value|\n if FICE_DB::SCAN_NAME.index(key) != nil\n signal_db[key] = value\n end\n end\n\n # For Multi-Hier\n upper_module,inst_name = resolve_MultiHier(inst_inf)\n \n signal_db.each do |name,value|\n if value.Type == \"input\"\n printf(\"@I:SCAN/TEST: Force change to PullDown at %s.%s\\n\",inst_name,name)\n # Change PULLDOWN\n signal = FICE_DB::SignalInf.new( \n :name => \"1'b0\",\n :type => \"constant\" \n )\n XMLParse::change_Connection(@root,upper_module,inst_name,{\"#{name}\" => [signal]},nil)\n printf(\"Done\\n\") \n elsif value.Type == \"output\"\n # Do nothing( Keep Oringinal Wire )\n=begin\n # Change OPEN\n signal = FICE_DB::SignalInf.new( \n :name => nil,\n :type => \"open\" \n )\n XMLParse::change_Connection(@root,upper_module,inst_name,{\"#{name}\" => [signal]},nil)\n printf(\"Done\\n\") \n=end\n end\n end\n \n\n \n=begin\n # Port Direction Check ( only input/inout is allowd in pulldown )\n if sig.Type == \"input\" || sig.Type == \"inout\"\n con = con_db.PIN_INF[sig.Name][i]\n const = make_ConstantValue(sig,0)\n printf(\"\\tadd Connection(PULLDOWN:%s)\\n\",const)\n signal = FICE_DB::SignalInf.new( \n :name => const, \n :type => \"constant\", \n :msb => sig.MSB, \n :lsb => sig.LSB, \n :portion => sig.BusPortion, \n :word_top => sig.WordTop, \n :word_buttom => sig.WordButtom)\n # connect port to PULLDOWN in instantiation1\n XMLParse::change_Connection(@root,upper_module,inst_name,{\"#{sig.Name}\" => [signal]},con_db)\n @circuit_inf.add_connect(inst_inf.InstName+\".\"+sig.Name,connect_file_type,inst_inf.ModuleName,con,signal)\n printf(\"Done\\n\") \n else\n # Error of port-direction\n printf \"\\n\"\n FMakeMessage.PrintError( :category => \"CONNECT\", :no => 211, :pin_name => sig.Name, :direction => sig.Type, :verilog => inst_inf.ReplaceVerilogFile)\n end\n=end\n end", "def rescan_pci\n shell_out(\"echo 1 > /sys/bus/pci/rescan\")\nend", "def refresh\n @patt = nil\n @title = nil\n rescan_required\nend", "def update_and_post_ledgers\n update_result = false;\n line_items = gst_credit_note_line_items\n transaction do\n if update\n Ledger.delete(ledgers)\n random_str = Ledger.generate_secure_random\n line_items.each do |line_item|\n debit_ledger_entry = Ledger.new_gst_debit_ledger(line_item.from_account_id, company_id, gst_credit_note_date, line_item.amount, gst_credit_note_number, created_by, branch_id, random_str, to_account_id)\n credit_ledger_entry = Ledger.new_gst_credit_ledger(to_account_id, company_id, gst_credit_note_date, line_item.amount, gst_credit_note_number, created_by, branch_id, random_str, line_item.from_account_id)\n #build relationship between invoice and ledgers\n ledgers << debit_ledger_entry\n ledgers << credit_ledger_entry\n end\n\n tax_line_items.reload\n tax_line_items.each do |line_item|\n tax_account = line_item.account\n next if (tax_account.accountable_type=='DutiesAndTaxesAccounts' && tax_account.accountable.calculation_method==4 && tax_account.accountable.split_tax == 0)\n random_str=Ledger.generate_secure_random\n debit_ledger_entry = Ledger.new_gst_debit_ledger(line_item.account_id, company_id, gst_credit_note_date, line_item.amount, gst_credit_note_number, created_by, branch_id, random_str, to_account_id)\n credit_ledger_entry = Ledger.new_gst_credit_ledger(to_account_id, company_id, gst_credit_note_date, line_item.amount, gst_credit_note_number, created_by, branch_id, random_str, line_item.account_id)\n #build relationship between expense and ledgers\n ledgers << credit_ledger_entry\n ledgers << debit_ledger_entry\n end\n update_result = true\n end\n end\n end", "def recover(requeue = true, &block)\n @connection.send_frame(Protocol::Basic::Recover.encode(@id, requeue))\n\n self.redefine_callback :recover, &block\n self\n end", "def add_block(amount, payer, payee, miner, timestamp, signature, prev_hash, nonce, broadcast)\r\n hash = Digest::SHA256.new.hexdigest(amount.to_s + payer.to_s + payee.to_s + miner.to_s + timestamp.to_s + signature.to_s + prev_hash.to_s + nonce.to_s)\r\n if (hash.start_with?(\"0\" * NONCE_ZEROES)) # Hash Is Valid\r\n block = Block.new(amount.to_f, signature.to_i, timestamp.to_i, prev_hash.to_s, nonce.to_i, hash.to_s, payer.to_i, payee.to_i, miner.to_i)\r\n $blockchain << block\r\n broadcast_block(block) if (broadcast)\r\n puts $blockchain.length.to_s.green\r\n Thread.new { calc_net_worth } # Calculates net worth of all peers\r\n else\r\n puts \"Hash #{hash} Does Not Match Requirements! BLACKLISTING PEER WITH PORT #{payer}\".red\r\n $status = \"Hash #{hash} Does Not Match Requirements! BLACKLISTING PEER WITH PORT #{payer}\"\r\n peer = search_peers_by_port(payer)\r\n peer.node_type = 3 if (peer != -1)\r\n end\r\nend", "def refresh(command, freshness = 0.0, &block)\n if (estimate_world_time - message_time(command)) > freshness\n # Note: Because global callbacks occur before local, on_* will\n # have a chance to update data before the following block.call\n ignore_arg = Proc.new { |r| block.call if block }\n\n #puts \"refreshing #{command.to_s}\"\n send(command, &ignore_arg)\n else\n #puts \"calling secondary block for #{command.to_s}\"\n block.call if block\n end\n end", "def resend_unlock_instructions; end", "def next_renewal_hashes\n wait_until_bus_section_load\n tables[1].hashes\n end", "def recovery\n command = User::RecoveryCommand.new(params)\n run(command)\n end", "def block_amount(amount)\n self.unavailable_balance += amount.to_d\n self.save!\n end", "def run\n success = false\n\n scan_class = TableScanHelper.scan_class(session)\n scan = scan_class.new(session, left_table, right_table)\n scan.progress_printer = progress_printer\n\n self.helper = SyncHelper.new(self)\n syncer = Syncers.configured_syncer(sync_options).new(helper)\n \n execute_sync_hook :before_table_sync\n self.helper.log_table_sync_started(left_table)\n\n scan.run do |type, row|\n yield type, row if block_given? # To enable progress reporting\n unless event_filtered?(type, row)\n syncer.sync_difference type, row\n end\n end\n\n self.helper.log_table_sync_complete(left_table)\n execute_sync_hook :after_table_sync\n\n success = true # considered to be successful if we get till here\n ensure\n helper.finalize success if helper\n end", "def update_restore(request, &block)\n put \"/restore/#{request[:restore_id]}/\", request, &block\n end", "def unblock!\n self.blocked = nil\n self.save\n end", "def post_scan(**modifiers)\n self.send(\"post_#{@options[:scan_mode]}_scan\", modifiers)\n scan_history = self.send(\"get_#{@options[:scan_mode]}_file_header\")\n\n item_id = modifiers[:item_id]\n historic_data = nil\n if File.exists?(@historical_file)\n log_message(\"Updating historical CSV file: #{@historical_file}.\")\n historic_data = []\n CSV.foreach(@historical_file, headers: true) { |r| historic_data << r }\n end\n\n updated_row = [@current_scan_state.find { |row| row[0].eql?(item_id) }]\n\n if historic_data.nil?\n log_message('No historical CSV file found. Generating.')\n scan_history.concat(updated_row)\n else\n index = historic_data.find_index { |id| id[0] == item_id }\n if index.nil?\n historic_data.concat(updated_row)\n historic_data.sort! { |x,y| x[0].to_i <=> y[0].to_i }\n else\n historic_data[index] = updated_row\n historic_data.flatten!\n end\n scan_history.concat(historic_data)\n end\n \n log_message('Updated historical CSV file for ' \\\n \"#{@options[:scan_mode]}: #{item_id}.\")\n @ticket_repository.save_to_file(@historical_file, scan_history)\n end", "def transfer_swincoin(amount, payer, payee, key_private)\r\n payer_peer = search_peers_by_port(payee)\r\n if (payer_peer != -1)\r\n new_block(amount, payer, payee, key_private)\r\n else\r\n puts \"Transaction failed. The payee port does not exist!\".red\r\n $status = \"Transaction failed. The payee port does not exist!\"\r\n end\r\nend", "def execute_restore_stripe(options={})\n new_vol_name = \"#{options[:lineage]}-#{ENV['EC2_INSTANCE_ID']}\"\n json_result = self.find_latest_ebs_backup(options[:lineage], options[:from_master], options[:timestamp])\n\n if json_result.nil? \n STDERR.puts \"No existing snapshot found for the specified nickname lineage. Aborting...\"\n exit(-1)\n end\n STDERR.puts \"Restoring.. #{json_result.inspect}\"\n options[:new_size_gb] = (options[:new_volume_size_in_gb] / json_result.size.to_f).ceil if options[:new_volume_size_in_gb]\n\n @disk.sync\n @disk.umount\n @disk.disable_volume\n\n self.execute_terminate_volumes if options[:force]\n\n json_result.each do |snapshot|\n \n# create volume from snap\n create_result = ( options[:new_size_gb] ? create_volume_from_snap_size_gb(snapshot[\"aws_id\"],new_vol_name,options[:new_size_gb] ) : create_volume_from_snap(snapshot[\"aws_id\"], new_vol_name ) )\n raise \"FATAL: error occured in create_volume_from_snap(#{snapshot['aws_id']}, #{new_vol_name})\" if create_result.nil?\n\n# attach volume to instance\n retry_seconds = 0\n while retry_seconds < 200\n begin \n attach_result = attach_volume(create_result['aws_id'], snapshot['device'])\n raise \"FATAL: error occured in attach_volume(#{create_result['aws_id']}, #{snapshot['device']}\" if attach_result.nil?\n break if attach_result\n rescue => e\n puts \"CAUGHT EXCEPTION in execute_restore_stripe. Device attachment. #{e}, Retrying #{retry_seconds} of 200 seconds\"\n retry_seconds += 30\n sleep 30 \n end\n end\n raise \"FATAL: error occured in attach_volume(#{create_result['aws_id']}, #{snapshot['device']}\" if attach_result.nil?\n end\n\n# wait for devices to attach, after completing ALL the api calls\n json_result.each { |s| wait_for_attachment(s['device']) }\n @disk.enable_volume\n raise \"FATAL: mount failed!\" unless @disk.mount\n @disk.write_fstab\n# TODO - grow the filesystem if a new size was given\n end", "def start\n\n @settings['accounts'].each do |account,keys|\n\n puts \"Account: #{account}\"\n @aws_access_key_id = keys['access_key_id']\n @aws_secret_access_key = keys['secret_access_key']\n\n # Find all servers with tags matching the supplied Hash\n find_instances(@tags).each do |server|\n\n # Begin snapshotting each volume attached to the server\n #\n server.block_device_mapping.each do |block_device|\n\n log \"\\e[0;32m Searching for matching snapshots \\e[0m(#{server.id}:#{block_device})..\"\n snapshots = volume_snapshots(block_device['volumeId'])\n\n # Create each type of backup we'll be using\n #\n %w(hourly daily weekly monthly).each do |snapshot_type|\n\n # Build snapshot history for the working volume and return all snapshots\n # matching our particular snapshot type\n history = snapshots.select do |snapshot|\n snapshot.tags['snapshot_type'] == snapshot_type &&\n snapshot.tags['volume_id'] == block_device['volumeId'] &&\n snapshot.tags['protected'] == 'false'\n end\n\n history.sort_by! { |snapshot| snapshot.created_at }\n\n unless too_soon?(history,snapshot_type) || instance_variable_get(\"@#{snapshot_type}_snapshots\") == 0\n\n # Check against threshold limits for backup history and delete as needed\n #\n while history.size >= instance_variable_get(\"@#{snapshot_type}_snapshots\")\n delete_snapshot(history.first.id)\n history.delete(history.first)\n end\n\n log \"Creating #{snapshot_type} for #{block_device['volumeId']}..\"\n create_snapshot({\n 'volume_id' => block_device['volumeId'],\n 'snapshot_type' => snapshot_type,\n 'description' => \"Snapshot::#{snapshot_type.capitalize}> Server: #{server.id}\",\n 'tags' => {\n 'snapshot_time' => \"#{Time.now}\",\n 'snapshot_type' => snapshot_type,\n 'instance_id' => server.id,\n 'volume_id' => block_device['volumeId'],\n 'deviceName' => block_device['deviceName'],\n 'protected' => 'false'\n }\n })\n end\n end\n end\n end\n end\n\n end", "def restart()\n stopwatch = Stopwatch.new\n event(\"Pre\")\n if agree(\"Should all the databases be cleared? <%= color('[y/n]', :bold) %>\")\n self.clean_db()\n system( \"vagrant reload --provision\" ) \n else\n system( \"vagrant reload\" )\n end\n event(\"Post\")\n stopwatch.end(\"restarted in:\")\n end", "def reload\n restart\n end", "def reload_data\n puts \"Refreshing data now...\".cyan\n sleep(2)\n CovidTracking::Summary.reset\n CovidTracking::CountrySummary.reset\n self.data_loader.reset\n program_run\n end", "def update\n event = @reservation.event\n begin\n result = Braintree::Transaction.sale(\n amount: params[\"amount\"],\n credit_card: {\n number: params[\"number\"],\n cvv: params[\"cvv\"],\n expiration_month: params[\"month\"],\n expiration_year: params[\"year\"]\n },\n options: {\n submit_for_settlement: true\n }\n )\n rescue => e\n result.error\n end\n\n if result.success?\n @reservation.update_attributes(status: \"Completed\", transaction_number: result.transaction.id)\n event.update_number_of_available_seats\n event.save\n\n flash[:notice] = \"Reservation was successfully updated. Transaction ID: #{result.transaction.id}\"\n redirect_to event_path event\n else\n flash[:notice] = \"Error while processing payment: #{result.message}\"\n redirect_to event_path event\n end\n end", "def rehash\n raw \"REHASH\\r\\n\"\n end", "def reload\n @new_info = {}\n read_data\n # run_callbacks_for(:after_load)\n self\n end", "def tx_rollback(&block)\n @connection.send_frame(Protocol::Tx::Rollback.encode(@id))\n\n self.redefine_callback :tx_rollback, &block\n self\n end", "def charge!(txid)\n with_lock do\n submit!\n accept!\n touch(:done_at)\n update_attribute(:txid, txid)\n end\n end", "def when_checkpoint_is_ready(&block)\n ready_blocks << block\n end", "def free(block_name)\n ensure_open\n\n raise(ArgumentError,\"no such block: #{block_name}\") if block_name >= name_max\n\n slot = get_rdir_slots_used()\n\n # if there is a free slot in the current recycle block, use it\n\n if slot < get_rdir_capacity\n set_rdir_slot(slot,block_name)\n set_rdir_slots_used(slot+1)\n append_or_replace(rdir_head_name, @recycle_data)\n else\n # use freed block as next recycle page\n old_dir = rdir_head_name\n\n write_hdr(HDR_RECYCLEINDEX_, block_name)\n\n read(block_name, @recycle_data)\n @recycle_data.clear\n\n set_rdir_next_name(old_dir)\n append_or_replace(block_name, @recycle_data)\n end\n end", "def append_block(block)\n valid = block.transactions.all? do |tx|\n tx.coinbase? || verify_transaction?(tx)\n end\n\n unless valid\n puts \"Verify block failed!\"\n return\n end\n\n pow = ProofOfWork.new(block)\n catch :not_found do\n result = pow.run!\n nonce, hash = result.values_at(:nonce, :hash)\n puts \"Mining done - #{hash}\"\n block.hash = hash\n block.nonce = nonce\n save_block(block)\n\n self.hash = hash\n end\n end", "def recalibrate_order!\n order.reload\n order.refresh_shipping_cost\n order.save\n end", "def remove_for_block(block)\n tx_hashes = []\n\n block.tx.each{|tx|\n tx_hashes << tx.hash\n # remove any now conflicted txs from the memory pool --\n # these are txs which spend outputs spent by txs in this new block. why would this happen?\n # maybe a tx in the block wasn't relayed to us but an associated double-spend was.\n self.remove_conflicts(tx)\n }\n\n # TODO: should probably transfer timestamps and other information\n Toshi::Models::UnconfirmedTransaction.remove_for_block(tx_hashes)\n Toshi::Models::UnconfirmedRawTransaction.where(hsh: tx_hashes).delete\n\n # make sure the transactions are on the tip pool (if they previously existed.)\n Toshi::Models::Transaction.where(hsh: tx_hashes)\n .update(pool: Toshi::Models::Transaction::TIP_POOL)\n end", "def reverse_blocks_and_transactions_until(height)\n $db.connection.execute(\"DELETE FROM blocks WHERE height > ?\", height)\n $db.connection.execute(\"DELETE FROM wallet_transfers WHERE block_height > ?\", height)\n end", "def reload\n stop\n start\n end", "def repoint\n unless @rom && @table && @index\n fail 'Rom, table and index must be set before repointing.'\n end\n\n l = (@lz77 ? to_lz77.length : to_bytes.length)\n f_offset = @rom.find_free(l)\n\n unless f_offset\n fail \"Bytestream#repoint: Could not find #{l} bytes of free data in\" \\\n \" #{@rom}. Consider using a clean rombase.\"\n end\n\n @rom.write_offset_to_table(@table, @index, f_offset)\n clear_cache\n f_offset\n end", "def reserve # Start Ride\n return render json: { error: \"This bike is not available to reserve\" }, status: :forbidden unless @bike.available?\n begin\n ActiveRecord::Base.transaction do\n @bike.current_ride = Ride.build_from_user_bike(@user, @bike)\n @bike.reserved!\n case params[:payment_type]\n when \"subscription\"\n render json: { error: \"Subscription has not been implemented yet\" }, status: :bad_request\n raise ActiveRecord::Rollback\n when \"prepay\"\n @user.validates_payment_and_good_standing\n @bike.current_ride.trans = Transaction.charge_user_for_ride(@user, @bike.current_ride, \"prepay\")\n else # :per_minute\n # put pay_per_minute logic here\n end\n @bike.save!\n\n print \"Reserved Bike #{@bike.id} - scheduling bike-reserved-email\"\n puts Time.now\n minutes = 5\n delay = \"#{minutes}m\"\n Rufus::Scheduler.singleton.in delay do\n if (Ride.find(@bike.current_ride.id).progress?)\n ApplicationMailer.bikes_been_reserved_for(minutes, @user, @bike.id).deliver_now\n print \"Sent email \"\n puts Time.now\n end\n end\n\n end\n rescue User::PaymentMethodException, User::BraintreeException => e\n render json: { error: e.message }, \n status: :payment_required, \n location: api_new_payment_path\n rescue User::NotInGoodStandingException => e\n render json: { error: e.message }, \n status: :forbidden, \n location: api_collections_path\n rescue ActiveRecord::RecordInvalid => e\n render :json => { :error => e.message }, \n status: :unprocessable_entity\n rescue Transaction::Rejected => e\n render :json => { :error => e.message }, \n status: :bad_request\n else\n render json: {bike: @bike.to_json({methods: :code}), transction: @bike.current_ride.trans}\n end\n end", "def update_tables\n @old_ethereum_address = @user_extended_details.ethereum_address\n\n @user_extended_details.ethereum_address = @encrypted_ethereum_address\n @user_extended_details.save!\n\n update_user_md5_extended_details\n\n @edit_kyc_request.status = GlobalConstant::EditKycRequest.processed_status\n @edit_kyc_request.save!\n\n @user_kyc_detail.last_acted_by = @admin_id\n @user_kyc_detail.last_acted_timestamp = Time.now.to_i\n @user_kyc_detail.save!\n\n log_activity\n\n success\n end", "def retire\n self.class.transaction do\n self.reagent_ids = []\n self.device_ownership_ids = []\n self.lab_id = nil\n self.department_id = nil\n self.institute_id = nil\n self.approved = false\n self.joined = nil\n end\n end", "def refresh\n Vedeu.trigger(\"_refresh_#{current}_\".to_sym)\n end", "def refresh\n Vedeu.trigger(:_refresh_, current)\n end", "def scan_and_wait(mod, resource, attempts)\n\t\t\t\tmethod = nil\n\t\t\t\tretries = attempts\n\n\t\t\t\tif mod.name == \"Uirusu::VTFile\"\n\t\t\t\t\tSTDERR.puts \"[*] Attempting to rescan #{resource}\" if @options['verbose']\n\t\t\t\t\tmethod = @options['rescan'] ? mod.method(:rescan_file) : mod.method(:scan_file)\n\t\t\t\telse\n\t\t\t\t\tSTDERR.puts \"[*] Attempting to upload file #{resource}\" if @options['verbose']\n\t\t\t\t\tmethod = mod.method :scan_url\n\t\t\t\tend\n\n\t\t\t\tbegin\n\t\t\t\t\tresult = method.call(@config['virustotal']['api-key'], resource)\n\t\t\t\trescue => e\n\t\t\t\t\tif @options['rescan']\n\t\t\t\t\t\tSTDERR.puts \"[!] An error has occurred with the rescan request. Retrying 60 seconds up #{retries} retries: #{e.message}\\n\" if @options['verbose']\n\t\t\t\t\telse\n\t\t\t\t\t\tSTDERR.puts \"[!] An error has occurred uploading the file. Retrying 60 seconds up #{retries} retries.\\n\" if @options['verbose']\n\t\t\t\t\tend\n\n\t\t\t\t\tif retries >= 0\n\t\t\t\t\t\tsleep 60\n\t\t\t\t\t\tretries = retries - 1\n\t\t\t\t\t\tretry\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tbegin\n\n\t\t\t\t\t# Convert all single result replies to an array. This is because\n\t\t\t\t\t# rescan_file returns an array of results if more than one hash\n\t\t\t\t\t# is requested to be rescanned.\n\t\t\t\t\tresult_array = result.is_a?(Array) ? result : [ result ]\n\n\t\t\t\t\tresult_array.collect do |r|\n\t\t\t\t\t\tif r['response_code'] == 1\n\t\t\t\t\t\t\tSTDERR.puts \"[*] Attempting to parse the results for: #{r['resource']}\" if @options['verbose']\n\t\t\t\t\t\t\tresults = mod.query_report(@config['virustotal']['api-key'], r['resource'])\n\n\t\t\t\t\t\t\twhile results['response_code'] != 1\n\t\t\t\t\t\t\t\tSTDERR.puts \"[*] File has not been analyized yet, waiting 60 seconds to try again\" if @options['verbose']\n\t\t\t\t\t\t\t\tsleep 60\n\t\t\t\t\t\t\t\tresults = mod.query_report(@config['virustotal']['api-key'], r['resource'])\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\treturn r['resource'], results\n\n\t\t\t\t\t\telsif r['response_code'] == 0 and @options['rescan']\n\t\t\t\t\t\t\tSTDERR.puts \"[!] Unknown Virustotal error for rescan of #{r['resource']}.\" if @options['verbose']\n\t\t\t\t\t\t\tnext\n\n\t\t\t\t\t\telsif r['response_code'] == -1 and @options['rescan']\n\t\t\t\t\t\t\tSTDERR.puts \"[!] Virustotal does not have a sample of #{r['resource']}.\" if @options['verbose']\n\t\t\t\t\t\t\tnext\n\n\t\t\t\t\t\telsif r['response_code'] == -2\n\t\t\t\t\t\t\tSTDERR.puts \"[!] Virustotal limits exceeded, ***do not edit the timeout values.***\"\n\t\t\t\t\t\t\texit(1)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tnil\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\trescue => e\n\t\t\t\t\tSTDERR.puts \"[!] An error has occurred retrieving the report. Retrying 60 seconds up #{retries} retries. #{e.message}\\n\" if @options['verbose']\n\t\t\t\t\tif retries >= 0\n\t\t\t\t\t\tsleep 60\n\t\t\t\t\t\tretries = retries - 1\n\t\t\t\t\t\tretry\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend", "def reset\r\n WimduCli.storage.reset\r\n puts \"\\nDone! All the previous registered information is gone.\\n\\n\"\r\n end", "def rebalance\n winning_block = @block_stacks.last.first\n parent_position = @block_stacks.count - 2\n\n while contested?(parent_position)\n # TODO: Is there's a smarter way to persistently select a winner than sorting the competition\n @block_stacks[parent_position].sort_by! do |previous_block|\n Assessment.valid_link?(previous_block, winning_block) ? 0 : 1\n end\n\n winning_block = @block_stacks[parent_position].first\n parent_position -= 1\n end\n end" ]
[ "0.5701263", "0.5534253", "0.5416664", "0.53749126", "0.5366809", "0.5316177", "0.5277727", "0.5277727", "0.52421373", "0.52363616", "0.5136468", "0.51326907", "0.51172715", "0.5090018", "0.5064164", "0.50536823", "0.50529176", "0.50422734", "0.50383496", "0.50149024", "0.5002913", "0.4998493", "0.4978807", "0.49771512", "0.4972786", "0.4972786", "0.49694824", "0.49606952", "0.49540043", "0.49248526", "0.49129084", "0.48931384", "0.48812708", "0.48779163", "0.48726103", "0.48652", "0.48636076", "0.48608527", "0.48570547", "0.48541272", "0.48448917", "0.48177686", "0.48062676", "0.47985038", "0.4776922", "0.47542968", "0.47430855", "0.47309962", "0.4729865", "0.47292477", "0.47274935", "0.47263545", "0.4719318", "0.47137007", "0.4706789", "0.47013542", "0.46996054", "0.46852136", "0.46850014", "0.46780005", "0.4674307", "0.4671882", "0.4669641", "0.46677566", "0.46674094", "0.4660106", "0.46510726", "0.46472114", "0.46383572", "0.46356052", "0.46327275", "0.46262717", "0.4625136", "0.4618647", "0.46164182", "0.46159866", "0.461471", "0.4614359", "0.4611254", "0.4610085", "0.46076667", "0.46040678", "0.4603406", "0.4602531", "0.4580826", "0.45802963", "0.45795187", "0.45780745", "0.45773908", "0.45694155", "0.4568312", "0.4565568", "0.45620844", "0.45592222", "0.45584023", "0.45544648", "0.45514452", "0.45450744", "0.45449826", "0.45385537" ]
0.72769284
0
Recovery wallet and accounts from root XPubs. All accounts and balances of bip44 multiaccount hierarchy for deterministic wallets can be restored via root xpubs.
def recovery_wallet(xpubs: []) client.make_request('/recovery-wallet', 'post', params: {xpubs: xpubs}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_derive_child_wallet\n addresses = []\n path = File.join(File.dirname(__FILE__), 'addresses.txt')\n File.open(path).read.each_line do |line|\n addresses << line.strip\n end\n xpub = \"xpub6EPbauBbH3SYLqJrdPAK8yQuyQDow7pY4HDV8SMezH3VVb5g5htLpMAb7gvFXVdXPRp6m2fYHc1J3bjurfbfRd2DuNZQ9rKKiKAPirbj3F7\"\n wallet = Bip44::Wallet.from_xpub(xpub)\n\n addresses.each_with_index do |address, i|\n sub_wallet = wallet.sub_wallet(\"M/#{i}\")\n assert_equal sub_wallet.ethereum_address, address\n end\n \n end", "def rescan_wallet\n client.make_request('/rescan-wallet', 'post', params: {})\n end", "def backup_wallet\n client.make_request('/backup-wallet', 'post', params: {})\n end", "def wallet_recover(id, seed, opts = {})\n data, _status_code, _headers = wallet_recover_with_http_info(id, seed, opts)\n data\n end", "def join(wallet, ledger: '/dev/null', baseline: false, master: false)\n if @id.nil?\n @id = wallet.id\n @key = wallet.key\n @network = wallet.network\n end\n unless wallet.network == @network\n @log.error(\"The wallet is from a different network '#{wallet.network}', ours is '#{@network}'\")\n return\n end\n unless wallet.key == @key\n @log.error('Public key mismatch')\n return\n end\n unless wallet.id == @id\n @log.error(\"Wallet ID mismatch, ours is #{@id}, theirs is #{wallet.id}\")\n return\n end\n seen = 0\n added = 0\n pulled = []\n wallet.txns.each do |txn|\n next if @txns.find { |t| t == txn }\n seen += 1\n if txn.amount.negative?\n dup = @txns.find { |t| t.id == txn.id && t.amount.negative? }\n if dup && !master\n @log.error(\"An attempt to overwrite existing transaction #{dup.to_text.inspect} \\\nwith a new one #{txn.to_text.inspect} from #{wallet.mnemo}\")\n next\n end\n if dup && master\n @log.debug(\"An overwrite to the existing transaction #{dup.to_text.inspect} \\\nis coming from a master node: #{txn.to_text.inspect} from #{wallet.mnemo}\")\n @txns.reject! { |t| t.id == txn.id && t.amount.negative? }\n end\n unless Signature.new(@network).valid?(@key, wallet.id, txn)\n @log.error(\"Invalid RSA signature at the transaction ##{txn.id} of #{wallet.id}: #{txn.to_text.inspect}\")\n next\n end\n else\n if Id::BANNED.include?(txn.bnf.to_s)\n @log.debug(\"The paying wallet is banned, #{wallet.id} can't accept this: #{txn.to_text.inspect}\")\n next\n end\n dup = @txns.find { |t| t.id == txn.id && t.bnf == txn.bnf && t.amount.positive? }\n if dup\n @log.error(\"Overwriting #{dup.to_text.inspect} with #{txn.to_text.inspect} \\\nfrom #{wallet.mnemo} (same ID/BNF)\")\n next\n end\n if !txn.sign.nil? && !txn.sign.empty?\n @log.error(\"RSA signature is redundant at ##{txn.id} of #{wallet.id}: #{txn.to_text.inspect}\")\n next\n end\n unless wallet.prefix?(txn.prefix)\n @log.debug(\"Payment prefix '#{txn.prefix}' doesn't match \\\nwith the key of #{wallet.id}: #{txn.to_text.inspect}\")\n next\n end\n unless @wallets.acq(txn.bnf, &:exists?)\n if baseline\n @log.debug(\"Paying wallet #{txn.bnf} is absent, \\\nbut the txn in in the baseline: #{txn.to_text.inspect}\")\n else\n next if pulled.include?(txn.bnf)\n pulled << txn.bnf\n if yield(txn) && !@wallets.acq(txn.bnf, &:exists?)\n @log.error(\"Paying wallet #{txn.bnf} file is absent even after PULL: #{txn.to_text.inspect}\")\n next\n end\n end\n end\n if @wallets.acq(txn.bnf, &:exists?) &&\n !@wallets.acq(txn.bnf) { |p| p.includes_negative?(txn.id, wallet.id) }\n if baseline\n @log.debug(\"The beneficiary #{@wallets.acq(txn.bnf, &:mnemo)} of #{@id} \\\ndoesn't have this transaction, but we trust it, since it's a baseline: #{txn.to_text.inspect}\")\n else\n if pulled.include?(txn.bnf)\n @log.debug(\"The beneficiary #{@wallets.acq(txn.bnf, &:mnemo)} of #{@id} \\\ndoesn't have this transaction: #{txn.to_text.inspect}\")\n next\n end\n pulled << txn.bnf\n yield(txn)\n unless @wallets.acq(txn.bnf) { |p| p.includes_negative?(txn.id, wallet.id) }\n @log.debug(\"The beneficiary #{@wallets.acq(txn.bnf, &:mnemo)} of #{@id} \\\ndoesn't have this transaction: #{txn.to_text.inspect}\")\n next\n end\n end\n end\n end\n @txns << txn\n added += 1\n next unless txn.amount.negative?\n File.open(ledger, 'a') do |f|\n f.puts(\n [\n Time.now.utc.iso8601,\n txn.id,\n txn.date.utc.iso8601,\n wallet.id,\n txn.bnf,\n txn.amount.to_i * -1,\n txn.prefix,\n txn.details\n ].map(&:to_s).join(';') + \"\\n\"\n )\n end\n end\n end", "def post_transaction_process\n bet_wallet.persist_wallet!\n end", "def archive_transactions_and_reset_wallet\n #add transaction so that both transaction updates need to be successful\n #or else everything does a rollback\n ActiveRecord::Base.transaction do\n #loop through all transactions that belong to this reservation \n #that are not archived\n transactions.get_unarchived.each do |transaction|\n #get diff in balance change\n diff = transaction.final_balance - transaction.original_balance\n\n #get concernable (user or restaurant) information\n concernable = transaction.concernable\n wallet = concernable.wallet\n balance = wallet.balance \n\n #reset concernable balance \n new_balance = wallet.balance - diff\n wallet.update(balance: new_balance)\n\n #archive transaction\n transaction.update(archived: true)\n end\n end\n end", "def restorepassword\n @shadow_location = \"#{@home}/etc/#{domain}\"\n @shadow = \"#{@shadow_location}/shadow\"\n @backup = \"#{@shadow_location}/#{@email_account_without_domain}.mailtool\"\n @backup_shadow_account = `grep -w #{@email_account_without_domain} #{@backup} 2>/dev/null`.chomp\n @current_shadow_account = `grep -w #{@email_account_without_domain} #{@shadow} 2>/dev/null`.chomp\n if File.exist?(\"#{@backup}\")\n @replace = `replace '#{@current_shadow_account}' '#{@backup_shadow_account}' -- #{@shadow}`\n puts 'Sucessfully restored the password' if @replace\n File.delete(\"#{@backup}\")\n else\n puts 'No password backup found'\n end\n end", "def save\n wallet.db.save_account(self)\n save_key(0, receive_depth, derive_key(0, receive_depth)) if receive_depth.zero?\n save_key(1, change_depth, derive_key(1, change_depth)) if change_depth.zero?\n end", "def private_reset!\n @balance = 0\n end", "def restore(account)\n # takes account as an arg\n memento = find account.id\n # uses the accounts id to find the relevant memento\n account.restore_state memento\n # calls the accounts restore method passing the memento as an arg\n end", "def xRestoreDump()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongorestore.bat')\n end", "def restore_admin4\n if File.exist?('/Library/Receipts/com.company.removedadmins') then\n users=read_admins\n users.each do |u|\n puts \"Restoring admin rights for #{u}\"\n %x(nicl -raw /var/db/netinfo/local.nidb -append /groups/admin users #{u})\n end\n else\n users=get_users\n users.each do |u|\n puts \"Restoring admin rights for #{u}\"\n %x(nicl -raw /var/db/netinfo/local.nidb -append /groups/admin users #{u})\n end\n end\nend", "def all_wallet_balances\n\t\ttotals = Hash.new {|h,uuid| h[uuid] = 0 }\n\t\ttotals[ GENESIS_WALLET ] = INITIAL_AMOUNT\n\n\t\tself.each_block do |block|\n\t\t\tblock.transactions.each do |tr|\n\t\t\t\ttotals[ tr[:to] ] += tr[:amount]\n\t\t\t\ttotals[ tr[:from] ] -= tr[:amount]\n\t\t\tend\n\t\tend\n\n\t\treturn totals.transform_values {|val| Money.new(val, :zmz) }\n\tend", "def unspents(wallet_id: default_wallet_id)\n call :get, '/wallet/' + wallet_id + '/unspents'\n end", "def recovery\n command = User::RecoveryCommand.new(params)\n run(command)\n end", "def refund_backers!\n self.class.transaction do\n Transaction.build do |tr|\n tr.description = \"Refund Fundraiser(#{id}) #{pledges_count} Pledges - Total Pledges: $#{total_pledged} Account Balance: $#{account_balance}\"\n\n # remove all money from the fundraiser account\n tr.splits.create(amount: -account_balance, item: self)\n\n # for each pledge, add a split adding money to person accounts\n pledges.find_each do |pledge|\n # get the amount to refund (pledge split where account is this fundraiser)\n if (split = pledge.splits.find_by_account_id(account.id))\n tr.splits.create(amount: split.amount, item: pledge.person)\n end\n end\n end\n end\n end", "def restore(opts = {})\n\t\tcheck_dir_access(backup_dir, false)\n\n\t\traise(ArgumentError, 'User list is empty') if users.empty?\n\n\t\trestores = []\n\n\t\tusers.each do |user|\n\t\t\tbegin\n\t\t\t\trestores << restore_account(user, opts)\n\t\t\trescue UserRestoreError => exc\n\t\t\t\tlogger.error \"[CPanelBackup] #{exc.message}. Trying next user.\"\n\t\t\tend\n\t\tend\n\n\t\trestores\n\tend", "def restore \n # pg_restore -c -U postgres -d dataslam -1 /tmp/out.dump\n begin\n check_if_db_exists\n is_allowed = @conn.exec(\"select datallowconn from pg_catalog.pg_database where datname='#{@options[:database]}'\")[0]['datallowconn']\n if is_allowed == 'f'\n # unquiece temporarily\n set_dataallowcon_to true\n end\n\n fn = get_latest_backup_fn\n\n if fn == \"\"\n raise NoBackupsAvailableException.new \"There are no backups available at the specified location or in the default location (/tmp/postgresbk)\"\n end\n\n # The below system call assumes you have passwordless access as the user passed into the executable tool\n # either due to ~/.pgpass or pg_hba.conf has your user as a 'trust' auth method\n `pg_restore -c -U #{@options[:user]} -d #{@options[:database]} -1 #{@options[:bkdir]}/#{fn}`\n\n rescue Exception => e\n raise e\n ensure\n if is_allowed == 'f'\n # re quiesce \n set_dataallowcon_to false\n end\n end\n end", "def backupwallet(destination)\n coind.backupwallet destination\n end", "def restore_wallet(account_image: {}, asset_image: {}, key_images: {})\n params = {\n account_image: account_image,\n asset_image: asset_image,\n key_images: key_images\n }\n client.make_request('/restore-wallet', 'post', params: params)\n end", "def restore_admin5\n if File.exist?('/Library/Receipts/com.company.removedadmins') then\n users=read_admins\n users.each do |u|\n puts \"Restoring admin rights for #{u}\" \n %x(/usr/sbin/dseditgroup -o edit -a #{u} -t user admin)\n end\n else\n users=get_users\n users.each do |u|\n puts \"Restoring admin rights for #{u}\"\n %x(/usr/sbin/dseditgroup -o edit -a #{u} -t user admin)\n end\n end\nend", "def confirm_withdrawals\n current_user.pretransactions.each do |p|\n withdraw_result = Operation.confirm_withdraw(p.transaction_id, p.user_id, p.user_pin, p.amount)\n # Cuando el retiro es exitoso, el webservice regresa un mensaje indicando el balance actual\n if withdraw_result.eql? \"Your current balance is now\"\n if Operation.create!(:to_user_id => p.user_id, \n :from_user_id => p.from_user,\n :op_type => \"withdraw\",\n :amount => p.amount, \n :after_balance => (current_user.points - p.amount),\n :description => p.description)\n update_user_points(p.user)\n update_user_points(User.find(p.from_user))\n p.destroy\n end\n end\n end\n end", "def restore(snapshot, signatures, validation_token = nil, relations = nil)\n @snapshot = snapshot\n @signatures = signatures\n @validation_token = validation_token\n @relations = relations\n model = JSON.parse(Crypto::Bytes.new(snapshot).to_s)\n restore_from_snapshot_model(model)\n end", "def recovery_keys\n return @recovery_keys\n end", "def reset_indecies\n puts 'Resetting AR indecies.'\n ApplicationRecord.connection.tables.each { |t| ApplicationRecord.connection.reset_pk_sequence!(t) }\n puts 'Restore complete'\n end", "def restore\n end", "def sub_account\n return @sub_account if @sub_account\n puts \"SIGNATURE \", signature.inspect\n Dir.chdir(@runner.root_folder) do\n external_account until (\n choices = nil\n Hash.phoenix('account_choices.rb'){|choices_hash| choices = choices_hash[signature]}\n #p [choices, data_line]\n choices\n ) and choices[:sub_account]\n @sub_account = choices[:sub_account]\n end\n end", "def backupwallet(destination)\n @api.request 'backupwallet', destination\n end", "def restore_checkpoint\n @api.send(\"world.checkpoint.restore()\")\n end", "def restore_files(paths, snapshot, all)\n #\n # Basic args\n #\n args = %w(rsync --archive --numeric-ids --inplace --relative --compress)\n\n #\n # Add on the I/O-timeout\n #\n args += ['--timeout', @io_timeout.to_s ] unless ( @io_timeout.nil? )\n args += ['--rsh', \"ssh -o BatchMode=yes -x -a -i #{@ssh_key} -l #{@destination_user}\"]\n args << '--verbose' if @verbose\n args += ['--rsync-path', \"byteback-restore --fake-super --snapshot #{snapshot}\" + (all ? \" --all\" : \"\")]\n\n #\n # To add extra rsync flags, a file can be used. This can have flags all on one line, or one per line.\n #\n if File.exists?(\"/etc/byteback/rsync_flags\")\n args += File.readlines(\"/etc/byteback/rsync_flags\").map(&:chomp)\n end\n\n dst = \"#{@destination_user}@#{@destination_host}:\"\n\n paths.each do |path|\n path = Byteback::Restore.encode_args(path).first\n args << File.join(dst,path)\n dst = \":\"\n end\n\n args << \".\"\n puts args.join(\" \") if @verbose\n system(*args)\nend", "def restore_command\n puts \"[+] Beginning restore...\"\n system \"sudo -u barman barman recover main latest /data/db/barmanrestored/\"\n $exit_status = $?.exitstatus\nend", "def backupwallet(destination)\n request(:backupwallet, destination)\n end", "def restore_ownership; end", "def restore_ownership; end", "def recover_ring(node)\n Result.new(call(CMD_RECOVER_RING % node))\n nil\n end", "def dump_root()\n self.dump_info(@evm.root, \"$evm.root\")\n end", "def restore_password\n user = User.where.not(change_password_hash: nil).take\n organization = user.organizations.take\n\n NotifierMailer.restore_password user, organization\n end", "def init_multisig_deposit_address(wallet, node_index)\n master = MultisigMoneyTree::Master.from_bip45(wallet[:bip45][:public])\n node = master.node_for(0, node_index)\n \n wallet[:addresses] = {} if wallet[:addresses].nil?\n wallet[:addresses][node_index] = {\n address: node.to_address(network: NETWORK)\n }\nend", "def accounts\n db.accounts.map do |raw|\n a = Account.parse_from_payload(raw)\n a.wallet = self\n a\n end\n end", "def recover!\n @session.chanserv.recover(self.name)\n end", "def recover_password params\n user = find_with_email(params[:email])\n user.send_recover_password\n end", "def reset_money\n @total_rat_money = 0\n\n set_kmuddy_variable(\"total_rat_money\", 0)\n\n @inventory_rats = 0\n\n set_kmuddy_variable(\"current_rat_count\", 0)\n send_kmuddy_command(\"put sovereigns in pack\")\n end", "def deposit_checking funds\n @balance_checking += funds\n @balance_total += funds\n rebalance\n puts \"#{funds} has been deposited. Your new balance is #{@balance_checking}\"\n self\n end", "def rebalance\n @root = build_tree(self.level_order_traversal) if !self.balanced?\n end", "def recover_password\n person = Person.find_by_email(params[:email])\n\n if person\n UserMailer.recovery(:key => CryptoHelper.encrypt(\"#{person.id}:#{person.salt}\"),\n :email => person.email,\n :username => person.username,\n :domain => APP_CONFIG.server_domain).deliver\n render_json :messages => \"Recovery mail sent to specified address.\", :status => :ok and return\n else\n render_json :messages => \"Record not found.\", :status => :not_found and return\n end\n\n end", "def restore\n RESTORE\n end", "def test_unallocated_balance\n kwhite17 = members(:kwhite17)\n tank = members(:tank)\n group_purchase2 = group_purchases(:two)\n\n assert_equal group_purchase2.unallocated_balance, group_purchase2.balance, \"No invoices added test\"\n \n invoice1 = invoices(:one)\n invoice1.debtor = kwhite17\n invoice1.group_purchase = group_purchase2\n invoice1.save\n group_purchase2.invoices << invoice1\n group_purchase2.save\n\n assert_equal group_purchase2.unallocated_balance, group_purchase2.balance - invoice1.balance, \"One invoice unallocated balance\"\n\n invoice2 = invoices(:two)\n invoice2.debtor = tank\n invoice2.group_purchase = group_purchase2\n invoice2.save\n group_purchase2.invoices << invoice2\n group_purchase2.save\n\n assert_equal group_purchase2.unallocated_balance, group_purchase2.balance - invoice1.balance - invoice2.balance, \"Test multiple invoices balances correct\"\n\n end", "def fetch_wallet_name(public_key)\n result = rpc.call('wallet_by_key_api.get_key_references', { 'keys' => [keys['recovery_public']] })\n result&.fetch('wallets', [])&.first&.first\nend", "def sync_balance\n begin\n synced_balance = BigDecimal.new(ripple_client.xrp_balance)\n update balance: synced_balance, validated: true\n rescue => e\n nil # raise custom error here\n end\n end", "def restore; end", "def wRestoreDump()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongorestore.bat')\n end", "def repack_pallet(req_amount = nil)\n #delete all the cartons, currently belonging to the pallet and create the\n #repacked cartons- each carton getting it's state from the representative\n #carton of the group, or if not specified from the main representative carton\n calc_amounts(req_amount) if req_amount\n new_pallet = nil\n @pallet.transaction do\n #---------------------------------------------------------------------------------\n #Set pallet and cartons' qc_status to 'UNINSPECTED' and result to nil\n #---------------------------------------------------------------------------------\n self.fg_carton.qc_status_code = \"UNINSPECTED\"\n self.fg_carton.qc_result_status = nil #fg carton's values will be propagated to all cartons on repacked pallet\n @pallet.qc_status_code = \"UNINSPECTED\"\n @pallet.qc_result_status = nil\n \n now = Time.now.to_formatted_s(:db)\n RwReceiptCarton.update_all(ActiveRecord::Base.extend_set_sql_with_request(\"alt_packed_datetime = '#{now}'\",\"rw_receipt_cartons\"),\"pallet_id = '#{@pallet.rw_receipt_pallet.id}' and rw_run_id = '#{@pallet.rw_receipt_pallet.rw_run_id}'\")\n override_reason = nil\n if !self.use_new_pallet\n @pallet.rw_receipt_pallet.alt_packed_datetime = now\n @pallet.carton_quantity_actual = req_amount\n self.fg_carton.update_pallet(@pallet)\n @pallet.reworks_action = \"ALT_PACKED\"\n @pallet.carton_quantity_actual = req_amount\n @pallet.update\n else\n #@pallet.rw_receipt_pallet.alt_packed_detroyed_datetime = now\n new_pallet = RwActivePallet.find(self.rw_pallet_id)\n new_pallet.pallet_format_product_code = @pallet.pallet_format_product_code\n new_pallet.pallet_format_product_id = @pallet.pallet_format_product_id\n new_pallet.carton_quantity_actual = req_amount\n new_pallet.rw_receipt_pallet_id = nil\n new_pallet.update\n end\n \n @pallet.rw_receipt_pallet.update\n RwActiveCarton.delete_all(\"rw_active_pallet_id = '#{@pallet.id}' and rw_run_id = '#{@pallet.rw_run_id}'\")\n \n @puc_groups.each do |run_code,puc_group|\n #-----------------------\n #delete original cartons\n #-----------------------\n puts \"NEW GROUP\"\n #--------------------------------------------------------------------------------------------------------\n #Create the required amount of new cartons- all copies from the clone, but with a different carton number\n #--------------------------------------------------------------------------------------------------------\n #new_sequence = MesControlFile.next_seq(1)\n req_amount = puc_group[:req_amount] if puc_group[:req_amount]\n if puc_group[:overridden_amount]\n req_amount = puc_group[:overridden_amount] \n if !override_reason\n override_reason = RwAltPackOverride.new \n override_reason.reason = self.override_reason\n override_reason.user = self.user.user_name\n override_reason.person = self.user.last_name + \",\" + self.user.first_name\n override_reason.amounts = run_code + \":[old = \" + puc_group[:req_amount].to_s + \"|new = \" + puc_group[:overridden_amount].to_s + \"]\"\n override_reason.rw_receipt_pallet = @pallet.rw_receipt_pallet\n #@pallet.rw_receipt_pallet.rw_alt_pack_override = override_reason\n #@pallet.rw_receipt_pallet.update\n else\n override_reason.amounts += \",\" + run_code + \":[old = \" + puc_group[:req_amount].to_s + \"|new = \" + puc_group[:overridden_amount].to_s + \"]\"\n end \n end\n \n begin\n #raise \" Group \" + run_code + \" has zero cartons. Every group must have at least one carton\" if req_amount == 0\n req_amount = 1 if req_amount == 0\n num_series = RwRun.get_object_nums(\"CARTON\",req_amount)\n rescue\n raise \"New carton numbers could not be obtained. The following exception was reported: \" + $!\n end\n \n for i in 1..req_amount\n new_sequence = num_series[i -1]#MesControlFile.next_seq(1)\n new_carton = RwActiveCarton.new \n \n if puc_group[:representative_carton]\n puc_group[:representative_carton].export_attributes(new_carton,true,[\"carton_number\"])\n else\n # conditions = \"rw_active_pallet_id = #{@pallet.id} and rw_run_id = #{@pallet.rw_run_id} and production_run_code = '#{run_code}'\"# (@pallet.id,@pallet.rw_run_id,run_code)\n # group_repr_carton = RwActiveCarton.find(:all,:conditions => \"rw_active_pallet_id = '#{@pallet.id.to_s}' and rw_run_id = '#{@pallet.rw_run_id.to_s}' and production_run_id = '#{puc_group[:run_id].to_s}'\")\n \n group_repr_carton = puc_group[:cartons][0]\n self.fg_carton.export_attributes(new_carton,true,[\"carton_number\",\"production_run_code\",\"farm_code\",\"puc\",\"track_indicator_code\",\"production_run_id\",\"bin_id\",\"line_code\",])\n new_carton.production_run_code = group_repr_carton.production_run_code\n new_carton.production_run_id = group_repr_carton.production_run_id\n new_carton.line_code = group_repr_carton.line_code\n new_carton.track_indicator_code = group_repr_carton.track_indicator_code\n new_carton.puc = group_repr_carton.puc\n new_carton.farm_code = group_repr_carton.farm_code\n new_carton.bin_id = group_repr_carton.bin_id\n end\n set_carton_fg_data(new_carton)#this will copy (and overwrite) all fg related data from the main 'fg_carton' for pallet\n new_carton.reworks_action = \"alt_packed\"\n new_carton.rw_receipt_carton_id = nil\n new_carton.rw_active_pallet_id = self.rw_pallet_id if self.use_new_pallet\n new_carton.pallet_number = new_pallet.pallet_number if self.use_new_pallet\n new_carton.carton_number = new_sequence\n new_carton.packer_number = \"00241\" \n new_carton.create\n \n end\n puc_group[:cartons]= nil\n end\n override_reason.create if override_reason\n self.pallet.destroy if self.use_new_pallet\n \n end\n \n end", "def listaccounts\n return {} unless node.wallet\n accounts = {}\n node.wallet.accounts.each do |a|\n accounts[a.name] = node.wallet.get_balance(a)\n end\n accounts\n end", "def update_stx(payments, stx_info, pubkey_payer, pubkey_payee)\n\n # update the balance after payment.\n for payment_type_hash in payments.keys()\n for index in (0..stx_info[:outputs].length - 1)\n @logger.info(\"update_stx: begin.\")\n output = stx_info[:outputs][index]\n output_data = stx_info[:outputs_data][index]\n @logger.info(\"update_stx: output: #{output}, output_data: #{output_data}\")\n type = find_type(payment_type_hash)\n amount = payments[payment_type_hash]\n if payment_type_hash == \"\"\n @logger.info(\"update_stx: ckb branch.\")\n return (output.capacity - output.calculate_min_capacity(output_data)) - amount if output.capacity - amount < output.calculate_min_capacity(output_data) && output.lock.args == pubkey_payer\n return (output.capacity - output.calculate_min_capacity(output_data)) + amount if output.capacity + amount < output.calculate_min_capacity(output_data) && output.lock.args == pubkey_payee\n stx_info[:outputs][index].capacity = output.capacity - amount if output.lock.args == pubkey_payer\n stx_info[:outputs][index].capacity = output.capacity + amount if output.lock.args == pubkey_payee\n elsif payment_type_hash == @udt_type_script_hash\n @logger.info(\"update_stx: udt branch.\")\n return type[:decoder].call(output_data) - amount if type[:decoder].call(output_data) - amount < 0 && output.lock.args == pubkey_payer\n return type[:decoder].call(output_data) + amount if type[:decoder].call(output_data) + amount < 0 && output.lock.args == pubkey_payee\n stx_info[:outputs_data][index] = type[:encoder].call(type[:decoder].call(output_data) - amount) if output.lock.args == pubkey_payer\n stx_info[:outputs_data][index] = type[:encoder].call(type[:decoder].call(output_data) + amount) if output.lock.args == pubkey_payee\n else\n return \"not support\"\n end\n end\n end\n\n witness_new = Array.new()\n for witness in stx_info[:witnesses]\n witness = parse_witness(witness)\n lock = parse_witness_lock(witness.lock)\n witness_new << generate_empty_witness(lock[:id], lock[:flag], lock[:nounce] + 1, witness.input_type, witness.output_type)\n end\n\n stx_info[:witnesses] = witness_new\n\n return stx_info\n end", "def check_balance\n\t\tsystem('clear')\n\t\tcheck_balance_display\n menu\n\tend", "def fetch_remote_invoice_wallets\n Zoldy.app.remotes_store.all.each do |r|\n fetch_invoice r\n end\n end", "def restore\n db = resolve_db(:allow_default => true)\n to_name = db[:name]\n to_url = db[:url]\n\n backup_id = args.shift\n\n if backup_id =~ /^http(s?):\\/\\//\n from_url = backup_id\n from_name = \"EXTERNAL_BACKUP\"\n from_uri = URI.parse backup_id\n backup_id = from_uri.path.empty? ? from_uri : File.basename(from_uri.path)\n else\n if backup_id\n backup = pgbackup_client.get_backup(backup_id)\n abort(\"Backup #{backup_id} already deleted.\") if backup[\"destroyed_at\"]\n else\n backup = pgbackup_client.get_latest_backup\n to_uri = URI.parse backup[\"to_url\"]\n backup_id = File.basename(to_uri.path, '.*')\n backup_id = \"#{backup_id} (most recent)\"\n end\n\n from_url = backup[\"to_url\"]\n from_name = \"BACKUP\"\n end\n\n message = \"#{db[:pretty_name]} <---restore--- \"\n padding = \" \" * message.length\n display \"\\n#{message}#{backup_id}\"\n if backup\n display padding + \"#{backup['from_name']}\"\n display padding + \"#{backup['created_at']}\"\n display padding + \"#{backup['size']}\"\n end\n\n if confirm_command\n restore = transfer!(from_url, from_name, to_url, to_name)\n restore = poll_transfer!(restore)\n\n if restore[\"error_at\"]\n message = \" ! An error occurred and your restore did not finish.\"\n message += \"\\n ! The backup url is invalid. Use `pgbackups:url` to generate a new temporary URL.\" if restore['log'] =~ /Invalid dump format: .*: XML document text/\n abort(message)\n end\n end\n end", "def reset_transactions\n @transactions_remaining = MAX_TRANSACTIONS\n end", "def reset_account\n @current_account = @options[:brightbox_account]\n end", "def FindRootPartitions\n return if @didSearchForRootPartitions\n\n ModuleLoading.Load(\n \"reiserfs\",\n \"\",\n \"Linux\",\n \"Reiser FS\",\n Linuxrc.manual,\n true\n )\n ModuleLoading.Load(\"jfs\", \"\", \"Linux\", \"JFS\", Linuxrc.manual, true)\n ModuleLoading.Load(\"xfs\", \"\", \"Linux\", \"XFS\", Linuxrc.manual, true)\n ModuleLoading.Load(\"ext3\", \"\", \"Linux\", \"Ext3\", Linuxrc.manual, true)\n ModuleLoading.Load(\"ext4\", \"\", \"Linux\", \"Ext4\", Linuxrc.manual, true)\n ModuleLoading.Load(\"btrfs\", \"\", \"Linux\", \"BtrFS\", Linuxrc.manual, true)\n ModuleLoading.Load(\"raid0\", \"\", \"Linux\", \"Raid 0\", Linuxrc.manual, true)\n ModuleLoading.Load(\"raid1\", \"\", \"Linux\", \"Raid 1\", Linuxrc.manual, true)\n ModuleLoading.Load(\"raid5\", \"\", \"Linux\", \"Raid 5\", Linuxrc.manual, true)\n ModuleLoading.Load(\"raid6\", \"\", \"Linux\", \"Raid 6\", Linuxrc.manual, true)\n ModuleLoading.Load(\"raid10\", \"\", \"Linux\", \"Raid 10\", Linuxrc.manual, true)\n ModuleLoading.Load(\n \"multipath\",\n \"\",\n \"Linux\",\n \"Multipath\",\n Linuxrc.manual,\n true\n )\n ModuleLoading.Load(\"dm-mod\", \"\", \"Linux\", \"DM\", Linuxrc.manual, true)\n SCR.Execute(path(\".target.bash\"), \"/sbin/devmap_mknod.sh\")\n ModuleLoading.Load(\"dm-snapshot\", \"\", \"Linux\", \"DM\", Linuxrc.manual, true)\n\n if Mode.test\n Storage.SetTargetMap(\n Convert.convert(\n SCR.Read(path(\".target.yast2\"), \"test_target_map.ycp\"),\n :from => \"any\",\n :to => \"map <string, map>\"\n )\n )\n end\n\n #\tStorage::ActivateEvms();\n target_map = Storage.GetOndiskTarget\n Builtins.y2milestone(\"target_map: %1\", target_map)\n\n # prepare progress-bar\n if UI.WidgetExists(Id(\"search_progress\"))\n UI.ReplaceWidget(\n Id(\"search_progress\"),\n ProgressBar(\n Id(\"search_pb\"),\n _(\"Evaluating root partition. One moment please...\"),\n 100,\n 0\n )\n )\n end\n\n @rootPartitions = {}\n @numberOfValidRootPartitions = 0\n\n # all partitions on all devices\n max_steps = 0\n Builtins.foreach(target_map) do |device, description|\n max_steps = Ops.add(\n max_steps,\n Builtins.size(Ops.get_list(description, \"partitions\", []))\n )\n end\n\n counter = 0\n Builtins.foreach(target_map) do |device, description|\n Builtins.foreach(Ops.get_list(description, \"partitions\", [])) do |partition|\n counter = Ops.add(counter, 1)\n if UI.WidgetExists(Id(\"search_progress\"))\n UI.ChangeWidget(\n Id(\"search_pb\"),\n :Value,\n Ops.divide(Ops.multiply(100, counter), max_steps)\n )\n end\n # some partitions don't make sense at all\n if Ops.get_symbol(partition, \"detected_fs\", :unknown) != :swap &&\n Ops.get_symbol(partition, \"type\", :primary) != :extended\n freshman = {}\n\n if Mode.test\n freshman = {\n :valid => true,\n :name => \"SuSE Linux 4.2\",\n :arch => \"i286\",\n :label => \"Label\"\n }\n else\n freshman = CheckPartition(partition)\n end\n\n @rootPartitions = Builtins.add(\n @rootPartitions,\n Ops.get_string(partition, \"device\", \"error\"),\n freshman\n )\n\n if Ops.get_boolean(freshman, :valid, false)\n @numberOfValidRootPartitions = Ops.add(\n @numberOfValidRootPartitions,\n 1\n )\n end\n end\n end\n end\n\n # 100%\n if UI.WidgetExists(Id(\"search_progress\"))\n UI.ChangeWidget(Id(\"search_pb\"), :Value, 100)\n end\n\n @didSearchForRootPartitions = true\n\n Builtins.y2milestone(\"rootPartitions: %1\", @rootPartitions)\n\n nil\n end", "def execute_backup_stripe(options={})\n @disk.sync\n\n# Ensure filesystem is frozen and uses retry\n raise \"FATAL: unable to freeze lvm filesystem!\" unless @disk.freeze\n\n create_opts = {\n :lineage => options[:lineage],\n :prefix_override => options[:lineage], #Make sure we use the volume_nickname \"lineage\" as the prefix for our snaps (even if the volume has a different, perhaps more descriptive name)\n :description => \"Snapshot created by RightScale DB tools on instance #{ENV['EC2_INSTANCE_ID']}.\",\n :max_snaps => options[:max_snapshots],\n :keep_dailies => options[:keep_dailies],\n :keep_weeklies => options[:keep_weeklies],\n :keep_monthlies => options[:keep_monthlies],\n :keep_yearlies => options[:keep_yearlies],\n :devices => options[:devices].join(\",\")\n }\n create_opts[:suffix] = options[:suffix] if options[:suffix]\n\n # TODO: retry on the http requests? sounds like a good idea to me\n result = self.create_ebs_backup(create_opts)\n raise \"FATAL: unable to create snapshots!\" if result.nil?\n aws_ids = result['aws_ids']\n raise \"FATAL: result not recognized #{result}\" unless aws_ids.is_a?(Array)\n\n# Ensure filesystem is unfrozen and uses retry\n raise \"FATAL: could not unfreeze filesystem!\" unless @disk.unfreeze\n\n aws_ids.each do |snap|\n # TODO: does this http call need to be retried also? \n self.update_snapshot(snap, \"committed\")\n end\n\n # e) - Perform snapshot cleanup\n lst = self.cleanup_snapshots_stripe(options[:cleanup_prefix],{:keep_last => options[:max_snapshots], :dailies => options[:keep_dailies], :weeklies => options[:keep_weeklies], :monthlies => options[:keep_monthlies], :yearlies => options[:keep_yearlies]})\n puts \"Cleanup resulted in deleting #{lst.length} snapshots : #{lst.inspect}\"\n \n end", "def rebalance!\n # Short-circut if already balanced.\n return @root if balanced?\n\n @root = build_tree(inorder)\n end", "def restore_archive\n end", "def execute_restore_stripe(options={})\n new_vol_name = \"#{options[:lineage]}-#{ENV['EC2_INSTANCE_ID']}\"\n json_result = self.find_latest_ebs_backup(options[:lineage], options[:from_master], options[:timestamp])\n\n if json_result.nil? \n STDERR.puts \"No existing snapshot found for the specified nickname lineage. Aborting...\"\n exit(-1)\n end\n STDERR.puts \"Restoring.. #{json_result.inspect}\"\n options[:new_size_gb] = (options[:new_volume_size_in_gb] / json_result.size.to_f).ceil if options[:new_volume_size_in_gb]\n\n @disk.sync\n @disk.umount\n @disk.disable_volume\n\n self.execute_terminate_volumes if options[:force]\n\n json_result.each do |snapshot|\n \n# create volume from snap\n create_result = ( options[:new_size_gb] ? create_volume_from_snap_size_gb(snapshot[\"aws_id\"],new_vol_name,options[:new_size_gb] ) : create_volume_from_snap(snapshot[\"aws_id\"], new_vol_name ) )\n raise \"FATAL: error occured in create_volume_from_snap(#{snapshot['aws_id']}, #{new_vol_name})\" if create_result.nil?\n\n# attach volume to instance\n retry_seconds = 0\n while retry_seconds < 200\n begin \n attach_result = attach_volume(create_result['aws_id'], snapshot['device'])\n raise \"FATAL: error occured in attach_volume(#{create_result['aws_id']}, #{snapshot['device']}\" if attach_result.nil?\n break if attach_result\n rescue => e\n puts \"CAUGHT EXCEPTION in execute_restore_stripe. Device attachment. #{e}, Retrying #{retry_seconds} of 200 seconds\"\n retry_seconds += 30\n sleep 30 \n end\n end\n raise \"FATAL: error occured in attach_volume(#{create_result['aws_id']}, #{snapshot['device']}\" if attach_result.nil?\n end\n\n# wait for devices to attach, after completing ALL the api calls\n json_result.each { |s| wait_for_attachment(s['device']) }\n @disk.enable_volume\n raise \"FATAL: mount failed!\" unless @disk.mount\n @disk.write_fstab\n# TODO - grow the filesystem if a new size was given\n end", "def recovery_key_transformation(recoverykey)\n # recovery key stretching phase 1\n recovery_intermediate = recoverykey.split('-').map(&:to_i)\n recovery_intermediate.each do |n|\n n % 11 != 0 && (fail ArgumentError, 'Invalid recovery key')\n end\n recovery_intermediate =\n recovery_intermediate.map { |a| (a / 11) }.pack('v*')\n\n # recovery key stretching phase 2\n recovery_keys = []\n cpu = Metasm.const_get('Ia32').new\n exe = Metasm.const_get('Shellcode').new(cpu)\n cp = Metasm::C::Parser.new(exe)\n bitlocker_struct_src = <<-EOS\n typedef struct {\n unsigned char updated_hash[32];\n unsigned char password_hash[32];\n unsigned char salt[16];\n unsigned long long int hash_count;\n } bitlocker_chain_hash_t;\n EOS\n cp.parse bitlocker_struct_src\n btl_struct = Metasm::C::AllocCStruct.new(cp, cp.find_c_struct(\n 'bitlocker_chain_hash_t'))\n vmk_protected_by_recovery_key = @vmk_entries_hash[\n PROTECTION_RECOVERY_PASSWORD]\n if vmk_protected_by_recovery_key.nil?\n fail ArgumentError, 'No recovery key on disk'\n end\n vmk_protected_by_recovery_key.each do |vmk_encrypted|\n vmk_encrypted_raw = vmk_encrypted[ENTRY_TYPE_NONE][\n VALUE_TYPE_STRETCH_KEY][0]\n stretch_key_salt = vmk_encrypted_raw[4, 16]\n strcpy(Digest::SHA256.digest(recovery_intermediate),\n btl_struct.password_hash)\n strcpy(stretch_key_salt, btl_struct.salt)\n btl_struct.hash_count = 0\n sha256 = Digest::SHA256.new\n btl_struct_raw = btl_struct.str\n btl_struct_hash_count_offset = btl_struct.struct.fldoffset[\n 'hash_count']\n (1..0x100000).each do |c|\n updated_hash = sha256.digest(btl_struct_raw)\n btl_struct_raw = updated_hash + btl_struct_raw \\\n [btl_struct.updated_hash.sizeof..(\n btl_struct_hash_count_offset - 1)] + [c].pack('Q')\n sha256.reset\n end\n recovery_keys += [btl_struct_raw[btl_struct.updated_hash.stroff,\n btl_struct.updated_hash.sizeof]]\n end\n recovery_keys\n end", "def give_back_money\n if(@transaction.sender)\n @transaction.sender.balance += @transaction.amount\n @transaction.sender.save\n \n end\n\n if(@transaction.receiver)\n @transaction.receiver.balance -= Monetize.parse(convert(Money.new(@transaction.amount,findCurrency(@transaction.sender_id,@transaction.receiver_id,'sent')), @transaction.receiver.currency)).fractional\n @transaction.receiver.save\n end\n end", "def load_deposit!(txid)\n method_not_implemented\n end", "def account_restored(user, project = nil)\n setup_email(user)\n @subject += head_encode((project ? project.login : 'Your account'.t) + \" has been restored to the Kroogi Network\".t)\n @body[:user] = user\n @body[:project] = project\n end", "def after_recover\n end", "def roots_of(dump, root_dump: nil)\n if root_dump && root_dump.empty?\n raise ArgumentError, \"no roots provided\"\n end\n\n root_addresses =\n if root_dump then root_dump.addresses\n else\n ['ALL_ROOTS']\n end\n\n ensure_graphs_computed\n\n result_nodes = Set.new\n dump_addresses = dump.addresses\n root_addresses.each do |root_address|\n visitor = RGL::DijkstraVisitor.new(@forward_graph)\n dijkstra = RGL::DijkstraAlgorithm.new(@forward_graph, Hash.new(1), visitor)\n dijkstra.find_shortest_paths(root_address)\n path_builder = RGL::PathBuilder.new(root_address, visitor.parents_map)\n\n dump_addresses.each_with_index do |record_address, record_i|\n if path = path_builder.path(record_address)\n result_nodes.merge(path)\n end\n end\n end\n\n find_and_map do |record|\n address = record['address']\n next if !result_nodes.include?(address)\n\n # Prefer records in 'dump' to allow for annotations in the\n # source\n record = dump.find_by_address(address) || record\n record = record.dup\n record['references'] = result_nodes & record['references']\n record\n end\n end", "def generate_keys(from_wallet_name, master_key)\n ks = { 'master' => master_key }\n %w(recovery money social memo).each do |role|\n private_key = Xgt::Ruby::Auth.generate_wif(from_wallet_name, master_key, 'recovery')\n public_key = Xgt::Ruby::Auth.wif_to_public_key(private_key, @address_prefix)\n ks[\"#{role}_private\"] = private_key\n ks[\"#{role}_public\"] = public_key\n end\n ks['wallet_name'] = Xgt::Ruby::Auth.generate_wallet_name(ks['recovery_public'])\n ks\nend", "def payout!\n ApplicationRecord.transaction do\n # rollback if no pledges to payout\n raise ActiveRecord::Rollback if pledges.unpaid.empty?\n\n transaction = Transaction::InternalTransfer::FundraiserCashOut.create!(\n description: \"Payout Fundraiser(#{id}): Account Balance: $#{account_balance}\",\n audited: true\n )\n total = account_balance\n transaction.splits.create!(amount: -total, item: self)\n transaction.splits.create!(amount: total, item: person)\n\n # update all of the pledges with rewards that have a merch fee, so that we do not charge twice for merchandise\n # if/when paid out again when it closes.\n pledges.unpaid.update_all status: Pledge::Status::PAID\n end\n end", "def reset_nodes\n # get all nodes for the active game\n self.nodes.update_all(:game_id => nil) \n # reset ownership for all nodes\n end", "def unconfigure_ks_pxe_client(options)\n options['mac'] = get_install_mac(options)\n if not options['mac']\n handle_output(options,\"Warning:\\tNo MAC Address entry found for #{options['name']}\")\n quit(options)\n end\n if options['biostype'].to_s.match(/efi/)\n tmp_cfg_octs = options['ip'].split(\".\")\n pxe_cfg_octs = [] \n tmp_cfg_octs.each do |octet|\n hextet = octet.convert_base(10, 16)\n if hextet.length < 2\n hextet = \"0\"+hextet\n end\n pxe_cfg_octs.push(hextet.upcase) \n end\n pxe_cfg_txt = pxe_cfg_octs.join\n pxe_cfg_file = \"grub.cfg-\"+pxe_cfg_txt\n pxe_cfg_dir = options['tftpdir']+\"/grub\"\n check_dir_exists(options,pxe_cfg_dir)\n check_dir_owner(options,pxe_cfg_dir,options['uid'])\n pxe_cfg_file = pxe_cfg_dir+\"/\"+pxe_cfg_file\n pxe_cfg_file = pxe_cfg_dir+\"/\"+pxe_cfg_file\n tftp_pxe_file = pxe_cfg_file\n else\n tftp_pxe_file = options['mac'].gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxelinux\"\n tftp_pxe_file = options['tftpdir']+\"/\"+tftp_pxe_file\n end\n if File.exist?(tftp_pxe_file)\n check_file_owner(options,ttftp_pxe_file,options['uid'])\n message = \"Information:\\tRemoving PXE boot file \"+tftp_pxe_file+\" for \"+options['name']\n command = \"rm #{tftp_pxe_file}\"\n output = execute_command(options,message,command)\n end\n pxe_cfg_dir = options['tftpdir']+\"/pxelinux.cfg\"\n pxe_cfg_file = options['mac'].gsub(/:/,\"-\")\n pxe_cfg_file = \"01-\"+pxe_cfg_file\n pxe_cfg_file = pxe_cfg_file.downcase\n pxe_cfg_file = pxe_cfg_dir+\"/\"+pxe_cfg_file\n if File.exist?(pxe_cfg_file)\n message = \"Information:\\tRemoving PXE boot config file \"+pxe_cfg_file+\" for \"+options['name']\n command = \"rm #{pxe_cfg_file}\"\n output = execute_command(options,message,command)\n if options['biostype'].to_s.match(/efi/)\n grub_file = pxe_cfg_dir+\"/grub.cfg\"\n grub_file = File.open(grub_file, \"w\")\n file_list = Dir.entries(pxe_cfg_dir)\n file_list.each do |file_name|\n if file_name.match(/cfg\\-/)\n temp_file = pxe_cfg_dir+\"/\"+file_name\n temp_array = File.readlines(temp_file)\n temp_array.each do |temp_line|\n grub_file.write(temp_line)\n end\n end\n end\n grub_file.close\n end\n end\n unconfigure_ks_dhcp_client(options)\n return\nend", "def before_recover\n end", "def handle_create_tx keys, recipients, fee = 0\n keystore = Bitcoin::Wallet::SimpleKeyStore.new(file: StringIO.new(\"[]\"))\n keys.each do |k|\n begin\n key = Bitcoin::Key.from_base58(k)\n key = { addr: key.addr, key: key }\n rescue\n if Bitcoin.valid_address?(k)\n key = { addr: k }\n else\n begin\n key = Bitcoin::Key.new(nil, k)\n key = { addr: key.addr, key: key }\n rescue\n return { error: \"Input not valid address, pub- or privkey: #{k}\" }\n end\n end\n end\n keystore.add_key(key)\n end\n wallet = Bitcoin::Wallet::Wallet.new(@node.store, keystore)\n tx = wallet.new_tx(recipients.map {|r| [:address, r[0], r[1]]}, fee)\n return { error: \"Error creating tx.\" } unless tx\n [ tx.to_payload.hth, tx.in.map {|i| [i.sig_hash.hth, i.sig_address] rescue nil } ]\n rescue\n { error: \"Error creating tx: #{$!.message}\" }\n end", "def test_seed_refund_no_adj\n data = {}\n data[:name] = 'Jean-Baptiste Poquelin'\n data[:external_key] = 'jeanpoquelin'\n data[:email] = 'jeanpoquelin@kb.com'\n data[:currency] = 'EUR'\n data[:time_zone] = 'Europe/Paris'\n data[:address1] = '17, rue Saint-Honore'\n data[:address2] = nil\n data[:postal_code] = '75000'\n data[:company] = nil\n data[:city] = 'Paris'\n data[:state] = 'Region Parisienne'\n data[:country] = 'France'\n data[:locale] = 'fr_FR'\n\n @jeanpoquelin = create_account_with_data(@user, data, @options)\n add_payment_method(@jeanpoquelin.account_id, '__EXTERNAL_PAYMENT__', true, nil, @user, @options)\n\n base1 = create_entitlement_base(@jeanpoquelin.account_id, 'reserved-metal', 'MONTHLY', 'DEFAULT', @user, @options)\n wait_for_expected_clause(1, @jeanpoquelin, @options, &@proc_account_invoices_nb)\n\n # Second invoice\n kb_clock_add_days(31, nil, @options) # 2015-09-01\n wait_for_expected_clause(2, @jeanpoquelin, @options, &@proc_account_invoices_nb)\n\n kb_clock_add_days(1, nil, @options) # 2015-09-02\n\n base1.cancel(@user, nil, nil, nil, 'IMMEDIATE', 'END_OF_TERM', nil, @options)\n\n payments = get_payments_for_account(@jeanpoquelin.account_id, @options)\n\n refund(payments[1].payment_id, payments[1].purchased_amount, nil, @user, @options)\n end", "def backup account\n backup_file File.join(@ssh_home, @ssh_id), File.join(@ssh_home, account + \".identity\")\n backup_file File.join(@ssh_home, @ssh_id + \".pub\"), File.join(@ssh_home, account + \".identity.pub\")\n @shell.say \"SSH identity backed up to account: #{account}.\"\n end", "def restore_exports_states\n logger.debug 'Restoring exports states.'\n\n changes_made = 0\n known_disks = VirtualDisk.all\n\n known_disks.each do |disk|\n if !StorageNode.volume_exists?(disk.disk_number)\n logger.info 'volume for disk number %d does not exist, removing from database' % [disk.disk_number]\n state = VirtualDiskState.find_by_disk_number(disk.disk_number)\n state.delete if state\n disk.delete\n else\n state = VirtualDiskState.find_by_disk_number(disk.disk_number)\n export_is_up = StorageNode.is_exported?(disk.disk_number)\n\n if state.nil?\n logger.info 'adding state record for virtual disk %d: %s' % [disk.disk_number, export_is_up]\n state = VirtualDiskState.new(disk.disk_number, export_is_up)\n state.save('discovered')\n next\n end\n\n export_should_be_up = state.is_up == true\n\n if export_should_be_up && !export_is_up\n logger.info \"bringing up export #{disk.disk_number}\"\n StorageNode.add_export(disk.disk_number, storage_number())\n changes_made += 1\n elsif !export_should_be_up && export_is_up\n logger.info \"shutting down export #{disk.disk_number}\"\n StorageNode.remove_export(disk.disk_number)\n changes_made += 1\n end\n end\n end\n\n changes_made\n end", "def restore\n unless @hash\n @p.transaction do\n @hash = @p['hash'] || {}\n end\n end\n @hash\n end", "def cash_out\n player.wallet = @wallet\n end", "def rebalance\n Result.new(call(CMD_REBALANCE))\n end", "def ledger_entries\n tx = raw\n\n # Delete keys that have expected values.\n raise \"UNHANDLED CASE\" unless tx.delete(\"is_market\") == false\n raise \"UNHANDLED CASE\" unless tx.delete(\"is_market_cancel\") == false\n raise \"UNHANDLED CASE\" unless tx.delete(\"is_virtual\") == false\n raise \"UNHANDLED CASE\" unless tx.delete(\"error\") == nil\n raise \"UNHANDLED CASE\" unless tx.delete(\"is_confirmed\") == true\n\n # Clean up the keys. Build a minimal hash of reference data.\n ref = {\n 'date' => bts_date(tx.delete('timestamp')),\n 'expires' => bts_date(tx.delete('expiration_timestamp')),\n 'fee' => tx.delete('fee'),\n 'trx_id' => tx.delete('trx_id'),\n 'block_num' => tx.delete('block_num')}\n\n # The only remaining key is removed. The hash should be empty!\n entries = tx.delete(\"ledger_entries\")\n raise \"Unhandled keys! #{tx.inspect} -- ref: #{ref}\" if tx.keys.any?\n\n # TODO: Another assumption. Have not yet seen more than 1 entry in a tx.\n #raise \"Multiple ledger entries in trx #{ref['trx_id']}\\n#{entries.inspect}\" if entries.size != 1\n\n # Append the minimal hash of data to each ledger entry\n # TODO: Document and sanity-check the structure of ledger_entries\n entries.map do |e|\n e.delete('running_balances')\n e['from'] = e.delete('from_account')\n e['to'] = e.delete('to_account')\n ref.merge(e)\n end\n end", "def rip_accounts()\n if @version >= IOS_VERSION_9\n @database.execute(\"SELECT ZICCLOUDSYNCINGOBJECT.Z_PK \" +\n \"FROM ZICCLOUDSYNCINGOBJECT \" + \n \"WHERE ZICCLOUDSYNCINGOBJECT.ZNAME IS NOT NULL\") do |row|\n rip_account(row[\"Z_PK\"])\n end \n end\n\n if @version == IOS_LEGACY_VERSION\n @database.execute(\"SELECT ZACCOUNT.Z_PK FROM ZACCOUNT\") do |row|\n rip_account(row[\"Z_PK\"])\n end\n end\n\n @accounts.each_pair do |key, account|\n @logger.debug(\"Rip Accounts final array: #{key} corresponds to #{account.name}\")\n end\n\n end", "def restore_state\n\t$log.info(\"Restoring state from database...\")\n\t$redis.list_multis.each do |id_multi, config|\n\t\trestore_multi_state id_multi\n\tend\n\t$log.info(\"Restoration complete.\")\nend", "def forget_pkgs(*args)\n args.each do |receipt|\n known_pkgs = %x(pkgutil --pkgs).split\n if known_pkgs.include?(receipt.to_s)\n puts \"#{receipt} is in receipts database. removing now.\"\n %x(pkgutil --forget #{receipt})\n else\n puts \"#{receipt} is not in receipts database. stopping.\"\n end\n end\n end", "def deduct_wallet\n user = User::find(self.user_id)\n user.budget -= self.pending_money\n user.save\n\n self.pending_money = 0\n self.save\n end", "def sweep_once\n if @source.updated_balance_available?\n result = sweep\n puts \"REZULT\"\n puts result\n return \"OK: #{result}\"\n else\n return \"OK: No balance detected.\"\n end\n end", "def bookkeeping_before_betting()\n @dealer.reset() ## very important to reset dealer\n @players.delete_if{|player| player.amount <= 0} ## remove broke players\n if @players.size == 0\n puts \"**********WE NEED MORE PLAYERS**************\"\n exit() # exit if no more players left\n end\n @players.each do | player|\n player.reset() ## reset remaining players\n end # end reset\n end", "def attach_checkout_wallet\n CheckoutWallet.pew(self)\n end", "def backuppassword\n @shadow_location = \"#{@home}/etc/#{domain}\"\n @shadow = \"#{@shadow_location}/shadow\"\n @backup_account = `grep -w ^#{@email_account_without_domain} #{@shadow} > #{@shadow_location}/#{@email_account_without_domain}.mailtool`\n end", "def restore_branch\n @@obj.branch(@@save_branch.pop).checkout\n end", "def restore(*args)\n argv = to_pointer([\"restore\"] + args)\n rrd_restore(args.size+1, argv) == 0\n ensure\n free_pointers\n end", "def do_auto_recovery\n for actor in members\n actor.do_auto_recovery\n end\n end", "def print_wallet\n\t\tputs \"\\n\\n\\n\"\n\t\tputs \"Your balance: #{@balance.round(2)}\"\n\tend", "def close_account\n self.void_pending_authorizations\n if probono = Organization.probono\n if probono.piggy_bank && probono.piggy_bank.reload && probono.piggy_bank != self\n result = self.transfer(probono.piggy_bank, self.available_balance, :limits => false) if probono.piggy_bank\n raise BankError, \"remaining funds could not be transferred\" if !result || !result.success?\n end\n end\n end", "def lost_partitions\n lost_partitions = {}\n\n revoked_partitions.each do |topic, partitions|\n lost_partitions[topic] = partitions - assigned_partitions.fetch(topic, EMPTY_ARRAY)\n end\n\n lost_partitions\n end", "def deduct_balance(params = {})\n self.class.get('/balance/deduct', params)\n end", "def transfer_funds\n Dialog::space\n @acct_list = bank.account_list(@man_name, @man_pin)\n @account_id_array = Display::account_info(@acct_list)\n from = Dialog::transfer_acct_1\n to = Dialog::transfer_acct_2\n how_much = Dialog::transfer_ammount\n bank.money_transfer(from, to, how_much)\n end" ]
[ "0.5695221", "0.54323214", "0.5343585", "0.5137428", "0.49947256", "0.49409306", "0.49350178", "0.48970926", "0.48897174", "0.47664508", "0.47620264", "0.47490352", "0.47310436", "0.47227284", "0.47217306", "0.47089007", "0.47069794", "0.47002456", "0.46941602", "0.46932575", "0.46882406", "0.4638115", "0.4571311", "0.4562112", "0.45352635", "0.45338643", "0.4533494", "0.4522015", "0.4510771", "0.4491465", "0.44900265", "0.44819725", "0.44710612", "0.44696522", "0.44696522", "0.44491994", "0.44433135", "0.4432838", "0.44300044", "0.4418512", "0.44011164", "0.4400408", "0.43925422", "0.43842775", "0.43787977", "0.43555358", "0.43529156", "0.4347825", "0.4344991", "0.4340246", "0.4338205", "0.43362966", "0.43288946", "0.43275788", "0.4327539", "0.43249834", "0.43213832", "0.43211392", "0.4314548", "0.42997912", "0.42930853", "0.42908302", "0.42886868", "0.42867437", "0.4285866", "0.42837438", "0.42609793", "0.4258589", "0.425529", "0.42550018", "0.42542157", "0.4253873", "0.42415673", "0.4209868", "0.42086172", "0.42009595", "0.4195802", "0.41915917", "0.41911194", "0.4183773", "0.41795644", "0.4175811", "0.41706288", "0.4169589", "0.41688544", "0.415999", "0.4157078", "0.41569385", "0.41557345", "0.41393477", "0.41347045", "0.41343877", "0.4130518", "0.41272336", "0.41252813", "0.4124436", "0.4121152", "0.41117212", "0.41059142", "0.41031814" ]
0.7513572
0
Return the information of wallet.
def wallet_info client.make_request('/wallet-info', 'post', params: {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getwalletinfo\n node.wallet ? node.wallet.to_h : {}\n end", "def getwalletinfo\n @api.request 'getwalletinfo'\n end", "def wallet\n get 'wallet'\n end", "def wallet_information(wallet_id)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'application/json', 'signature' => signature('', 'get', \"/v1/user/#{wallet_id}\"),\n 'salt' => salt, 'timestamp' => timestamp, 'access_key' => access_key }\n response, msg = rest_client.getCall(\"/v1/user/#{wallet_id}\", headers)\n if response.present? && response.body.present? && JSON.parse(response.body)['status']['status'] == 'SUCCESS'\n JSON.parse(response.body)\n else\n msg\n end\n rescue StandardError => e\n Rails.logger.error e\n nil\n end", "def wallet_summary\n get 'walletSummary'\n end", "def get_details(wallet_id)\n\t\t\t\tJuspayCheckout::ExpressCheckout.request(\"/wallets/#{wallet_id}\", 'get')\n\t\t\tend", "def wallet_history\n get 'walletHistory'\n end", "def wallet_address\n vault = current_resource_owner_vault\n return render({ json: nil, status: :no_content }) unless vault.present?\n render json: {wallet_address: vault.wallet_address}, status: :ok\n end", "def current_wallet\n # currency_wallet\n @participant ? betting_pool_wallet : points_wallet\n end", "def fetch_wallet(funds_type, currency_iso_code)\n MangoPay.request(:get, url() + \"/wallets/#{funds_type}/#{currency_iso_code}\")\n end", "def wallets\n @wallets ||= ArkEcosystem::Client::API::Wallets.new(@client)\n end", "def show\n @wallet = Wallet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wallet }\n end\n end", "def print_wallet\n\t\tputs \"\\n\\n\\n\"\n\t\tputs \"Your balance: #{@balance.round(2)}\"\n\tend", "def listaccounts\n return {} unless node.wallet\n accounts = {}\n node.wallet.accounts.each do |a|\n accounts[a.name] = node.wallet.get_balance(a)\n end\n accounts\n end", "def fetch_wallets(funds_type = nil)\n MangoPay.request(:get, url() + \"/wallets/#{funds_type}\")\n end", "def wallet_transactions_listing(wallet_id, type)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'application/json',\n 'signature' => signature('', 'get', \"/v1/user/#{wallet_id}/transactions?type=#{type}\"), 'salt' => salt, 'timestamp' => timestamp, 'access_key' => access_key }\n response, msg = rest_client.getCall(\"/v1/user/#{wallet_id}/transactions?type=#{type}\", headers)\n JSON.parse(response)['data'] if response.present?\n rescue StandardError => e\n Rails.logger.error e\n nil\n end", "def getblockchaininfo\n @api.request 'getblockchaininfo'\n end", "def show\n @utilized_bitcoin_wallet = UtilizedBitcoinWallet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @utilized_bitcoin_wallet }\n end\n end", "def id\n wallet_token\n end", "def info\n @info ||= client.try(:get, transaction_url)||{}\n end", "def wallet_type()\n type = Spree::PAYONE::Utils::WalletType.validate(@wallet_type)\n if type != nil\n return type\n else\n return ''\n end\n end", "def wallet(id)\n attrs = @store.wallets.lookup(id) || create_wallet(id, \"\")\n Wallet.new(@store.accounts, **attrs) if attrs\n end", "def wallet(id, opts = {})\n data, _status_code, _headers = wallet_with_http_info(id, opts)\n data\n end", "def wallet\n # urls\n binance_url = \"http://bit.ly/binance-coinmarket\"\n coinbase_url = \"http://bit.ly/coinbasemacsfreeman\"\n wirex_url = \"https://bit.ly/2QgCLRH\"\n\n # names\n wirex_name = \"Wirex\"\n coinbase_name = \"CoinBase\"\n binance_name = \"Binance\"\n\n #messages\n wirex_msg1 = \"\\tWirex is the easiest wallet to use!\\n\"\n wirex_msg2 = \"\\tGet a visa card related to your cryptos!\\n\"\n wirex_msg3 = \"\\tWirex has just launched its own crypto!\"\n wirex_msg = wirex_msg1 + wirex_msg2 + wirex_msg3\n\n # concatenate\n wirex = wirex_url + \" (\" + wirex_name + \")\\n\" + wirex_msg\n coinbase = coinbase_url + \" (\" + coinbase_name + \")\"\n binance = binance_url + \" (\" + binance_name + \")\"\n\n dashes = \"-\" * 2 * coinbase.length\n # menu with options to choose\n puts dashes\n puts \"Option 1: #{wirex}\"\n puts \"Option 2: #{coinbase}\"\n puts \"Option 3: #{binance}\"\n puts dashes\nend", "def show_balance\n\t\t\treturn @balance\n\t\tend", "def show\n @user = current_user\n @initiator = User.find(@wallet_transaction.initiator_id)\n if @wallet_transaction.wallet_from_id.present?\n @wallet_from = Wallet.find(@wallet_transaction.wallet_from_id).identity\n end\n @wallet_to = Wallet.find(@wallet_transaction.wallet_to_id).identity\n end", "def account_info()\n response = @session.do_get build_url(\"/account/info\")\n parse_response(response)\n end", "def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end", "def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end", "def account\n AccountInfoParser.parse(post(\"money/info\"))\n end", "def fetch(wallet)\n query = { wallet: wallet, balance: { '$gt' => 1e-8 } }\n order = { balance: :desc }\n addresses = find_order_limit(query, order, 50)\n .map { |doc| Entities::Address.create_from(doc) }\n Entities::Wallet.create_from 'id' => wallet, 'name' => name(wallet),\n 'balance' => balance(wallet),\n 'size' => count(wallet),\n 'addresses' => addresses\n end", "def balance\n rest.get(:getbalance)['data']\n end", "def balance_hash\n @money\n end", "def backup_wallet\n client.make_request('/backup-wallet', 'post', params: {})\n end", "def wallet_params\n params.require(:wallet).permit(:public_key, :private_key, :name)\n end", "def index\n @transactions = current_user.wallet.transactions\n\n end", "def fetch_wallet_name(public_key)\n result = rpc.call('wallet_by_key_api.get_key_references', { 'keys' => [keys['recovery_public']] })\n result&.fetch('wallets', [])&.first&.first\nend", "def index\n @wallets = Wallet.all\n end", "def index\n @wallets = Wallet.all\n end", "def get_withdrawal_info\n # body = {\n # cmd: \"get_withdrawal_info\"\n # }\n\n end", "def set_wallet\n @wallet = Wallet.find(params[:id])\n end", "def save(wallet)\n db.transaction do\n db[wallet.address] = wallet\n end\n end", "def getaccount(coinaddress)\n coind.getaccount coinaddress\n end", "def index\n @wallets = Wallet.all\n # @currency = Currency.first\n end", "def wallet_params\n params.require(:wallet).permit(:bank, :name, :second_name, :last_name, :wallet_name, :type_identificador, :identificador, :country)\n end", "def set_wallet\n @wallet = Wallet.find(params[:id])\n end", "def set_wallet\n @wallet = Wallet.find(params[:id])\n end", "def set_wallet\n @wallet = Wallet.find(params[:id])\n end", "def get_balance\n return balance\n end", "def create\n @wallet = Wallet.new(wallet_params)\n\n respond_to do |format|\n if @wallet.save\n format.html { redirect_to @wallet, notice: 'User wallet was successfully created.' }\n format.json { render :show, status: :created, location: @wallet }\n else\n format.html { render :new }\n format.json { render json: @wallet.errors, status: :unprocessable_entity }\n end\n end\n end", "def getaccount(bitcoinaddress)\n @api.request 'getaccount', bitcoinaddress\n end", "def set_wallet\n @wallet = Wallet.find(params[:id])\n end", "def balance\n wallet = Fyb.private.getaccinfo.perform.parse\n btc_label = 'btcBal'\n money_label = Fyb::Configuration.currency.to_s + 'Bal'\n\n btc = BigDecimal.new wallet[btc_label]\n real_money = BigDecimal.new wallet[money_label]\n\n { :btc => btc, Fyb::Configuration.currency => real_money }\n end", "def account\n AccountInfoParser.parse(post(\"balance\"))\n end", "def account\n @details ||= fetch_details\n @details[:account]\n end", "def hash\n [wallet_id, debtor_bic, debtor_iban, debitor_name, debitor_country, debitor_address_line, creditor_bic, creditor_iban, creditor_name, creditor_address_line, creditor_country, transaction_id, virtual_iban_id, settlement_date, settlement_amount, return_reason_code, virtual_iban_reference, remittance_information, transaction_end_to_end_id].hash\n end", "def return_balance(name)\n return find_account(name)[:balance]\n end", "def walletlock\n @api.request 'walletlock'\n end", "def account\n params[\"MerchantCode\"]\n end", "def account_information\n\t\t\t{\n\t\t\t\tid: @id,\n\t\t\t\tchecking: @checking,\n\t\t\t\tsaving: @saving,\n\t\t\t\ttotal: combined_capital,\n\t\t\t\tinterest_rate: @interest_rates\n\t\t\t}\n\t\tend", "def me\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/account/info').info\n end", "def new\n @wallet = get_wallet\n @transaction = Transaction.new\n end", "def get_balance\n\t\treturn @balance.balance\n\tend", "def getBalance\n result = @driver.GetBalance(:ApiKey => @apikey)\n if result.getBalanceResult.errorCode == \"0\" then\n output = result.getBalanceResult.balance\n else\n output = result.getBalanceResult.errorMessage\n end\n return output\n end", "def getaccount(namecoin_address)\n request :getaccount, namecoin_address\n end", "def account_balance\n @account_balance\n end", "def wallet_params\n params.require(:wallet).permit(:user_id, :amount, :memo, :deleted_at)\n end", "def active_merchant_hash\n {\n name: full_name,\n address1: address1,\n address2: address2,\n city: city,\n state: state_text,\n zip: zipcode,\n country: country.try(:iso),\n phone: phone\n }\n end", "def transaction_details\n\t\ttransaction_details = Hash.new\n\t\ttransaction_details[\"history\"] = \"#{Time.now.strftime(\"%d/%m/%Y at %H:%M\")} - #{@descriptor} worth $#{@amount}. Balance is now: $#{@balance}\"\n\t\ttransaction_details[\"balance\"] = @balance\n\t\tappend_to_file(\"models/userDetails/#{@username}.txt\", transaction_details)\n\t\tmenu\n\tend", "def user_get_wallet_history(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: UserApi#user_get_wallet_history ...\"\n end\n\n # resource path\n path = \"/user/walletHistory\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\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 => 'Array<Transaction>')\n if Configuration.debugging\n Configuration.logger.debug \"API called: UserApi#user_get_wallet_history. Result: #{result.inspect}\"\n end\n return result\n end", "def get_bank_name()\n return @RESPONSE_HASH['BANK_NAME']\n end", "def find(id)\n response = JSON.parse(@client.get(\"wallet_accounts/#{id}\").body)\n Promisepay::WalletAccount.new(@client, response['wallet_accounts'])\n end", "def hash\n [additional_details, blockchain, fee_priority, network, recipients, total_transaction_amount, transaction_id, transaction_request_status, transaction_type, unit, wallet_id].hash\n end", "def getaccountdetails(params = {})\n request :getaccountdetails, params.merge( :parser => :hash)\n end", "def get_customer_account\n http_response = payment_get('/virtual_bank/accounts/self.json')\n \n if (http_response.code === 200)\n return {\n response_code: Shop::Transaction::API_RESPONSE_OK,\n response_data: {\n amount: http_response.parsed_response['amount'],\n }\n }\n else\n return {response_code: Shop::Transaction::API_RESPONSE_ERROR}\n end\n end", "def createwallet(wallet_id = 1, wallet_path_prefix = Bitcoin::Wallet::Base.default_path_prefix)\n wallet = Bitcoin::Wallet::Base.create(wallet_id, wallet_path_prefix)\n node.wallet = wallet unless node.wallet\n {wallet_id: wallet.wallet_id, mnemonic: wallet.master_key.mnemonic}\n end", "def to_s\n\t\t puts \"Bank Account:\\t#{name}\\n\"\n\t\t puts \"Your current balance is:\\t#{sprintf(\"%0.2f\", balance)} USD\" \n\tend", "def balance() @address.balance; end", "def update\n respond_to do |format|\n if @wallet.update(wallet_params)\n format.html { redirect_to @wallet, notice: 'User wallet was successfully updated.' }\n format.json { render :show, status: :ok, location: @wallet }\n else\n format.html { render :edit }\n format.json { render json: @wallet.errors, status: :unprocessable_entity }\n end\n end\n end", "def getbalance(args={})\n {\n :method=> \"GetBalances\"\n }.to_json\n end", "def balance\n parse_balance(post('/api/1/generic/info'))\n end", "def payee\n profile\n end", "def index\n @users_wallets = Users::Wallet.all\n end", "def show_man_balance\n Dialog::space\n @acct_list = bank.account_list(@man_name, @man_pin)\n @account_id_array = Display::account_info(@acct_list) \n end", "def account_info language_code: \"en\"\n params = init_params\n params[:languageCode] = language_code\n request_url = UrlGenerator.url_for(\"account\")\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end", "def get_account(acct)\n\t\t$DB.where(account_name: acct).each do |t|\n\t\t\tputs \"#{t[:account_name]}: #{t[:balance]}\"\n\t\tend\n\tend", "def current_account\n ENV['CURRENT_ACCOUNT']\n #BlOCKCHAIN_CLIENT.eth_accounts['result'][0]\n #'0x1f9334BAE0acC7a86834f60488d0C6Fa89B4590b'\n end", "def generate_address\n if Rails.env.development?\n resp = $rippleClient.dev_wallet_propose\n if resp.raw.present?\n self.address= resp.raw.address\n self.secret= resp.raw.secret\n end\n else\n resp = $rippleClient.wallet_propose\n if resp.raw.present?\n self.address= resp.resp.account_id\n self.secret= resp.resp.master_seed\n end\n end\n end", "def blockinfo_get_address_info(address, network = :bitcoin)\n \n base = \"https://blockchain.info/multiaddr?&simple=true&active=\" + address\n \n base = base + get_api_key_params\n \n json = OnChain::BlockChain.fetch_response(URI::encode(base))\n \n return { received: json[address]['total_received'], \n balance: json[address]['final_balance'],\n confirmed: json[address]['final_balance'] }\n \n end", "def wallets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.wallets ...'\n end\n # resource path\n local_var_path = '/api/v1/wallets'\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', 'application/xml', ])\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<Object>' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#wallets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def bank_account\n @bank_account\n end", "def balance\n @accounts.values.first\n end", "def wallet_params\n params.require(:wallet).permit(:btc_balance, :inr_balance,:user_id)\n end", "def save\n wallet.db.save_account(self)\n end", "def account_info(opts = {})\n params = {\n account: opts.delete(:account) || client_account,\n strict: opts[:strict].nil?? true : opts[:strict],\n ledger_hash: opts[:ledger_hash],\n ledger_index: opts[:ledger_index] || \"validated\",\n }\n post(:account_info, params)\n end", "def retrieve_payment_data(pay_key)\n api.execute(:PaymentDetails, pay_key: pay_key) do |response|\n if response.success?\n response.payment_info_list.payment_info.each do |payment|\n p \"Receiver: #{payment.receiver.email}\"\n p \"Amount: #{payment.receiver.amount.to_f}\"\n p \"Transaction status: #{payment.transaction_status}\".green\n end\n else\n p \"#{response.ack_code}: #{response.error_message}\".red\n end\n return response\n end\nend", "def wallets(opts = {})\n data, _status_code, _headers = wallets_with_http_info(opts)\n data\n end", "def wallet_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.wallet ...'\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 DefaultApi.wallet\"\n end\n # resource path\n local_var_path = '/api/v1/wallet'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'id'] = id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || []\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: DefaultApi#wallet\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def make_response(user)\n res = {email: user.email, wallets:[]}\n user.wallets.each{|wallet| res[:wallets] << { id: wallet.id, balance: wallet.display_balance, currency: wallet.balance_currency}}\n res\n end", "def account_info(options = {})\n request :account, :get, 'account', options\n end" ]
[ "0.86107737", "0.8168548", "0.7994915", "0.77760816", "0.7691275", "0.73840183", "0.6876495", "0.6849385", "0.67396706", "0.66357905", "0.65899664", "0.6556994", "0.64850205", "0.6466804", "0.64327633", "0.6405591", "0.63930184", "0.6382976", "0.637228", "0.63144517", "0.62766576", "0.6251698", "0.62271225", "0.6210143", "0.62012887", "0.613875", "0.6128904", "0.61038494", "0.61038494", "0.60942584", "0.6085519", "0.6045168", "0.60353047", "0.5997411", "0.59903914", "0.59885985", "0.5978804", "0.5970114", "0.5970114", "0.59424907", "0.59294343", "0.59223723", "0.59202045", "0.5910717", "0.5899499", "0.5898693", "0.5898693", "0.5898693", "0.58947396", "0.58822775", "0.5870727", "0.5867027", "0.58577186", "0.5854711", "0.5822602", "0.58197457", "0.5807309", "0.5798951", "0.57933986", "0.5784525", "0.5767891", "0.5765673", "0.5764252", "0.5739917", "0.57296413", "0.57187307", "0.5715769", "0.56959504", "0.56735384", "0.5662896", "0.5652646", "0.56415284", "0.5640226", "0.5634567", "0.5626501", "0.562515", "0.5619221", "0.56175643", "0.5613747", "0.56045336", "0.5602641", "0.55994284", "0.55923027", "0.5588986", "0.5587145", "0.5584731", "0.5575999", "0.5572329", "0.55682987", "0.5563146", "0.5562607", "0.5553402", "0.5552725", "0.5550882", "0.55473214", "0.55313927", "0.55301225", "0.5529538", "0.5528654", "0.5527933" ]
0.8846748
0
Get unspent utxos for the given addresses, returns a list of lists like so: [[address, txid, position (vout), amount (in satoshis)], ...]
def list_unspent(addresses) raise NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unspent(addresses)\n get(\"addr/\"+addresses.join(\",\")+\"/utxo?noCache=1\")\n end", "def list_unspent(addresses)\n unspents = []\n addresses.in_groups_of(500, false).collect do |group|\n unspents += list_unspent_helper(group)\n end\n unspents\n end", "def list_unspent(oa_address_list = [])\n btc_address_list = oa_address_list.map { |oa_address| oa_address_to_address(oa_address)}\n outputs = get_unspent_outputs(btc_address_list)\n result = outputs.map{|out| out.to_hash}\n result\n end", "def list_unspent(addresses = [], min = 1 , max = 9999999)\n listunspent(min, max, addresses)\n end", "def utxos(sources)\n txns = []\n sources.each do |hash|\n json = Sibit::Json.new(http: @http, log: @log).get(\n Iri.new('https://chain.api.btc.com/v3/address').append(hash).append('unspent')\n )\n data = json['data']\n raise Sibit::Error, \"The address #{hash} not found\" if data.nil?\n txns = data['list']\n next if txns.nil?\n txns.each do |u|\n outs = Sibit::Json.new(http: @http, log: @log).get(\n Iri.new('https://chain.api.btc.com/v3/tx').append(u['tx_hash']).add(verbose: 3)\n )['data']['outputs']\n outs.each_with_index do |o, i|\n next unless o['addresses'].include?(hash)\n txns << {\n value: o['value'],\n hash: u['tx_hash'],\n index: i,\n confirmations: u['confirmations'],\n script: [o['script_hex']].pack('H*')\n }\n end\n end\n end\n txns\n end", "def listunspent(bitcoinaddress=nil, minconf=1, maxconf=nil)\n @api.request 'listunspent', minconf, maxconf, bitcoinaddress\n end", "def get_unspent_txouts_for_address(address, unconfirmed = false)\n txouts = self.get_txouts_for_address(address, unconfirmed)\n txouts.select! do |t|\n not t.get_next_in\n end\n txouts\n end", "def get_txouts_for_address(address, unconfirmed = false)\n hash160 = Bitcoin.hash160_from_address(address)\n type = Bitcoin.address_type(address)\n get_txouts_for_hash160(hash160, type, unconfirmed)\n end", "def fetch_transactions_for(address)\n # API may return nil instead of an empty array if address turns out to be invalid\n # (for example when trying to supply a testnet address instead of mainnet while using\n # mainnet adapter.\n if api_response = api_request('queryTransactionInventory', {addresses: [address], limit: 100})\n (api_response['txIds'] || []).map { |tid| fetch_transaction(tid, address: address) }\n else\n raise BitcoinAddressInvalid, message: \"address in question: #{address}\"\n end\n end", "def fetch_transactions_for(address)\n tid = api_request('queryTransactionInventory', { addresses: [address], limit: 1 })[\"txIds\"].first\n tid ? [fetch_transaction(tid, address: address)] : []\n end", "def unspent_transaction_outputs_of(public_key_hash)\n unspent_outputs = []\n unspent_transactions_of(public_key_hash).each do |tx|\n tx.v_out.each do |out|\n unspent_outputs.push(out) if out.locked_with?(public_key_hash)\n end\n end\n unspent_outputs\n end", "def fetch_balance_for(address)\n unspent = 0\n api_request('queryUnspentOutputs', { addresses: [address]})['unspent'].each do |out|\n unspent += out['value']\n end\n unspent\n end", "def fetch_balance_for(address)\n unspent = 0\n api_request('queryUnspentOutputs', { addresses: [address]})['unspent'].each do |out|\n unspent += out['value']\n end\n unspent\n end", "def address_uxouts(address, opts = {})\n data, _status_code, _headers = address_uxouts_with_http_info(address, opts)\n data\n end", "def update_unspent_outputs(tx)\n if !tx.is_coinbase?\n tx.inputs.each do |txin|\n @storage.mark_output_as_spent(txin.prev_out, txin.prev_out_index)\n end\n end\n\n # Add unspent output\n tx.outputs.each_with_index do |txout, i|\n @storage.mark_output_as_unspent(tx.binary_hash, i)\n end\n end", "def unspent_transactions_of(public_key_hash)\n unspent_txs = []\n spent_tx_outputs = {}\n\n each do |block|\n block.transactions.each do |tx|\n tx_id = tx.id.to_s\n catch :spent do\n tx.v_out.each.with_index do |out, out_id|\n if spent_tx_outputs[tx_id]\n spent_tx_outputs[tx_id].each do |spent_out|\n throw :spent if spent_out == out_id\n end\n end\n\n if out.locked_with?(public_key_hash)\n unspent_txs << tx\n end\n end\n end\n\n unless tx.coinbase?\n tx.v_in.each do |input|\n if input.uses_key?(public_key_hash)\n in_tx_id = input.tx_id.to_s\n\n spent_tx_outputs[in_tx_id] ||= []\n spent_tx_outputs[in_tx_id] << input.v_out\n end\n end\n end\n end\n end\n\n unspent_txs\n end", "def normal_transactions(address, args = {})\n action = 'txlist'\n transcations(action, address, nil, args)\n end", "def internal_transactions(address, args = {})\n action = 'txlistinternal'\n transcations(action, address, nil, args)\n end", "def fetch_transactions_for(address)\n super\n rescue Straight::Blockchain::Adapter::BitcoinAddressInvalid => e\n StraightServer.logger.warn \"Address #{address} seems to be invalid, ignoring it. #{e.message}\"\n return []\n rescue => ex\n StraightServer.logger.debug \"fetch_transactions_for #{address} failed: #{ex.inspect}\"\n return []\n end", "def get_orphan_txs_by_prev_hash(tx_hash)\n orphan_txs = []\n Toshi::Models::UnconfirmedInput.where(prev_out: tx_hash).each{|input|\n transaction = input.transaction\n if transaction.is_orphan?\n orphan_txs << transaction.bitcoin_tx\n end\n }\n orphan_txs\n end", "def transactions\n txs = @client.listtransactions.reverse\n txs.map do |tx|\n tx = symbolize tx\n Transaction.new(\n account: tx.f(:account),\n address: tx.f(:address),\n category: tx.f(:category),\n amount: tx.f(:amount),\n vout: tx.f(:vout),\n confirmations: tx.f(:confirmations),\n blockhash: tx[:blockhash],\n blockindex: tx[:blockindex],\n blocktime: tx[:blocktime],\n txid: tx.f(:txid),\n keychainconflicts: tx.f(:keychainconflicts),\n time: tx.f(:time),\n timereceived: tx.f(:timereceived),\n )\n end\n end", "def utxos(keys)\n best_of('utxos') do |api|\n api.utxos(keys)\n end\n end", "def get_utxo(min_confirmation=100, min_amount=0.0001)\n txs = @rpc.listunspent(min_confirmation)\n for tx in txs\n if tx['amount'] > min_amount then\n return tx\n end\n end\n return nil\n end", "def searchrawtransactions(bitcoinaddress, verbose=1)\n @api.request 'searchrawtransactions', bitcoinaddress, verbose\n end", "def list_internal_transactions_by_address(blockchain, network, address, opts = {})\n data, _status_code, _headers = list_internal_transactions_by_address_with_http_info(blockchain, network, address, opts)\n data\n end", "def unspents(wallet_id: default_wallet_id)\n call :get, '/wallet/' + wallet_id + '/unspents'\n end", "def listunconfirmed(addr)\n json_get('address','unconfirmed',addr)['data']['unconfirmed']\n end", "def transactions_by_address(address, options = {})\n agent.transactions_by_address(self['id'], address, options) do |data, resp|\n yield(data, resp) if block_given?\n end\n end", "def get_uncached_addresses(addresses, suffix = '')\n ret = []\n addresses.each do |address|\n if cache_read(address + suffix) == nil\n ret << address\n end\n end\n return ret\n end", "def balance_of(address)\n payload = Base58.decode(address).to_s(16)\n public_key_hash = payload.slice(0, payload.length - 4)\n unspent_txs = unspent_transaction_outputs_of(public_key_hash)\n unspent_txs.reduce(0) { |sum, tx_out| sum + tx_out.value }\n end", "def transactions_by_address(account_id, address, options = {})\n out = nil\n currency = if options[:currency] then options[:currency] else blockchain_type end\n get(\"/v1/#{currency}/accounts/#{account_id}/transactions/address/#{address}\", options) do |resp|\n out = resp.data.map { |item| Cryptoprocessing::Transaction.new(self, item) }\n yield(out, resp) if block_given?\n end\n out\n end", "def unspents_amount\n unspents.map {|u| u[\"value\"]}.reduce(:+)\n end", "def utxos(_sources)\n raise Sibit::NotSupportedError, 'Blockchair doesn\\'t implement utxos()'\n end", "def get_txins_for_txouts(txouts)\n txouts.map{|tx_hash, tx_idx| get_txin_for_txout(tx_hash, tx_idx) }.compact\n end", "def mark_outputs_as_unspent(output_ids, on_disconnect)\n self.class.add_to_utxo_set(output_ids, on_disconnect)\n\n # mark these unspent all at once\n Toshi::Models::Output.where(id: output_ids)\n .update(spent: false, branch: Toshi::Models::Block::MAIN_BRANCH)\n end", "def pay(address, satoshi)\n batch = {}\n unspent = 0\n @pgsql.exec('SELECT * FROM asset WHERE value > 0 ORDER BY value').each do |r|\n next if r['pvt'].nil?\n batch[r['address']] = @codec.decrypt(r['pvt'])\n unspent += r['value'].to_i\n break if unspent > satoshi\n end\n if unspent < satoshi\n raise \"Not enough funds to send #{satoshi}, only #{unspent} left in #{batch.count} Bitcoin addresses\"\n end\n txn = @sibit.pay(satoshi, '-L', batch, address, acquire)\n batch.each_key { |a| set(a, 0) }\n @log.info(\"Sent #{satoshi} to #{address} from #{batch.count} addresses: #{batch.keys.join(', ')}; \\\ntotal unspent was #{unspent}; tx hash is #{txn}\")\n txn\n end", "def list_unconfirmed_transactions\n client.make_request('/list-unconfirmed-transactions', 'post', params: {})\n end", "def multi_addr(addresses)\n get(\"addr/\"+addresses.join(\",\")+\"/balance?noCache=1\")\n end", "def accounts\n @transactions.collect(&:account).uniq\n end", "def wallet_transactions_listing(wallet_id, type)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'application/json',\n 'signature' => signature('', 'get', \"/v1/user/#{wallet_id}/transactions?type=#{type}\"), 'salt' => salt, 'timestamp' => timestamp, 'access_key' => access_key }\n response, msg = rest_client.getCall(\"/v1/user/#{wallet_id}/transactions?type=#{type}\", headers)\n JSON.parse(response)['data'] if response.present?\n rescue StandardError => e\n Rails.logger.error e\n nil\n end", "def get_user_coin_transactions\n user_coin_transactions = Transaction.where(user_id: @user.id, coin_id: @user_coin.id) if @user\n return user_coin_transactions;\n end", "def token_transactions(contract_address, address = nil, args = {})\n fail Etherscan::Exception, 'contract or address must be defined' if (contract_address || address).nil?\n action = 'tokentx'\n transcations(action, address, contract_address, args)\n end", "def get_unallocated_employees(employees)\n employees_list = []\n employees.each do |employee|\n employees_list.push employee.name\n end\n return employees_list\n end", "def get_txs(tx_hashes)\n tx_hashes.map {|h| get_tx(h)}.compact\n end", "def build\n\n if !self.change_address\n raise MissingChangeAddressError\n end\n\n result = Result.new\n\n add_input_for_utxo = proc do |utxo|\n raise ArgumentError, \"Unspent output must contain index\" if !utxo.index\n raise ArgumentError, \"Unspent output must contain transaction_hash\" if !utxo.transaction_hash\n\n if !self.internal_provider.consumed_unspent_output?(utxo)\n self.internal_provider.consume_unspent_output(utxo)\n\n result.inputs_amount += utxo.value\n txin = TransactionInput.new(\n previous_hash: utxo.transaction_hash,\n previous_index: utxo.index,\n # put the output script here so the signer knows which key to use.\n signature_script: utxo.script)\n txin.transaction_output = utxo\n result.transaction.add_input(txin)\n else\n # UTXO was already consumed possibly by another Tx Builder sharing the same provider.\n end\n end\n\n # If no outputs are specified, spend all utxos to a change address, minus the mining fee.\n if (self.outputs || []).size == 0\n result.inputs_amount = 0\n\n (self.prepended_unspent_outputs || []).each(&add_input_for_utxo)\n (self.unspent_outputs || []).each(&add_input_for_utxo)\n\n if result.transaction.inputs.size == 0\n raise MissingUnspentOutputsError, \"Missing unspent outputs\"\n end\n\n # Value will be determined after computing the fee\n change_output = TransactionOutput.new(value: 0, script: self.change_address.public_address.script)\n result.transaction.add_output(change_output)\n\n result.fee = compute_fee_for_transaction(result.transaction, self.fee_rate)\n result.outputs_amount = result.inputs_amount - result.fee\n result.change_amount = 0\n\n # Check if inputs cover the fees\n if result.outputs_amount < 0\n raise InsufficientFundsError.new(result)\n end\n\n # Warn if the output amount is relatively small.\n if result.outputs_amount < result.fee\n Diagnostics.current.add_message(\"BTC::TransactionBuilder: Warning! Spending all unspent outputs returns less than a mining fee. (#{result.outputs_amount} < #{result.fee})\")\n end\n\n # Set the output value as needed\n result.transaction.outputs[0].value = result.outputs_amount\n\n # For each address that is a WIF, locate the matching input and sign it.\n attempt_to_sign_transaction(result)\n\n return result\n end # if no specific outputs required\n\n # We are having one or more outputs (e.g. normal payment)\n # Need to find appropriate unspents and compose a transaction.\n\n # Prepare all outputs.\n # result.outputs_amount will also contain a fee after it's calculated.\n (self.outputs || []).each do |txout|\n result.outputs_amount += txout.value\n result.transaction.add_output(txout)\n end\n\n # We'll determine final change value depending on inputs.\n # Setting default to MAX_MONEY will protect against a bug when we fail to update the amount and\n # spend unexpected amount on mining fees.\n change_output = TransactionOutput.new(value: MAX_MONEY, script: self.change_address.public_address.script)\n result.transaction.add_output(change_output)\n\n mandatory_utxos = (self.prepended_unspent_outputs || []).to_a.dup\n\n # We have specific outputs with specific amounts, so we need to select the best amount of coins.\n # To play nice with BIP32/BIP44 change addresses (that need to monitor an increasing amount of addresses),\n # we'll spend oldest outputs first and will add more and more newer outputs until we cover fees\n # and change output is either zero or above the dust limit.\n # If `confirmations` attribute is nil, order is preserved.\n utxos = self.unspent_outputs || []\n if self.keep_unspent_outputs_order\n sorted_utxos = utxos.to_a.dup\n else\n sorted_utxos = utxos.to_a.sort_by{|txout| -(txout.confirmations || -1) } # oldest first\n end\n \n if self.parent_transactions\n # Can repeat some outputs in mandatory_utxos or sorted_utxos, \n # but double-spending will be prevented by provider.\n self.parent_transactions.each do |parenttx|\n sorted_utxos += parenttx.outputs\n end\n end\n \n all_utxos = (sorted_utxos + mandatory_utxos)\n\n while true\n if (sorted_utxos.size + mandatory_utxos.size) == 0\n raise InsufficientFundsError.new(result)\n end\n\n utxo = nil\n while (sorted_utxos.size + mandatory_utxos.size) > 0\n utxo = if mandatory_utxos.size > 0\n mandatory_utxos.shift\n else\n sorted_utxos.shift\n end \n if utxo.value > 0 &&\n !utxo.script.op_return_script? &&\n !self.internal_provider.consumed_unspent_output?(utxo)\n self.internal_provider.consume_unspent_output(utxo)\n break\n else\n #puts \"CONSUMED UTXO, SKIPPING: #{utxo.transaction_id}:#{utxo.index} (#{utxo.value})\"\n # Continue reading utxos to find one that is not consumed yet.\n utxo = nil\n end\n end\n \n if !utxo\n # puts \"ALL UTXOS:\"\n # all_utxos.each do |utxo|\n # puts \"--> #{utxo.transaction_id}:#{utxo.index} (#{utxo.value})\"\n # end\n raise InsufficientFundsError\n end\n \n result.inputs_amount += utxo.value\n\n raise ArgumentError, \"Transaction hash must be non-nil in unspent output\" if !utxo.transaction_hash\n raise ArgumentError, \"Index must be non-nil in unspent output\" if !utxo.index\n\n txin = TransactionInput.new(previous_hash: utxo.transaction_hash,\n previous_index: utxo.index,\n # put the output script here so the signer knows which key to use.\n signature_script: utxo.script)\n txin.transaction_output = utxo\n result.transaction.add_input(txin)\n\n # Do not check the result before we included all the mandatory utxos.\n if mandatory_utxos.size == 0\n # Before computing the fee, quick check if we have enough inputs to cover the outputs.\n # If not, go and add one more utxo before wasting time computing fees.\n if result.inputs_amount >= result.outputs_amount\n fee = compute_fee_for_transaction(result.transaction, self.fee_rate)\n\n change = result.inputs_amount - result.outputs_amount - fee\n\n if change >= self.minimum_change\n\n # We have a big enough change, set missing values and return.\n\n change_output.value = change\n result.change_amount = change\n result.outputs_amount += change\n result.fee = fee\n attempt_to_sign_transaction(result)\n return result\n\n elsif change > self.dust_change && change < self.minimum_change\n\n # We have a shitty change: not small enough to forgo, not big enough to be useful.\n # Try adding more utxos on the next cycle (or fail if no more utxos are available).\n\n elsif change >= 0 && change <= self.dust_change\n # This also includes the case when change is exactly zero satoshis.\n # Remove the change output, keep existing outputs_amount, set fee and try to sign.\n result.transaction.outputs = result.transaction.outputs[0, result.transaction.outputs.size - 1]\n result.change_amount = 0\n result.fee = fee\n attempt_to_sign_transaction(result)\n return result\n\n else\n # Change is negative, we need more funds for this transaction.\n # Try adding more utxos on the next cycle.\n result.fee = fee\n end\n\n end # if inputs_amount >= outputs_amount\n end # if no more mandatory outputs to add\n end # while true\n end", "def addresses\n Array(@addresses)\n end", "def unique_transactions(for_actor=nil)\n txns = Hash.new()\n\n self.counts.each do |a, values|\n next if for_actor && a != for_actor\n values[\"txns\"].arr.each do |arr|\n txns[arr[0]] = arr[1]\n end\n end\n\n txns\n end", "def strip_order_address_users(order)\n order.bill_address.try(:update_attributes!, user_id: nil)\n order.ship_address.try(:update_attributes!, user_id: nil)\n order\n end", "def network\n arr =\n self.credits.find(:all, :select => \"DISTINCT emails.address\", :joins => \"INNER JOIN users ON users.id = transactions.debtor_id INNER JOIN emails ON emails.user_id = users.id\", :conditions => [\"users.id != ?\", id]).map(&:address) +\n self.debts.find(:all, :select => \"DISTINCT emails.address\", :joins => \"INNER JOIN users ON users.id = transactions.creditor_id INNER JOIN emails ON emails.user_id = users.id\", :conditions => [\"users.id != ?\", id]).map(&:address)\n arr.uniq\n end", "def get_target_users\n\n users = []\n\n self.get_orders.each do |user_hash|\n\n user_ids = user_hash.keys\n\n users = users + user_ids unless user_ids.nil?\n end\n\n users.compact!\n\n return users\n end", "def utxos(_sources)\n raise Sibit::NotSupportedError, 'Not implemented yet'\n end", "def get_balance(address = nil)\n outputs = get_unspent_outputs(address.nil? ? [] : [oa_address_to_address(address)])\n colored_outputs = outputs.map{|o|o.output}\n sorted_outputs = colored_outputs.sort_by { |o|o.script.to_string}\n groups = sorted_outputs.group_by{|o| o.script.to_string}\n result = groups.map{|k, v|\n btc_address = script_to_address(v[0].script)\n sorted_script_outputs = v.sort_by{|o|o.asset_id unless o.asset_id}\n group_assets = sorted_script_outputs.group_by{|o|o.asset_id}.select{|k,v| !k.nil?}\n assets = group_assets.map{|asset_id, outputs|\n {\n 'asset_id' => asset_id,\n 'quantity' => outputs.inject(0) { |sum, o| sum + o.asset_quantity }.to_s,\n 'amount' => outputs.inject(0) { |sum, o| sum + o.asset_amount }.to_s,\n 'asset_definition_url' => outputs[0].asset_definition_url,\n 'proof_of_authenticity' => outputs[0].proof_of_authenticity\n }\n }\n {\n 'address' => btc_address,\n 'oa_address' => (btc_address.nil? || btc_address.is_a?(Array)) ? nil : address_to_oa_address(btc_address),\n 'value' => satoshi_to_coin(v.inject(0) { |sum, o|sum + o.value}),\n 'assets' => assets,\n 'account' => v[0].account\n }\n }\n address.nil? ? result : result.select{|r|r['oa_address'] == address}\n end", "def balance(address)\n uri = Iri.new('https://chain.api.btc.com/v3/address').append(address).append('unspent')\n json = Sibit::Json.new(http: @http, log: @log).get(uri)\n if json['err_no'] == 1\n @log.info(\"The balance of #{address} is zero (not found)\")\n return 0\n end\n data = json['data']\n if data.nil?\n @log.info(\"The balance of #{address} is probably zero (not found)\")\n return 0\n end\n txns = data['list']\n if txns.nil?\n @log.info(\"The balance of #{address} is probably zero (not found)\")\n return 0\n end\n balance = txns.map { |tx| tx['value'] }.inject(&:+) || 0\n @log.info(\"The balance of #{address} is #{balance}, total txns: #{txns.count}\")\n balance\n end", "def update_utxo_pool(block)\n parse_block_utxos(block)\n discard_used_utxos_from_pool(block)\n end", "def index\n @user_addresses = UserAddress.all\n end", "def from_address\n out = []; @envelope.from_addrs.each{|a| out.push(a.address)}\n return out\n end", "def uids\n return [] unless valid?\n\n queries.search(name_query).merged_uids\n end", "def list_wallet_transactions(wallet_id: default_wallet_id, params: {})\n call :get, \"/wallet/#{wallet_id}/tx\", params\n end", "def fetch_wallets_transactions(filters = {})\n MangoPay.request(:get, url() + \"/transactions\", {}, filters)\n end", "def pay(amount, fee, sources, target, change)\n p = price('USD')\n satoshi = satoshi(amount)\n f = mfee(fee, size_of(amount, sources))\n satoshi += f if f.negative?\n raise Error, \"The fee #{f.abs} covers the entire amount\" if satoshi.zero?\n raise Error, \"The fee #{f.abs} is bigger than the amount #{satoshi}\" if satoshi.negative?\n builder = Bitcoin::Builder::TxBuilder.new\n unspent = 0\n size = 100\n utxos = Sibit::Json.new(http: @http, log: @log).get(\n URI(\"https://blockchain.info/unspent?active=#{sources.keys.join('|')}&limit=1000\")\n )['unspent_outputs']\n @log.info(\"#{utxos.count} UTXOs found, these will be used \\\n (value/confirmations at tx_hash):\")\n utxos.each do |utxo|\n unspent += utxo['value']\n builder.input do |i|\n i.prev_out(utxo['tx_hash_big_endian'])\n i.prev_out_index(utxo['tx_output_n'])\n i.prev_out_script = [utxo['script']].pack('H*')\n address = Bitcoin::Script.new([utxo['script']].pack('H*')).get_address\n i.signature_key(key(sources[address]))\n end\n size += 180\n @log.info(\n \" #{num(utxo['value'], p)}/#{utxo['confirmations']} at #{utxo['tx_hash_big_endian']}\"\n )\n break if unspent > satoshi\n end\n if unspent < satoshi\n raise Error, \"Not enough funds to send #{num(satoshi, p)}, only #{num(unspent, p)} left\"\n end\n builder.output(satoshi, target)\n f = mfee(fee, size)\n tx = builder.tx(\n input_value: unspent,\n leave_fee: true,\n extra_fee: [f, Bitcoin.network[:min_tx_fee]].max,\n change_address: change\n )\n left = unspent - tx.outputs.map(&:value).inject(&:+)\n @log.info(\"A new Bitcoin transaction #{tx.hash} prepared:\n #{tx.in.count} input#{tx.in.count > 1 ? 's' : ''}:\n #{tx.inputs.map { |i| \" in: #{i.prev_out.bth}:#{i.prev_out_index}\" }.join(\"\\n \")}\n #{tx.out.count} output#{tx.out.count > 1 ? 's' : ''}:\n #{tx.outputs.map { |o| \"out: #{o.script.bth} / #{num(o.value, p)}\" }.join(\"\\n \")}\n Min tx fee: #{num(Bitcoin.network[:min_tx_fee], p)}\n Fee requested: #{num(f, p)} as \\\"#{fee}\\\"\n Fee left: #{num(left, p)}\n Tx size: #{size} bytes\n Unspent: #{num(unspent, p)}\n Amount: #{num(satoshi, p)}\n Target address: #{target}\n Change address is #{change}\")\n unless @dry\n Sibit::Json.new(http: @http, log: @log).post(\n URI('https://blockchain.info/pushtx'),\n tx.to_payload.bth\n )\n end\n tx.hash\n end", "def peel_away_univ_stubs(order, use_acct_credit) \n uni_orders = []\n order.line_items.select {|li| li.product.is_a?(UnivStub)}.each do |unistub_li|\n\n uni = unistub_li.product.university\n \n amount_of_regular_credit = use_acct_credit ?\n ((unistub_li.product.price < @usable_account_credit) ?\n unistub_li.product.price : @usable_account_credit ) : 0\n \n uni_order = charge_and_complete_univ_order(@customer,\n @credit_card,\n uni,\n { :amount => unistub_li.product.price } )\n order.line_items = order.line_items - [ unistub_li ]\n \n @usable_account_credit -= amount_of_regular_credit\n @customer.subtract_account_credit(amount_of_regular_credit, nil, 0 )\n \n uni_orders << uni_order\n\n # remove the LI\n unistub_li.destroy\n end\n uni_orders\n end", "def getnames(address)\n @resolvers.each do |resolver|\n names = []\n resolver.each_name(address) { |name| names << name }\n return names unless names.empty?\n end\n []\n end", "def get_tradelines_except(user_id)\n filtered_tradelines = []\n\n trade_lines.each do |x|\n if x.inventory_own.user_id != user_id\n filtered_tradelines << x\n end\n end\n return filtered_tradelines \n end", "def list_internal_transactions_by_address_with_http_info(blockchain, network, address, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InternalApi.list_internal_transactions_by_address ...'\n end\n # verify the required parameter 'blockchain' is set\n if @api_client.config.client_side_validation && blockchain.nil?\n fail ArgumentError, \"Missing the required parameter 'blockchain' when calling InternalApi.list_internal_transactions_by_address\"\n end\n # verify enum value\n allowable_values = [\"ethereum\", \"ethereum-classic\", \"binance-smart-chain\"]\n if @api_client.config.client_side_validation && !allowable_values.include?(blockchain)\n fail ArgumentError, \"invalid value for \\\"blockchain\\\", must be one of #{allowable_values}\"\n end\n # verify the required parameter 'network' is set\n if @api_client.config.client_side_validation && network.nil?\n fail ArgumentError, \"Missing the required parameter 'network' when calling InternalApi.list_internal_transactions_by_address\"\n end\n # verify enum value\n allowable_values = [\"mainnet\", \"mordor\", \"testnet\", \"goerli\"]\n if @api_client.config.client_side_validation && !allowable_values.include?(network)\n fail ArgumentError, \"invalid value for \\\"network\\\", must be one of #{allowable_values}\"\n end\n # verify the required parameter 'address' is set\n if @api_client.config.client_side_validation && address.nil?\n fail ArgumentError, \"Missing the required parameter 'address' when calling InternalApi.list_internal_transactions_by_address\"\n end\n # resource path\n local_var_path = '/blockchain-data/{blockchain}/{network}/addresses/{address}/internal'.sub('{' + 'blockchain' + '}', CGI.escape(blockchain.to_s)).sub('{' + 'network' + '}', CGI.escape(network.to_s)).sub('{' + 'address' + '}', CGI.escape(address.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'context'] = opts[:'context'] if !opts[:'context'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ListInternalTransactionsByAddressR'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiKey']\n\n new_options = opts.merge(\n :operation => :\"InternalApi.list_internal_transactions_by_address\",\n :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: InternalApi#list_internal_transactions_by_address\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def transactions_output(transactions, user)\n output = []\n transactions.each do |transaction|\n output << {\n transaction: transaction,\n balance: transaction.balance,\n balance_partner: transaction.balance.partner_for(user),\n message: transaction.transaction_message(user),\n description: transaction.description,\n creation_date: transaction.created_at.strftime(\" Created on: %-d %B %Y at %k:%M\"),\n edition_date: transaction.updated_at.strftime(\" Updated on: %-d %B %Y at %k:%M\"),\n creator: transaction.creator,\n editor: transaction.editor\n }\n end\n output\n end", "def reconcile\n done = 0\n errors = 0\n all(show_empty: true).each do |a|\n after = @sibit.balance(a[:address])\n unless after == a[:value]\n set(a[:address], after)\n yield(a[:address], a[:value], after, a[:hot])\n end\n done += 1\n rescue Sibit::Error => e\n @log.info(\"Failed to reconcile #{a[:address]} Bitcoin address: #{e.message}\")\n errors += 1\n end\n @log.info(\"Reconciled #{done} Bitcoin addresses (#{errors} errors)\")\n end", "def full_address_array\n [name, address1, address2, city_state_zip].compact\n end", "def full_address_array\n [name, address1, address2, city_state_zip].compact\n end", "def size_of(amount, sources)\n satoshi = satoshi(amount)\n builder = Bitcoin::Builder::TxBuilder.new\n unspent = 0\n size = 100\n utxos = Sibit::Json.new(http: @http, log: @log).get(\n URI(\"https://blockchain.info/unspent?active=#{sources.keys.join('|')}&limit=1000\")\n )['unspent_outputs']\n utxos.each do |utxo|\n unspent += utxo['value']\n builder.input do |i|\n i.prev_out(utxo['tx_hash_big_endian'])\n i.prev_out_index(utxo['tx_output_n'])\n i.prev_out_script = [utxo['script']].pack('H*')\n address = Bitcoin::Script.new([utxo['script']].pack('H*')).get_address\n i.signature_key(key(sources[address]))\n end\n size += 180\n break if unspent > satoshi\n end\n size\n end", "def retrieve_user_touts(uid, order=nil, per_page=nil, page=nil)\n response = get(\"/api/v1/users/#{uid}/touts\", query: {order: order, per_page: per_page, page: page})\n ITout::Touts.new.from_response(response)\n end", "def size_of(amount, sources)\n satoshi = satoshi(amount)\n builder = Bitcoin::Builder::TxBuilder.new\n unspent = 0\n size = 100\n utxos = get_json(\n \"/unspent?active=#{sources.keys.join('|')}&limit=1000\"\n )['unspent_outputs']\n utxos.each do |utxo|\n unspent += utxo['value']\n builder.input do |i|\n i.prev_out(utxo['tx_hash_big_endian'])\n i.prev_out_index(utxo['tx_output_n'])\n i.prev_out_script = [utxo['script']].pack('H*')\n address = Bitcoin::Script.new([utxo['script']].pack('H*')).get_address\n i.signature_key(key(sources[address]))\n end\n size += 180\n break if unspent > satoshi\n end\n size\n end", "def get_addresses apts\n return apts.map { |apt| apt.address }\n end", "def get_addresses\n User.includes(:address)\n .where.not(addresses: {city: [nil, \"\"]})\n .map { |user| user.address }\nend", "def get_transactions_from_user\n # Get transactions for all accounts the user has\n transactions_sent = current_user.sent_transactions\n transactions_received = current_user.received_transactions\n return transactions_sent + transactions_received\n end", "def build_for_empty_wallet(addresses, address_dest, path, xpubs = [])\n build_inputs(addresses)\n total, fee = build_fee(:send)\n raise Keoken::Error::NoToken if @tokens.empty?\n\n send(inputs: @inputs,\n path: path,\n output_amount: total - (fee.to_i * 2),\n address: nil,\n output_amount_to_addr2: fee.to_i,\n addr2: address_dest,\n script: token_script_for_inputs,\n xpubs: xpubs)\n end", "def index\n @user = current_user\n @bankAccounts = current_user.bank_accounts\n @transactions = []\n @bankAccounts.each do |acc|\n @transactions += acc.transactions\n end\n @transactions = @transactions.uniq\n @transactions.sort {|a,b| a.created_at <=> b.created_at}\n end", "def notification_email_addresses\n emails = []\n if self.billing_address.email.blank? and self.shipping_address.email.blank? and !self.user.nil?\n emails << self.user.email\n elsif self.shipping_address.nil? and !self.billing_address.email.blank?\n emails << self.billing_address.email\n else\n if (!self.user.nil? and !self.user.email.blank?)\n emails << self.user.email\n end\n emails << self.billing_address.email unless self.billing_address.email.blank?\n emails << self.shipping_address.email unless self.shipping_address.email.blank?\n end\n \n return emails.uniq\n end", "def call_address_service\n addresses = []\n success = call_ok?(:address_search, make_request) do |body|\n ServiceClient.iterate_element(body[:address_list]) do |address|\n add_address(addresses, address) unless address.nil?\n end\n end\n [success, addresses]\n end", "def users\n user_arr = []\n accounts.each do |s|\n user_arr << User.find(s.user.id)\n end\n user_arr\n end", "def get_all_user_tags(owner_user_id)\n tag_hashes = USER_TAGS.where(owner_user_id: owner_user_id).order(:tag_name).all\n\n tags = []\n tag_hashes.each do |tag|\n tags.push(UserTag.new(tag))\n end\n\n return tags\n end", "def all_wallet_balances\n\t\ttotals = Hash.new {|h,uuid| h[uuid] = 0 }\n\t\ttotals[ GENESIS_WALLET ] = INITIAL_AMOUNT\n\n\t\tself.each_block do |block|\n\t\t\tblock.transactions.each do |tr|\n\t\t\t\ttotals[ tr[:to] ] += tr[:amount]\n\t\t\t\ttotals[ tr[:from] ] -= tr[:amount]\n\t\t\tend\n\t\tend\n\n\t\treturn totals.transform_values {|val| Money.new(val, :zmz) }\n\tend", "def tx_stat( address )\n get(\"/txStat/#{address}\")\n end", "def transactions\n JSON.parse(call_blockchain_api(\"transactions\"))\n end", "def index\n @transactions = current_user.wallet.transactions\n\n end", "def from_addrs\n from ? [from].flatten : []\n end", "def output_for_outpoint(txin)\n unconfirmed_output = Toshi::Models::UnconfirmedOutput.prevout(txin)\n Bitcoin::Protocol::TxOut.new(unconfirmed_output.amount, unconfirmed_output.script) rescue nil\n end", "def get_addresses\n return [get_pubkey_address] if is_pubkey?\n return [get_hash160_address] if is_hash160? || is_namecoin?\n return get_multisig_addresses if is_multisig?\n []\n end", "def address_uxouts_with_http_info(address, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.address_uxouts ...'\n end\n # verify the required parameter 'address' is set\n if @api_client.config.client_side_validation && address.nil?\n fail ArgumentError, \"Missing the required parameter 'address' when calling DefaultApi.address_uxouts\"\n end\n # resource path\n local_var_path = '/api/v1/address_uxouts'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'address'] = address\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', 'application/xml', ])\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<Object>' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#address_uxouts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_transactions_from_user\n user = User.find(params[:user_id])\n transactions_sent = user.sent_transactions\n transactions_received = user.received_transactions\n return transactions_sent + transactions_received\n end", "def index\n @user_addresses = current_user.user_addresses\n end", "def scan_tx(client, tx)\n findings = []\n\n # Ignore miner data (less interesting).\n return [] if tx['vin'][0]['coinbase']\n\n outputs = tx['vout']\n # multisig, pubkeyhash, nulldata, nil\n outputs_by_type = outputs.group_by { |output| output['scriptPubKey']['type'] }\n outputs_by_type.keys.each {|type|\n # TODO: If vout.spentTxId, probably not data\n have_length_and_cksum, mime, filedata, filesize = scan_output_group(client, outputs_by_type[type])\n if mime\n if not whitelisted_mime?(mime) and not mime.start_with?('text/') and filedata.length > 40\n total = outputs_by_type[type].length\n spent = outputs_by_type[type].select{ |output| output.include?('spentTxId') }.length\n unspent = total - spent\n if unspent > spent\n puts ''\n puts \"#{tx['txid']} ******* Potentially interesting ******* #{mime}\"\n puts ''\n end\n end\n if filedata.length < filesize\n nexttx = tx\n while filedata.length < filesize\n nexttx = find_next_tx(client, nexttx)\n outputs = nexttx['vout']\n outputs_by_type = outputs.group_by { |output| output['scriptPubKey']['type'] }\n\n data = vouts_to_data(outputs_by_type[type])\n length, cksum = get_length_and_cksum(data)\n next_have_length_and_cksum = (length != nil)\n if next_have_length_and_cksum != have_length_and_cksum\n $stderr.puts '******* Length and cksum mismatch on multi-tx file ********'\n next\n end\n next_filedata = have_length_and_cksum ? data.byteslice(8, length) : data.byteslice(0..-1)\n filedata += next_filedata\n end\n end\n if filesize > 0\n skipto = 20 * (filesize / 20 + 1)\n if skipto < filedata.length\n leftoverdata = filedata.byteslice(skipto..-1)\n if Digest::RMD160.digest(filedata.byteslice(0, filesize)) == leftoverdata.byteslice(0, 160/8)\n # cryptograffiti\n skipto = 20 * (filesize / 20 + 2)\n if (skipto + 40) < filedata.length\n leftoverdata = leftoverdata.byteslice(20..-1)\n endidx = leftoverdata.index(\"\\x00\")\n endidx = (endidx - 1) if endidx != nil\n endidx = (leftoverdata.length - 40 - 1) if endidx == nil\n text = leftoverdata.byteslice(0..endidx).force_encoding('utf-8')\n if not text.valid_encoding?\n puts \"#{tx['txid']} Invalid encoding, skipping\"\n next\n end\n end\n end\n end\n filedata = filedata.byteslice(0, filesize)\n end\n if whitelisted_mime?(mime)\n if not text and text_mime?(mime)\n mime = nil\n endidx = filedata.index(\"\\x00\")\n endidx = (endidx - 1) if endidx != nil\n endidx = -1 if endidx == nil\n text = filedata.byteslice(0..endidx).force_encoding('utf-8')\n if not text.valid_encoding?\n puts \"#{tx['txid']} Invalid encoding, skipping\"\n next\n end\n next if has_ignored_prefix?(text)\n filedata = nil\n end\n findings += [\n {\n tx: tx['txid'],\n file_mime: mime,\n file_data: filedata,\n file_ext: file_extension(filedata, mime),\n text: text,\n time: tx['time']\n }\n ]\n # We found what we wanted in this tx\n return findings\n end\n end\n }\n findings\nend", "def offsetsList(ast)\n ast.filter(StructOffset).uniq.sort\nend", "def load_output_cache(txs)\n query = ''\n tx_seen = {}\n txs.each{|tx|\n if query.bytesize > (1024*512)\n # Postgres' max stack depth is 2MB by default.\n # Matt's b39 would otherwise crash us here.\n load_output_cache_from_query(query)\n query = ''\n end\n # Fetch immediate outputs for this tx.\n query += (query.empty? ? '' : ' OR ') + \"(hsh = '#{tx.hash}')\"\n tx_seen[tx.hash] = true\n tx.in.each{|txin|\n # Fetch all spent prev outs too.\n next if txin.coinbase?\n next if tx_seen[txin.previous_output]\n if query.bytesize > (1024*512)\n load_output_cache_from_query(query)\n query = ' '\n else\n query += ' OR '\n end\n query += \"(hsh = '#{txin.previous_output}' AND position = #{txin.prev_out_index})\"\n }\n }\n load_output_cache_from_query(query) if !query.empty?\n end", "def recent_tx(opts = {})\n from = opts.has_key?(:from) ? opts[:from] : 0\n count = opts.has_key?(:count) ? opts[:count] : DEFAULT_RECENT_TRANSACTIONS\n user = User.find_by(username: name)\n\n # make RPC calls to list transactions. some transactions are internal,\n # which we need to filter out\n raw_tx_list = []\n\n # a little ugly, but we have to page through results until we find enough\n # ones that are applicable to the target user\n begin\n batch = rpc.listtransactions(name, count, from)\n from += count\n\n raw_tx_list.push(*batch.select{ |i| i.has_key? 'txid' }) \n end while raw_tx_list.length < count and batch.length > 0\n\n # trim the list down to the required size\n raw_tx_list = raw_tx_list.first(count)\n \n # transform the raw data into transaction objects\n raw_tx_list.collect do |tx_data|\n # note: .new means unpersisted\n Transaction.new(txid: tx_data['txid'],\n user: user).apply_rpc_listtx_data! tx_data\n end\n end", "def select_addresses(order_or_user, addresses={})\n visit_addresses(order_or_user)\n\n select_address(addresses[:user_bill], :user, :bill) if addresses[:user_bill]\n select_address(addresses[:user_ship], :user, :ship) if addresses[:user_ship]\n select_address(addresses[:order_bill], :order, :bill) if addresses[:order_bill]\n select_address(addresses[:order_ship], :order, :ship) if addresses[:order_ship]\n\n submit_addresses(!addresses[:fail])\n end", "def aws_ou_list\n output = {}\n root_ou_id = @aws_org_client.list_roots.roots[0].id\n\n ou_recurse = lambda do |ous|\n ous.each do |ou_name, ou_id|\n children = aws_ou_list_children(ou_id, ou_name)\n unless children.empty?\n output.merge!(children)\n ou_recurse.call(children)\n end\n end\n end\n ou_recurse.call(root: root_ou_id)\n\n output\n end", "def get_users_for_repo(neo, repo)\n\n\tneo.traverse(repo, 'nodes', {\n\t\t:order => 'breadth first',\n\t\t:uniqueness => 'node global',\n\t\t:relationships => {\n\t\t\t:type => 'follows',\n\t\t\t:direction => 'in'\n\t\t},\n\t})\n\nend", "def visit_user_addresses(user)\n visit spree.edit_admin_user_path(user)\n expect_address_list\n\n expect_user_addresses(user)\n end", "def listtransactions(account = '' , count = 10, from = 0)\n @api.request 'listtransactions', account, count, from\n end", "def give_coins(from_addr, to_addr, coins, acc_balances)\n acc_balances[from_addr] = acc_balances[from_addr].to_i - coins.to_i\n acc_balances[to_addr] = acc_balances[to_addr].to_i + coins.to_i\n\n acc_balances\nend" ]
[ "0.8014979", "0.8006779", "0.7983811", "0.75588715", "0.75351995", "0.7373325", "0.7324532", "0.64809555", "0.6431202", "0.6269225", "0.6131479", "0.61166215", "0.61166215", "0.59714645", "0.5774702", "0.5766443", "0.5677136", "0.54803354", "0.54732054", "0.5461593", "0.54045784", "0.53987765", "0.53781414", "0.5359527", "0.5243598", "0.5214422", "0.51873004", "0.5182139", "0.5177634", "0.5163231", "0.50892127", "0.50677633", "0.5063321", "0.5056771", "0.49963662", "0.49807253", "0.49620697", "0.48944783", "0.48888233", "0.48448074", "0.48441434", "0.48140112", "0.4789787", "0.4767648", "0.47314835", "0.46992144", "0.46981093", "0.46917093", "0.46914384", "0.46765426", "0.46053806", "0.46037635", "0.46005622", "0.45991978", "0.4593936", "0.45879957", "0.45778397", "0.45690006", "0.45643106", "0.45583534", "0.45182493", "0.45065835", "0.44961533", "0.44842106", "0.44824818", "0.44736767", "0.44643658", "0.44643658", "0.44628257", "0.44457892", "0.44405237", "0.443616", "0.44314137", "0.4429556", "0.44286302", "0.44196922", "0.44051784", "0.44045126", "0.44010937", "0.4398455", "0.4392247", "0.43852362", "0.43777412", "0.43768167", "0.43579093", "0.43553507", "0.43532342", "0.4350676", "0.4348516", "0.434797", "0.43455732", "0.43421498", "0.4337906", "0.43297112", "0.43081662", "0.43035075", "0.43006888", "0.42929742", "0.42900792", "0.42741182" ]
0.7526553
5
Return a stored pdef
def definition(name) @pdef_registry[name.to_sym] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def definition\n return pj_info.definition\n end", "def get_definition\n\n end", "def parse (pdef)\n\n tree = case pdef\n when Array then pdef\n when String then parse_string(pdef)\n when Class then pdef.do_make\n when ProcessDefinition then pdef.do_make\n when SimpleExpRepresentation then pdef.do_make # legacy...\n else\n raise \"cannot handle pdefinition of class #{pdef.class.name}\"\n end\n\n tree = [ 'define', { 'name' => 'NoName', 'revision' => '0' }, [ tree ] ] \\\n unless get_expression_map.is_definition?(tree.first)\n #\n # making sure the first expression in the tree is a DefineExpression\n # (an alias for 'process-definition')\n\n tree\n end", "def get_definition(var, bld)\n if var.genGet == true && !var.isPointer\n varName = Utils.instance.getStyledVariableName(var)\n bld.add(\"public \" + Utils.instance.getTypeName(var) + \" \" + Utils.instance.getStyledFunctionName(\"get \" + var.name))\n bld.sameLine(\"()\\t{ return(\" + varName + \"); }\")\n end\n end", "def base_pdef\n return $data_enemies[@enemy_id].pdef\n end", "def get_definition(codeClass, cfg)\n readDef = String.new\n varArray = Array.new\n codeClass.getAllVarsFor(varArray);\n\n\treadDef << \"\\n\"\n\t\n readDef << \" public function create() {\\n\";\n readDef <<\n\t\t\t\"$serializer = JMS\\Serializer\\SerializerBuilder::create()->build();\n\t\t\t\t\t\"\n\t\t\t\"$data = $serializer->deserialize(file_get_contents('php://input'), '', 'json')\n\t\t\t\n\t\t\tforeach ($data as $varName => varValue)\n\t\t\t{\n\t\t\t}\"\n \n\t\t\t\"{ return($this->\" << varSec.name << \"); };\\n\"\n \n\n for varSec in varArray\n if varSec.elementId == CodeElem::ELEM_VARIABLE && varSec.genSet == \"true\"\n if !varSec.isPointer\n if varSec.arrayElemCount == 0\n readDef << \"( $new\" << XCTEPhp::Utils::getCapitalizedFirst(varSec.name)\n readDef << \")\\t{ $this->\" << varSec.name << \" = $new\" << XCTEPhp::Utils::getCapitalizedFirst(varSec.name) << \"; };\\n\"\n end\n end\n\n elsif varSec.elementId == CodeElem::ELEM_COMMENT\n readDef << \" \" << XCTEPhp::Utils::getComment(varSec)\n elsif varSec.elementId == CodeElem::ELEM_FORMAT\n readDef << varSec.formatText\n end\n end\n\n return(readDef);\n end", "def get_description\n\n pdef, prep = load_process_def\n\n OpenWFE::ExpressionTree.get_description prep\n end", "def ref\n @definition_name\n end", "def load_process_definition\n\n pdef, prep = load_process_def\n\n [ pdef, prep.to_a.to_json ]\n end", "def target_def; genomic.definition; end", "def get_definition(codeClass, bld)\n end", "def %(p0) end", "def %(p0) end", "def definition\n @definition ||= []\n end", "def get_definition(codeClass, cfg)\n eqString = String.new\n seperator = \"\"\n longArrayFound = false\n varArray = Array.new\n codeClass.getAllVarsFor(varArray)\n\n eqString << \"/**\\n* Defines the variables in an object\\n*/\\n\"\n eqString << \"void \" << codeClass.name << \" :: zero()\\n\"\n eqString << \"{\\n\"\n\n # if codeClass.hasAnArray\n # eqString << \" unsigned int i;\\n\\n\";\n # end\n\n varArray = Array.new\n codeClass.getAllVarsFor(varArray)\n\n for var in varArray\n if var.elementId == CodeElem::ELEM_VARIABLE\n if !var.isStatic # Ignore static variables\n if XCTECpp::Utils::isPrimitive(var)\n eqString << \" \" << var.name << \" = \" << XCTECpp::Utils::getZero(var) << \";\\n\"\n end\n end\n end\n end\n\n eqString << \"}\\n\\n\"\n end", "def definitions; end", "def definitions; end", "def definition_builder; end", "def definition_builder; end", "def current_definition\n self.class.definition\n end", "def base_pdef\n weapon = $data_weapons[@weapon_id]\n armor1 = $data_armors[@armor1_id]\n armor2 = $data_armors[@armor2_id]\n armor3 = $data_armors[@armor3_id]\n armor4 = $data_armors[@armor4_id]\n pdef1 = weapon != nil ? weapon.pdef : 0\n pdef2 = armor1 != nil ? armor1.pdef : 0\n pdef3 = armor2 != nil ? armor2.pdef : 0\n pdef4 = armor3 != nil ? armor3.pdef : 0\n pdef5 = armor4 != nil ? armor4.pdef : 0\n return pdef1 + pdef2 + pdef3 + pdef4 + pdef5\n end", "def getDefine(node)\n return @defTable[node.name] ;\n end", "def parse_string (pdef)\n\n pdef = pdef.strip\n\n return parse_xml(pdef) if pdef.match(X_START)\n return YAML.load(pdef) if pdef.match(Y_START)\n\n #(json = (OpenWFE::Json.from_json(pdef) rescue nil)) and return json\n return OpenWFE::Json.from_json(pdef) if pdef.match(J_ARRAY)\n\n #\n # else it's some ruby code to eval\n\n get_tree_checker.check(pdef)\n\n # no exception, green for eval...\n\n ProcessDefinition.eval_ruby_process_definition(pdef)\n end", "def get_definition(cls, bld, fun)\r\n get_body(cls, bld, fun)\r\n end", "def definitions() return @definitions end", "def query_def; mrna.definition; end", "def get_definition(codeClass, outCode)\n outCode.indent\n\n outCode.add(\"/**\")\n outCode.add(\"* Loads data into a cell in this data set\")\n outCode.add(\"*/\")\n\n outCode.add(\"public function loadCell($cellString, $errorList, $curRowIndex, $curCellIndex)\")\n outCode.add(\"{\");\n \n outCode.iadd(1, \"if (isset($cellString) && strlen(trim($cellString)) > 0)\");\n outCode.iadd(1, \"{\");\n outCode.iadd(2, \"switch($curCellIndex)\");\n outCode.iadd(2, \"{\");\n \n varNum = 0;\n\n varArray = Array.new\n codeClass.getAllVarsFor(varArray);\n\n for var in varArray\n if var.elementId == CodeElem::ELEM_VARIABLE\n \n if XCTEPhp::Utils::isPrimitive(var)\n outCode.iadd(3, \"case \" << varNum.to_s << \": $this->dataSet['\" << var.name << \"'] = \")\n outCode.iadd(3, \"$cellString; break;\") \n else\n outCode.iadd(3, \"case \" << varNum.to_s << \": $this->dataSet['\" << var.name << \"'] = \")\n outCode.sameLine(\"new \" << var.vtype << \"($cellString); break;\") \n end \n \n varNum = varNum + 1;\n end\n end\n \n outCode.iadd(3, \"default: break;\");\n \n outCode.iadd(2, \"}\");\n outCode.iadd(1, \"}\");\n \n outCode.add(\"}\");\n outCode.unindent\n end", "def get_program_def(name:)\n PROGRAMS[name]\n end", "def name\n definition.name\n end", "def target_def; seq2.definition; end", "def get_definition(codeClass, outCode)\n outCode.indent\n\n outCode.add(\"/**\")\n outCode.add(\"* Creates an insert statement for this classes data\")\n outCode.add(\"*/\")\n\n outCode.add(\"public function genInsert($cellString, $curCellIndex)\")\n outCode.add(\"{\");\n \n outCode.add(\" $inserts = \")\n outCode.add('\"INSERT INTO ' << codeClass.name << 'List VALUES (\";')\n # outCode.add(\"'.\\\\n\\\";\")\n \n varNum = 0\n\n# for var in codeClass.variableSection\n# if var.elementId == CodeElem::ELEM_VARIABLE\n# \n# if XCTEPhp::Utils::isPrimitive(var)\n# conDef << \" case \" << varNum.to_s << \": $this->dataSet['\" << var.name << \"'] = \"\n# conDef << \"$cellString; break;\") \n# else\n# conDef << \" case \" << varNum.to_s << \": $this->dataSet['\" << var.name << \"'] = \"\n# conDef << \"new \" << var.vtype << \"($cellString); break;\") \n# end \n# \n# varNum = varNum + 1;\n# end\n# end\n \n \n outCode.add(\"}\");\n\n return(conDef);\n end", "def name=(p0) end", "def name=(p0) end", "def = 3", "def definition; Mrowka::Lists[self.type.to_sym]; end", "def ppm(dataType, ppmType, varName, varAlias)\r\n dt = dataType.ljust(12)\r\n pt = ppmType.ljust(12)\r\n vn = varName.ljust(48)\r\n va = varAlias\r\n out = <<EOF\r\nppm #{dt}#{pt}#{vn}\"#{va}\";\r\nEOF\r\n\r\n out # Return generated output\r\n end", "def get_definition(cls, bld)\r\n clsVar = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n clsName = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n clsIntf = Utils.instance.createVarFor(cls, \"ts_interface\")\r\n\r\n bld.startFunction(\"initData(item: \" + Utils.instance.getStyledClassName(cls.model.name) + \"): void\")\r\n\r\n Utils.instance.eachVar(UtilsEachVarParams.new().wCls(cls).wBld(bld).wSeparate(true).wVarCb(lambda { |var|\r\n if var.isList()\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = [];\")\r\n else\r\n if Utils.instance.isNumericPrimitive(var)\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = 0;\")\r\n elsif var.getUType().downcase == \"boolean\"\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = false;\")\r\n elsif var.getUType().downcase == \"datetime\"\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = new Date();\")\r\n elsif Utils.instance.isPrimitive(var)\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = '';\")\r\n else\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) +\r\n \" = {} as \" + Utils.instance.getStyledClassName(var.getUType()) + \";\")\r\n varCls = ClassModelManager.findVarClass(var, \"ts_interface\")\r\n if varCls != nil\r\n vService = Utils.instance.createVarFor(varCls, \"class_angular_data_gen_service\")\r\n\r\n if vService != nil\r\n srcName = \"item.\" + Utils.instance.getStyledVariableName(var)\r\n bld.add(\"this.\" + Utils.instance.getStyledVariableName(vService) +\r\n \".initData(\" + srcName + \");\")\r\n end\r\n end\r\n end\r\n end\r\n }))\r\n\r\n bld.endFunction()\r\n end", "def query_def; @seq1.definition; end", "def defs; end", "def defs; end", "def default_definition() {} end", "def get_definition(fun, cfg)\n eDef = String.new\n\n indent = String.new(\" \")\n\n # Skeleton of comment block\n eDef << indent << \"#\\n\"\n eDef << indent << \"#\\n\"\n\n for param in fun.parameters\n eDef << indent << \"# \" << param.name << \":: \\n\"\n end\n\n if fun.returnValue.vtype != \"void\"\n eDef << indent << \"# \\n\" << indent << \"# return:: \\n\"\n end\n\n eDef << indent << \"def \"\n\n # Function body framework\n if fun.isStatic\n eDef << \"self.\"\n end\n\n eDef << fun.name << \"(\"\n\n for param in (0..(fun.parameters.size - 1))\n if param != 0\n eDef << \", \"\n end\n\n eDef << XCTERuby::Utils::getParamDec(fun.parameters[param])\n end\n\n eDef << \")\"\n\n eDef << \"\\n\"\n\n eDef << indent << \" \\n\"\n\n if fun.returnValue.vtype != \"void\"\n eDef << indent << \" return \\n\"\n end\n\n eDef << indent << \"end # \" << fun.name << \"\\n\\n\"\n\n return eDef\n end", "def generate_definition\n # return if not @type # ToDo: remove?\n @type.to_s + ' ' + code_name + \";\\n\"\n end", "def to_definition\n Definition.from(self)\n end", "def query_def; seq1.definition; end", "def parse_definition_list; end", "def definition(definition_name)\n @definition_name = definition_name\n end", "def mini_definition\n {\n '@type': schema_type,\n '@id': identifier,\n 'name': sanitize(title)\n }\n end", "def mini_definition\n {\n '@type': schema_type,\n '@id': identifier,\n 'name': sanitize(title)\n }\n end", "def pe_variable(pe)\n pe.name.squish.downcase.tr(\" \",\"_\").to_sym\n end", "def get_declaration(varSec, bld)\n if varSec.elementId == CodeElem::ELEM_VARIABLE && varSec.genSet == true\n funName = Utils.instance.getStyledFunctionName(\"get \" + varSec.name)\n varName = Utils.instance.getStyledVariableName(varSec)\n bld.add(\"const \" + Utils.instance.getTypeName(varSec) + \"& \" + funName)\n bld.sameLine(\"() const\\t{ return(\" + varName + \"); };\")\n end\n end", "def pobj\n rel 'pobj'\n end", "def get_definition(codeClass, cfg)\n readDef = String.new\n \n readDef << \"/**\\n* Reads this object from a stream\\n*/\\n\"\n readDef << \"void \" << codeClass.name << \" :: read\" + \"(ug::io::StreamReader* ugsr)\\n\"\n readDef << \"{\\n\"\n \n if codeClass.hasAnArray\n readDef << \" unsigned int i;\\n\\n\"\n end\n\n for par in codeClass.parentsList\n readDef << \" \" << par.name << \"::read(ugsr);\" << \"\\n\"\n end\n \n varArray = Array.new\n codeClass.getAllVarsFor(varArray);\n\n for varSec in varArray\n if varSec.elementId == CodeElem::ELEM_VARIABLE \n if varSec.isStatic # Ignore static variables\n readDef << \"\" \n elsif !varSec.isPointer \n if varSec.arrayElemCount > 0 \n if XCTECpp::Utils::isPrimitive(varSec) \n readDef << \"\\n for (i = 0; i < \" << XCTECpp::Utils::getSizeConst(varSec) + \"; i++)\\n\"\n readDef << \" ugsr -> read\" << XCTECpp::Utils::getTypeAbbrev(varSec)\n readDef << \"(\" << varSec.name << \"[i]);\\n\\n\"; \n else \n readDef << \"\\n for (i = 0; i < \" << XCTECpp::Utils::getSizeConst(varSec) + \"; i++)\\n\"\n readDef << \" \" + varSec.name << \"[i].read(ugsr);\\n\\n\";\n end\n else # Not an array \n if XCTECpp::Utils::isPrimitive(varSec)\n readDef << \" ugsr -> read\" << XCTECpp::Utils::getTypeAbbrev(varSec)\n readDef << \"(\" + varSec.name << \");\\n\" \n else \n readDef << \" \" << varSec.name << \".read(ugsr);\\n\";\n end\n end \n \n elsif varSec.isPointer \n readDef << \" // \" + varSec.name + \" -> read(ugsr);\\n\" \n else \n readDef << \"\\n\"\n end\n \n elsif varSec.elementId == CodeElem::ELEM_COMMENT\n readDef << \" \" << XCTECpp::Utils::getComment(varSec) \n elsif varSec.elementId == CodeElem::ELEM_FORMAT\n readDef << varSec.formatText\n end\n end\n \n readDef << \"}\\n\\n\";\n \n return readDef;\n end", "def get_definition(codeClass, cfg)\n conDef = String.new\n indent = \" \"\n\n conDef << indent << \"# Constructor\\n\"\n\n conDef << indent << \"def initialize()\\n\"\n\n varArray = Array.new\n codeClass.getAllVarsFor(varArray);\n\n for var in varArray\n if var.elementId == CodeElem::ELEM_VARIABLE\n if var.defaultValue != nil\n conDef << indent << \" @\" << var.name << \" = \"\n\n if var.vtype == \"String\"\n conDef << \"\\\"\" << var.defaultValue << \"\\\"\"\n else\n conDef << var.defaultValue << \"\"\n end\n\n if var.comment != nil\n conDef << \"\\t# \" << var.comment\n end\n\n conDef << \"\\n\"\n end\n end\n end\n\n conDef << indent << \"end # initialize\\n\\n\";\n\n return(conDef);\n end", "def definition_by_name(name)\n definitions_repository.get(name)\n end", "def new_definition(sax, author_id)\n Definition.new.tap do |definition|\n definition.author_id = author_id\n definition.text = sax.text\n definition.source = sax.source\n definition.uri = sax.uri\n end\nend", "def variable; end", "def variable; end", "def createDefinition(csdl = '')\n\t\t\tDataSift::Definition.new(self, csdl, false)\n\t\tend", "def create_definition(style); end", "def p4\n @p4\n end", "def _typedef\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_structdef)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_sequencedef)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_uniondef)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_forwarddef)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_typedef unless _tmp\n return _tmp\n end", "def instance_variable_get(p0) end", "def name\n definition[:name]\n end", "def query_def; @hit.mrna.definition; end", "def default=(p0) end", "def pfamily\n @family\n end", "def get_declaration(codeClass, cfg)\n return \"\"\n end", "def read_definition\n xml = Cheetah.run([\"sudo\", \"virsh\", \"dumpxml\", name], stdout: :capture)\n @definition = REXML::Document.new(xml)\n end", "def on_def(node); end", "def get_definition(cls, bld, fun)\r\n itemVar = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n clsVar = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n populateServiceVar = Utils.instance.createVarFor(cls, \"class_angular_data_map_service\")\r\n\r\n if clsVar != nil && populateServiceVar != nil\r\n bld.startFunction(\"populate(): void\")\r\n bld.add(\"this.\" + Utils.instance.getStyledVariableName(populateServiceVar) +\r\n \".populate(this.\" + clsVar + \" as FormGroup, this.item);\")\r\n\r\n bld.endFunction()\r\n end\r\n end", "def get_procedure_literal\r\n save, @buffer = @buffer, \"\"\r\n open_procedure_literal\r\n\r\n begin\r\n token = get_procedure_token\r\n due_token(token)\r\n end until token.has_tag?(:end)\r\n\r\n close_procedure_literal\r\n (_, @buffer = @buffer, save)[0]\r\n end", "def definition_provider\n attributes.fetch(:definitionProvider)\n end", "def set_field_definition\n @field_definition = FieldDefinition.find(params[:id])\n end", "def definition_cache\n @definition_cache ||= {}\n end", "def process_defn(exp)\n make_function exp\n end", "def get_definition()\n html_def = @noko.css(\"li.g:first-of-type\")\n local_word_info = Hash.new\n local_word_info[:title] = html_def.css(\"h3 span\")[0].text\n\n if local_word_info[:title].ascii_only?\n local_word_info[:title] = local_word_info[:title].upcase\n else\n local_word_info[:title] = make_readable(local_word_info[:title]).upcase\n end\n\n local_word_info[:types_definitions] = []\n html_def.css(\"tr\").each do |e|\n # puts e\n if e.to_s =~ /<div/\n definitions = Hash.new\n definitions[:type] = e.css(\"div\")[0].text.upcase\n definitions[:definitions] = []\n e.css(\"li\").each do |li|\n definitions[:definitions] << li.text\n end\n local_word_info[:types_definitions] << definitions\n end\n end\n\n return local_word_info\n end", "def define\n read_next.must_be_identifier!(\"def\")\n DefStmnt.create(ASTLeaf.new(read_next), param_list, block)\n end", "def file() = pathname.relative_path_from(Cnfs.config.paths.definitions)", "def paragraph; end", "def proc_descr ( code = proc_code )\n proc = Procedure.find_by(code: code )\t \n return proc.descr rescue '' \n end", "def base_mdef\n return $data_enemies[@enemy_id].mdef\n end", "def get_definition(codeClass, bld)\n eqString = String.new\n longArrayFound = false\n\n styledCName = Utils.instance.getStyledClassName(codeClass.name)\n\n bld.add(\"/**\")\n bld.add(\" * Sets this object equal to incoming object\")\n bld.add(\" */\")\n bld.startClass(\"const \" + styledCName +\n \"& \" + styledCName + \" :: operator=(const \" + styledCName + \"& src\" + styledCName + \");\")\n\n # if codeClass.hasAnArray\n # bld.add(\" unsigned int i;\\n\");\n # end\n\n for par in codeClass.baseClasses\n bld.add(\" \" << par.name << \"::operator=(src\" + styledCName << \");\")\n end\n\n varArray = Array.new\n codeClass.getAllVarsFor(varArray)\n\n for var in varArray\n if var.elementId == CodeElem::ELEM_VARIABLE\n fmtVarName = Utils.instance.getStyledVariableName(var)\n if !var.isStatic # Ignore static variables\n if Utils.instance.isPrimitive(var)\n if var.arrayElemCount.to_i > 0 # Array of primitives\n bld.add(\"memcpy(\" << fmtVarName << \", \")\n bld.sameLine(\"src\" << styledCName << \".\")\n bld.sameLine(fmtVarName << \", \")\n bld.sameLine(\"sizeof(\" + Utils.instance.getTypeName(var.vtype) << \") * \" << Utils.instance.getSizeConst(var))\n bld.sameLine(\");\")\n else\n bld.add(fmtVarName << \" = src\" << styledCName << \".\" << fmtVarName << \";\")\n end\n else # Not a primitive\n if var.arrayElemCount > 0 # Array of objects\n if !longArrayFound\n bld.add(\"unsigned int i;\")\n bld.add\n longArrayFound = true\n end\n bld.startBlock(\"for (i = 0; i < \" << Utils.instance.getSizeConst(var) << \"; i++)\")\n bld.add(fmtVarName + \"[i] = src\" + styledCName + \".\" + \"[i];\")\n bld.endBlock\n else\n bld.add(fmtVarName + \" = src\" + styledCName + \".\" + fmtVarName + \";\")\n end\n end\n end\n elsif var.elementId == CodeElem::ELEM_COMMENT\n bld.add(Utils.instance.getComment(var))\n elsif var.elementId == CodeElem::ELEM_FORMAT\n bld.add(var.formatText)\n end\n end\n\n bld.add\n bld.add(\"return(*this);\")\n bld.endBlock\n end", "def addProcedure()\n if (! @procedures.has_key?(@scope_location))\n # Copy the arguments to a temporal Hash\n temp_vars = Hash.new\n @arguments.each { |arg|\n temp_vars[arg[:id]] = arg.clone()\n # Copy the arguments from the signature to the local variables\n # even if they are references\n\n # Increment the counter of variables according with the data type\n if temp_vars[arg[:id]][:array]\n size = temp_vars[arg[:id]][:size]\n else\n size = 1\n end\n temp_vars[arg[:id]][:value] = @local_memory.getAddress(arg[:type], 'normal', size)\n temp_vars[arg[:id]].delete(:ref)\n }\n @procedures[@scope_location] = { id: @scope_location, args: @arguments.clone(),\n local_vars: temp_vars, return_type: @data_type, line: @lines_counter }\n # Also adds a global variable for the return data in case that the returning type is\n # diferent of void\n if @data_type != 'void'\n name = @scope_location + '_ret_swap'\n address = @global_memory.getAddress(@data_type)\n var_info = { id: name, type: @data_type, value: address }\n @global[name] = var_info\n end\n else\n abort(\"\\nERROR: Procedure '#{@scope_location}' already defined\\n\")\n end\n end", "def pword\n end", "def declaration; end", "def target_def; target.name; end", "def parslet; end", "def parslet; end", "def parslet; end", "def parslet; end", "def variable_name; end", "def variable_name; end", "def locals; end", "def locals; end", "def locals; end", "def define\n end", "def define\n end", "def declaration=(_arg0); end", "def define_variable(name)\n emit_section :data\n emit \"#{name}: .long 0x0\\n\"\n emit_section :text\nend" ]
[ "0.6696077", "0.6584004", "0.62652695", "0.6237746", "0.61041343", "0.57534575", "0.57519424", "0.57488763", "0.5720119", "0.57179016", "0.5680229", "0.56553876", "0.56553876", "0.5616365", "0.55804884", "0.5560979", "0.5560979", "0.5532538", "0.5532538", "0.552494", "0.551074", "0.54746586", "0.5446735", "0.54306", "0.5410911", "0.5393134", "0.5386091", "0.5351631", "0.53382695", "0.5327079", "0.5321303", "0.5310689", "0.5310689", "0.5308796", "0.53071964", "0.5286505", "0.52818865", "0.5278839", "0.5275374", "0.5275374", "0.5266856", "0.52453536", "0.5239737", "0.52375686", "0.52123594", "0.5192177", "0.5177735", "0.5134477", "0.5134477", "0.5131413", "0.5117579", "0.5115613", "0.51070505", "0.5093635", "0.50887096", "0.5087743", "0.50738883", "0.50738883", "0.50710803", "0.5064431", "0.5062712", "0.50518626", "0.5048116", "0.5043103", "0.50406873", "0.5039907", "0.5037411", "0.50346637", "0.5015266", "0.49964505", "0.49878153", "0.498353", "0.49657726", "0.49583548", "0.49497402", "0.49466273", "0.49353847", "0.4921973", "0.49218544", "0.49170688", "0.4915003", "0.49128354", "0.49091604", "0.4906793", "0.49033514", "0.49011865", "0.48997322", "0.48945916", "0.48945916", "0.48945916", "0.48945916", "0.48875055", "0.48875055", "0.4885164", "0.4885164", "0.4885164", "0.48829246", "0.48829246", "0.48785502", "0.48707247" ]
0.67768735
0
enum status: [:prop_waiting, :prop_accepted, :prop_refused, :app_waiting, :app_refused, :app_accepted, :direct_app_waiting, :direct_app_accepted, :direct_app_refused, :canceled]
def appointee_colored_icon(a) fa_icon, title = case when a.status.include?("prop_") ["fa-question-circle", "Proposta"] when a.status=="canceled" ["fa-times-circle", "Proposta/incarico annullato"] else ["fa-suitcase-rolling", "Incarico"] end fa_color = case when a.status=="direct_app" "green" when a.status.include?("_waiting") "grey" when a.status.include?("_accepted") "green" when a.status.include?("_refused") "red" when a.status=="canceled" "red" else "light-grey" end content_tag(:i, nil, class: "appointee-colored-icon fas #{fa_icon} fa-lg #{fa_color}", data: { toggle: "tooltip", placement: "top" }, title: title) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status_enum\n [\n [STATUSES.active],\n [STATUSES.resolved],\n [STATUSES.cancelled],\n [STATUSES.deleted]\n ]\n end", "def status_enum\n status_list\n end", "def statuses\n return ['canceled', 'completed'] if self.status == 'paid'\n return ['canceled', 'paid'] if self.status == 'ordered'\n end", "def status\r\n if @status == \"paid\"\r\n :completed\r\n elsif @tatus == \"refused\"\r\n :refused\r\n else\r\n :pending_payment\r\n end\r\n end", "def status_enum\n @status_enum ||= ApprovalState::STATES.invert\n return @status_enum\n end", "def allowed_status\n errors.add(:string, 'must be pending, accepted or declined.') unless %w[pending accepted declined].any?(status)\n end", "def possible_statuses\n\t\tcase self.status\n\t\twhen 'pending'\n\t\t\t['granted', 'denied']\n\t\twhen 'granted'\n\t\t\t['revoked']\n\t\twhen 'denied'\n\t\t\t['granted']\n\t\twhen 'revoked'\n\t\t\t['granted']\n\t\telse\n\t\t\t[]\n\t\tend\n\tend", "def statuses\n statuses = {\n \"Not started\" => 1,\n \"In Progress\" => 2,\n \"Finished\" => 3\n }\n return statuses\n end", "def status\n return :completed if completed?\n return :failed if failed?\n :pending\n end", "def status\r\n case status_id\r\n when 1; \"Sending\"\r\n when 2; \"Sent\"\r\n when 3; \"Bounced\"\r\n when 4; \"Opened\"\r\n when 5; \"Downloaded\"\r\n when 6; \"Send Failed\"\r\n else; \"Processing\"\r\n end\r\n end", "def status\n refund? ? 3 : redeemed? ? 1 : (used_status? ? 2 : 0)\n end", "def ineligible_statuses\n ['1 Day Loan',\n '1 Week No Renew',\n '1 Week No Renew Equip',\n '2 Day Loan',\n '24 Hour Loan',\n '3 Day Loan',\n 'Audio Recorder',\n 'Due at Closing',\n 'Journal Loan',\n 'Music CD/DVD',\n 'Pass',\n 'See Note Above',\n 'Two Week Loan']\n end", "def status_string\n case status\n when APPROVED_STATUS\n \"approved\"\n when REJECTED_STATUS\n \"rejected\"\n when REMOVED_STATUS\n \"removed\"\n when PENDING_STATUS\n \"pending\"\n else\n \"error\"\n end\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"waiting\", \"processing\", \"canceled\", \"failed\", \"succeeded\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for 'status', must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "def status\n if complete?\n \"PAID\"\n else\n \"PENDING\"\n end\n end", "def status\n { 'status' => success ? 'sent' : 'failed' }\n end", "def status\n if params['fraud_status'] == 'pass' || params['credit_card_processed'] == 'Y'\n 'Completed'\n elsif params['fraud_status'] == 'wait'\n 'Pending'\n else\n 'Failed'\n end\n end", "def states\n [\n 'CREATE_IN_PROGRESS',\n 'CREATE_IN_PROGRESS',\n 'CREATE_FAILED',\n 'CREATE_COMPLETE',\n 'ROLLBACK_IN_PROGRESS',\n 'ROLLBACK_FAILED',\n 'ROLLBACK_COMPLETE',\n 'DELETE_IN_PROGRESS',\n 'DELETE_FAILED',\n 'DELETE_COMPLETE',\n 'UPDATE_IN_PROGRESS',\n 'UPDATE_COMPLETE_CLEANUP_IN_PROGRESS',\n 'UPDATE_COMPLETE',\n 'UPDATE_ROLLBACK_IN_PROGRESS',\n 'UPDATE_ROLLBACK_FAILED',\n 'UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS',\n 'UPDATE_ROLLBACK_COMPLETE',\n 'REVIEW_IN_PROGRESS'\n ]\n end", "def invite_status\n if status == 'running'\n 'running'\n elsif status == 'applying'\n if Time.now < self.campaign.recruit_end_time\n 'applying'\n else\n 'end_apply'\n end\n elsif status == 'approved' && self.campaign.is_recruit_type?\n if Time.now < self.campaign.start_time\n 'apply_passed'\n else\n 'executing'\n end\n elsif status == 'approved'\n if !start_upload_screenshot\n 'approved_and_unstart_upload'\n elsif img_status == 'pending' && screenshot.blank?\n 'approved_and_can_upload'\n elsif img_status == 'pending' && screenshot.present?\n 'approved_and_uploaded'\n elsif img_status == 'passed'\n 'approved_and_passed'\n elsif img_status == 'rejected'\n 'approved_and_rejected'\n else\n 'unknown'\n end\n elsif status == 'finished'\n if !start_upload_screenshot\n 'finished_and_unstart_upload'\n elsif img_status == 'pending' && screenshot.blank?\n 'finished_and_can_upload'\n elsif img_status == 'pending' && screenshot.present?\n 'finished_and_uploaded'\n elsif img_status == 'rejected'\n 'finished_and_rejected'\n else\n 'unknown'\n end\n elsif status == 'settled'\n 'settled'\n elsif status == 'rejected'\n 'rejected'\n elsif status == 'missed'\n 'missed'\n else\n 'unknown'\n end\n end", "def status\n if waiting?\n :waiting\n elsif running?\n :running\n elsif done?\n :done\n end\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"not_activated\", \"done\", \"in_progress\", \"error\", \"paused\", \"stopped_by_system\", \"in_queue\", \"finished_with_warnings\", \"calculating\", \"stopped_by_user\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for \\\"status\\\", must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "def status_allowed(state)\n allowed_states = case status\n when 'legacy'\n ['deleted']\n when 'provisional'\n ['pending', 'approved', 'deleted']\n when 'pending'\n ['approved', 'deleted']\n when 'approved'\n ['interred', 'deleted']\n when 'interred'\n ['completed', 'deleted']\n when 'completed'\n ['deleted']\n else\n []\n end\n \n allowed_states << status if self.class.valid_states.include?(state)\n allowed_states.include? state\n end", "def status\n state = (active_instance.nil? ? 999 : active_instance.status)\n case state\n when 0 \n 'missing'\n when 1 \n 'none'\n when 2 \n 'pending'\n when 3 \n 'unready'\n when 4 \n 'failed'\n when 5 \n 'ready'\n when 666 \n 'deleted'\n when 999\n 'inactive'\n else \n 'hold'\n end\n end", "def status\n if self.started_at.nil? and self.stopped_at.nil?\n 'Pending'\n elsif self.started_at.present? and self.stopped_at.nil?\n 'Active'\n elsif self.started_at.present? and self.stopped_at.present?\n 'Completed'\n end\n end", "def status(*status)\n all.select { |b| status.include?(b.status) }\n end", "def status_options\n [\n {label: 'To-do', value: 'todo'},\n {label: 'In Progress', value: 'inprogress'},\n {label: 'To Verify', value: 'toverify'},\n {label: 'Done', value: 'done'}\n ]\n end", "def status_enum=(status)\n write_attribute(:status, status)\n end", "def status\n\t\treturn \"Pending\" if !completed\n\t\t\"Completed\"\n\tend", "def status\n case @status\n when 0 then :off\n when 1 then :on\n end\n end", "def stringify_status(status_code)\n case status_code\n when 0\n 'paused'\n when 1\n 'not_checked_yet'\n when 2\n 'up'\n when 8\n 'seems_down'\n when 9\n 'down'\n else\n 'unknown'\n end\nend", "def status\n return :cancelled if cancelled?\n return :closed if closed?\n return :active if active?\n\n # If the establishment is not active, closed, or cancelled it is pending\n :pending\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"Incomplete\", \"Not-Found\", \"Not-Listed\", \"Validated\", \"Not-Evaluated\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for \\\"status\\\", must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "def fulfillment_status=(value)\n\t\tpotential_status = [:pending, :paid, :processing, :shipped, :complete]\n\t\tif potential_status.include? value\n\t\t\t@fulfillment_status=(value)\n\t\telse\n\t\t\traise ArgumentError,\"Status is bogus\"\n\t\tend\n\tend", "def set_status\n @status= {\n 'Unstarted' => 0,\n 'In Progress' => 1,\n 'Completed' => 2\n }\n end", "def status\n STATUSES[self.status_id]\n end", "def convert_vapp_status(status_code)\n case status_code.to_i\n when 0\n 'suspended'\n when 3\n 'paused'\n when 4\n 'running'\n when 8\n 'stopped'\n when 10\n 'mixed'\n else\n \"Unknown #{status_code}\"\n end\n end", "def convert_vapp_status(status_code)\n case status_code.to_i\n when 0\n 'suspended'\n when 3\n 'paused'\n when 4\n 'running'\n when 8\n 'stopped'\n when 10\n 'mixed'\n else\n \"Unknown #{status_code}\"\n end\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"active\", \"paused\", \"ready\", \"delivered\", \"cancelled\", \"reverted\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for 'status', must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "def status\n raise \"Status not set for #{self.inspect}\" if @status == :nil\n raise \"Not allowed status: #{@status} for #{self.inspect}\" unless ALLOWED.include?(@status)\n @status\n end", "def status_flags\n\tstatus_bits_to_flags(self.status)\n end", "def friendly_status\n\n case self.status\n when \"no response\"\n \"You have not responded\"\n when \"reserve\"\n \"Reserved\"\n when \"decline\"\n \"Declined\"\n else\n \"Unknown\"\n end\n\n end", "def status\n STATUSES[self.status_id || 0]\n end", "def status\n value_for('status')\n end", "def acceptable?\n status.to_sym.in? [StatusReponded]\n end", "def status=(val)\n unless [nil, :frozen, :live].include?(val)\n raise ArgumentError.new(\"Status must be :frozen or :live\") \n end\n @status = val\n end", "def convert_status(status)\n case status\n when '-1'\n return :failure\n when '0'\n return :unknown\n when '1'\n return :working\n when '2'\n return :complete\n else\n return :error\n end\n end", "def statuses\n calculated = Array(read_attribute(:statuses))\n calculated.delete(Contact::OK)\n calculated.delete(Contact::LINKED)\n calculated << Contact::OK if calculated.empty?# && valid?\n calculated << Contact::LINKED if linked?\n\n calculated.uniq\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', ['new', 'used', 'expired'])\n unless validator.valid?(status)\n fail ArgumentError, 'invalid value for \"status\", must be one of #{validator.allowable_values}.'\n end\n @status = status\n end", "def descriptively_ok=(status)\n self.acceptance = (acceptance & PRESCRIPTIVE) | (status.to_i * DESCRIPTIVE)\n end", "def statuses; end", "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"LIVE\", \"QUARANTINED\", \"REMOVED\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for 'status', must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "def is_status_valid(status)\n [\"DISPONIBLE_RET_DESP\" ,\"PAGADO\", \"ENVIADO\", \"ENTREGADO\"].include?(status)\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', ['pending', 'active', 'inactive'])\n unless validator.valid?(status)\n fail ArgumentError, 'invalid value for \"status\", must be one of #{validator.allowable_values}.'\n end\n @status = status\n end", "def status_value(status)\n if status\n \"Active\"\n else\n \"Disabled\"\n end\n end", "def status_sym\n (status || :off).to_sym\n end", "def allowed_status_flows(start=nil)\n start||=status\n permitted=*self.class.allowed_status_flows[start.to_sym]\n end", "def progress_codes\n %w[\n EN_ROUTE\n AVAILABLE_FOR_DELIVERY\n DELAYED\n EXPECTED_DELAY\n ]\n end", "def status_desc\n case self.proposal_status\n when 0\n 'Pending'\n when 1\n 'Accepted'\n when 2\n 'Declined'\n end\n end", "def default_status\n\t\tself.status = \"Pending\"\n end", "def status_name\n STATUSES[status]\n end", "def check_status(status)\n case status.to_i\n when 1 # Valid\n true\n when 2 # Rejected\n false\n when 3 # Differed\n false\n when 4 # Test\n false\n else\n false\n end\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', ['NotDefined', 'Active', 'Resolved', 'Closed'])\n unless validator.valid?(status)\n fail ArgumentError, 'invalid value for \"status\", must be one of #{validator.allowable_values}.'\n end\n @status = status\n end", "def status\n\t\t:not_acceptable\n\tend", "def status\n\t\t:not_acceptable\n\tend", "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"Active\", \"ActiveUnderContract (Backup-Offer)\", \"Pending\", \"Hold\", \"Withdrawn\", \"Closed\", \"Expired\", \"Delete\", \"Incomplete\", \"ComingSoon\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for 'status', must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', ['unknown', 'not-vulnerable', 'vulnerable', 'vulnerable-version', 'vulnerable-potential', 'vulnerable-with-exception-applied', 'vulnerable-version-with-exception-applied', 'vulnerable-potential-with-exception-applied'])\n unless validator.valid?(status)\n fail ArgumentError, 'invalid value for \"status\", must be one of #{validator.allowable_values}.'\n end\n @status = status\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', ['unknown', 'archived', 'underOffer', 'sold', 'leased', 'newDevelopment', 'recentlyUpdated', 'new', 'live', 'pending'])\n unless validator.valid?(status)\n fail ArgumentError, 'invalid value for \"status\", must be one of #{validator.allowable_values}.'\n end\n @status = status\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"ACTIVE\", \"INVOICED\", \"LOCKED\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for \\\"status\\\", must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "def status=(value)\n value = value.to_s.to_sym\n fail Deployment::InvalidArgument, \"#{self}: Invalid task status: #{value}\" unless ALLOWED_STATUSES.include? value\n status_changes_concurrency @status, value\n @status = value\n reset_forward if DEPENDENCY_CHANGING_STATUSES.include? value\n @status\n end", "def status\n uniform_status? ? statuses.first : :bad_request\n end", "def status_types(result_type = [:in_progress, :success, :failure])\n result_type = [result_type] unless result_type.is_a?(Array)\n results = []\n for t in result_type\n raise \"Invalid status type. Must be one of :in_progress, :success, or :failure.\" unless [:in_progress, :success, :failure].include?(t)\n raw = read_attribute(\"#{t}_application_status_types\")\n next if raw.blank?\n arr = []\n results << ApplicationStatusType.find_all_by_name(raw.split(/[\\n\\|\\s]/)).collect(&:name)\n end\n results.flatten\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"processed\", \"rendered\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for \\\"status\\\", must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "def determine_status_color( status )\n case status\n when 'pending' then return '#cea61b'\n when 'error' then return '#bd2c00'\n when 'success' then return '#6cc644'\n end\nend", "def status\n case completed_rounds.size\n when 0 then :hasnt_started\n when ROUNDS.size then :completed\n else :in_progress\n end\n end", "def status\n if canceled.present?\n return 'canceled'\n elsif returned.present?\n return 'returned'\n elsif due_back?\n return 'due back'\n elsif shipped.present?\n return 'shipped'\n elsif authorized\n return 'placed'\n else\n return 'placed'\n end\n end", "def status\n return \"draft\" if self.draft?\n return \"sent\" if self.sent?\n return \"batch\" if self.batch_sent?\n end", "def current_status\n case status\n when NOT_STARTED\n return 'Game not started yet'.freeze\n when RUNNING\n return 'Game is running'.freeze\n when WIN\n return 'Game is won'.freeze\n when DRAWN\n return 'Game is drawn'.freeze\n when ABANDONED\n return 'Game is abandoned'.freeze\n end\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"ACTIVE\", \"EXPIRED\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for \\\"status\\\", must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "def prescriptively_ok=(status)\n self.acceptance = (acceptance & DESCRIPTIVE) | (status.to_i * PRESCRIPTIVE) \n end", "def get_status\n fetch_status unless status == :completed\n status\n end", "def get_status\n fetch_status unless status == :completed\n status\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', ['available', 'assigned', 'activated', 'deprecated'])\n unless validator.valid?(status)\n fail ArgumentError, 'invalid value for \"status\", must be one of #{validator.allowable_values}.'\n end\n @status = status\n end", "def change_status\n\t\tif status.include?(\"available\")\n\t\t\tstatus = \"checked_out\"\n\t\telsif status.include?(\"checked_out\")\n\t\t\tstatus = \"available\"\n\t\tend\n\tend", "def status_final_state\n return unless status_changed?\n return unless %w(denied missed returned archived).include?(status_was)\n errors.add(:base, \"Cannot change status of #{status_was}\"\\\n \" reservation.\\n\")\n end", "def calculated_status\n if deliveries.any? {|delivery| delivery.status == \"not_sent\" }\n \"not_sent\"\n elsif deliveries.any? {|delivery| delivery.status == \"unknown\" }\n \"unknown\"\n elsif deliveries.any? {|delivery| delivery.status == \"hard_bounce\" }\n \"hard_bounce\"\n elsif deliveries.any? {|delivery| delivery.status == \"soft_bounce\" }\n \"soft_bounce\"\n elsif deliveries.all? {|delivery| delivery.status == \"delivered\" }\n \"delivered\"\n else\n raise \"Unexpected situation\"\n end\n end", "def status\n return :not_confirmed unless confirmed?\n return :disabled unless enabled?\n \n :enabled\n end", "def status\n if params['payment_status'] == \"COMPLETE\"\n \"Completed\"\n else\n \"Failed\"\n end\n end", "def display_status(item_status_code)\n case item_status_code\n when 'I' # Initiated (Assigned)\n 'incomplete'\n when 'A', 'R' # Active (Processing) / Received\n 'beingProcessed'\n when 'C', 'W' # Completed / Waived\n 'completed'\n when 'Z' # Incomplete\n 'furtherActionNeeded'\n else\n 'incomplete'\n end\n end", "def next_status\n (skipping_absentee_registration? ? VotePending : STATUSES[self.status::ID + 1]) || self.status\n end", "def status\n STATUSES[code] || 'Unknown'\n end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def state\n case pipeline.status\n when 'scheduled', 'created', 'pending', 'preparing', 'waiting_for_resource' then 'pending'\n when 'running' then 'in_progress'\n when 'success' then 'successful'\n when 'failed' then 'failed'\n when 'canceled', 'skipped' then 'cancelled'\n else\n 'unknown'\n end\n end", "def status_map(status)\n case status\n when nil then 'pass'\n when :passed then 'pass'\n when :failed then 'fail'\n when :undefined then 'error'\n when :skipped then 'ignore'\n when :comment then 'ignore'\n else 'pass'\n end\n end", "def get_status status_code\n status = STATUSES[status_code]\n if status\n status\n else\n status = STATUSES['IV']\n end\n end", "def status\n \"approved\"\n end", "def status\n statuses = []\n transactions.where(action: 'purchase').each do |t|\n statuses << (t.is_refunded ? 'Refunded' : 'Valid')\n end\n if statuses.uniq.length > 1\n 'Partially Refunded'\n else\n (statuses.uniq == ['Refunded']) ? 'Fully Refunded' : 'Valid'\n end\n end", "def status\n status = stats.fetch @resource[:name], nil\n debug \"Got status: '#{status}'\"\n return :absent unless status\n return :present if [:present, :absent].include? @resource[:ensure]\n return :up if status == 'UP'\n return :down if status == 'DOWN'\n :present\n end", "def status(*code)\n self.status_code = code.first if code.first.present?\n self.status_code\n end", "def status\n return :code => info[:statuscode].to_i, :messages => info[:messages]\n end", "def status_str\n case self.status\n when ACTIVE\n \"Active\"\n when INACTIVE\n \"Inactive\"\n when CLOSED\n \"Closed\"\n when NO_STRIPE\n \"No Stripe Account\"\n when UNKNOWN\n \"Unknown\"\n else\n \"Invalid\"\n end\n end" ]
[ "0.7980789", "0.74826306", "0.74757695", "0.7213033", "0.7167568", "0.70960367", "0.70032775", "0.69916046", "0.6886648", "0.6799852", "0.67238784", "0.668713", "0.66799235", "0.6661175", "0.6635721", "0.6624297", "0.6596435", "0.6593171", "0.6591134", "0.6584354", "0.65669996", "0.6545363", "0.65392053", "0.65370554", "0.6534247", "0.65185857", "0.6518583", "0.6478159", "0.6459235", "0.64590454", "0.6449509", "0.64393115", "0.6435524", "0.64318925", "0.64019233", "0.639358", "0.639358", "0.63866943", "0.6383068", "0.6381031", "0.637143", "0.6365544", "0.6364349", "0.63548756", "0.6330082", "0.63252825", "0.6314866", "0.63086325", "0.6306965", "0.6306712", "0.630489", "0.6298629", "0.629644", "0.6295366", "0.6291895", "0.62795156", "0.6267232", "0.62670124", "0.62620336", "0.6260941", "0.6260667", "0.6240752", "0.62401295", "0.62401295", "0.62320423", "0.622867", "0.6226597", "0.62173104", "0.6212216", "0.6210981", "0.6208071", "0.620586", "0.61960363", "0.6194821", "0.6192739", "0.61906856", "0.6189147", "0.6182654", "0.6181707", "0.6181677", "0.6181677", "0.61709553", "0.617029", "0.6165178", "0.6158386", "0.61572427", "0.6156848", "0.61555797", "0.61366326", "0.61282873", "0.6123551", "0.6123551", "0.61215544", "0.6101858", "0.60970384", "0.60950613", "0.60940385", "0.608828", "0.6083371", "0.6079928", "0.607733" ]
0.0
-1
just one logo for store
def one_logo if self.class_type == 'logo' && Multimedium.find_all_by_class_type('logo').count > 0 self.errors.add(:base, "This store already has one logo") false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logo; end", "def logo; end", "def logo\n\t\ts = image_tag('rails.png', :alt => \"Online Orders Application\")\n\t\treturn s\n\tend", "def logo\r\n \tlogo = image_tag(\"logo.png\", :alt => \"mens fashion today\", :class => \"round\")\r\n end", "def logo\n\t\timage_tag(\"logo.png\", :alt => \"jobradar\", :class => \"round\")\n\tend", "def logo_url\n logo? ? h.image_tag(logo.thumb_medium, alt: 'Logo', width: 90) :\n h.content_tag(:span, initial, class: 'brand_img_holder', style: 'width:43px; height:43px;')\n end", "def logo\n content_tag(:span, \"HASTINGS FINE HOMES\", class: \"logo\")\n end", "def sp_logo\n sp.logo || DEFAULT_LOGO\n end", "def logo\n return @logo\n end", "def logo\n get_attribute(Yoti::Attribute::APPLICATION_LOGO)\n end", "def logo_url\n @shop.dig('logo_url','url')\n end", "def logo\n logo=image_tag(\"rails.png\" , :alt=>\"Sample app\" ,:class=>\"round\")\n end", "def get_logo_display\n\t\tif !logged_in?\n\t\t\treturn \"City Produce\"\n\t\tend\n\t\tif current_user.admin?\n\t\t\treturn \"Admin\"\n\t\tend\n\t\treturn \"Home\"\n\tend", "def logo_tag\n image_tag \"rails.png\", :alt => @page_title\n end", "def logo\n image_tag(\"logo.png\", :alt => \"Sample App\", :class => \"round\")\n end", "def logo\n image_tag(\"logo.png\", :alt => \"Sample App\", :class => \"round\")\n end", "def logo\n logo = image_tag(\"background.png\", :alt => \"background\")\n end", "def logo\n \"This is a cool logo !\"\n end", "def logo=(value)\n @logo = value\n end", "def logo_url style = :original\n logo.url(style, timestamp: false)\n end", "def logo_path\n root_path\n end", "def logo_path\n root_path\n end", "def logo_path\n root_path\n end", "def logo_link\n root_path\n end", "def logo\n image_tag(\"boulder.png\", :width => \"100\", \n :height => \"75\",\n :alt => \"Learning RoR\", \n :class => \"round\")\n end", "def g_home_logo(page_title)\n if page_title.empty?\n '<a href=\"#\"><img class=\"brand\" width=\"26\" src=\"/assets/botflip-logo.svg\"></a><a href=\"#\" class=\"brand\">Miniflip</a>'.html_safe\n # link_to \"MiniFeed\", \"#\", class: \"brand\"\n else\n '<a href=\"/\"><img class=\"brand\" width=\"26\" src=\"/assets/botflip-logo.svg\"></a><a href=\"/\" class=\"brand\">Miniflip</a>'.html_safe\n end\n end", "def logo=(_arg0); end", "def logo\n raw_team['team_logo']\n end", "def logo\n rand_num = Random.rand(76) + 1\n \"http://www.biz-logo.com/examples/#{ rand_num < 10 ? \"00\" : \"0\" }#{rand_num}.gif\"\n end", "def interchange_logo\n q = []\n q << \"[#{image_path(\"#{website.folder}/logo.png\")}, (default)]\"\n q << \"[#{image_path(\"#{website.folder}/logo.png\")}, (large)]\"\n q << \"[#{image_path(\"#{website.folder}/logo.png\")}, (medium)]\"\n q << \"[#{image_path(\"#{website.folder}/logo-sm.png\")}, (only screen and (max-width: 720px))]\"\n\n image_tag('', #\"#{website.folder}/logo.png\",\n class: \"no-resize no-resize-for-small\",\n alt: Setting.site_name(website),\n data: { interchange: q.join(\", \") })\n end", "def interchange_logo\n q = []\n q << \"[#{image_path(\"#{website.folder}/logo.png\")}, (default)]\"\n q << \"[#{image_path(\"#{website.folder}/logo.png\")}, (large)]\"\n q << \"[#{image_path(\"#{website.folder}/logo.png\")}, (medium)]\"\n q << \"[#{image_path(\"#{website.folder}/logo-sm.png\")}, (only screen and (max-width: 720px))]\"\n\n image_tag('', #\"#{website.folder}/logo.png\",\n class: \"no-resize no-resize-for-small\",\n alt: Setting.site_name(website),\n data: { interchange: q.join(\", \") })\n end", "def settings_logo\n @page_title = _('Logo_settings')\n @logo = Confline.get_value(\"Logo_Picture\")\n end", "def display_course_logo(course)\n content_tag(:span, class: ['image']) do\n image_tag(course.logo.medium.url || 'course_default_logo.svg')\n end\n end", "def logo_url\n @attributes[:logo_url]\n end", "def casein_config_logo\n \t'/images/logo_ss.jpg'\n end", "def select_logo_title\n\t\tdefine_area\n\t\tif @area == 'model'\n\t\t\tlogo_title = t('layouts.main_filters.collection')\n\t\telsif @area == 'creation'\n\t\t\tlogo_title = t('layouts.main_filters.creation')\n\t\telsif @area == 'accessory' || @area == 'fabric' || @area == 'workshop'\n\t\t\tlogo_title = t('layouts.main_filters.shop')\n\t\tend\n\tend", "def logo\n image_tag('rubyLogo.png', alt: 'Ruby on Rails Sample App', class: 'round', height: \"50px\")\n end", "def application_logo(classes)\n if cookies[:layout] == 'application' || cookies[:layout].nil?\n image_tag(asset_pack_path('media/images/duszek-awesome.svg'), class:\"#{classes}\")\n else\n image_tag(asset_pack_path('media/images/duszki.png'), class:\"#{classes}\")\n end\n end", "def get_logo\n Oneclick::Application.config.ui_logo\n end", "def organisation_logo\n session[:organisation][:name]\n end", "def get_logo_for_season_type\n if object.season_type && object.season_type.code =~ /CSI/i\n h.image_tag( 'logo_csi.png', size: '25x16' )\n elsif object.season_type && object.season_type.code =~ /FIN/i\n h.image_tag( 'logo_fin.png', size: '40x16' )\n elsif object.season_type && object.season_type.code =~ /UISP/i\n h.image_tag( 'logo_uisp.png', size: '40x16' )\n elsif object.season\n object.season.get_season_type\n else\n ''\n end\n end", "def logo_url\n logo? ? logo.url : profile_img\n end", "def show_logo\n\tcompany = company_from_subdomain\n\tclient = Customer.find(params[:id], :conditions => [\"company_id = ?\", company.id])\n\n unless client.logo?\n render :nothing => true\n return\n end\n\n image = Magick::Image.read( client.logo_path ).first\n if image\n send_file client.logo_path, :filename => \"logo\", :type => image.mime_type, :disposition => 'inline'\n else\n render :nothing => true\n end\n image = nil\n GC.start\n end", "def logo\n rand_num = rand(1..13)\n \"https://pigment.github.io/fake-logos/logos/medium/color/#{rand_num}.png\"\n end", "def beer_logo_path\n self.logo_path.url(:medium)\n end", "def company_customization_primary_logo\n @company && @company.customizations&.primary_header_logo\n end", "def logo_url\n if user_signed_in?\n current_user\n elsif admin_signed_in?\n current_admin_user\n else\n root_url\n end\n end", "def logo_link\n link_to(logo_img, view_context.root_path)\n end", "def logo_path(ngo)\n if ngo.image.attached?\n Rails.application.routes.url_helpers.rails_blob_path(ngo.image, only_path: true)\n else\n ActionController::Base.helpers.image_path('image_not_found.png')\n end\n end", "def create_logo(text)\n tag = 'h1' if item.identifier == '/'\n tag ||= 'div'\n\n \"<\" + tag + \" id=\\\"logo\\\"><a href=\\\"/\\\">\" + text + \"</a></\" + tag + \">\"\n end", "def logo_builder\n ManifestBuilder::LogoBuilder\n end", "def logo_base_64\n 'data:image/png;base64, ' + Base64.encode64(File.open(\"#{Rails.root}/app/assets/images/logo_orgao.png\", 'rb').read).to_s\n end", "def logo=(v)\n @logo = v ? URI.parse(v) : nil\n end", "def user_logo(user)\n image_tag(user.avatar_url)\n end", "def logo \n logo = @@doc.xpath(\"//div[contains(@id, 'logo')]\")\n logo += @@doc.xpath(\"//div[contains(@class, 'logo')]\")\n # najdenie href = .... skript\n logo_href = logo.xpath(\".//a//@href\")\n logo_src = logo.xpath(\".//img//@src\")\n\n lg = @@doc.at_xpath(\"//*[contains(@src, 'logo')]\")\n #lg += @@doc.xpath(\"//*[contains(@style, 'logo')]\")\n\n # checking if any logo was found\n if logo_src.size != 0\n template_logo = Hash.new\n template_logo[:written] = false\n if logo_href.size != 0 \n template_logo[:href] = logo_href.to_s\n template_logo[:href_sign] = true\n end\n template_logo[:src] = @@name + logo_src.to_s\n template_logo[:image] = true\n else \n template_logo = Hash.new\n template_logo[:image] = false\n end\n\n if lg != nil\n template_logo = Hash.new\n template_logo[:written] = false\n link = lg.parent\n \n template_logo[:href] = link.xpath('.//@href').to_s\n template_logo[:href_sign] = true\n\n template_logo[:src] = @@name + link.xpath('.//@src').to_s\n template_logo[:image] = true\n end\n\n # if no logo was found then make home with domain name \n if template_logo[:image] == false && lg == nil\n template_logo[:written] = true\n template_logo[:name] = @@name\n template_logo[:src] = @@page_name.capitalize\n end\n\n # sending logo info into template\n template_logo\n end", "def set_logo\n @logo = Logo.find(@company.logo_id) # NOTE: this raises a 404 if there's no logo,\n # which is what we want here.\n end", "def header\n image \"#{Rails.root}/app/assets/images/giftgardensmall.jpg\", \n width: 40, height: 40\n move_up 30\n text \"Activities Report\", size: 24, style: :bold, :align => :center\n end", "def build_logo\n if @logo && !@logo.empty?\n bottom = @document.note.empty? ? 75 : (75 + note_height)\n @pdf.image(@logo, at: [0, bottom], fit: [x(200), y(50)])\n end\n end", "def header\n\t\tlogo_path = Rails.root.join('app','assets','images','longbourn_logo.png')\n\t\timage logo_path, :width => 70, :height => 45\n\t\tdraw_text \"Informe de Desempeño de Alumnos\", :at => [100,25], size:12\n\t\tdraw_text \"Longbourn Institute\", :at => [100,10], size:12\n\tend", "def flow_get_jumbo_image\n if !params[:page] && request.path == '/'\n '/jumbo/home.jpg'\n else\n return nil unless @taxon\n image = @taxon.icon(:original)\n image.include?('default_taxon.png') ? nil : image\n end\n end", "def casein_config_logo\n 'casein/casein.png'\n end", "def set_logo\n @logo = Logo.find(params[:id])\n end", "def set_logo\n @logo = Logo.find(params[:id])\n end", "def set_logo\n @logo = Logo.find(params[:id])\n end", "def logo(path, params)\n l = image_tag(path, params) \n link_to l, path\n end", "def footer_gi_logo_link\n $tracer.trace(__method__)\n return ToolTag.new(nav.className(\"logo\"), __method__)\n end", "def get_logo_for_season_type( season_type_code )\r\n if season_type_code =~ /CSI/i\r\n h.image_tag( 'logo_csi.png', size: '20x16' )\r\n elsif season_type_code =~ /FIN/i\r\n h.image_tag( 'logo_fin.png', size: '40x16' )\r\n elsif season_type_code =~ /UISP/i\r\n h.image_tag( 'logo_uisp.png', size: '40x16' )\r\n else\r\n season_type_code\r\n end\r\n end", "def get_thumb\n (self.logo.present?)? self.logo.thumb : 'assets/logo.png'\n end", "def link_to_root_logo\n link_to(content_tag(:span, '', { class: 'navbarLogo', alt: 'Sky Logo' }), root_path, class: 'navbar-brand')\n end", "def og_image\n if @user && @user.image?\n @user.image.url\n elsif @person && @person.image?\n @person.image\n else\n root_url.chomp('/') + image_path('logo.png')\n end\n end", "def store_locator_icon\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.div.className(create_ats_regex_string(\"ats-storetitle\")).img, format_method(__method__))\n end", "def social_title(image)\n name = image.name\n if !name.blank?\n name\n elsif domain = product_domain(image)\n \"LifeSizer image on #{domain}\"\n else\n \"LifeSizer image\"\n end\n end", "def get_team_logo(team) \n doc = getHTML(\"http://espn.go.com/mens-college-basketball/team/_/id/#{team.webExt}\") \n logo = doc.xpath(\"//meta[@property='og:image']/@content\").text\n team.update(logo: logo)\n end", "def tier_logo_path(tier, options={})\n version = options.delete(:name)\n source = options.delete(:source)\n return source if source\n tier.logo.url(\"normal\") if tier.logo.file?\n end", "def index\n @logos = Logo.all\n end", "def index\n @logos = Logo.all\n end", "def index\n @logos = Logo.all\n end", "def url_logo(coin: T.unsafe(nil)); end", "def image\n 'gh.png'\n end", "def logo(options={})\n @logo ||= (\n if file = output.glob_relative('**/logo.*').first\n file #.relative_path_from(output)\n else\n keyword = options[:keyword]\n directory = options[:directory]\n keyword ||= (metadata.search || metadata.title || metadata.name)\n logo_search(keyword, directory)\n end\n )\n end", "def add_subdomain_logo\n @donor.logo = process_donor_logo @donor.url\n @donor.save\n end", "def set_image_title\n controller_name == 'temp_listings' ? '' : 'Pin it @ Pinterest'\n end", "def image_name\n @presenter.is_homepage? ? 'thumb' : 'thumb_inner'\n end", "def header_img\n image_tag('header-img-2.jpg', border: 0)\n end", "def nav_logo_stamp\n nav_logo.blob.created_at.to_i if nav_logo.attached?\n end", "def link_to_powered_by_logo\n link_to(content_tag(:div, '', :class => \"poweredByLogo fl ml10\"), home_page_url, {:popup => true})\n end", "def crop_logo\n logo.recreate_versions! if crop_logo_x.present?\n end", "def get_logo_route\n\t\tif !logged_in?\n\t\t\treturn root_path\n\t\tend\n\t\tif current_user.admin?\n\t\t\treturn admin_path\n\t\tend\n\t\treturn current_user\n\tend", "def tier_logo_tag(tier, options={}, html_options={})\n html_options = {:size => \"300x66\", :title => h(tier.name), :alt => h(tier.name)}.merge(html_options).symbolize_keys\n if path = tier_logo_path(tier, options)\n image_tag(path, html_options)\n end\n end", "def url_for_co_hbrand_image(company)\n \"#{I18n.t('shf_medlemssystem_url')}/hundforetag/#{company.id}/company_h_brand\"\n end", "def default_url\n ActionController::Base.helpers.asset_path(\"logos/\" + [version_name, \"missing.png\"].compact.join('/'))\n end", "def commenter_logo(commenter)\n if commenter.provider && commenter.provider == 'weibo'\n link_to image_tag(commenter.profile_image_url, :alt => commenter.name), \"http://weibo.com/#{commenter.profile_url}\", :target => '_blank', :rel => 'nofollow'\n else\n link_to image_tag(commenter.logo.url, :alt => commenter.name), APP_CONFIG['site_url']\n end\n end", "def default_image\n if instance.platform.name =~ /^(.*)-([^-]*)$/\n \"#{$1}:#{$2}\"\n else\n instance.platform.name\n end\n end", "def default_image\n end", "def getLogoData(data)\n data && data['asset_id'] && data['width'] && data['height'] or return nil\n return { url: \"/assets/#{data['asset_id']}\", width: data['width'], height: data['height'] }\nend", "def main_sprite\r\n super\r\n # Make title graphic\r\n @sprite = Sprite.new\r\n @sprite.bitmap = RPG::Cache.title($data_system.title_name)\r\n end", "def get_linked_full_name_with_logo\n h.link_to( get_logo_for_season_type + ' ' + get_full_name, meeting_show_full_path(id: object.id), { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') } )\n end", "def og_image(image)\n\t\tbase_image = \"http://i.imgur.com/DfYlA.png\"\n\t\tif image.empty?\n\t\t\tbase_image\n\t\telse\n\t\t\timage\n\t\tend\n\tend", "def create\n @logo = @campaign.logos.new(logo_params)\n @logo.name = \"#{current_user.company_info.company_name} - #{Time.now.to_i}\"\n filename = params[:logo][:image].tempfile.path\n create_api_image\n @api_image.create_image(@campaign.uuid,filename)\n @logo.uuid_image = @api_image.uuid_image\n respond_to do |format|\n if @logo.save\n format.html { redirect_to dashboard_index_path}\n format.json { render :show, status: :created, location: @logo }\n else\n format.html { render :new }\n format.json { render json: @logo.errors, status: :unprocessable_entity }\n end\n end\n end", "def logo_dimensions_string\n \"#{LOGO_WIDTH}x#{LOGO_HEIGHT}\"\n end" ]
[ "0.7580324", "0.7580324", "0.7487482", "0.74149615", "0.739185", "0.73908037", "0.73888695", "0.7381284", "0.7364943", "0.731713", "0.7221564", "0.720779", "0.7193293", "0.71708304", "0.7159938", "0.7159938", "0.70722485", "0.7053646", "0.7004538", "0.6969171", "0.6963374", "0.6963374", "0.6963374", "0.69432455", "0.6922402", "0.68918455", "0.68771106", "0.68631375", "0.68460065", "0.6830458", "0.6830458", "0.6827012", "0.68157977", "0.6812528", "0.6803082", "0.67427754", "0.67420065", "0.6733451", "0.67305696", "0.67081183", "0.66938543", "0.6689679", "0.66129345", "0.65960133", "0.6560244", "0.6532969", "0.6515571", "0.6501153", "0.64883894", "0.64805084", "0.64737", "0.6441675", "0.6441381", "0.64320624", "0.63776135", "0.63295245", "0.63130784", "0.63126504", "0.62635154", "0.62328243", "0.6219948", "0.62093115", "0.6208564", "0.6208564", "0.61949635", "0.6177559", "0.61743575", "0.6163448", "0.61574405", "0.6136653", "0.6096991", "0.60709804", "0.6057688", "0.60509044", "0.59998184", "0.59998184", "0.59998184", "0.5950968", "0.59370834", "0.5914215", "0.5909658", "0.5892326", "0.5890272", "0.58726335", "0.58456737", "0.58405364", "0.58392924", "0.5826832", "0.5819568", "0.5800065", "0.5797333", "0.5791032", "0.5785375", "0.5767526", "0.57662255", "0.5761736", "0.57513225", "0.5738976", "0.57389754", "0.5730346" ]
0.7127193
16
just one banner for store
def one_banner if self.class_type == 'banner' && Multimedium.find_all_by_class_type('banner').count > 0 self.errors.add(:base, "This store already has one banner") false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def banner\n @data['banner']\n end", "def banner\n checkConnection()\n @banner\n end", "def banner\n checkConnection()\n @banner\n end", "def banner\n self.class.instance_variable_get(:@__banner)\n end", "def show\n banner = Banner.where(area: Banner.areas[:MemberShow]).first\n if banner\n @banner_image = banner.desktop_image.url\n @banner_url = banner.desktop_url\n end\n end", "def index \n @banners = Banner.for_admin\n end", "def show\n @banner = Banner.find params[:id]\n end", "def banner(value = (not_set = true))\n if not_set\n @properties[:banner]\n else\n @properties[:banner] = value\n end\n end", "def set_admin_banner\n @banner = Banner.find(params[:id])\n end", "def set_admin_banner\n @banner = Banner.find(params[:id])\n end", "def set_banner\n @banner = Banner.find(params[:id])\n end", "def set_banner\n @banner = Banner.find(params[:id])\n end", "def set_banner\n @banner = Banner.find(params[:id])\n end", "def set_banner\n @banner = Banner.find(params[:id])\n end", "def set_banner\n @banner = Banner.find(params[:id])\n end", "def set_banner\n @banner = Banner.find(params[:id])\n end", "def set_banner\n @banner = Banner.find(params[:id])\n end", "def get_banner\n @server.make_request('show.getbanner', tvdbid: @tvdbid)\n end", "def banner\n if(@all_images.nil?)\n @all_images = Image.all\n end\n\n if(!@all_images.empty?)\n for img in @all_images\n if(img.picture_file_name == \"Company_Logo.png\")\n @imagelogo = img.picture.url\n end\n if(img.picture_file_name == \"Company_Banner.png\")\n @imagebanner = img.picture.url\n end\n end\n end\n end", "def set_banner\n @banner = Banner.find(params[:id])\n end", "def index\n @banners = Banner.all\n end", "def banner_url\n object.banner_url.url\n end", "def show\n\n image = ''\n\n if !@ebook.image_url.nil?\n image = @ebook.image_url\n end\n\n prepare_meta_tags(title: @ebook.title + ' - Ebooks',\n description: @ebook.summary,\n keywords: '',\n image: @ebook.facebook_image_url,\n og: {\n title: @ebook.title,\n description: @ebook.summary,\n image: @ebook.facebook_image_url,\n type: 'article',\n 'image:type': 'image/jpg',\n updated_time: @ebook.updated_at.strftime('%FT%T')\n },\n article: {\n #tag: @article.tag_list,\n author: '947897365241721',\n section: 'Blog',\n published_time: @ebook.created_at.strftime('%FT%T'),\n modified_time: @ebook.updated_at.strftime('%FT%T')\n },\n twitter: {\n title: @ebook.title,\n card: '',\n description: @ebook.summary,\n image: @ebook.facebook_image_url\n })\n\n @banner = Banner.where(name: 'ebook').take\n end", "def banner?\n @properties.key?(:banner) && !@properties[:banner].nil?\n end", "def banner(banner_src)\n content_for(:custom_banner) { banner_src.html_safe }\n end", "def entry_banner\n 'Team Meeting'\n end", "def banner(arg=nil)\n @banner = arg if arg\n @banner || description\n end", "def show\n render json: @banner\n end", "def show\n redirect_to edit_banner_url(params[:id])\n\n #@banner = Banner.find(params[:id])\n #\n #respond_to do |format|\n # format.html # show.html.erb\n # format.json { render :json => @banner }\n #end\n end", "def create\n @banner = Banner.new banner_params \n if @banner.save\n redirect_to admin_banners_path\n else\n render :action => 'new'\n end\n \n end", "def show\n @banner = Banner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @banner }\n end\n end", "def banner\n unless @banner\n @banner = +\"Usage: #{program_name} [options]\"\n visit(:add_banner, @banner)\n end\n @banner\n end", "def show\n @more_deals = Storepromotion.where(spcategory_id: @storepromotion.spcategory_id)\n impressionist(@storepromotion)\n set_meta_tags title: @storepromotion.sp_title,\n site: 'Oh,igottabuythis',\n revierse: true,\n description: @storepromotion.sp_description,\n keywords: @storepromotion.sp_title,\n twitter: {\n card: \"summary\",\n site: \"@OhIgottabuythis\",\n title: @storepromotion.sp_title,\n description: @storepromotion.sp_description,\n image: @storepromotion.sp_image\n },\n og: {\n title: @storepromotion.sp_title,\n description: @storepromotion.sp_description,\n type: 'website',\n url: storepromotion_url(@storepromotion),\n image: @storepromotion.sp_image\n }\n end", "def banner\n lines = []\n \n name_line = \"#{ name } role\"\n lines << name_line\n lines << \"=\" * name_line.length\n lines << ''\n if meta['description']\n lines << meta['description']\n lines << ''\n end\n lines << 'Usage:'\n lines << ''\n lines << \" #{ usage }\"\n lines << ''\n lines << ''\n \n lines.join(\"\\n\")\n end", "def banner_label\n html_content[0..100]\n end", "def create\n @banner = Banner.new(admin_banner_params)\n @banner.bannerable_type = \"Article\"\n @banner.bannerable_id = Article.last.id\n @banner.banner_category_id = BannerCategory.last.id\n respond_to do |format|\n if @banner.save\n format.html { redirect_to admin_banners_url, notice: 'banner was successfully created.' }\n format.json { render :show, status: :created, location: @banner }\n else\n format.html { render :new }\n format.json { render json: @banner.errors, status: :unprocessable_entity }\n end\n end\n end", "def link_banner(banner)\n raise \"Zone must be saved\" if new_record?\n raise ArgumentError.new(\"Banner must be saved\")if banner.new_record?\n\n session = self.class.connection\n server = XmlrpcClient.new2(\"#{session.url}\")\n server.call(\"ox.linkBanner\", session, self.id, banner.id)\n end", "def bannerUrl\n @obj['bannerUrl']\n end", "def show\n #@banner = Banner.find(params[:id])\n @banner = Banner.find_by_id(params[:pidm])\n\n @title = 'Banner Details'\n @description = 'Detailed Banner Data'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @banner }\n end\n end", "def show(banner)\n\n ViewHelper.show(self, banner)\n end", "def index\n @banners = Banner.all.order('id DESC')\n @banner = Banner.new\n end", "def entry_banner\n 'Interview'\n end", "def entry_banner\n 'Four by four'\n end", "def store_mall_name\n $tracer.trace(__method__)\n return ToolTag.new(div.className(create_ats_regex_string(\"ats-storeheader\")).h1, __method__)\n end", "def banner(text)\n @__banner = text.strip\n end", "def new\n @banner = Banner.new\n @types = Banner::TYPES\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @banner }\n end\n end", "def create\n params[\"banner\"][\"sale_event_id\"] = nil if params[\"banner\"][\"sale_event_id\"] == \"\"\n @banner = Banner.new(params[:banner])\n @types = Banner::TYPES\n\n respond_to do |format|\n if @banner.save\n format.html { redirect_to(admin_banners_path, :notice => 'Banner was successfully created.') }\n format.xml { render :xml => @banner, :status => :created, :location => @banner }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @banner.errors, :status => :unprocessable_entity }\n end\n end\n end", "def link_banner(banner)\n raise \"Zone must be saved\" if new_record?\n raise ArgumentError.new(\"Banner must be saved\")if banner.new_record?\n\n session = Base.connection\n server = XMLRPC::Client.new2(\"#{session.url}#{self.class.endpoint}\")\n server.call(\"linkBanner\", session.id, self.id, banner.id)\n end", "def banner_for(user, height=100)\n image_tag(url_for(user.set_banner(height)))\n end", "def description\n purchase.store.present? ? \"Bought from #{purchase.store.name}\" : ''\n end", "def index\n @banners = Banner.order(:name)\n end", "def index\n @menu = \"board\"\n @board = \"banner\"\n @section = \"index\"\n \n @banner_left = Banner.all(:location => \"left\", :order => [:order])\n @banner_center = Banner.all(:location => \"center\", :order => [:order])\n @banner_right = Banner.all(:location => \"right\", :order => [:order])\n \n render 'banner' \n end", "def banner s; @order << [:text, s] end", "def after_create(banner)\n expire_cache_for(banner)\n end", "def show\n @site_banner = SiteBanner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @site_banner }\n end\n end", "def show\n # @most_hotdeals = Hotdeal.order(\"impressions_count DESC\").limit(10)\n impressionist(@hotdeal)\n set_meta_tags title: @hotdeal.h_title,\n site: 'Oh,igottabuythis',\n revierse: true,\n description: @hotdeal.h_spare_21,\n keywords: 'deals, discounts',\n twitter: {\n card: \"summary\",\n site: \"@OhIgottabuythis\",\n title: @hotdeal.h_title,\n description: @hotdeal.h_spare_21,\n image: @hotdeal.h_image\n },\n og: {\n title: @hotdeal.h_title,\n description: @hotdeal.h_spare_21,\n type: 'website',\n url: hotdeal_url(@hotdeal),\n image: @hotdeal.h_image\n }\n end", "def show\n #without IP_adress\n impressionist(@featured)\n set_meta_tags title: @featured.f_title,\n # site: 'Aveneu71::감성 큐레이팅 Shop',\n revierse: true,\n description: @featured.f_title,\n keywords: '쿠팡, 아마존, 알리익스프레스, 직구, 아이디어상품, 홈인테리어, 인테리어소품, 집꾸미기, 방꾸미기, 자취방꾸미기, 홈데코, 주방인테리어',\n # twitter: {\n # card: \"summary\",\n # site: \"@aveneu71\",\n # title: @featured.f_title,\n # description: @featured.f_title,\n # image: @featured.f_image\n # },\n og: {\n title: @featured.f_title,\n description: @featured.f_title,\n type: 'website',\n url: post_url(@featured),\n image: @featured.f_image\n }\n \n #with IP_adress\n # impressionist(@featured, nil, unique: [:ip_address])\n end", "def place_ad_for_today\n copy_image\n update_page_heading\n end", "def banner\n return \"codnar-weave - Weave documentation chunks to a single HTML.\"\n end", "def assert_banner(position, store_position_class)\n page.should have_content(\"My good banner\")\n page.should have_content I18n.t(\"activerecord.values.banner.position.#{position}\")\n Banner.first.image.url.should_not == \"\"\n\n # The banner is added to the store's homepage\n visit root_path\n within(store_position_class) do\n find(\"img\")[:src].should == Banner.first.image.url\n end\n end", "def create\n @banner = Banner.new(params[:banner])\n\n respond_to do |format|\n if @banner.save\n format.html { redirect_to admin_banner_path(@banner), notice: 'Banner was successfully created.' }\n format.json { render json: @banner, status: :created, location: @banner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @banner.errors, status: :unprocessable_entity }\n end\n end\n end", "def draw_banner\n bmp = Cache.picture(@quest.banner) # Get Picture\n # Shift the hue if requested\n bmp.hue_change(@quest.banner_hue) unless @quest.banner_hue == 0\n x = (contents_width - bmp.rect.width) / 2\n if x < 0 # Stretch horizontally if the banner is too wide\n dest_rect = bmp.rect.dup\n dest_rect.width = contents_width\n contents.stretch_blt(dest_rect, bmp, bmp.rect)\n else\n contents.blt(x, @draw_y, bmp, bmp.rect)\n end\n bmp.dispose\n end", "def banner_copyright\n return unless banner\n\n %(Header photo: &copy; <a href=\"#{banner.url}\">#{banner.author}</a>)\n end", "def banner_statistics start_on = Date.today, end_on = Date.today, local_time_zone = true\n self.get_statistics('ox.publisherBannerStatistics', start_on, end_on, local_time_zone)\n end", "def show\n @hbanner = Hbanner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hbanner }\n end\n end", "def print_banner\n print_line BANNER\n print_line\n print_line\n end", "def create\n @banner = Banner.new(banner_params)\n exchange_attributes_params\n respond_to do |format|\n if @banner.save\n notice = 'Banner was successfully created.' \n notice += ' <span class=\"text-danger\">Error on bidder synch process. Please try again.</span>' if @banner.campaign and not @banner.campaign.update_bidder\n format.html { redirect_to @banner, notice: notice }\n format.json { render :show, status: :created, location: @banner }\n else\n format.html { render :new }\n format.json { render json: @banner.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n\n set_meta_tags og: {\n title: @newsletter.title,\n description: truncate(@newsletter.greeting, :length => 300, :separator => /\\w/, :omission => \"&hellip;\"),\n image: root_url[0..-2] + ActionController::Base.helpers.asset_url('newsletter.png'),\n url: preview_newsletter_url(@newsletter)\n }, title: @newsletter.title\n\n end", "def print_banner(meta_info = nil)\n banner = meta_info.nil? ? \"#{@banner}\" : \"#{meta_info}\\n #{@banner}\"\n puts banner\n end", "def banner_params\n params.require(:banner).permit(:image_url, :name, :link_url, :description, :banner_type_id, :user_id)\n end", "def get_banner_header\n if (@banner_ad.nil? || @banner_ad.empty?)\n \"\"\n else\n render :partial => 'layouts/ads/dfp_header', :locals => {:banner_ad => @banner_ad, :banner_id => @banner_id}\n end\n end", "def get_banner_to_display(banner_toplist)\n session[:ads_served] ||= [] #Create a session array for ads served\n \n random_pos = -1 \n \n #clear array if all banners have been shown once or if there are more banners in the session variable due to \n #previous run with a different dataset\n if (session[:ads_served].size.to_i == (banner_toplist.size.to_i) || session[:ads_served].size > banner_toplist.size)\n session[:ads_served].clear\n end\n \n #check if banner already displayed this session and don't display it again until all ads have been displayed\n while (random_pos == -1 || (session[:ads_served].include?(banner_toplist[random_pos.to_i][:banner_id].to_s))) do \n random_pos = rand(0..(banner_toplist.size.to_i.to_i - 1)) \n end\n\n #set the banner to be displayed and add it to the session variable array\n banner_to_display = banner_toplist[random_pos][:banner_id]\n count = session[:ads_served].size.to_i\n #$debug_str += \"\\n count = \" + session[:ads_served].size.to_s\n session[:ads_served][count.to_i%banner_toplist.size.to_i] = banner_to_display.to_s\n \n return banner_to_display\n end", "def advertisement\n if @advertising_platform.active?\n if @banner = @advertising_platform.view_relevant_banner\n render layout: false\n return\n end\n end\n render nothing: true, status: 401\n end", "def init\n @banners = Banner.all#[0..25]\n end", "def show\n @title = @gallery.title\n @shopping_cart_item = ShoppingCartItem.new\n end", "def showBanner\n\treturn unless $options.show_banner\n\tputs <<BANNER\n ____ ____ ____ ___________ ____ __ __ ______\n / ___\\\\_/ __ \\\\ / \\\\_/ __ \\\\_ __ \\\\/ _ \\\\| | \\\\/ ___/\n / /_/ > ___/| | \\\\ ___/| | \\\\( <_> ) | /\\\\___ \\\\\n \\\\___ / \\\\___ >___| /\\\\___ >__| \\\\____/|____//____ >\n\\\\_____/ \\\\/ \\\\/ \\\\/ project generator \\\\/\n\nBANNER\nend", "def create\n @banner = Banner.new(params[:banner])\n\n respond_to do |format|\n if @banner.save\n format.html { redirect_to admins_banners_url, notice: 'Banner was successfully created.' }\n format.json { render json: @banner, status: :created, location: @banner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @banner.errors, status: :unprocessable_entity }\n end\n end\n end", "def banner\n\t\t\t@banner || \"Usage: #{program_prefix} [arguments]\"\n\t\tend", "def set_ad_banner\n @ad_banner = AdBanner.find(params[:id])\n end", "def banner\n \"Usage: #{$0} minimal_cart\"\n end", "def set_bannerimage\n @bannerimage = Bannerimage.find(params[:id])\n end", "def has_cached_banner?\n @server.make_json_request('show.cache', tvdbid: @tvdbid)['data']['banner'] == 1\n end", "def banner_ad\r\n\t\tbanner_ads = \r\n\t\t['<a href=\"http://www.anrdoezrs.net/click-6185997-10660760\" target=\"_top\"><img src=\"http://www.ftjcfx.com/image-6185997-10660760\" width=\"728\" height=\"90\" alt=\"728x90: Free trial\" border=\"0\"/></a>',\r\n\t\t '<a href=\"http://www.anrdoezrs.net/click-6185997-10660758\" target=\"_top\"><img src=\"http://www.lduhtrp.net/image-6185997-10660758\" width=\"728\" height=\"90\" alt=\"728x90: Free trial\" border=\"0\"/></a>',\r\n\t\t '<a href=\"http://www.tkqlhce.com/click-6185997-10660751\" target=\"_top\"><img src=\"http://www.lduhtrp.net/image-6185997-10660751\" width=\"728\" height=\"90\" alt=\"728x90: Free trial\" border=\"0\"/></a>',\r\n\t\t '<a href=\"http://www.anrdoezrs.net/click-6185997-10880818\" target=\"_top\"><img src=\"http://www.ftjcfx.com/image-6185997-10880818\" width=\"728\" height=\"90\" alt=\"14 Day Free Trial \" border=\"0\"/></a>',\r\n\t\t '<a href=\"http://www.jdoqocy.com/click-6185997-10660719\" target=\"_top\"><img src=\"http://www.ftjcfx.com/image-6185997-10660719\" width=\"728\" height=\"90\" alt=\"728x90_Genes Reunited\" border=\"0\"/></a>',\r\n\t\t '<a href=\"http://www.dpbolvw.net/click-6185997-10931192\" target=\"_top\"><img src=\"http://www.tqlkg.com/image-6185997-10931192\" width=\"728\" height=\"90\" alt=\"\" border=\"0\"/></a>',\r\n\t\t '<a href=\"http://www.jdoqocy.com/click-6185997-10931171\" target=\"_top\"><img src=\"http://www.lduhtrp.net/image-6185997-10931171\" width=\"728\" height=\"90\" alt=\"\" border=\"0\"/></a>',\r\n\t\t '<a href=\"http://www.kqzyfj.com/click-6185997-10931162\" target=\"_top\"><img src=\"http://www.tqlkg.com/image-6185997-10931162\" width=\"728\" height=\"90\" alt=\"\" border=\"0\"/></a>']\r\n\r\n\t\treturn banner_ads[rand(banner_ads.count)].html_safe\r\n\tend", "def to_s\n @banner + \"\\n\\n\" + @doc.join(\"\\n\") + \"\\n\"\n end", "def show\n @banner = Banner.find(params[:id])\n @banners = Banner.limit(4)\n @banner_01 = @banners[0]\n @banner_02 = @banners[1]\n @banner_03 = @banners[2]\n @banner_04 = @banners[3]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @banner }\n end\n end", "def create\n @banner= Banner.new(params[:banner])\n\n respond_to do |wants|\n if @banner.save\n flash[:notice] = 'Баннер сохранен.'\n wants.html { redirect_to(admin_banners_url) }\n wants.xml { render :xml => @banner, :status => :created, :location => @banner }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @banner.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @banner_placement = BannerPlacement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @banner_placement }\n end\n end", "def banner(context, block)\n context.instance_eval(&block)\n end", "def boxview_data\n desc = self.description.nil? ? \"\" : \"#{self.description.slice(0, 80)}..\"\n { :controller => 'boxview/capolettera',\n :title => \"Capolettera: #{self.anastatica.page_position}\", \n :description => desc,\n :res_id => \"pi_letter_illustration_#{self.id}\", \n :box_type => 'image',\n :thumb => nil\n }\n end", "def show\n if @post.banner.attached?\n @url = url_for(@post.banner)\n\n @temp = {\n \"url\" => @url, \n \"id\" => @post.id, \n \"name\" => @post.name,\n \"content\" => @post.content,\n \"views\" => @post.views,\n \"created_at\" => @post.created_at\n }\n\n render json: @temp, status: 200\n else\n render json: @post, status: 200\n end\n end", "def banner_params\n params.require(:banner).permit(:banner, :title, :description)\n end", "def print_banner\n notice( \"\\n=== #{@key} ===\", [:CYAN, :BOLD])\n notice( description, [:CYAN] )\n notice( \"----> OS value: #{os_value.inspect}\", [:CYAN] ) if os_value\n notice( \"----> Recommended value: #{recommended_value.inspect}\", [:CYAN] ) if recommended_value\n end", "def banner_path\n path = @path[0...@path.length - 4] + '_banner.png'\n path_remote = @path_remote[0...@path_remote.length - 4] + '_banner.png'\n File.exists?(path) ? path_remote : 'https://maps.avicus.net' + '/default_map_banner.png' # May need configured\n end", "def index\n @campaign_banners = @campaign.campaign_banners\n end", "def show\n page_title = 'Linkshot: ' + @shot.name\n if @shot.user.nil?\n page_description = @shot.name + ' — Shared via Linkshot'\n else \n page_description = @shot.name + ' — Shared by ' + @shot.user.name + ' via Linkshot'\n end\n end", "def banner_params\n params.require(:banner).permit(:title, :description, :actived, :image)\n end", "def new\n @banner = Banner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @banner }\n end\n end", "def new\n @banner = Banner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @banner }\n end\n end", "def create\n @banner = Banner.new(banner_params)\n \n respond_to do |format|\n if @banner.save\n format.html { redirect_to @banner, :notice => 'Banner was successfully created.' }\n format.json { render :json => @banner, :status => :created, :location => @banner }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @banner.errors, :status => :unprocessable_entity }\n end\n end\n end", "def banner(options = {}, &block)\n options = {\n :comment => :js\n }.update(options)\n \n if block_given?\n @_banner = yield.to_s\n elsif !@_banner\n banner = []\n banner << \"Version : #{self.scm.version}\"\n banner << \"Date : #{self.scm.date.strftime(\"%Y-%m-%d\")}\"\n\n size = banner.inject(0){|mem,b| b.size > mem ? b.size : mem }\n banner.map!{|b| \"= #{b.ljust(size)} =\" }\n div = \"=\" * banner.first.size\n banner.unshift(div)\n banner << div\n @_banner = banner.join(\"\\n\")\n end\n \n if options[:comment]\n self.comment(@_banner, :style => options[:comment])\n else\n @_banner\n end\n end" ]
[ "0.71231735", "0.68731964", "0.68731964", "0.6748388", "0.6744911", "0.66055006", "0.64492196", "0.63693875", "0.61881524", "0.61881524", "0.6168486", "0.6160776", "0.6160776", "0.6160776", "0.6160776", "0.6160776", "0.6160776", "0.6159553", "0.6156885", "0.6155793", "0.6123919", "0.6115089", "0.60838324", "0.6075468", "0.60745966", "0.6073335", "0.6048078", "0.60438436", "0.603728", "0.599588", "0.5986528", "0.59228075", "0.5920048", "0.5875699", "0.5874405", "0.58728606", "0.5846957", "0.58090824", "0.5808565", "0.5783502", "0.57814986", "0.5780799", "0.5774574", "0.5765969", "0.5764424", "0.5760267", "0.57446903", "0.5716422", "0.5712882", "0.5699434", "0.5656705", "0.5611964", "0.5605612", "0.5600709", "0.5597316", "0.5574869", "0.5566092", "0.55564773", "0.55511856", "0.5550174", "0.5537252", "0.55006045", "0.5493059", "0.54917705", "0.5489048", "0.5484966", "0.54847574", "0.54828626", "0.54827386", "0.54797554", "0.5476104", "0.5474817", "0.54710114", "0.545858", "0.5450786", "0.5445188", "0.54203355", "0.54185253", "0.5405225", "0.54038423", "0.53906333", "0.53899753", "0.5387617", "0.5377876", "0.5362922", "0.535718", "0.53532624", "0.5351762", "0.5350499", "0.5347563", "0.5336175", "0.5321478", "0.53210354", "0.53187466", "0.5309285", "0.53046757", "0.53044957", "0.53044957", "0.53008026", "0.52880484" ]
0.7068478
1
set the style of the file accordingly to the class_type
def set_styles if self.class_type == 'variant' {:thumb => '300x300!'} elsif self.class_type == 'banner' {:banner => '800x100!'} elsif self.class_type == 'logo' {:logo => '400x60>'} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_class_style\n @class_style = ClassStyle.find(params[:id])\n end", "def fetch_style_class\n\t\tstyles = Dir.entries(\"./styles\").select do |entry|\n\t\t File.extname(entry).eql? \".rb\"\n\t\tend\n\n\t\tstyle_def = styles.detect do |style|\n\t\t File.basename(style, \".rb\") == @options[:style].to_s\n\t\tend\n\n\t\traise Errors::InvalidStyle unless style_def\n\n\t\trequire \"./styles/#{style_def}\"\n\n\t\tstyle_class_name = classify File.basename(style_def, \".rb\")\n\t\tstyle_class = Styles.const_get style_class_name\n\t\tstyle_class.new(@options)\n\n\t end", "def use_style=(style)\n end", "def style_it\n\n\t\t#Fetches the style class from the list of ./styles.\n\t\tstyle_instance = fetch_style_class\n\n\t\tFile.open( @file, \"r\" ) do |input|\n\t\t File.open( \"#{File.dirname(@file)}/sc_#{File.basename(@file)}\" , \"w\") do |output|\n\n\t\t\tcomment_lines = []\n\t\t\tshow_something?(lines = input.readlines)\n\t\t\t\n\t\t\tlines.each do |line|\n\t\t\t if line[/\\S/] == @options[:literal] \n\t\t\t\tcomment_lines << line\n\t\t\t elsif not comment_lines.empty?\n\t\t\t\tmodified_comments = style_instance.style_it comment_lines \n\t\t\t\tcomment_lines.clear\n\t\t\t\toutput << modified_comments\n\t\t\t\toutput << line\n\t\t\t else\n\t\t\t\toutput << line\n\t\t\t end\n\t\t\tend\n\n\t\t end\n\t\tend\n\t\tputs \"Done !\"\n\t end", "def styles; end", "def styles; end", "def styles; end", "def as_css_background_with_class(klass=nil)\n klass=File.basename(@file_path).tr('.','_') unless klass\n \".#{klass} {\\n #{self.as_css_background}\\n}\"\n end", "def getStyle(filename)\n DEFAULT_FILE_TYPES.invert[File.extname(filename)]\n end", "def style; end", "def style; end", "def style; end", "def set_style\r\n @style = Style.new\r\n\r\n alignment_node = @node.xpath('.//w:jc').first\r\n alignment = alignment_node ? alignment_node.attributes['val'].value : nil\r\n @style.instance_variable_set('@text_align', alignment.to_sym) if alignment\r\n\r\n size_node = @node.xpath('w:pPr//w:sz').first\r\n font_size = size_node ? size_node.attributes['val'].value.to_i / 2 : nil\r\n @style.instance_variable_set('@font_size', font_size)\r\n\r\n bold_node = @node.xpath('w:pPr//w:b').first\r\n @style.instance_variable_set('@font_weight', 'bold') if bold_node\r\n\r\n italic_node = @node.xpath('w:pPr//w:i').first\r\n @style.instance_variable_set('@font_style', 'italic') if italic_node\r\n\r\n underline_node = @node.xpath('w:pPr//w:u').first\r\n @style.instance_variable_set('@text_underline_style', 'solid') if underline_node\r\n end", "def set_filetype(filename)\n\t\t$filetypes.each{|k,v|\n\t\t\tif filename.match(k) != nil\n\t\t\t\t@filetype = v\n\t\t\tend\n\t\t}\n\t\t# set up syntax coloring\n\t\t@syntax_color_lc = $syntax_color_lc[@filetype]\n\t\t@syntax_color_bc = $syntax_color_bc[@filetype]\n\t\t@syntax_color_regex = $syntax_color_regex[@filetype]\n\tend", "def style=(_); end", "def set_styles\n self.has_styles = true\n self.twitter_style = true\n end", "def style\n end", "def style(options); end", "def style=(value)\n @style = value\n end", "def file_type_class\n self.file_type.downcase.split.join('-') + '-file'\n end", "def styles=(_arg0); end", "def create_definition(style); end", "def style_classes=(new_style_classes)\n @style_classes = new_style_classes\n if respond_to?(:setStyleClass)\n setStyleClass(new_style_classes.join(' '))\n end\n restyle!\n end", "def add_classes_to_file( filename )\n\n\t\tpath = \"#{ @view_directory }#{ filename }\"\n\t\ttemp_file = Tempfile.new( 'foo' )\n\n\t\tbegin\n\t\t File.open( path, 'r' ) do |file|\n\t\t file.each_line do |line|\n\t\t temp_file.puts make_classy( line, @file_identifier )\n\t\t end\n\t\t end\n\t\t temp_file.close\n\t\t FileUtils.mv( temp_file.path, path )\n\t\trescue Exception => e\n\t\t\tbaxter( e )\n\t\tensure\n\t\t temp_file.close\n\t\t temp_file.unlink\n\t\tend\n\n\tend", "def set_style()\n style = @yaml['html']['style'] || @yaml['style']\n case\n when style.nil? then ''\n when style.class == String then \"style=\\\"#{style}\\\"\"\n when style.class == Hash then\n value = style.to_a.inject([]) {|r,v| r << \"#{v[0]}: #{v[1]}\" }.join(';')\n \"style=\\\"#{value}\\\"\" \n else ''\n end \nend", "def set_style()\n style = @yaml['html']['style'] || @yaml['style']\n case\n when style.nil? then ''\n when style.class == String then \"style=\\\"#{style}\\\"\"\n when style.class == Hash then\n value = style.to_a.inject([]) {|r,v| r << \"#{v[0]}: #{v[1]}\" }.join(';')\n \"style=\\\"#{value}\\\"\" \n else ''\n end \nend", "def initialize(type=\"inline\", style=nil)\n super()\n @parsing = false\n @added = 0\n @removed = 0\n @type = type\n @style = style\n @file_name = nil\n @previous_file_name = nil\n @git_diff = false\n end", "def style_conversion; end", "def generate_class klass, template_file = nil\n setup\n\n current = klass\n\n template_file ||= @template_dir + 'class.rhtml'\n\n debug_msg \" working on %s (%s)\" % [klass.full_name, klass.path]\n out_file = @outputdir + klass.path\n rel_prefix = @outputdir.relative_path_from out_file.dirname\n search_index_rel_prefix = rel_prefix\n search_index_rel_prefix += @asset_rel_path if @file_output\n\n asset_rel_prefix = rel_prefix + @asset_rel_path\n svninfo = get_svninfo(current)\n\n @title = \"#{klass.type} #{klass.full_name} - #{@options.title}\"\n\n debug_msg \" rendering #{out_file}\"\n render_template template_file, out_file do |io|\n here = binding\n # suppress 1.9.3 warning\n here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)\n here.local_variable_set(:svninfo, svninfo)\n here\n end\n end", "def replace_style(style, file)\n style = style.downcase.to_sym\n if data.styles.keys.include?(style)\n if File.exist?(RAILS_ROOT + '/public' + a.data(style))\n end\n end\n end", "def style_types\n %w( primary success info )\n end", "def correct_style_detected; end", "def correct_style_detected; end", "def correct_style_detected; end", "def icon_css_class\n case file_mime_type\n when *ARCHIVE_FILE_TYPES\n then \"archive\"\n when *AUDIO_FILE_TYPES\n then \"audio\"\n when *IMAGE_FILE_TYPES\n then \"image\"\n when *VIDEO_FILE_TYPES\n then \"video\"\n when \"application/x-shockwave-flash\"\n then \"flash\"\n when \"image/x-psd\"\n then \"psd\"\n when \"text/plain\"\n then \"text\"\n when \"application/rtf\"\n then \"rtf\"\n when \"application/pdf\"\n then \"pdf\"\n when \"application/msword\"\n then \"word\"\n when \"application/vnd.ms-excel\"\n then \"excel\"\n when *VCARD_FILE_TYPES\n then \"vcard\"\n else \"file\"\n end\n end", "def set_file_type\n if self.is_local?\n if self.attachment_content_type.blank?\n self.file_type = \"misc\"\n elsif self.attachment_content_type == 'application/pdf'\n self.file_type = \"pdf\"\n elsif self.attachment_content_type.include?('powerpoint')\n self.file_type = \"presentation\"\n elsif self.attachment_content_type == 'application/zip'\n self.file_type = \"zip\"\n elsif self.attachment_content_type == \"application/rtf\" || self.attachment_content_type == 'text/plain' || self.attachment_content_type == 'application/msword' || self.attachment_content_type.include?('wordprocessing')\n self.file_type = \"document\"\n elsif self.attachment_content_type.include?('spreadsheet') || self.attachment_content_type == 'ms-excel'\n self.file_type = \"spreadsheet\"\n elsif self.attachment_content_type.include?('image')\n self.file_type = \"image\"\n else\n self.file_type = \"misc\"\n end\n end\n end", "def css_class\n end", "def style\n File.read(@folder + \"/data/style.css\")\n end", "def style_new\n st = GT::Style.new\n style_file = File.expand_path(\"config/default.style\",\n \"#{File.dirname(__FILE__)}/../..\")\n log \"new style, trying to load #{style_file}\", 2\n st.load_file style_file\n log \"new style, default.style loaded\", 2\n return st\n end", "def type\n class_to_filename(self.class.to_s.sub(/.*:/, ''))\n end", "def override_content_type_and_save_info\n case File.extname(file.file).delete('.').downcase.to_sym\n when :xlsx\n file.content_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\n when :docx\n file.content_type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'\n when :pptx\n file.content_type = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'\n when :rar\n file.content_type = 'application/vnd.rar'\n when :zip\n file.content_type = 'application/zip'\n when :bat\n file.content_type = 'application/x-msdos-program'\n when :cmd\n file.content_type = 'application/cmd'\n when :exe\n file.content_type = 'application/x-msdownload'\n when :msi\n file.content_type = 'application/x-msi'\n when :php\n file.content_type = 'application/x-php'\n when :py\n file.content_type = 'application/x-python'\n when :vbs\n file.content_type = 'application/x-vbs'\n end\n\n model.file_content_type = file.content_type if file.content_type\n model.file_size = number_to_human_size(file.size) if file.size\n end", "def s(val); @style = val; end", "def style(options)\n @styles = options\n end", "def myletter\n \n end", "def add_class file_path\n\n cleaned_html = AsdocTidy.clean_for_rexml(file_path)\n class_html\t = REXML::Document.new cleaned_html\n\n class_name = File.basename( file_path, \".html\" )\n log( \"Adding #{class_name}..\" )\n\n @class_names.push(class_name)\n add_as_element(class_html,METHOD,@method_names)\n add_as_element(class_html,PROTECTED_METHOD,@protected_method_names)\n add_as_element(class_html,CONSTANT,@constant_names)\n add_as_element(class_html,PROPERTY,@property_names)\n add_as_element(class_html,PROTECTED_PROPERTY,@protected_properties)\n\n gen_method_completions(class_html,METHOD)\n gen_method_completions(class_html,PROTECTED_METHOD)\n\n end", "def pdf=(klass); end", "def use_default_style!\n @use_default_style = true\n end", "def set_type\n end", "def stylist\n\n end", "def set_asset_class\n for pattern, klass in asset_class_lookup\n if pattern === mimetype\n new_klass = klass\n end\n end\n\n transmogrify_asset(new_klass || GenericAsset)\n end", "def stylesheet; end", "def class_style_params\n params.require(:class_style).permit(:user_id, :latin, :partner, :freestyle)\n end", "def set_data_font(data_type)\n @maqj_default_font = contents.font.dup unless @maqj_default_font\n contents.font.name = QuestData::FONTNAMES[data_type] ? \n QuestData::FONTNAMES[data_type] : @maqj_default_font.name\n contents.font.size = QuestData::FONTSIZES[data_type] ? \n QuestData::FONTSIZES[data_type] : @maqj_default_font.size\n contents.font.bold = QuestData::FONTBOLDS.keys.include?(data_type) ? \n QuestData::FONTBOLDS[data_type] : @maqj_default_font.bold\n contents.font.italic = QuestData::FONTITALICS.keys.include?(data_type) ?\n QuestData::FONTITALICS[data_type] : @maqj_default_font.italic\n case data_type\n when :objectives then change_color(@maqj_objective_color) if @maqj_objective_color\n when :name then change_color(quest_name_colour(@quest)) if @quest\n else\n change_color(text_color(QuestData::COLOURS[data_type])) if QuestData::COLOURS.keys.include?(data_type)\n end\n end", "def header_style(header); end", "def set_file_format\n @file_format = FileFormat.find(params[:id])\n end", "def set_content_type(override=false)\n if override || file.content_type.blank?\n File.open(file.path) do |fd|\n data = fd.read(1024) || \"\"\n new_content_type = filemagic.buffer(data)\n if file.respond_to?(:content_type=)\n file.content_type = new_content_type\n else\n file.instance_variable_set(:@content_type, new_content_type)\n end\n end\n end\n end", "def create\n @class_style = ClassStyle.new(class_style_params)\n\n respond_to do |format|\n if @class_style.save\n format.html { redirect_to @class_style, notice: 'Class style was successfully created.' }\n format.json { render action: 'show', status: :created, location: @class_style }\n else\n format.html { render action: 'new' }\n format.json { render json: @class_style.errors, status: :unprocessable_entity }\n end\n end\n end", "def style(prop); end", "def make_classy( line, file_identifier )\n\t\t# TODO: should add file name to end of class\n\t\tStayClassy::Builder::DEFAULT_CLASS_TAGS.each do |tag|\n\t\t\tif line.include?( \"<#{ tag }\" ) && !line.include?( \"class=\" )\n\t\t\t\tline = line.gsub( \"<#{ tag }\", \"<#{ tag } class=\\\"#{ @prefix }#{ tag }_#{ file_identifier }\\\"\" )\n\t\t\tend\n\t\tend\n\t\treturn line\n\tend", "def setStyleName(style)\n styleNameHelper(MODE_SET, style)\n end", "def style\n @style ||= Style.new(attributes[:style])\n end", "def set_content_type(override=false)\n if override || file.content_type.blank? || generic_content_type?\n new_content_type = ::MIME::Types.type_for(current_path).first.to_s\n if file.respond_to?(:content_type=)\n file.content_type = new_content_type\n else\n file.instance_variable_set(:@content_type, new_content_type)\n end\n end\n rescue ::MIME::InvalidContentType => e\n raise CarrierWave::ProcessingError, I18n.translate(:\"errors.messages.mime_types_processing_error\", :e => e)\n end", "def output_file(style_name)\n overrides = {}\n if (format = styles[style_name][:format])\n overrides[:extension] = format\n end\n attachment.interpolate_path(style_name, overrides)\n end", "def scaffold_table_class(type)\n @scaffold_table_classes ||= {}\n @scaffold_table_classes[type] ||= SCAFFOLD_OPTIONS[:table_classes][type]\n end", "def style\n Style.new(self)\n end", "def css_class\n Meal.css_class_for_type(type)\n end", "def set_format(type, image, color)\n @formats[type] = [image, color]\n end", "def determine_style(m)\n begin\n case m[:source].to_s\n when m.start_with?('Carnivore::Source::Http')\n :http\n else\n m[:source].class.to_s.split('::').last.downcase.to_sym\n end\n rescue\n :unknown\n end\n end", "def style\n @style\n end", "def output\n super(@file_format => @file_path)\n end", "def view_options\n {\n class: css_classes\n }\n end", "def defined_classname filename\r\n script = File.new filename\r\n script.each_line do |line|\r\n if line =~ /class(.*)[<|\\z]/ \r\n script.close\r\n return $1.strip\r\n end\r\n end \r\n script.close \r\n \"\"\r\nend", "def run(filename, css); end", "def set_style(style_id = 2)\n style_id = 2 if style_id < 1 || style_id > 48\n @style_id = style_id\n end", "def custom_set_codeline_class\n @codeline_class = SASSLine\n end", "def style\n self\n end", "def set_file_type(file_type)\n @file_type = file_type\n init_data_arrays\n end", "def class_type=(value)\n\t\tself[:type] = value\n\tend", "def get_model_class(file); end", "def new\n @style = Style.new()\n end", "def render_document_class(document = @document)\n document_classes = super(document) ? [super(document)] : []\n if homegrown_content?(document)\n document_classes << \"homegrown\"\n end\n return document_classes.join(' ')\n end", "def render_document_class(document = @document)\n document_classes = super(document) ? [super(document)] : []\n if homegrown_content?(document)\n document_classes << \"homegrown\"\n end\n return document_classes.join(' ')\n end", "def write_style_sheet\n return unless @template.constants.include? :STYLE or\n @template.constants.include? 'STYLE'\n\n template = RDoc::TemplatePage.new @template::STYLE\n\n unless @options.css then\n open RDoc::Generator::CSS_NAME, 'w' do |f|\n values = {}\n\n if @template.constants.include? :FONTS or\n @template.constants.include? 'FONTS' then\n values[\"fonts\"] = @template::FONTS\n end\n\n template.write_html_on(f, values)\n end\n end\n end", "def write_style_sheet\n return unless @template.constants.include? :STYLE or\n @template.constants.include? 'STYLE'\n\n template = RDoc::TemplatePage.new @template::STYLE\n\n unless @options.css then\n open RDoc::Generator::CSS_NAME, 'w' do |f|\n values = {}\n\n if @template.constants.include? :FONTS or\n @template.constants.include? 'FONTS' then\n values[:fonts] = @template::FONTS\n end\n\n template.write_html_on(f, values)\n end\n end\n end", "def style=(style)\n validator = EnumAttributeValidator.new('String', ['Unknown', 'Percent05', 'Percent10', 'Percent20', 'Percent25', 'Percent30', 'Percent40', 'Percent50', 'Percent60', 'Percent70', 'Percent75', 'Percent80', 'Percent90', 'DarkHorizontal', 'DarkVertical', 'DarkDownwardDiagonal', 'DarkUpwardDiagonal', 'SmallCheckerBoard', 'Trellis', 'LightHorizontal', 'LightVertical', 'LightDownwardDiagonal', 'LightUpwardDiagonal', 'SmallGrid', 'DottedDiamond', 'WideDownwardDiagonal', 'WideUpwardDiagonal', 'DashedUpwardDiagonal', 'DashedDownwardDiagonal', 'NarrowVertical', 'NarrowHorizontal', 'DashedVertical', 'DashedHorizontal', 'LargeConfetti', 'LargeGrid', 'HorizontalBrick', 'LargeCheckerBoard', 'SmallConfetti', 'Zigzag', 'SolidDiamond', 'DiagonalBrick', 'OutlinedDiamond', 'Plaid', 'Sphere', 'Weave', 'DottedGrid', 'Divot', 'Shingle', 'Wave', 'Horizontal', 'Vertical', 'Cross', 'DownwardDiagonal', 'UpwardDiagonal', 'DiagonalCross', 'NotDefined'])\n unless validator.valid?(style)\n fail ArgumentError, 'invalid value for \"style\", must be one of #{validator.allowable_values}.'\n end\n @style = style\n end", "def []=(content_type, klass); end", "def create_format_method\n case @style\n when :json; Parseable.create_json_format_method(self)\n when :yaml; Parseable.create_yaml_format_method(self)\n else raise ArgumentError, \"unknown format style '#@style'\" end\n end", "def class(attachment = nil, style_name = nil)\n return super() if attachment.nil? && style_name.nil?\n\n plural_cache.underscore_and_pluralize_class(attachment.instance.class)\n end", "def generate_custom_classes\r\n\t\t# TODO: this method assumes an application to find the metadata on; the metadata should be part of this class instance instead, shared with the app when present\r\n\t\tparent_class_name = {\r\n\t\t\t'CustomMaterial' => 'MaterialBase',\r\n\t\t\t'Effect' => 'Effect',\r\n\t\t\t'Behavior' => 'Behavior',\r\n\t\t\t'RenderPlugin' => 'RenderPlugin'\r\n\t\t}\r\n\t\t@class_by_ref = {}\r\n\t\t@doc.xpath('/UIP/Project/Classes/*').each do |reference|\r\n\t\t\tpath = absolute_path( reference['sourcepath'] )\r\n\t\t\tnext unless File.exist?( path )\r\n\t\t\tparent_class = app.metadata.by_name[ parent_class_name[reference.name] ]\r\n\t\t\traise \"Error, unsupported custom class #{reference.name}\" unless parent_class\r\n\t\t\tparent_props = parent_class.properties\r\n\t\t\tnew_defaults = Hash[ reference.attributes.map{ |name,attr| [name,attr.value] }.select{ |name,val| parent_props[name] } ]\r\n\t\t\tproperty_el = case reference.name\r\n\t\t\t\twhen 'CustomMaterial', 'Effect', 'RenderPlugin'\r\n\t\t\t\t\tdoc = Nokogiri.XML(File.read(path,encoding:'utf-8'))\r\n\t\t\t\t\tdoc.at('/*/MetaData') || doc.at('/*/metadata') # Some render plugins in the wild use lower-case tag name :/\r\n\t\t\t\twhen 'Behavior'\r\n\t\t\t\t\tlua = File.read(path,encoding:'utf-8')\r\n\t\t\t\t\tmeta = lua[ /--\\[\\[(.+?)(?:--)?\\]\\]/m, 1 ]\r\n\t\t\t\t\tNokogiri.XML(\"<MetaData>#{meta}</MetaData>\").root\r\n\t\t\tend\r\n\t\t\t@class_by_ref[ \"##{reference['id']}\" ] = app.metadata.create_class( property_el, parent_class, reference.name, new_defaults )\r\n\t\tend\r\n\t\tnil\r\n\tend", "def genFileContent(cls, bld)\r\n Utils.instance.genFunctionDependencies(cls, bld)\r\n Utils.instance.genUses(cls.uses, bld)\r\n Utils.instance.genNamespaceStart(cls.namespace, bld)\r\n\r\n classDec = cls.model.visibility + \" class \" + cls.name\r\n\r\n inheritsFrom = Array.new\r\n\r\n for baseClass in cls.baseClasses\r\n inheritsFrom << baseClass.name\r\n end\r\n if cls.interfaceNamespace.hasItems?()\r\n inheritsFrom << Utils.instance.getStyledClassName(\"i \" + getUnformattedClassName(cls))\r\n end\r\n\r\n for par in (0..inheritsFrom.size)\r\n if par == 0 && inheritsFrom[par] != nil\r\n classDec << \" : \" << inheritsFrom[par]\r\n elsif inheritsFrom[par] != nil\r\n classDec << \", \" << inheritsFrom[par]\r\n end\r\n end\r\n\r\n bld.startClass(classDec)\r\n\r\n render_functions(cls, bld)\r\n\r\n bld.endClass\r\n\r\n Utils.instance.genNamespaceEnd(cls.namespace, bld)\r\n end", "def css; end", "def css; end", "def css; end", "def class_type_from(content_type) \n case Mime::Type.lookup(content_type).to_sym \n when :text: 'SimpleText' \n when :jpg, :jpeg, :gif, \n :png, :tiff, :bmp: 'ImageData' \n when :xml: 'XmlData' \n when :pdf: 'PdfData' \n else name.demodulize \n end \n end", "def css_template_filename\n self.class.name.downcase.gsub(/.*::/,'') << '.css.erb'\n end", "def processor_options\n original_processor_options.merge!(:style => name)\n end", "def detected_styles; end", "def output_class\n 'PictureTag::OutputFormats::' + titleize(PictureTag.preset['markup'])\n end", "def set_style\n @style = Style.find(params[:id])\n end", "def style_path(path_prefix, type)\n @record.name =~ /\\.#{type}$/ ? \"#{path_prefix}Stylesheets/#{@record.name}\" : \"#{path_prefix}Stylesheets/#{@record.name}.#{type}\"\n end" ]
[ "0.645608", "0.63567096", "0.6282099", "0.6250258", "0.6184444", "0.6184444", "0.6184444", "0.61592114", "0.6152576", "0.60998493", "0.60998493", "0.60998493", "0.6087915", "0.608073", "0.59904", "0.5940956", "0.59060866", "0.5902025", "0.58882016", "0.5883764", "0.5860706", "0.5755097", "0.5701755", "0.56981117", "0.56495976", "0.56495976", "0.5627685", "0.5625074", "0.56215715", "0.5609238", "0.56065863", "0.5595159", "0.5595159", "0.5595159", "0.5589844", "0.55784947", "0.5577539", "0.5568587", "0.5549123", "0.5536058", "0.5515242", "0.55017823", "0.5484541", "0.54800916", "0.54797703", "0.54775673", "0.5455476", "0.5426926", "0.542164", "0.5413723", "0.5412548", "0.5408034", "0.5404546", "0.5401306", "0.5395473", "0.5385029", "0.538487", "0.5383225", "0.53779995", "0.5377791", "0.5375183", "0.5371502", "0.5361581", "0.53589493", "0.5357613", "0.53549564", "0.53534377", "0.5347366", "0.5326222", "0.5326077", "0.53257966", "0.5315932", "0.53153914", "0.5302229", "0.5301167", "0.52990836", "0.5297874", "0.5291838", "0.52607965", "0.5252163", "0.5251907", "0.5251907", "0.5241834", "0.5240938", "0.5231601", "0.52197963", "0.52128136", "0.52060723", "0.5194034", "0.5189128", "0.5185876", "0.5185876", "0.5185876", "0.51843965", "0.5171061", "0.5170933", "0.51692563", "0.5157321", "0.51454264", "0.5133024" ]
0.6458337
0
set the path where the files are going to be stored based on the class_type
def set_path_based_on_parent! if self.class_type == 'variant' ":rails_root/public/assets/upload/variants/:id/:style/:basename.:extension" elsif self.class_type == 'banner' ":rails_root/public/assets/upload/banner/:style/:basename.:extension" elsif self.class_type == 'logo' ":rails_root/public/assets/upload/logo/:style/:basename.:extension" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_path\n self.path = File.join(self.store_dir, self.filename)\n end", "def setup_class_info\n @file_model = nil\n @resource_assoc = :generic_files\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end", "def store_dir\n\t\t\"magic_beans/upload/tmp/#{model.id}\"\n\tend", "def setFileName(path)\n end", "def files_for(klass); end", "def store_dir\n # \"images/#{model.class.to_s.underscore}/#{model.team_name}\"\n \"images/product_images/\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end", "def store_dir\n \"#{model.class.to_s.underscore}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore.pluralize}/#{model.image_type.pluralize}/#{model.id}\"\n end", "def initialize(path, path_type = :full)\n super()\n @ext_name = :yml\n @path_type = path_type\n @original_path = path\n @relative_save_file_path = PathnameManager.new(path, path_type).relative_save_file_path\n end", "def object_dir\n ::File.join(new_resource.config_home, type_from_name) + 's'\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.attachable_id}\"\n end", "def set_file_type(file_type)\n @file_type = file_type\n init_data_arrays\n end", "def store_dir\n \"assets/media/#{model.class.to_s.underscore}/#{model.contest_attachment_group_id}/\"\n end", "def pathfind(file_type)\n image_directory = Rails.root.join('public', 'system', 'shipping_labels', @carrier.to_s)\n\n FileUtils.mkdir_p(image_directory)\n @path = File.join(image_directory, \"#{tracking_number}.#{file_type}\")\n end", "def path_for(type_name)\n path = path_join type_name.file_path\n ensure_path_exists path\n\n File.join path, type_name.file_name\n end", "def post_configure\n super\n @path = File.expand_path(path)\n end", "def store_dir\n \"uploads/creation_doc/#{model.id}\"\n end", "def set_file_type\n if self.is_local?\n if self.attachment_content_type.blank?\n self.file_type = \"misc\"\n elsif self.attachment_content_type == 'application/pdf'\n self.file_type = \"pdf\"\n elsif self.attachment_content_type.include?('powerpoint')\n self.file_type = \"presentation\"\n elsif self.attachment_content_type == 'application/zip'\n self.file_type = \"zip\"\n elsif self.attachment_content_type == \"application/rtf\" || self.attachment_content_type == 'text/plain' || self.attachment_content_type == 'application/msword' || self.attachment_content_type.include?('wordprocessing')\n self.file_type = \"document\"\n elsif self.attachment_content_type.include?('spreadsheet') || self.attachment_content_type == 'ms-excel'\n self.file_type = \"spreadsheet\"\n elsif self.attachment_content_type.include?('image')\n self.file_type = \"image\"\n else\n self.file_type = \"misc\"\n end\n end\n end", "def set_path\n @file_path = @s3_local_object.body.path\n end", "def file_path\n\t\tself.class.file_path\n\tend", "def class_path klass_name\n File.join @path, *klass_name.split('::')\n end", "def store_dir\n \"#{model.class.to_s.pluralize.parameterize}/#{model.id}/\"\n end", "def file_path\n self.class.file_path\n end", "def file_path\n self.class.file_path\n end", "def file_path\n self.class.file_path\n end", "def store_dir\n \"uploads/#{model.Mid}\"\n end", "def store_dir\n if model.class.name == 'Monologue::Post'\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n else\n \"uploads/#{model.imageable.class.name}/#{mounted_as}/#{model.id}\"\n end\n end", "def store_dir\n \"uploads/creation_ppt/#{model.id}\"\n end", "def store_dir\n if model.is_a?(Asset) && !model.theme_id.blank?\n \"uploads/#{model.class.to_s.underscore}/#{model.theme_id}\"\n else\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end\n end", "def file_type_class\n self.file_type.downcase.split.join('-') + '-file'\n end", "def path\n @path ||= make_path(@module.to_a.concat(outter_class.to_a).push(filename))\n end", "def store_dir\n '%suploads/peoplefinder/%s/%s/%s' % [\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n ]\n end", "def type_path\n type_directory + \"#{@name}.rb\"\n end", "def pdf=(klass); end", "def initialize\n TYPES.each do |type|\n transform_files!(Files.type_files(type), type)\n end\n end", "def store_dir\n \"#{model.class.to_s.underscore}/#{model.id}/documents\"\n end", "def store_dir\n # NOTE that we are storing avatars by wca_id. There are two consequences of this:\n # - A user must have a wca_id to have an avatar (see validations in user.rb).\n # - Changing the wca_id for a user is complicated, and not something we\n # are bothering to handle very well.\n \"uploads/#{model.class.to_s.underscore}/avatar/#{model.wca_id}\"\n end", "def file_type; 'directory' end", "def store_dir\n \"uploads/#{model.id}\"\n end", "def store_dir\n format(\n '%suploads/peoplefinder/%s/%s/%s',\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n )\n end", "def type\n class_to_filename(self.class.to_s.sub(/.*:/, ''))\n end", "def url_path_class=(klass)\n @_url_path_class = klass\n end", "def store_dir\n \"files/#{model.album.path}\"\n end", "def path\n @path_klass.new(super)\n end", "def push_path(type, path, file_glob = \"**/*.rb\") \n\t\t enforce!(type => Symbol)\n\t\t load_paths[type] = [path, file_glob]\n\t\tend", "def store_dir\n %(#{Rails.root}/storage/#{model.parent.class.name.pluralize.downcase}/#{model.parent.id})\n end", "def store_dir\n\t\t\"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n\tend", "def path\n filename = [key, self.class.subclass_suffix, self.class::FILE_SUFFIX]\n filename = filename.compact.join('.')\n\n if subdirectory\n directory.join(subdirectory).join(filename)\n else\n directory.join(filename)\n end\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.isbn}\"\n end", "def _FILESDIR; Config._FILES; end", "def store_dir\n\"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\nend", "def extra_store_dir\n case object_class_name\n when 'conferences'\n 'logos'\n when 'lodgings'\n 'photos'\n when 'sponsors'\n 'logos'\n when 'venues'\n 'photos'\n else mounted_as\n end\n end", "def path\n filename = [key, self.class.subclass_suffix, self.class.extension_name]\n filename = filename.compact.join('.')\n\n if subdirectory\n directory.join(subdirectory).join(filename)\n else\n directory.join(filename)\n end\n end", "def type_dir\n Rails.root + \"app/assets/images/#{model.imageable_type.downcase.pluralize}/\"\n end", "def store_dir\n configured_upload_path + \"#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def datat_location\n \n #Please change the datat_path as required\n datat_path = '/Users/James/Dropbox/ToucanBox/Data/'\n \n #@@datat_path_specific is accessible anywhere in the class\n @@datat_path_specific = datat_path + @database +'.csv'\n \n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\" \n end", "def store_dir\r\n \"assets/user/avatar/#{model.id}\"\r\n end", "def save_java_class_path(path)\n #$CLASSPATH << File.join(PROJECT_ROOT, \"package\", \"classes\", \"java\")\n end", "def initialize uri = nil, response = nil, body_io = nil, code = nil\n directory = self.class.directory\n\n raise Mechanize::Error,\n 'no save directory specified - ' \\\n 'use Mechanize::DirectorySaver.save_to ' \\\n 'and register the resulting class' unless directory\n\n super\n\n path = File.join directory, @filename\n\n save path\n end", "def store_dir\n \"uploads/paper/#{model.paper.id}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def path= path\n @path = path\n @fileInTable.path = @user + '/' + @group + '/' + @path\n save\n end", "def store_dir\n File.join(OpenInvoice.config.dir_prefix,\n model.class.to_s.underscore,\n mounted_as.to_s,\n model&.id.to_s)\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\nend", "def file_path(append_extension = true)\n\t\tpath = SOLUTION_PATH + folder_name + class_name\n\t\tpath += '.java' if append_extension\n\t\treturn path\n\tend", "def class_to_basefile class_name\n\t\t\treturn \"#{base_dir}/#{class_name.gsub(\"::\", \"/\")}\"\n\t\tend", "def directory\n self.class.directory\n end", "def directory\n self.class.directory\n end", "def type path\n end", "def store_dir\n 'file_uploads'\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"#{Rails.env}/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/imports/\"\n end", "def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end", "def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end", "def klass=(content_type)\n if self.class_name == content_type.slug\n @klass = content_type\n end\n end", "def store_dir\n cls = \"#{model.class.to_s.underscore}\"\n \"uploads/#{Rails.env}/#{cls}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"post_images/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"#{Rails.env}/uploads/user/avatar/#{model.id}\"\n end", "def store_dir\n \"#{Rails.env}/uploads/#{model.class.to_s.underscore}/#{mounted_as}\"\n # /#{model.id}\"\n end", "def push_path(type, path, file_glob = \"**/*.rb\")\n enforce!(type => Symbol)\n load_paths[type] = [path, file_glob]\n end", "def push_path(type, path, file_glob = \"**/*.rb\")\n enforce!(type => Symbol)\n load_paths[type] = [path, file_glob]\n end", "def store_dir\n \"uploads/#{model.request_id}\"\n end", "def instance_directory\n @instance_directory ||= instance_pathname filename: \"/\"\n end", "def path\n File.join(self.folder, self.filename)\n end", "def store_dir\n \"system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n if Wangeditor::AssetUploader.save_upload_info?\n \"#{RailsWangeditor.upload_store_dir}/#{model.asset_type.to_s.underscore.gsub(/(wangeditor\\/)|(_uploader)/, '')}/#{model.created_at.strftime(\"%Y%m\")}\"\n else\n \"#{RailsWangeditor.upload_store_dir}/#{self.class.to_s.underscore.gsub(/(wangeditor\\/)|(_uploader)/, '')}/#{Time.now.strftime(\"%Y%m\")}\"\n end\n end", "def store_dir\n \"uploads/#{Rails.env}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.uid}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end" ]
[ "0.6750725", "0.63662887", "0.630653", "0.62392724", "0.62199235", "0.6179013", "0.6077784", "0.6059656", "0.60539013", "0.60539013", "0.60539013", "0.60539013", "0.60539013", "0.60539013", "0.60539013", "0.6053886", "0.5972618", "0.5909949", "0.59066343", "0.5880611", "0.5870429", "0.584845", "0.5843233", "0.58267885", "0.58049625", "0.5792845", "0.5791165", "0.5779429", "0.57792115", "0.576332", "0.57607454", "0.57517034", "0.57448626", "0.57448626", "0.57448626", "0.574431", "0.57421494", "0.57278687", "0.5726547", "0.57183087", "0.5706116", "0.57010055", "0.56969213", "0.56935215", "0.5688555", "0.5671638", "0.56522405", "0.56414676", "0.56366235", "0.5627395", "0.5614338", "0.56110334", "0.561006", "0.560996", "0.5604142", "0.56006026", "0.56001306", "0.55988246", "0.55986845", "0.5594885", "0.55883855", "0.5586789", "0.55850095", "0.558164", "0.556757", "0.5560823", "0.555945", "0.5558471", "0.55578715", "0.5553914", "0.55432594", "0.55427116", "0.5528696", "0.55191696", "0.55178595", "0.55081207", "0.55076027", "0.55076027", "0.5492725", "0.5491519", "0.5490426", "0.54899424", "0.54863834", "0.54834735", "0.54834735", "0.54791903", "0.5477538", "0.5476616", "0.5476596", "0.5471751", "0.54707026", "0.54707026", "0.54696065", "0.5464799", "0.5464304", "0.54576683", "0.54576683", "0.5456651", "0.5454834", "0.54454577" ]
0.62961644
3
set the url where the files are going to be accessed based on the class_type
def set_url_base_on_parent! if self.class_type == 'variant' "/assets/upload/variants/:id/:style/:basename.:extension" elsif self.class_type == 'banner' "/assets/upload/banner/:style/:basename.:extension" elsif self.class_type == 'logo' "/assets/upload/logo/:style/:basename.:extension" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_path_class=(klass)\n @_url_path_class = klass\n end", "def assign_download_endpoint(klass)\n endpoint_class = Class.new(klass)\n endpoint_class.opts[:shrine_class] = self\n const_set(:DownloadEndpoint, endpoint_class)\n end", "def url\n self.class.url\n end", "def url\n raise NotImplementedError, 'this should be overridden by subclass'\n end", "def url_path\n self.class.url_path_class.new(self).call\n end", "def fetch_file_by_url\n if (self.url)\n self.file = self.url\n end\n end", "def set_path_based_on_parent!\n if self.class_type == 'variant'\n \":rails_root/public/assets/upload/variants/:id/:style/:basename.:extension\"\n elsif self.class_type == 'banner'\n \":rails_root/public/assets/upload/banner/:style/:basename.:extension\"\n elsif self.class_type == 'logo'\n \":rails_root/public/assets/upload/logo/:style/:basename.:extension\"\n end\n end", "def url\n end", "def url\n raise \"Implement in child class\"\n end", "def url\n end", "def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend", "def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend", "def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend", "def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend", "def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend", "def url=(_); end", "def url\n super\n end", "def file_url\n end", "def url\n # NOTE: May be useful to get the class for the base_document_type and see if it respond_to base.\n # If so call that to make sure we really are at the top parent!\n controller = self.base_document_type.pluralize\n path = \"#{controller}/#{self.base_document_id.to_s}\"\n klass = self.document_type.to_s.camelize.constantize\n base_klass = self.base_document_type.to_s.camelize.constantize\n has_custom_url_method = klass.respond_to?(:audit_url) || base_klass.respond_to?(:audit_url)\n klass_with_custom_url = klass.respond_to?(:audit_url) ? klass : base_klass;\n return has_custom_url_method ? klass_with_custom_url.audit_url(base_document_id) : path\n rescue NameError\n path\n end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def set_url(url_value)\n @path = url_value.delete_prefix \"/\"\n @dir = File.dirname(@path)\n @url = url_value\n end", "def set_url\n url 'set'\n end", "def save_url\n raise MotionModelResource::URLNotDefinedError.new \"URL is not defined for #{self.class.name}!\" unless self.class.respond_to?(:url)\n\n case save_action\n when :create then self.try(:url) || self.class.url\n when :update then self.try(:url) || \"#{self.class.url}/#{id}\"\n end\n end", "def acquirer_url(request_type)\n self.class.send(\"#{test_or_live}#{sort_request(request_type)}_url\")\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 set_url\n @url = DEFAULT_URL\n end", "def klass=(content_type)\n if self.class_name == content_type.slug\n @klass = content_type\n end\n end", "def url(url)\n @url = url\n end", "def []=(content_type, klass); end", "def url\n cname = self.class.classname.to_s.downcase\n return \"?show=#{cname}_show&#{cname}_id=#{self.id}\"\n end", "def url_by_url_type(url, url_type)\n UrlTypes.url_by_url_type url ,url_type\n end", "def url(**options)\n file&.url(**options)\n end", "def url\n @url\n end", "def url\n @url\n end", "def url(value)\n @url = value\n end", "def url\n @url\n end", "def url\n [ Configuration.url, @path ].join\n end", "def url\n self.name\n end", "def classes\n redirect_to helpers.static_page_path_for(:classes), status: :moved_permanently\n end", "def url; \"file:#{@root}\"; end", "def path\n http_url @store.rdoc.generator.class_dir\n end", "def url_template; end", "def url_template; end", "def url\n \"http://#{self.domain}/#{self.path}\"\n end", "def get_create_url(document_type)\n\n get_server_url(false) + '/sample?fileExt=' + get_internal_extension(document_type).delete('.')\n\n end", "def url\n @client.url + self.class.path + @sport.to_s\n end", "def url\n ::File.join \"/\", path.to_s\n end", "def set_url\n @url = Url.get_from_short(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def output_file(type)\n if (type == :html)\n \"#{DirMap.public}#{News.public_path}/#{self.filename}.html\"\n else\n \"#{DirMap.public}#{News.public_path}/#{self.filename}.html\"\n end\n end", "def source_url=(url)\n return nil if not url\n http_getter = Net::HTTP\n uri = URI.parse(url)\n response = http_getter.start(uri.host, uri.port) {|http|\n http.get(uri.path)\n }\n case response\n when Net::HTTPSuccess\n file_data = response.body\n return nil if file_data.nil? || file_data.size == 0\n self.content_type = response.content_type\n self.temp_data = file_data\n self.filename = uri.path.split('/')[-1]\n else\n return nil\n end\n end", "def url_for(style)\n reprocess_for(style)\n file.url(style)\n end", "def url(*args)\n if [:thumb, :content].include?(args.first)\n send(\"url_#{args.first.to_s}\")\n else\n file.url(*args)\n end\n end", "def url=(url)\n @@url = url\n end", "def url_for_list(type); end", "def set_server_type(server_type)\n if (server_type.casecmp('filer') == 0)\n @url = FILER_URL\n @dtd = FILER_dtd\n elsif (server_type.casecmp('netcache') == 0)\n @url = NETCACHE_URL\n @port = 80\n elsif (server_type.casecmp('agent') == 0)\n @url = AGENT_URL\n @port = 4092\n @dtd = AGENT_dtd\n elsif (server_type.casecmp('dfm') == 0)\n @url = DFM_URL\n @port = 8088\n @dtd = DFM_dtd\n if(@transport_type == \"HTTPS\")\n @port = 8488\n end\n elsif (server_type.casecmp('ocum') == 0)\n @url = DFM_URL\n @port = 443\n @transport_type = \"HTTPS\"\n @dtd = DFM_dtd\n else\n fail_response(13001, \"NaServer::set_server_type: bad type \\\"\" + server_type + \"\\\"\")\n end\n @server_type = server_type\n end", "def files_for(klass); end", "def initialize(**options)\n @type = options[:type]\n @uri = options[:uri]\n @class_name ||= Lotus::Utils::String.new(\"#{@type}_adapter\").classify\n end", "def url=(url)\n @@url = url\n end", "def path\n @path_klass.new(super)\n end", "def set_url\n # @url = Url.find(params[:id])\n end", "def url\n if @url\n @url\n else\n begin\n\n page_name = File.basename(self.name, '.*')\n config = @config['permalinks'][page_name]\n\n if config.is_a? String\n @url = config\n self.data['permalink'] = nil\n else\n @config['permalinks'][File.basename(self.name, '.*')] = self.data['permalink']\n end\n rescue; end\n\n super\n\n if @url && @url =~ /\\/$/\n if self.ext == '.xml'\n @url = File.join(@url, \"index.xml\")\n else\n @url = File.join(@url, \"index.html\")\n end\n end\n\n @url\n end\n end", "def path\n \"#{RAILS_ROOT}/photos/#{self.visit.user_id}/#{self.visit_id}\"\n \n# \"#{RAILS_ROOT}/public/images/#{self.class.to_s.underscore.pluralize}\"\n end", "def set_asset_class\n for pattern, klass in asset_class_lookup\n if pattern === mimetype\n new_klass = klass\n end\n end\n\n transmogrify_asset(new_klass || GenericAsset)\n end", "def staticPath(type)\n case type\n when 'log' then '/public/downloads/logs/'\n when 'logs' then '/public/downloads/logs/'\n when 'image' then '/public/static/images/'\n when 'images' then '/public/static/images/'\n when 'css' then '/public/static/css/'\n when 'js' then '/public/static/js/'\n end\n end", "def set_filetypes\n #unless params[:id] == 'download' || params == :file\n @filetype = Filetype.find(params[:id])\n # end\n end", "def url\n SETTINGS[:url] || raise(\"Must provide URL - please edit file\")\nend", "def url\n SETTINGS[:url] || raise(\"Must provide URL - please edit file\")\nend", "def url\n SETTINGS[:url] || raise(\"Must provide URL - please edit file\")\nend", "def thumb_url_for(format)\n if Smartthumbs::Config.get_option(:assume_klass).to_s == self.class.to_s\n \"/th/#{format.to_s}/#{self.id}.#{st_extension}\"\n else\n \"/th/#{self.class.to_s.underscore.parameterize}/#{format.to_s}/#{self.id}.#{st_extension}\"\n end\n end", "def base_url\n self.class.base_url\n end" ]
[ "0.7079703", "0.656588", "0.6538705", "0.63712037", "0.6356744", "0.6351664", "0.6223782", "0.61992407", "0.61583555", "0.6144934", "0.6142258", "0.6142258", "0.6142258", "0.6142258", "0.6142258", "0.6013497", "0.60076904", "0.59998655", "0.5993192", "0.59394485", "0.59394485", "0.59394485", "0.59394485", "0.59394485", "0.59394485", "0.59394485", "0.59394485", "0.59394485", "0.59394485", "0.59394485", "0.59394485", "0.59394485", "0.59394485", "0.59394485", "0.59394485", "0.59394485", "0.59394485", "0.59394485", "0.59237677", "0.5865481", "0.58601564", "0.58531594", "0.5825023", "0.58122474", "0.58016896", "0.5790828", "0.579055", "0.5785197", "0.57582426", "0.57534266", "0.57245046", "0.57245046", "0.5718424", "0.5717315", "0.5714869", "0.57040316", "0.570016", "0.5699834", "0.5686512", "0.56769687", "0.56769687", "0.56620795", "0.56617254", "0.5659545", "0.5657553", "0.56493527", "0.5648685", "0.5648685", "0.5648685", "0.5648685", "0.5648685", "0.5648685", "0.5648685", "0.5648685", "0.5648685", "0.5648685", "0.5648685", "0.5648685", "0.5640303", "0.563522", "0.5604303", "0.55940926", "0.5588814", "0.5588429", "0.5571511", "0.55706054", "0.5569399", "0.5565108", "0.5563607", "0.55587", "0.5544941", "0.55368847", "0.5535684", "0.55341476", "0.55315375", "0.5531019", "0.5531019", "0.5531019", "0.5528348", "0.55219156" ]
0.6704642
1
for new layout test
def render_resolve_url_personal(work, show_youtube_iframe=false) url = work.attach_url obj = get_resolved_url_obj(url) case obj[:type] when "image" tag :img, src: "#{url}", onload: "onImageLoad(this)" when "audio" #compare to 2 tag :audio, controls: "controls", src: "#{url}", style: "width:100%;" when "video" tag :video, controls: "controls", src: "#{url}", width: "100%", height: "100%" when "youtube" matches = obj[:match_object] if show_youtube_iframe queryobj = {} queryobj["rel"] = 0 hashes = "" overrides = Rack::Utils.parse_query(URI.parse(matches[0]).query) overrides.delete("v") queryobj = queryobj.merge(overrides) if matches[4] != nil splits = matches[4].split('#') if splits.length > 1 hashes += "#" + splits[1] end end queryobj["enablejsapi"] = 1; if queryobj["t"].present? timeRe = /((?<min>\d+)[m])?((?<sec>\d+)[s])?/ time = queryobj["t"].scan(timeRe)[0] queryobj["start"] = (time[0] ? time[0].to_i : 0) * 60 + (time[1] ? time[1].to_i : 0) end querystr = Rack::Utils.build_query(queryobj) content_tag :iframe, '', src: "https://www.youtube.com/embed/#{matches[2]}?#{querystr}#{hashes}", width: '100%', frameborder: '0', height: '100%' else tag :img, src: "https://i.ytimg.com/vi/#{matches[2]}/hqdefault.jpg", onload: "onImageLoad(this)" end else # content_tag :div, :data => { :remote_url => url }, class: "remote-preview" do # content_tag(:div,'', style: 'background-image:url(' + work.remote_image_url + ')', class: 'preview-image') + # content_tag(:p, work.remote_description, class: 'preview-description') # end tag :img, src: "#{work.remote_image_url}", onload: "onImageLoad(this)" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_in_layout?; end", "def place_in_layout?; end", "def set_layout\n @layoutme = 1\n end", "def layout; end", "def layouts=(_arg0); end", "def layouts=(_arg0); end", "def layout=(_arg0); end", "def _implied_layout_name; end", "def layout_children\n \n end", "def validate_layout(layout); end", "def render_layout(output, layout, info); end", "def _layout(*_arg0); end", "def no_layout?; end", "def _conditional_layout?; end", "def invalid_layout?(layout); end", "def invalid_layout?(layout); end", "def kopal_layout_after_body_start\n\n end", "def layouts; end", "def layouts; end", "def determine_layout\n 'akinu'\n end", "def layout_fields\n \n end", "def kopal_layout_after_page_header\n\n end", "def kopal_layout_after_page_sidebar\n\n end", "def test_layout\n @prefs.each do |x|\n # quite a many portletpreferences have no layouts. perhaps they are deleted from the page?\n if x.plid == 0\n assert_nil x.layout\n else\n assert_not_nil x.layout, \"PortletPreferences #{x.id} belongs to non-existing layout #{x.plid}\"\n end\n end\n end", "def action_has_layout?; end", "def allow_layout?\n true\n end", "def kopal_layout_after_page_front\n\n end", "def layout(new_layout = nil)\n @layout = new_layout if new_layout\n @layout\n end", "def do_layout(payload, layouts)\n end", "def kopal_layout_before_page_sidebar\n\n end", "def layout\n lookup_layout\n end", "def test_render_passing_layout_located_in_cells_b_layouts\n BCell.class_eval do\n def existing_view; @b = \"b\"; \n render :layout => \"b/layouts/metal\"; end\n end\n assert_equal \"B-Metal:B/existing_view/b\", render_cell(:b, :existing_view)\n end", "def layout \n return @layout\n end", "def test\n\n render layout: 'views/index'\n\n end", "def layout\n @layout\n end", "def versao_layout_lote\n raise Brcobranca::NaoImplementado, 'Sobreescreva este método na classe referente ao banco que você esta criando'\n end", "def layout\n nil\n end", "def kopal_layout_after_page_meta\n\n end", "def place_in_layouts(content, payload, info); end", "def layout(name)\n $stderr.puts \"Overwriting Layout: #{self.class.def_layout.inspect} with #{name}\"\n @_layout = name\n end", "def register_layout_setup\n @tab = :register\n end", "def kopal_layout_before_page_header\n\n end", "def kopal_layout_before_page_footer\n\n end", "def assert_basic_layout\n get topic_path(@topic)\n # Posts index is actually topic show.\n assert_template 'posts/index'\n # Assert there is topic title.\n assert_match CGI.escapeHTML(@topic.title), response.body\n # Assert there is current_page/total_pages indicator.\n current_page = assigns(:posts).current_page\n total_pages = assigns(:posts).total_pages\n assert_match CGI.escapeHTML(\"#{current_page}/#{total_pages}\"), response.body\n # Asset there is link to corresponding category.\n assert_select 'a[href=?]', category_path(@topic.category)\n # Assert there is will_paginate on the page.\n assert_select 'ul.pagination', count: 1\n # Assert there is no flash messages.\n assert_flash_notices\n end", "def initialize_test_layout\n self.model_tests_dir = \"test/unit\"\n self.controller_tests_dir = \"test/functional\"\n self.view_tests_dir = \"test/views\"\n self.fixtures_dir = \"test/fixtures\"\n end", "def layout\n nil\n end", "def assert_layout(expected)\n if expected\n assert_equal(\"layouts/#{expected}\", @response.layout, \"layout\")\n else\n assert_nil(@response.layout, \"no layout\")\n end\n end", "def assert_layout(expected)\n if expected\n assert @layouts.include?(\"layouts/#{expected}\"), \"Expected layout #{expected} in #{@layouts.keys.join(\", \")}\"\n else\n assert @layouts.keys.all? { |k| k.nil? }, \"Expected no layout, but had #{@layouts.inspect}\"\n end\n end", "def test_layoutid\n flunk mysql_bug if defined?(mysql_bug)\n\n @layouts.each do |x|\n assert_not_nil x.layoutid, \"#{x} has no local layout number\"\n end\n\n groupids = @layouts.map{|x| x.groupid}.uniq\n groupids.each do |gid|\n # find all group's layoutids\n pub = Web::Layout.find(:all, :conditions => \"groupid=#{gid} AND privatelayout=false\").map{|x| x.layoutid}\n priv = Web::Layout.find(:all, :conditions => \"groupid=#{gid} AND privatelayout=true\").map{|x| x.layoutid}\n\n # they must have no overlapping ids\n assert pub.uniq == pub, \"Group #{gid} has duplicate public layoutids\"\n assert priv.uniq == priv, \"Group #{gid} has duplicate private layoutids\"\n end\n end", "def on_load\n layout (self.view, :root) do\n\n @title = subview(UILabel, :title)\n @username = subview(UITextField, :username, delegate: self)\n @password = subview(UITextField, :password, delegate: self)\n @login_button = subview(UIButton.custom, :login_button)\n @register_button = subview(UIButton.custom, :register_button)\n\n #auto do\n # metrics 'margin' => 20\n # #metrics '2margin' => 20\n #\n # vertical \"|-50-[title]-75-[username]-margin-[password(==80)]-margin-[login_button(==30)]->=20-[register_button(==40)]-margin-|\"\n # horizontal \"|-[title]-|\"\n # horizontal \"|-margin-[username]-margin-|\"\n # horizontal \"|[password]-margin-|\"\n # horizontal \"|-margin-[login_button]-margin-|\"\n # horizontal \"|-margin-[register_button]-margin-|\"\n #end\n end", "def default_layout(width=@width, height=@height)\n if @nodes.length > 0\n set_static_nodes(width,height)\n static_wheel_nodes(width,height)\n fruchterman_reingold(100,width,height) #fast, little bit of layout for now\n normalize_graph(width,height)\n #do_kamada_kawai\n else\n @notice = NO_ITEM_ERROR\n end\n end", "def build_layout\n year = Time.now.year\n add_call('Notification des abonnements électroniques', ->() { notifier })\n add_call(\"Extension des abonnements gratuits et d'échange de l'année #{year - 1}\", ->() { freesubs(year - 1) })\n add_call(\"Extension des abonnements gratuits et d'échange de l'année #{year}\", ->() { freesubs(year) })\n add_call('Création d\\'un abonnement collectif', ->() { collective_manager })\n add_call('Exploitation des abonnements collectifs', ->() { collective_exploitation })\n add_call('Recherche des tiers par facture', ->() { billing_manager })\n add_call('(Pour développeur) Fichiers de requête', ->() { sql_files })\n @layout.add_stretch\n end", "def kopal_layout_before_page_front\n\n end", "def layout()\n layout_children()\n end", "def kopal_layout_after_page_footer\n \n end", "def current_layout\n controller.send :_layout # private method\n end", "def admin_layout \n @admin_layout\n end", "def find_layout(layout, keys, formats); end", "def test_name\n @layouts.each do |x|\n assert_not_nil x.name, \"#{x} has no name\"\n end\n end", "def w3c_tests\n render(layout: false)\n end", "def set_layout\n if 1==1\n 'application'\n else\n 'dean'\n end\n end", "def static_layout\n nil\n end", "def layout(layout_type)\n\t\t#most content. that is loaded into the artist content area (just content)\n\t\tif layout_type.nil? || layout_type.blank?\n\t\t\t@layout = false\n\t\t\t@hook = \"#content\"\n\t\t#when artist page has to be loaded (logo, nave and content)\n\t\telsif layout_type == \"artist\"\n\t\t\t@layout = \"layouts/artist_admin_and_artist_floating_content.html.erb\"\n\t\t\t@hook = \".dynamicContent\"\n\t\tend\n\tend", "def create_layout\n self.bitmap = Cache.UI(LayoutImage)\n self.x = Graphics.center_width(self.bitmap.width)\n self.y = Graphics.height - self.bitmap.height - 16\n end", "def determine_layout\r\n #\"earthlingtwo/earthlingtwo\"\r\n \"#{template_name}/#{template_name}\"\r\n end", "def kopal_layout_before_body_close\n\n end", "def kopal_layout_before_page_meta\n\n end", "def _init_layout\n # when user gives a negative value, we recalc and overwrite so the need to save, for a redraw.\n @saved_width ||= @width\n @saved_height ||= @height\n\n lines = Ncurses.LINES - 1\n columns = Ncurses.COLS - 1\n if @height_pc\n @height = ((lines - @top_margin - @bottom_margin) * @height_pc).floor\n elsif @saved_height <= 0\n @height = lines - @saved_height - @top_margin - @bottom_margin\n end\n $log.debug \" layout height = #{@height} \"\n if @width_pc\n @width = ((columns - @left_margin - @right_margin) * width_pc).floor\n elsif @saved_width <= 0\n # if width was -1 we have overwritten it so now we cannot recalc it. it remains the same\n @width = columns - @saved_width - @left_margin - @right_margin\n end\n $log.debug \" layout wid = #{@width} \"\n # if user has not specified, then get all the objects\n @components ||= @form.widgets.select do |w| w.visible != false && !@ignore_list.include?(w.class.to_s.downcase); end\n $log.debug \" components #{@components.count} \"\n end", "def getLayoutData\n @layoutData\n end", "def do_layout\n _init_layout\n r = @top_margin\n c = @left_margin\n #\n # determine fixed widths and how much is left to share with others,\n # and how many variable width components there are.\n ht = 0 # accumulate fixed height\n fixed_ctr = 0 # how many items have a fixed wt\n var_ctr = 0\n var_wt = 0.0\n @components.each do |e|\n $log.debug \" looping 1 #{e.name} \"\n _tmpwt = cget(e, :weight) || 0\n # what of field and button placed side by side\n if e.is_a? Field or e.is_a? Button or e.is_a? Label\n # what to do here ?\n @wts[e] ||= 1\n ht += @wts[e] || 1\n fixed_ctr += 1\n elsif _tmpwt >= 1\n ht += _tmpwt || 0\n fixed_ctr += 1\n elsif _tmpwt > 0 and _tmpwt <= 1\n # FIXME how to specify 100 % ???\n var_ctr += 1\n var_wt += _tmpwt\n end\n end\n unaccounted = @components.count - (fixed_ctr + var_ctr)\n $log.debug \" unacc #{unaccounted} , fixed #{fixed_ctr} , var : #{var_ctr} , ht #{ht} height #{@height} \"\n balance_ht = @width - ht # use this for those who have specified a %\n balance_ht1 = balance_ht * (1 - var_wt )\n average_ht = (balance_ht1 / unaccounted).floor # give this to those who have not specified ht\n average_ht = (balance_ht1 / unaccounted) # give this to those who have not specified ht\n $log.debug \" #{balance_ht} , #{balance_ht1} , #{average_ht} \"\n # not accounted for gap in heights\n rem = 0 # remainder to be carried over\n @components.each do |e|\n $log.debug \" looping 2 #{e.name} #{e.class.to_s.downcase} \"\n next if @ignore_list.include? e.class.to_s.downcase\n $log.debug \" looping 3 #{e.name} \"\n e.row = r\n e.col = c\n wt = cget(e, :weight)\n if wt\n if wt.is_a? Integer\n e.width = wt\n elsif wt.is_a? Float\n e.width = (wt * balance_ht).floor\n end\n else\n # no wt specified, give average of balance wt\n e.width = average_ht\n hround = e.width.floor\n\n rem += e.width - hround\n e.width = hround\n # see comment in prev block regarding remaininder\n if rem >= 1\n e.width += 1\n rem = 0\n end\n end\n $log.debug \" layout #{e.name} , w: #{e.width} r: #{e.row} , c = #{e.col} \"\n\n e.height = @height\n c += e.width.floor\n c += @gap\n end\n $log.debug \" layout finished \"\n end", "def test_feature_for_layout\r\n\t\tfeatures = Feature.for_layout(99)\r\n\r\n\t\tassert_equal(2, features.length)\r\n\t\tassert_equal(true, features.include?(products(:optioner)))\r\n\t\tassert_equal(true, features.include?(products(:cow3)))\r\n\r\n\t\t# check that the correct number is given when the number to return is < the number of\r\n\t\t# results found in the db\r\n\t\tfeatures = Feature.for_layout(1)\r\n\r\n\t\tassert_equal(1, features.length)\r\n\r\n\t\tfeatures = Feature.for_layout\r\n\r\n\t\tassert_equal(1, features.length)\r\n\tend", "def window_layout(window)\n window =~ /\\[layout (\\S+)\\]/\n $1\nend", "def custom_layout\n case action_name\n when \"industry_xls\"\n \"no_layout\"\n when \"supplier_profiles\"\n \"no_layout\"\n when \"total_xls\"\n \t \"no_layout\"\n when \"industry_level\"\n \"no_layout\"\n when \"supplier_level\"\n \"no_layout\"\n when \"company_xls\"\n \t\"no_layout\"\n when \"customer_record\"\n \t\"no_layout\"\n when \"most_company_xls\"\n \t\"no_layout\"\n when \"conversion_industry\"\n \t\"no_layout\"\n when \"conversion_company\"\n \t\"no_layout\"\n when \"company_xls\"\n \t\"no_layout\"\t\n when \"suppliers_profiles\"\n \t\"no_layout\"\n when \"registered_suppliers\"\n \t\"no_layout\"\n when \"unregistered_suppliers\"\n \t\"no_layout\"\n when \"all_customers\"\n \t\"no_layout\"\n when \"jagent\"\n \t\"no_layout\"\n when \"sagent\"\n \t\"no_layout\"\n when \"poll\"\n \"no_layout\"\t\n when \"industry_conversion\"\n \"no_layout\"\t\n when \"company_conversion\"\t\t\n \"no_layout\"\n when \"reviews_processed\"\n \"no_layout\"\n when \"agent_output\"\n \"no_layout\"\n when \"agent_performance\"\n \"no_layout\"\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n else\n \"admin\"\n end\n end", "def reset_layout layout\n @layout = layout # 2010-02-13 22:23 \n @height = layout[:height]\n @width = layout[:width]\n @top = layout[:top]\n @left = layout[:left]\n end", "def layout(model)\n #Rfm.layout(model.storage_name, options.symbolize_keys) #query.repository.adapter.options.symbolize_keys)\n model.layout\n end", "def set_layout\n #agent = request.env['HTTP_USER_AGENT']#request.user_agent #request.env['HTTP_USER_AGENT']\n #if agent.match(\"Android\")\n #if agent.match(\"Android\")\n # false\n #TOdo change the institution_id to 25607\n unless params[:format].eql?'json'\n if !current_user.institution_id.nil? and [25607, 51324].include? current_user.institution_id\n 'pearson_new'\n elsif !current_user.institution_id.nil? and [26717, 57296].include? current_user.institution_id\n 'schand'\n # elsif !current_user.institution_id.nil? and [44566].include? current_user.institution_id\n # 'abcd_top_menu'\n else\n 'new'#'abcd_top_menu'\n end\n else\n false\n end\n # unless params[:format].eql?'json'\n # if !current_user.institution_id.nil? and [25607, 51324].include? current_user.institution_id\n # 'pearson_new'\n # elsif !current_user.institution_id.nil? and [26717, 57296].include? current_user.institution_id\n # 'schand'\n # elsif !current_user.institution_id.nil? and [1020].include? current_user.institution_id\n # 'abcd_top_menu'\n # else\n # 'new'\n # end\n # else\n # false\n # end\n end", "def find\n self.class.find(@view.layout)\n end", "def get_layout\n layout ||= Amz::Config[:layout] \n layout = Amz::Config[:amp_layout] \n # layout = Amz::Config[:mobile_layout] if browser.mobile?\n # layout = Amz::Config[:tablet_layout] if browser.tablet?\n layout\n end", "def layout=(value)\n return if @default_layout == value && @layout == value\n @default_layout = value\n @layout = value\n refresh\n end", "def do_layout\n $log.debug \" inside do_layout\"\n _init_layout\n raise \"please implement this in your subclass \"\n c = @left_margin\n # determine fixed widths and how much is left to share with others,\n # and how many variable width components there are.\n ht = 0 # accumulate fixed height\n fixed_ctr = 0 # how many items have a fixed wt\n var_ctr = 0\n var_wt = 0.0\n @components.each do |e|\n $log.debug \" looping 1 #{e.name} \"\n _tmpwt = @wts[e] || 0\n # what of field and button placed side by side\n if e.is_a? Field or e.is_a? Button or e.is_a? Label\n @wts[e] ||= 1\n ht += @wts[e] || 1\n fixed_ctr += 1\n elsif _tmpwt >= 1\n ht += @wts[e] || 0\n fixed_ctr += 1\n elsif _tmpwt > 0 and _tmpwt <= 1\n # FIXME how to specify 100 % ???\n var_ctr += 1\n var_wt += @wts[e]\n end\n end\n unaccounted = @components.count - (fixed_ctr + var_ctr)\n $log.debug \" unacc #{unaccounted} , fixed #{fixed_ctr} , var : #{var_ctr} , ht #{ht} height #{@height} \"\n balance_ht = @height - ht # use this for those who have specified a %\n balance_ht1 = balance_ht * (1 - var_wt )\n average_ht = (balance_ht1 / unaccounted).floor # give this to those who have not specified ht\n average_ht = (balance_ht1 / unaccounted) # give this to those who have not specified ht\n $log.debug \" #{balance_ht} , #{balance_ht1} , #{average_ht} \"\n # not accounted for gap in heights\n rem = 0 # remainder to be carried over\n @components.each do |e|\n $log.debug \" looping 2 #{e.name} #{e.class.to_s.downcase} \"\n next if @ignore_list.include? e.class.to_s.downcase\n $log.debug \" looping 3 #{e.name} \"\n e.row = r\n e.col = c\n wt = @wts[e]\n if wt\n if wt.is_a? Integer\n e.height = wt\n elsif wt.is_a? Float\n e.height = (wt * balance_ht).floor\n end\n else\n # no wt specified, give average of balance wt\n e.height = average_ht\n hround = e.height.floor\n\n rem += e.height - hround\n e.height = hround\n # see comment in prev block regarding remaininder\n if rem >= 1\n e.height += 1\n rem = 0\n end\n end\n $log.debug \" layout #{e.name} , h: #{e.height} r: #{e.row} , c = #{e.col} \"\n\n e.width = @width\n r += e.height.floor\n r += @gap\n end\n $log.debug \" layout finished \"\n end", "def page_layout\n @user = User.current\n @blocks = @user.pref.my_page_layout\n end", "def create_layout_info\n self.piece_layout ||= PieceLayout.create(layout: ImageLayout.create)\n self.part_layout ||= PartLayout.create(layout: ImageLayout.create)\n save\n end", "def determine_layout\n case action_name\n when \"new\"\n \"hero\"\n when \"create\"\n \"hero\"\n when \"edit\"\n \"dashboard\"\n when \"update\"\n \"dashboard\"\n end\n end", "def layout_full_center\n nil\n end", "def set_layout\n if %w( print plain ).include? params[:layout]\n params[:layout]\n else\n 'default'\n end\n end", "def layout\n properties[:layout]\n end", "def display_position\n # Fill this in\n end", "def display_position\n # Fill this in\n end", "def default_layout\n nil\n end", "def modified_sample_layout\n lyt = []\n make_modified_start_array(@group_size).each do |j|\n cols = Array.new(@columns) { |c| c }\n cols.each { |c| @group_size.times { |i| lyt << [i + j, c] } }\n end\n lyt\n end", "def _layout_for_option(name); end", "def html_contents\n layout_contents\n end", "def layout(name=:layout, &block)\n return super(name, &block) if block_given?\n @_layout = name\n end", "def build_single_editor_layout(width, height, pane_id)\n Layout.new(\"#{width}x#{height}\", 0, 0, PaneId.new(pane_id))\nend", "def defineLayoutMenu\n #puts \"Removing Old Menu and Home Layout\"\n rm_rf File.join(\"#{g('wiki_source')}\",URL_LAYOUT_DEFAULT)\n #puts \"Generating New Menu\"\n open(File.join(\"#{g('wiki_source')}\",URL_LAYOUT_DEFAULT), 'w') do |newLayout|\n newLayout.puts '\n <!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"><title>{{ page.title }}</title></head>\n <body>\n {% include style.html %}\n {% include menu.html %}\n '\n oldUnder=-1\n File.foreach(File.join(\"#{g('wiki_source')}\",URL_MENU_FILE)) do |line|\n currentUnder = count_em(line,\"-\")\n #Fils du courant\n if(currentUnder>oldUnder)\n if(oldUnder==-1)\n newLayout.puts '\n <div class=\"w3-row-padding w3-padding-64 w3-container\">\n <div>\n <div class=\"w3-quarter\" style=\"width:260px\">\n\t\t<nav class=\"w3-bar-block w3-collapse w3-large w3-theme-l5 w3-animate-left w3-small w3-round w3-blue\" style=\"z-index:3;margin-left:10px\" id=\"mySidebar\">\n <div class=\"w3-medium w3-text-white w3-margin-left\" style=\"font-weight:bold\"><div>'\n else\n newLayout.puts \" <div id='sub' class=' w3-padding-small w3-bar-block w3-small'>\"\n end\n oldUnder=currentUnder\n else\n #Père du courant\n if(currentUnder<oldUnder)\n loop do \n newLayout.puts \" </div>\"\n oldUnder = oldUnder -1\n break if oldUnder==currentUnder\n end\n end\n end\n fileWithName = File.join(\"#{g('wiki_dest')}\",\"/\"+line.gsub(\"-\",\"\")).gsub(\"\\n\",\"\")\n title=line\n if(File.exists?(fileWithName+\".md\"))\n File.foreach(fileWithName+\".md\") do |row|\n if(row.include? \"title:\")\n title = row\n break\n end\n end \n newLayout.puts \"<a href='/\"+fileWithName+\"'>\"+title.gsub(\"title: \",\"\")+\"</a><br/>\"\n else\n newLayout.puts \"\"+title.gsub(\"-\",\"\")+\"\"\n end\n end\n newLayout.puts '</div></div></nav></div>\n <div class=\"w3-threequarter\">\n {{ content }}\n </div>\n </div>\n </div>\n </body></html>'\n end\n \n \nend", "def layout_contents\n layout.render(self)\n end", "def layout\n yield(monitoring_layout)\n monitoring_layout\n end", "def page_layout\n if @page\n if params[:popup]\n \"modal\"\n elsif !@page.layout.blank?\n @page.layout\n else\n choose_layout\n end\n else\n params[:popup] ? 'modal' : choose_layout\n end\n end", "def make_mini_layout\n divs = \"<div id='mini_layout'>\" \n places_holder.map { |position| divs += \"<div id='mini_#{position}' class='hover'>\n #{t(\"components.pos.#{position}\")} </div>\"} \n divs += \"</div>\" \n end", "def layout(method = nil)\n @layout = method || @layout\n end", "def theme; end" ]
[ "0.7337308", "0.7337308", "0.7032893", "0.70090616", "0.69189703", "0.69189703", "0.6886924", "0.685819", "0.6836379", "0.6799751", "0.6680701", "0.6638515", "0.65718704", "0.6549206", "0.6513924", "0.6513924", "0.6474133", "0.64034104", "0.64034104", "0.6342727", "0.63080966", "0.6292008", "0.62526727", "0.62353444", "0.62105", "0.61488837", "0.61434996", "0.6065064", "0.6048545", "0.6039404", "0.60269564", "0.6024227", "0.60108924", "0.60075486", "0.6005617", "0.5985832", "0.5979068", "0.5953618", "0.59518254", "0.5943823", "0.5934391", "0.59315974", "0.5923514", "0.59112", "0.58863133", "0.5883427", "0.5878109", "0.5874574", "0.58745605", "0.5871351", "0.58552665", "0.5854598", "0.58535045", "0.5852074", "0.5844402", "0.5837886", "0.5833605", "0.58209246", "0.58133817", "0.58009934", "0.5789787", "0.57840496", "0.5783447", "0.57745594", "0.5769838", "0.5769015", "0.5768552", "0.5761139", "0.5752732", "0.57453346", "0.5743898", "0.57291263", "0.5726414", "0.5722746", "0.5714699", "0.5693139", "0.5685779", "0.5666217", "0.56538945", "0.5619709", "0.5613795", "0.5613257", "0.561128", "0.5596379", "0.5589312", "0.5568282", "0.55635655", "0.55635655", "0.5552907", "0.55503047", "0.55430555", "0.55326384", "0.55284053", "0.55219704", "0.5520383", "0.5511393", "0.5504457", "0.5504151", "0.54990506", "0.5486411", "0.54862416" ]
0.0
-1
GET /cc_statements/1 GET /cc_statements/1.xml
def show @cc_statement = CcStatement.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @cc_statement } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @cc_statement = CcStatement.new\n @cc_statement.build_cc_all\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cc_statement }\n end\n end", "def show\n @query = Query.find(params[:id])\n client = GridClientClass.new\n @modifier = @query.modifier\n @attributes = Array.new\n \n @cql1Result = client.getCQL1QueryXML(getGlobusCred, @query)\n puts @cql1Result\n \n @cql2Result = client.getCQL2QueryXML(getGlobusCred, @query)\n puts @cql2Result\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @query }\n end\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def query(action, hash = {})\n # uri = URI.parse(\"https://130.59.10.31\")\n # http = Net::HTTP.new(uri.host, uri.port)\n # http.use_ssl = true\n # http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n #\n # request = Net::HTTP::Get.new(uri.request_uri)\n #\n # response = http.request(request)\n # response.body\n # response.status\n # response[\"header-here\"] # All headers are lowercase\n uri = URI.parse(@url + \"/api/xml?action=#{action}\")\n hash.each_pair do |key, val|\n if val\n if key == \"filter\" or key == \"sort\"\n uri.query += val.query\n else\n uri.query += \"&\" + key + \"=\" + CGI::escape(\"#{val}\")\n end\n end\n end\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.scheme == \"https\"\n http.use_ssl=true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n request = Net::HTTP::Get.new(uri.request_uri)\n # logger = Logger.new('log/development.log')\n # logger.info(url.path + \"?\" + url.query)\n if @sessionid\n request.add_field(\"Cookie\", \"BREEZESESSION=\"+@sessionid)\n end\n puts \"ACS query - request: \" + request.path\n response = http.request(request)\n puts \"ACS query - response: \" + response.body.inspect\n return response\n end", "def get_statements(options={})\n options = {:result_type => DATA_TYPES[:Turtle]}.merge(options)\n easy = Curl::Easy.new\n easy.headers[\"Accept\"] = options[:result_type]\n\n url = self.uri + \"/statements?\" + self.class.get_parameterize(options.reject{|k,v|\n ![:subj, :pred, :obj, :context, :infer].include?(k)\n })\n easy.url = url\n easy.http_get\n\n raise(SesameException.new(easy.body_str)) unless easy.response_code == 200\n\n easy.body_str\n end", "def statements(company_number)\n client.get(\"/company/#{company_number}/persons-with-significant-control-statements/#{statement_id}\")\n end", "def get_xml_lines()\r\nopen(\"#{BASE_URL}/#{@base_currency}.xml\").readlines.find_all do |line|\r\nline =~ /1 #{@base_currency} =/\r\nend\r\nend", "def get_xml_lines()\n open(\"#{BASE_URL}/#{@base_currency}.xml\").readlines.find_all do |line| \n line =~ /1 #{@base_currency} =/\n end\n end", "def index\n @cst_icms = CstIcm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cst_icms }\n end\n end", "def index\n @queries = @idea.canned_queries\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @queries }\n end\n end", "def get_course_statements_with_http_info(course_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CourseApi.get_course_statements ...'\n end\n # verify the required parameter 'course_id' is set\n if @api_client.config.client_side_validation && course_id.nil?\n fail ArgumentError, \"Missing the required parameter 'course_id' when calling CourseApi.get_course_statements\"\n end\n # resource path\n local_var_path = '/courses/{courseId}/xAPIStatements'.sub('{' + 'courseId' + '}', course_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'learnerId'] = opts[:'learner_id'] if !opts[:'learner_id'].nil?\n query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?\n query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?\n query_params[:'more'] = opts[:'more'] if !opts[:'more'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['APP_NORMAL', '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 => 'XapiStatementResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CourseApi#get_course_statements\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @ccl = Ccl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ccl }\n end\n end", "def index\n\t@account = Account.find(params[:account_id])\n @rules = @account.rules\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rules }\n end\n end", "def show\n @concert = Concert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @concert }\n end\n end", "def show\n @cg_tn_cn = CgTnCn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cg_tn_cn }\n end\n end", "def show\n @clenum = Clenum.find(params[:ids])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clenum }\n end\n end", "def index\n @opening_statements = OpeningStatement.all\n end", "def index\n @criancas = Crianca.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @criancas }\n end\n end", "def index\n @account_transactions = AccountTransaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @account_transactions }\n end\n end", "def show\n @statement = Statement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @statement }\n end\n end", "def index\n @station = Station.find(params[:station_id])\n\t\t@acs = @station.acs\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @acs }\n end\n end", "def pacscl_xml\n document = Blacklight.default_index.search(q: \"id:#{params[:id]}\")&.dig(\"response\", \"docs\")&.first\n document = SolrDocument.new(document)\n document.suppress_xml_containers!\n respond_to do |format|\n format.xml do\n render xml: document.export_as_xml\n end\n end\n end", "def index\n @criterions = Criterion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @criterions }\n end\n end", "def get_statements(uri)\n open(uri) { |fh| fh.read }.\n split(\"\\n\").\n map { |line| line.sub(/(.*?)--.*/, '\\1') }.\n join.\n split(/;/).\n map { |line| line.strip }\nend", "def index\n @labor_cost_lines = LaborCostLine.scoped\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @labor_cost_lines }\n end\n end", "def destroy\n @cc_statement = CcStatement.find(params[:id])\n @cc_statement.destroy\n\n respond_to do |format|\n format.html { redirect_to(cc_statements_url) }\n format.xml { head :ok }\n end\n end", "def query\n {:xml => xml}\n end", "def list\n\t @complaints = Complaint.find(:all, :conditions => \"approved = 0\")\n\t\trespond_to do |format|\t\t\n\t\t\tformat.html \n\t\t\tformat.xml { render :xml => @complaints }\t#Render to XML File\n\t\tend\n\t end", "def index\n @csos = Cso.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @csos }\n end\n end", "def show\n @cst_icm = CstIcm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cst_icm }\n end\n end", "def get(path='', filter=nil)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n response = if filter\n categories = filter.categories.collect { |category| category.to_text }.join(',')\n attributes = filter.entities.collect { |entity| entity.attributes.combine.collect { |k, v| k + '=' + v } }.join(',')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = 'text/occi'\n headers['Category'] = categories unless categories.empty?\n headers['X-OCCI-Attributes'] = attributes unless attributes.empty?\n\n self.class.get(@endpoint + path, :headers => headers)\n else\n self.class.get(@endpoint + path)\n end\n\n response_msg = response_message response\n raise \"HTTP GET failed! #{response_msg}\" unless response.code.between? 200, 300\n\n Occi::Log.debug \"Response location: #{('/' + path).match(/\\/.*\\//).to_s}\"\n kind = @model.get_by_location(('/' + path).match(/\\/.*\\//).to_s) if @model\n\n Occi::Log.debug \"Response kind: #{kind}\"\n\n if kind\n kind.related_to? Occi::Core::Resource ? entity_type = Occi::Core::Resource : entity_type = nil\n entity_type = Occi::Core::Link if kind.related_to? Occi::Core::Link\n end\n\n Occi::Log.debug \"Parser call: #{response.content_type} #{entity_type} #{path.include?('-/')}\"\n collection = Occi::Parser.parse(response.content_type, response.body, path.include?('-/'), entity_type, response.headers)\n\n Occi::Log.debug \"Parsed collection: empty? #{collection.empty?}\"\n collection\n end", "def index\r\n @cuentum = Cuentum.find(params[:cuentum_id])\r\n @credits = @cuentum.credits\r\n \r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @credits}\r\n end\r\n end", "def index\n @cvs = Cv.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cvs }\n end\n end", "def index\n @cvs = Cv.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cvs }\n end\n end", "def show\n @conseqs = Sequence.get(params[:id]).conseqs.all(:order=>[:aasequence_id]) #Conseq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @conseq }\n end\n end", "def show\r\n Connection.switch_data(params[:connection], \"daily\")\r\n @connections = Connection.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @connections.to_xml(:root => 'records', :children => 'record', :dasherize => false) }\r\n end\r\n end", "def show\n @cash_transaction = CashTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cash_transaction }\n end\n end", "def show\n puts \"SHOW\"\n puts params.inspect\n puts \"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]\"\n\n\n scout = Scout.find(params[:scout_id])\n @advance = scout.advancement\n con = params[:con]\n req = params[:req]\n puts con\n puts req\n @link = @advance.toggle_approve(scout, con, req)\n respond_to do |format|\n format.json\n end\n end", "def lookup\n @code = Code.find_by_code(params[:code])\n\n # Make a custom xml builder (since excluding \".xml\" in the URL renders ALL fields)\n xml = Builder::XmlMarkup.new(:indent=>2)\n xml.instruct!\n xml.code do\n xml.description @code.description\n xml.amount @code.amount\n xml.currency @code.currency\n xml.organization @code.organization\n xml.email @code.email\n xml.support_contact @code.support_contact\n xml.support_phone @code.support_phone\n xml.updated_at @code.updated_at\n end\n\n respond_to do |format|\n format.any { render :xml => xml.target! }\n# format.html { render :xml => xml.target! }\n end\n end", "def each_statement(&block)\n # Block called from add_statement\n @callback = block\n\n root = @doc.root\n\n\n rdf_nodes = root.xpath(\"/rdf:RDF\", \"rdf\" => RDF.to_uri.to_s)\n statements = []\n rdf_nodes.each do |node|\n\n\n root.xpath(\"//rss:channel\", \"rss\"=>RDF::RSS.to_s).each do |channel|\n if channel.attribute('about')\n channel_uri = RDF::URI.intern(channel.attribute('about').value)\n else\n channel_uri = RDF::Node.new\n end\n statements << RDF::Statement.new(channel_uri, RDF.type, RDF::RSS.channel)\n channel.children.each do |elem|\n unless elem.name == 'items'\n if elem.children.length == 1 && elem.children.first.is_a?(Nokogiri::XML::Text)\n statements << RDF::Statement.new(channel_uri, RDF::URI.intern(elem.namespace.href + elem.name), literal(elem.children.first))\n elsif elem.attribute('resource')\n statements << RDF::Statement.new(channel_uri, RDF::URI.intern(elem.namespace.href + elem.name), RDF::URI.intern(elem.attribute('resource').value))\n end\n else\n stmt = RDF::Statement.new(:subject=>channel_uri, :predicate=>RDF::URI.intern(elem.namespace.href + elem.name))\n elem.children.each do |list|\n if list.attribute('about')\n list_uri = RDF::URI.intern(list.attribute('about').value)\n else\n list_uri = RDF::Node.new\n end\n\n stmt.object = list_uri\n statements << stmt\n list_type = RDF::URI.intern(list.namespace.href + list.name)\n unless list_type == RDF.Description\n statements << RDF::Statement.new(:subject=>list_uri, :predicate=>RDF.type, :object=>list_type)\n end\n list.children.each do |li|\n stmt = RDF::Statement.new(:subject=>list_uri, :predicate=>RDF::URI.intern(li.namespace.href + li.name))\n if li.attribute('resource')\n stmt.object = RDF::URI.intern(li.attribute('resource').value)\n elsif li.children.length == 1 && li.children.first.is_a?(Nokogiri::XML::Text)\n stmt.object = literal(li.children.first)\n end\n statements << stmt if stmt.object\n end\n end\n end\n end\n end\n root.xpath(\"/rdf:RDF/rss:item\", \"rdf\"=>RDF.to_uri.to_s, \"rss\"=>RDF::RSS.to_s).each do |item|\n if item.attribute('about')\n item_uri = RDF::URI.intern(item.attribute('about').value)\n else\n item_uri = RDF::Node.new\n end\n statements.concat statements_from_element(item, item_uri)\n end\n\n\n end\n statements.each do |stmt |\n yield stmt\n end \n statements.to_enum \n end", "def index\n @transaction_details = TransactionDetail.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @transaction_details.to_xml }\n end\n end", "def index\n @complaints = Complaint.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @complaints }\n end\n end", "def index\n @contracts = @project.contracts\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contracts }\n end\n end", "def show\n @query = CannedQuery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @query }\n end\n end", "def index\n @transactions = Transaction.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end", "def index\n @correspondences = Correspondence.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @correspondences }\n end\n end", "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end", "def show\n @charge_transaction = ChargeTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @charge_transaction.to_xml }\n end\n end", "def get(path='', filter=nil)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n response = if filter\n categories = filter.categories.collect { |category| category.to_text }.join(',')\n attributes = filter.entities.collect { |entity| entity.attributes.combine.collect { |k, v| k + '=' + v } }.join(',')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = 'text/occi'\n headers['Category'] = categories unless categories.empty?\n headers['X-OCCI-Attributes'] = attributes unless attributes.empty?\n\n self.class.get(@endpoint + path, :headers => headers)\n else\n self.class.get(@endpoint + path)\n end\n\n response_msg = response_message response\n raise \"HTTP GET failed! #{response_msg}\" unless response.code.between? 200, 300\n\n Occi::Log.debug \"Response location: #{('/' + path).match(/\\/.*\\//).to_s}\"\n kind = @model.get_by_location(('/' + path).match(/\\/.*\\//).to_s) if @model\n\n Occi::Log.debug \"Response kind: #{kind}\"\n\n if kind\n kind.related_to? Occi::Core::Resource ? entity_type = Occi::Core::Resource : entity_type = nil\n entity_type = Occi::Core::Link if kind.related_to? Occi::Core::Link\n end\n\n entity_type = Occi::Core::Resource unless entity_type\n\n Occi::Log.debug \"Parser call: #{response.content_type} #{path.include?('-/')} #{entity_type} #{response.headers.inspect}\"\n collection = Occi::Parser.parse(response.content_type, response.body, path.include?('-/'), entity_type, response.headers)\n\n Occi::Log.debug \"Parsed collection: empty? #{collection.empty?}\"\n collection\n end", "def get_changes\n CouchRest.get(SERVER.uri << DB.uri << \"/_changes\")\nend", "def list_statements(company_number)\n client.get(\"/company/#{company_number}/persons-with-significant-control-statements\")\n end", "def index\n @cases = Case.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cases }\n end\n end", "def get_data(contexts=[\"all\"])\n synchronize do\n \n # Prepares the URL to request the data\n context = contexts.map{|context| \"context=#{context}\"}*\"&&\"\n dir = \"#{@options[\"host\"]}:#{@options[\"port\"]}/openrdf-sesame/repositories/#{@options[\"repo\"]}/statements?#{context}\"\n\n # Asks for the data\n ntriples = RestClient.get dir, :content_type=>select_type\n\n # Makes the graph to return.\n Parser.parse(:rdf, ntriples)\n end\n\t \tend", "def index\n @cancellations = Cancellation.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml # index.xml.builder\n end\n end", "def index\n @source_codes = SourceCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @source_codes }\n end\n end", "def index\n @links = Link.find(:all,:conditions => [\"entity_id = ?\",@entity_id])\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @links.to_xml }\n end\n end", "def index \n#http://libserver3.yale.edu:3000/auth?oid=10590515&type=jpg150&ip=130.132.80.210\n#http://lbdev.library.yale.edu/xml_accesscondition.aspx?a=s_lib_ladybird&b=E8F3FF02-A65A-4A20-B7B1-A9E35969A0B7&c=10590515'\n oid = params[:oid] || \"\"\n\ttype = params[:type] || \"\"\n\tip = params[:ip] || \"\"\n\tnetid = params[:netid] || \"\"\n\t\n\tif oid==\"\" || type==\"\" || ip==\"\"\n\t\trender :text => \"missing parameters - oid:\"+oid+\" type:\"+type+\" ip:\"+ip\n\t\treturn\n end \n\tbase_url = 'http://lbdev.library.yale.edu/xml_accesscondition.aspx?'\n\tparam_a = 'a=s_lib_ladybird'\n\tparam_b = 'b=E8F3FF02-A65A-4A20-B7B1-A9E35969A0B7'\n\tparam_c = 'c=' + oid\n\tfull_url = base_url+param_a+\"&\"+param_b+\"&\"+param_c\n\tlogger.info full_url\n doc = Nokogiri::XML(open(full_url))\n\trule = doc.xpath(\"//schema//object//rule[@type='\"+type+\"']//@code\")\n\tlogger.info rule.to_s\n\treturn_msg = \"default\"\n\tif rule.to_s == \"Yale Only\"\n\t\tif ip_check(ip) == true\n\t\t\treturn_msg = \"authorized\"\n\t\telse\n\t\t\t#if cas netid ok then return_msg = \"authorized\"\n\t\t\t#elsf no cas netid then return_msg = \"try cas\"\n\t\t\t#else unauthorized\n\t\t\tif netid.size == 0\n\t\t\t\treturn_msg = \"unauthorized\"\n\t\t\telse\n\t\t\t\treturn_msg = \"authorized\"\n\t\t\tend\n\t\tend \n\tend\n\tif rule.to_s == \"AD Group Restriction\"\n\t\tgroup = doc.xpath(\"//schema//object//rule[@type='\"+type+\"']//value\")\n\t\treturn_msg = group.to_s\t\n\tend\n\t#TODO other rules here\n\n\t#logger.info \"IP:\"+ip\n\t#logger.info ip_check(ip)\n logger.info \"Host:\"+ request.host_with_port\t\n\trender :text => return_msg\n\treturn\n end", "def path\n \"/onca/xml\"\n end", "def index\n @cuentas = Cuenta.all\n\n @cadena = getcuentasxml\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cadena }\n end\n end", "def index\n @lookup_scantasks = LookupScantask.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_scantasks }\n end\n end", "def index\n @csrelations = Csrelation.all\n end", "def list(name)\n #Card.where(\"X-ADDRESSBOOKSERVER-KIND\" => \"group\")\n if name\n query = Nokogiri::XML::Builder.new(:encoding => \"UTF-8\") do |xml|\n #xml.send('B:addressbook-query', 'xmlns:B' => \"urn:ietf:params:xml:ns:carddav\") do\n xml.send('D:principal-property-search', 'xmlns:D' => \"DAV:\") do\n xml.send('D:property-search') do\n xml.send('D:prop') do\n xml.send('D:displayname')\n end\n xml.send('D:match') do\n xml << name\n end\n end\n xml.send('D:prop') do\n xml.send('C:addressbook-home-set', 'xmlns:C' => 'urn:ietf:params:xml:ns:carddav')\n xml.send('D:displayname')\n end\n \n end\n \n #end\n\n end\n else\n query = Nokogiri::XML::Builder.new(:encoding => \"UTF-8\") do |xml|\n xml.send('A:propfind', 'xmlns:A' => 'DAV:') do\n xml.send('A:prop') do\n xml.send('D:addressbook-home-set', 'xmlns:D' => \"urn:ietf:params:xml:ns:carddav\")\n xml.send('D:directory-gateway', 'xmlns:D' => \"urn:ietf:params:xml:ns:carddav\")\n xml.send('A:displayname')\n xml.send('C:email-address-set', 'xmlns:C' => \"http://calendarserver.org/ns/\")\n xml.send('A:principal-collection-set')\n xml.send('A:principal-URL')\n xml.send('A:resource-id')\n xml.send('A:supported-report-set')\n end\n end\n end\n end\n \n headers = {\n \"content-Type\" => \"text/xml; charset=\\\"utf-8\\\"\",\n \"depth\" => 0,\n \"brief\" => \"t\",\n \"Content-Length\" => \"#{query.to_xml.to_s.size}\"\n }\n content = @client.request('REPORT', @uri, nil, query.to_xml.to_s, headers)\n puts content.body + \"<<<<<\\n\\n\"\n xml = Nokogiri::XML(content.body)\n vcards = []\n xml.xpath('//C:address-data').each do |card|\n vcards << Card.new(card.text)\n end\n return vcards\n end", "def call\n @cc = @client.call(@path, 'GET')\n @cc\n #{:ID => rows[0][0], :NAME => rows[0][1], :GID => rows[0][4], :GNAME => rows[0][5]}\n end", "def call\n @cc = @client.call(@path, 'GET')\n @cc\n #{:ID => rows[0][0], :NAME => rows[0][1], :GID => rows[0][4], :GNAME => rows[0][5]}\n end", "def call\n @cc = @client.call(@path, 'GET')\n @cc\n #{:ID => rows[0][0], :NAME => rows[0][1], :GID => rows[0][4], :GNAME => rows[0][5]}\n end", "def call\n @cc = @client.call(@path, 'GET')\n @cc\n #{:ID => rows[0][0], :NAME => rows[0][1], :GID => rows[0][4], :GNAME => rows[0][5]}\n end", "def index\n respond_to do |format|\n format.html { render nothing: true }\n format.json { render json: @statements }\n end\n end", "def read_document\n #puts \"======= #{params[:controller]} ========\"\n #on pars chercher le contenu du params\n @query = Convocation.find(params[:contravention_id])\n #render layout: 'administration'\n render layout: 'views/index'\n end", "def index\n @success_cases = SuccessCase.all.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @success_cases }\n end\n end", "def code\n @arc = Arc.find_by_code(params[:code])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arc.to_xml(:except => [ :created_at, :updated_at ], :include => :tahs) }\n end\n end", "def show\n @criterion = Criterion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @criterion }\n end\n end", "def response_xml\r\n @sess.DoRequests(@request_set).ToXMLString\r\n end", "def index\n @campaigns = Campaign.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @orgadmin_campaigns }\n end\n end", "def get_copays\n raise InvalidVBSRequestError, request_data.errors unless request_data.valid?\n\n response = request.post('/Prod/GetStatementsByEDIPIAndVistaAccountNumber', request_data.to_hash)\n\n ResponseData.build(response: response).handle\n end", "def index\n @rules = Rule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rules }\n end\n end", "def index\n @incidents = Incident.where(\"project = ?\", session[:project]).order( \"reference DESC\").\\\n\t paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @incidents }\n end\n end", "def index\n redirect_to statements_path\n end", "def get_ci(id)\n xml = RestClient.get \"#{@base_url}/ci/#{id}\", {:accept => :xml, :content_type => :xml}\n return XmlSimple.xml_in(xml)\n end", "def index\n @help = \"Transaction List\"\n @transactions = @account.transactions.find(:all, :order => \"tran_date desc, created_at desc\")\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end", "def show\n @complain = Complain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @complain }\n end\n end", "def show\n @account_transaction = AccountTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @account_transaction }\n end\n end", "def show\n @account_transaction = AccountTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @account_transaction }\n end\n end", "def xml_with_contracts\n results = query 'select \"sp_ID\" as id',\n ', \"sp_Kanton\" as kanton',\n ', \"sp_Name\" as name',\n ', \"sp_Ort\" as ort',\n ', \"sp_Aktiv\" as aktiv',\n ', count (\"vt_sp_ID\") as vertraege',\n 'from KOGU.\"StammSpital\"',\n 'left outer join KOGU.\"VertragMandantMitSpital\" on \"vt_sp_ID\" = \"sp_ID\" and \"vt_cd_LeMdFaktura\" = 1',\n 'where \"sp_Aktiv\" < 50 and \"sp_cd_LeXmlZertifiziert\" = 1',\n 'group by \"sp_ID\",\"sp_Kanton\", \"sp_Name\", \"sp_Ort\", \"sp_Aktiv\", \"sp_cd_LeXmlZertifiziert\"',\n 'order by \"sp_Kanton\", \"sp_Name\"'\n\n results.map { |data| self.new(data) }\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 successful_authorize_response\n <<-XML\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <EngineDocList>\n <DocVersion DataType=\"String\">1.0</DocVersion>\n <EngineDoc>\n <Overview>\n <AuthCode DataType=\"String\">889350</AuthCode>\n <CcErrCode DataType=\"S32\">1</CcErrCode>\n <CcReturnMsg DataType=\"String\">Approved.</CcReturnMsg>\n <DateTime DataType=\"DateTime\">1212066788586</DateTime>\n <Mode DataType=\"String\">Y</Mode>\n <OrderId DataType=\"String\">483e6382-7d12-3001-002b-0003bac00fc9</OrderId>\n <TransactionId DataType=\"String\">483e6382-7d13-3001-002b-0003bac00fc9</TransactionId>\n <TransactionStatus DataType=\"String\">A</TransactionStatus>\n </Overview>\n </EngineDoc>\n </EngineDocList>\n XML\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @requests }\n end\n end", "def getXMLTicket(path)\n resp2 = @@conn.get do |req|\n req.url path\n req.headers['Authorization'] = 'Basic aHIuc2VsbGVydEBnbWFpbC5jb206c2VzMTEy' #@TODO make this a param\n req.headers['Content-Type'] = 'application/xml'\n end\n # puts \"Responce : \" + resp2['body'].inspect\n # puts \"Responce2 : \" + resp2.body.to_s()\n \n return resp2.body.to_s()\n end", "def index\n @_resources = client.credit_contracts.includes(:main_account, :current_account, credit: %i[currency credit_type])\n render layout: 'application_fluid'\n end", "def response\n connection.send(request_method) do |req|\n req.url path\n req.headers['LicenseID'] = client.license_id\n req.headers['Host'] = client.host\n req.headers['Connection'] = 'Keep-Alive'\n req.headers['Expect'] = '100-continue'\n req.headers['Content-Type'] = 'text/xml'\n req.body = body\n end\n end", "def show\n @contratacion = Contratacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contratacion }\n end\n end", "def execute()\n # Connect to the SugarCRM server\n begin\n SugarCRM::Base.establish_connection(\n @info_values['server_url'],\n @info_values['username'], \n @info_values['password']\n )\n rescue\n # raise an error with a meaningful message if failed to establish a\n # connection to the SugarCRM server\n msg = \"Could not establish connection to the SugarCRM server at: \"\n msg += @info_values['server_url']\n msg += \" with the user: #{@info_values['username']}\"\n \n raise (msg)\n end\n\n # Retrieve the Account\n account = SugarCRM::Account.find_by_name(@parameters['account_name'])\n \n # Raise an exception if no accounts matched the supplied name\n raise \"The account '#{@parameters['account_name']}' does not exist.\" unless account\n log(\"Account details: #{account}\")\n\n # Build and return the results xml that will be returned by this handler.\n results = <<-RESULTS\n <results>\n <result name=\"Id\">#{escape(account.id)}</result>\n <result name=\"Account Type\">#{escape(account.account_type)}</result>\n <result name=\"Assigned User Id\">#{escape(account.assigned_user_id)}</result>\n <result name=\"Assigned User Name\">#{escape(account.assigned_user_name)}</result>\n <result name=\"Billing Address City\">#{escape(account.billing_address_city)}</result>\n <result name=\"Billing Address Country\">#{escape(account.billing_address_country)}</result>\n <result name=\"Billing Address Postal Code\">#{escape(account.billing_address_postalcode)}</result>\n <result name=\"Billing Address Street\">#{escape(account.billing_address_street)}</result>\n <result name=\"Billing Address Street 2\">#{escape(account.billing_address_street_2)}</result>\n <result name=\"Billing Address Street 3\">#{escape(account.billing_address_street_3)}</result>\n <result name=\"Billing Address Street 4\">#{escape(account.billing_address_street_4)}</result>\n <result name=\"Campaign Id\">#{escape(account.campaign_id)}</result>\n <result name=\"Campaign Name\">#{escape(account.campaign_name)}</result>\n <result name=\"Created By\">#{escape(account.created_by)}</result>\n <result name=\"Created By Name\">#{escape(account.created_by_name)}</result>\n <result name=\"Date Entered\">#{escape(account.date_entered)}</result>\n <result name=\"Date Modified\">#{escape(account.date_modified)}</result>\n <result name=\"Description\">#{escape(account.description)}</result>\n <result name=\"Email 1\">#{escape(account.email1)}</result>\n <result name=\"Industry\">#{escape(account.industry)}</result>\n <result name=\"Modified By Name\">#{escape(account.modified_by_name)}</result>\n <result name=\"Modified User Id\">#{escape(account.modified_user_id)}</result>\n <result name=\"Name\">#{escape(account.name)}</result>\n <result name=\"Ownership\">#{escape(account.ownership)}</result>\n <result name=\"Parent Id\">#{escape(account.parent_id)}</result>\n <result name=\"Parent Name\">#{escape(account.parent_name)}</result>\n <result name=\"Phone Alternate\">#{escape(account.phone_alternate)}</result>\n <result name=\"Phone Fax\">#{escape(account.phone_fax)}</result>\n <result name=\"Phone Office\">#{escape(account.phone_office)}</result>\n <result name=\"Rating\">#{escape(account.rating)}</result>\n <result name=\"Shipping Address City\">#{escape(account.shipping_address_city)}</result>\n <result name=\"Shipping Address Country\">#{escape(account.shipping_address_country)}</result>\n <result name=\"Shipping Address Postal Code\">#{escape(account.shipping_address_postalcode)}</result>\n <result name=\"Shipping Address State\">#{escape(account.shipping_address_state)}</result>\n <result name=\"Shipping Address Street\">#{escape(account.shipping_address_street)}</result>\n <result name=\"Shipping Address Street 2\">#{escape(account.shipping_address_street_2)}</result>\n <result name=\"Shipping Address Street 3\">#{escape(account.shipping_address_street_3)}</result>\n <result name=\"Shipping Address Street 4\">#{escape(account.shipping_address_street_4)}</result>\n <result name=\"SIC Code\">#{escape(account.sic_code)}</result>\n <result name=\"Ticker Symbol\">#{escape(account.ticker_symbol)}</result>\n <result name=\"Valid\">#{escape(account.valid?)}</result>\n <result name=\"Website\">#{escape(account.website)}</result>\n </results>\n RESULTS\n log(\"Results: \\n#{results}\")\n\n return results\n end", "def show\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contract }\n end\n end", "def show\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contract }\n end\n end", "def list\n\t\t@ssccategories = Ssccategory.paginate :page => params[:page], :per_page => 10\t#Pagination for 10 Records\n \trespond_to do |format|\t\t\n \t\t format.html # list.html.erb\n \t\t\tformat.xml { render :xml => @ssccategories }\t#Render to XML File\n \tend\n\tend", "def execute(xml)\n\t\tAPIRequest.execute(url,xml.to_s)\n\tend", "def by_saison\n @saison = Saison.find_by_year(params[:id])\n respond_to do |format|\n format.xml\n end\n end", "def index\n @accounts = Account.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @accounts }\n end\n end", "def index\n @accounts = Account.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @accounts }\n end\n end", "def index\n @accounts = Account.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @accounts }\n end\n end", "def show\n @clique = Clique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clique }\n end\n end" ]
[ "0.5782129", "0.5696132", "0.5664426", "0.5581414", "0.55535257", "0.5533329", "0.5511199", "0.54803324", "0.5427989", "0.5340383", "0.5337714", "0.5327987", "0.5288051", "0.52879035", "0.5285559", "0.52842164", "0.52528435", "0.5233402", "0.520974", "0.520887", "0.520272", "0.5195605", "0.5181244", "0.51761335", "0.5170331", "0.5168821", "0.5158967", "0.5152281", "0.51506966", "0.514694", "0.5144696", "0.5137561", "0.5136336", "0.5136336", "0.5134547", "0.51281327", "0.5127662", "0.5108913", "0.5108353", "0.510621", "0.5105655", "0.51023537", "0.5101936", "0.5096001", "0.5090201", "0.50807655", "0.506001", "0.5057155", "0.5055096", "0.5031896", "0.5028764", "0.5025188", "0.50250983", "0.5024744", "0.50141984", "0.5007865", "0.5000318", "0.49954647", "0.4994777", "0.4992444", "0.49904722", "0.49852195", "0.49840412", "0.49840412", "0.49840412", "0.49840412", "0.4980753", "0.49658707", "0.49633104", "0.49618432", "0.49587628", "0.4952135", "0.49501115", "0.4948609", "0.4939252", "0.49367192", "0.49331725", "0.49309474", "0.49181083", "0.4917902", "0.49178487", "0.49178487", "0.49175978", "0.4915504", "0.4915256", "0.49142826", "0.49056166", "0.49050266", "0.49042535", "0.49008796", "0.48987088", "0.48968384", "0.48968384", "0.48965552", "0.48944375", "0.48868632", "0.48866457", "0.48866457", "0.48866457", "0.487634" ]
0.6717177
0
GET /cc_statements/new GET /cc_statements/new.xml
def new @cc_statement = CcStatement.new @cc_statement.build_cc_all respond_to do |format| format.html # new.html.erb format.xml { render :xml => @cc_statement } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @statement = Statement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @statement }\n end\n end", "def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comdty }\n end\n end", "def new\n @conseq = Conseq.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @conseq }\n end\n end", "def new\n @ccl = Ccl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ccl }\n end\n end", "def new\n @tx = Tx.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tx }\n end\n end", "def new\n @complain = Complain.new\n @code = \"GS-02-002-#{DateTime.now.strftime('%y%m%d%H%M%S')}\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @complain }\n end\n end", "def new\n @transaction = Transaction.new\n\t@categories = Category.find(:all, :order => 'name')\n\t@no_category = Category.new(:name => \"N/A\")\n\t@categories.insert(0, @no_category)\n\t@accounts = Account.find(:all, :order => 'name')\n\t@transaction_types = TransactionType.find(:all)\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n @query = CannedQuery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @query }\n end\n end", "def new\n \n @transaction = Transaction.new(:contact_id => params[:contact_id])\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n @contract_template = ContractTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contract_template }\n end\n end", "def create\n @statement = Statement.new(params[:statement])\n\n respond_to do |format|\n if @statement.save\n format.html { redirect_to administration_cms_path, notice: 'Statement was successfully created.' }\n format.json { render json: @statement, status: :created, location: @statement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @statement.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @contract = Contract.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contract }\n end\n end", "def new\n @contract = Contract.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contract }\n end\n end", "def new\n @cadd = Cadd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cadd }\n end\n end", "def new\n @sentence = Sentence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sentence }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @statement = Statement.find(params[:statement_id])\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @expression = Expression.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @expression }\n end\n end", "def new\n @transaction = Transaction.new\n @transaction.build_document\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end", "def new\n @cg_tn_cn = CgTnCn.new\n @load_next_column = \"N\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cg_tn_cn }\n end\n end", "def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n @code_rule = CodeRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @code_rule }\n end\n end", "def new\n new_prc\n\n setup_campuses_and_semesters\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prc }\n end\n end", "def new\n @cash_transaction = CashTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cash_transaction }\n end\n end", "def new\n @clenum = Clenum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clenum }\n end\n end", "def new\n @construction_method = ConstructionMethod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @construction_method }\n end\n end", "def new\n @commitment = Commitment.new\n @title = \"New Commitment\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @commitment }\n end\n end", "def new\n @contribution = Contribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contribution }\n end\n end", "def new\n @contribution = Contribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contribution }\n end\n end", "def new\n @account_transaction = AccountTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account_transaction }\n end\n end", "def new\n @correspondence_template = CorrespondenceTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @correspondence_template }\n end\n end", "def new\n @title = \"New Operations\"\n @operation = Operation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @operation }\n end\n end", "def new\n @request = Request.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @operation = Operation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @operation }\n end\n end", "def new\n @source_code = SourceCode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source_code }\n end\n end", "def new\n @node = Node.new(:displayed => true)\n @node.template = Template.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template }\n end\n end", "def new\n @addition = Addition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @addition }\n end\n end", "def new\n @rule = Rule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rule }\n end\n end", "def new\n @svn_module = SvnModule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @svn_module }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @explain = Explain.new\n @page = 'new-explain'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @explain }\n end\n end", "def new\n @cst_icm = CstIcm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cst_icm }\n end\n end", "def new\n @query = Query.new\n @discActions = DiscoveryActions.new\n $DATA_SERVICES ||= @discActions.getDataServices\n @services = $DATA_SERVICES\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @query }\n end\n end", "def new\n @success_case = SuccessCase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @success_case }\n end\n end", "def new\n @court = Court.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @court }\n end\n end", "def new\n @code_table = CodeTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @code_table }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @compliance }\n end\n end", "def new\n @contribution_record = ContributionRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contribution_record }\n format.xml { render xml => @contribution_record }\n end\n end", "def new\n @combat = Combat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @combat }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end", "def new\n @contratacion = Contratacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contratacion }\n end\n end", "def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @borrow }\n end\n end", "def new\n @source = Source.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source }\n end\n end", "def new\n @source = Source.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source }\n end\n end", "def new\n @help = \"New Transaction\"\n @transaction = @account.transactions.build\n @recurrings = @account.recurrings.find(:all, :conditions => \"transaction_type != 'Budget'\")\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n @lsrs_cmp = LsrsCmp.new\n @record = LsrsCmp.first\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lsrs_cmp }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ciclo }\n end\n end", "def new\n @convenio = Convenio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @convenio }\n end\n end", "def new\n @citation = Citation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @citation }\n end\n end", "def new\n @history_course = HistoryCourse.new\n @courses = Course.find(:all)\n \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @history_course }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\t#LOG.debug(fname) {\"params=#{params}\"}\n\t\t@relation = Relation.new\n\t\t@views = View.all\n\t\t@types = Typesobject.get_types(\"relation\")\n\t\t@status = Statusobject.get_status(\"relation\")\n\t\t#LOG.debug(fname) {\"relation=#{@relation.inspect}\"}\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @relation }\n\t\tend\n\tend", "def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end", "def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end", "def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end", "def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end", "def create\n @ccl = Ccl.new(params[:ccl])\n\n respond_to do |format|\n if @ccl.save\n format.html { redirect_to(@ccl, :notice => 'Ccl was successfully created.') }\n format.xml { render :xml => @ccl, :status => :created, :location => @ccl }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ccl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @csosn = Csosn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @csosn }\n end\n end", "def new\n @colo = Colo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @colo }\n end\n end", "def new\n @formula = Formula.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @formula }\n end\n end", "def new\n @current_condition = CurrentCondition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @current_condition }\n end\n end", "def new\n @goaltemplate = Goaltemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goaltemplate }\n end\n end", "def new\n @resp = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resp }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end", "def new\n @congressman = Congressman.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @congressman }\n end\n end", "def new\n @tuple = Tuple.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tuple }\n end\n end", "def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end", "def new\n #@branch = Branch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @branch }\n end\n end", "def new\n @constituency = Constituency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @constituency }\n end\n end", "def new\n @complaint = Complaint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @complaint }\n end\n end", "def new\n @balance = Balance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @balance }\n end\n end", "def new\n @lookup_scantask = LookupScantask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end", "def new\n @browsenodeid = Browsenodeid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @browsenodeid }\n end\n end", "def new\n @page_title = t('branches.new.title')\n @branches = Branch.all \n @branch = Branch.new\n respond_to do |format|\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @branch }\n end\n end", "def new\n @scout_master = ScoutMaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scout_master }\n end\n end", "def new\n @threat = Threat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @threat }\n end\n end", "def new\n @context_rule = ContextRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @context_rule }\n end\n end", "def new\n @coffee_table = CoffeeTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coffee_table }\n end\n end", "def new\n @transaction_type = TransactionType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction_type }\n end\n end", "def new\n @curso = Curso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @curso }\n end\n end" ]
[ "0.6758487", "0.6496736", "0.64260536", "0.6336849", "0.6275615", "0.62714225", "0.6238137", "0.621727", "0.6215843", "0.61640376", "0.60985094", "0.60966", "0.60966", "0.60935676", "0.6088341", "0.60805917", "0.6075441", "0.6073276", "0.6058147", "0.6033018", "0.60233384", "0.602268", "0.6018844", "0.6018844", "0.60136324", "0.6011511", "0.5994232", "0.59928304", "0.5989292", "0.59889686", "0.5988219", "0.5988219", "0.5987988", "0.5982379", "0.5974814", "0.59513783", "0.59494823", "0.59494823", "0.59494823", "0.5947837", "0.5935301", "0.59196174", "0.5911708", "0.5910975", "0.59103906", "0.58994436", "0.58987", "0.58987", "0.58983314", "0.58932674", "0.58921653", "0.5875805", "0.58751625", "0.5873058", "0.587097", "0.58652633", "0.58642876", "0.5861175", "0.58604246", "0.58592653", "0.585808", "0.585808", "0.5845944", "0.5844993", "0.5844179", "0.5843607", "0.5838656", "0.58357644", "0.5829171", "0.5829171", "0.5824508", "0.5819867", "0.5819867", "0.5819867", "0.5819601", "0.5819204", "0.5818948", "0.5816101", "0.58157444", "0.5815536", "0.5807904", "0.5807635", "0.5805399", "0.5805399", "0.58050185", "0.5801609", "0.5799481", "0.5795608", "0.579542", "0.57948476", "0.57919496", "0.5790639", "0.57879347", "0.57789946", "0.57782495", "0.57756", "0.5773752", "0.57729274", "0.5770708", "0.57699645" ]
0.72920173
0
POST /cc_statements POST /cc_statements.xml
def create #I need :parent_id set to 0 by default for itself and next_sib if params[:cc_statement][:cc_all_attributes][:parent_id] == "" params[:cc_statement][:cc_all_attributes][:parent_id] = "0" end #we need the parent id to set next_sib params[:cc_statement][:cc_all_attributes][:next_sib] += "_" params[:cc_statement][:cc_all_attributes][:next_sib] += params[:cc_statement][:cc_all_attributes][:parent_id] #render :text => params.inspect #logger.debug "xxx in create1" @cc_statement = CcStatement.new(params[:cc_statement]) #render :text => "===" + @cc_statement.to_yaml + "===" respond_to do |format| if @cc_statement.save format.html { redirect_to(@cc_statement, :notice => 'Statement component was successfully created.') } format.xml { render :xml => @cc_statement, :status => :created, :location => @cc_statement } else format.html { render :action => "new" } format.xml { render :xml => @cc_statement.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @cc_statement = CcStatement.new\n @cc_statement.build_cc_all\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cc_statement }\n end\n end", "def commit(action, xml)\n headers = { 'Content-Type' => 'application/x-qbmsxml',\n 'Content-length' => xml.size.to_s }\n \n # Post to server\n url = get_post_url\n @request = xml\n data = ssl_post(url, xml, headers)\n \n response = parse(action, data)\n message = message_from(response)\n \n # Post Processing - Create the Response object\n case action\n \n when 'session_ticket'\n @response = Response.new(success?(response), message, response, \n :test => test?,\n :authorization => response[:session_ticket]\n )\n @response\n \n else\n @response = Response.new(success?(response), message, response, \n :test => test?,\n :authorization => response[:transaction_id],\n :cvv_result => cvv_result(response),\n :avs_result => avs_result(response)\n ) \n end\n end", "def create\n @statement = Statement.new(params[:statement])\n\n respond_to do |format|\n if @statement.save\n format.html { redirect_to administration_cms_path, notice: 'Statement was successfully created.' }\n format.json { render json: @statement, status: :created, location: @statement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @statement.errors, status: :unprocessable_entity }\n end\n end\n end", "def commit(xml)\n url = (test? ? test_url : live_url)\n\n response = parse(ssl_post(url, post_data(xml), 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'))\n\n Response.new(\n success_from(response),\n message_from(response),\n response,\n authorization: authorization_from(response),\n test: test?,\n error_code: error_code_from(response)\n )\n end", "def create\n @statement = Statement.new(statement_params)\n @statement.user = current_user\n\n respond_to do |format|\n if @statement.save\n format.html { redirect_to @statement, notice: 'Statement was successfully created.' }\n format.json { render :show, status: :created, location: @statement }\n else\n format.html { render :new }\n format.json { render json: @statement.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_to_cc(data)\n post_args = { \n 'js_code' => data[\"code\"],\n 'compilation_level' => data[\"level\"],\n 'output_format' => data[\"format\"],\n 'output_info' => data[\"info\"]\n }\n\n if $debug\n puts \"#DEBUG post_args \\n\"\n p post_args\n puts \"\\n\"\n end\n\n # send the request\n resp, data = Net::HTTP.post_form(URI.parse(GOOGLE_SERVICE_ADDRESS), post_args)\n end", "def statement_params\n params.require(:statement).permit(:email, :name, :soname, :father_name, :position, :place, :test_id, :check_id)\n end", "def statement_params\n params.require(:statement).permit(:uuid, :text, :user_id, :parent_statement_id, :agree, :countered_argument_id, :top_level, :verified_one_sentence)\n end", "def update\n @cc_statement = CcStatement.find(params[:id])\n\n #we need the parent id to set next_sib\n params[:cc_statement][:cc_all_attributes][:next_sib] += \"_\"\n params[:cc_statement][:cc_all_attributes][:next_sib] += params[:cc_statement][:cc_all_attributes][:parent_id] \n\n respond_to do |format|\n if @cc_statement.update_attributes(params[:cc_statement])\n format.html { redirect_to(@cc_statement, :notice => 'Statement component was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cc_statement.errors, :status => :unprocessable_entity }\n end\n end\n end", "def postMatching_instruction( entity_id, entity_name)\n params = Hash.new\n params['entity_id'] = entity_id\n params['entity_name'] = entity_name\n return doCurl(\"post\",\"/matching_instruction\",params)\n end", "def create\n @closing_statement = ClosingStatement.new(closing_statement_params)\n\n respond_to do |format|\n if @closing_statement.save\n format.html { redirect_to @closing_statement.debate notice: 'closing statement was successfully created.' }\n format.json { render :show, status: :created, location: @closing_statement }\n else\n format.html { render :new }\n format.json { render json: @closing_statement.errors, status: :unprocessable_entity }\n end\n end\n end", "def statement_params\n params.require(:statement).permit(:email, :name, :soname, :father_name, :position, :place, :test_id, :notified, :paid, :certificate, {search: [:paid, \n :email, :fio, :ticket_id,{date: [:start, :end]}]})\n end", "def destroy\n @cc_statement = CcStatement.find(params[:id])\n @cc_statement.destroy\n\n respond_to do |format|\n format.html { redirect_to(cc_statements_url) }\n format.xml { head :ok }\n end\n end", "def post operation, data={}\n body = case data\n when String\n body = data\n else\n Yajl::Encoder.encode(data)\n end\n\n request = new_request operation, body\n request.sign sts\n hydra.queue request\n hydra.run\n response = request.response\n puts response.inspect if @debug\n\n if response.code == 200\n Yajl::Parser.parse response.body\n else\n raise_error response\n end\n end", "def commit(request, options)\n requires!(options, :soap_action)\n \n\t response = parse(ssl_post(test? ? TEST_URL : LIVE_URL, build_request(request, options),\n\t {\"SOAPAction\" => options[:soap_action],\n\t \"Content-Type\" => \"text/xml; charset=utf-8\" }))\n \n # puts response.inspect if test?\n \n\t success = response[:transaction_result][:status_code] == \"0\"\n\t message = response[:transaction_result][:message]\n authorization = success ? [ options[:order_id], response[:transaction_output_data][:cross_reference], response[:transaction_output_data][:auth_code] ].compact.join(\";\") : nil\n \n IridiumResponse.new(success, message, response, \n :test => test?, \n :authorization => authorization,\n :avs_result => { :code => response[:avsCode] },\n :cvv_result => response[:cvCode],\n :three_d_secure => response[:transaction_result][:status_code] == \"3\",\n :pa_req => (response[:transaction_output_data][:three_d_secure_output_data][:pa_req] rescue \"\"),\n :md => (response[:transaction_output_data][:cross_reference] rescue \"\"),\n :acs_url => (response[:transaction_output_data][:three_d_secure_output_data][:acsurl] rescue \"\")\n )\n end", "def postSignal( entity_id, country, gen_id, signal_type, data_type, inactive_reason, inactive_description, feedback)\n params = Hash.new\n params['entity_id'] = entity_id\n params['country'] = country\n params['gen_id'] = gen_id\n params['signal_type'] = signal_type\n params['data_type'] = data_type\n params['inactive_reason'] = inactive_reason\n params['inactive_description'] = inactive_description\n params['feedback'] = feedback\n return doCurl(\"post\",\"/signal\",params)\n end", "def post_evaluate(excon, body)\n excon.request(\n method: :post,\n path: '/evaluate',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend", "def postContractCreate( entity_id, user_id, payment_provider, basket, billing_period, source, channel, campaign, referrer_domain, referrer_name, flatpack_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['user_id'] = user_id\n params['payment_provider'] = payment_provider\n params['basket'] = basket\n params['billing_period'] = billing_period\n params['source'] = source\n params['channel'] = channel\n params['campaign'] = campaign\n params['referrer_domain'] = referrer_domain\n params['referrer_name'] = referrer_name\n params['flatpack_id'] = flatpack_id\n return doCurl(\"post\",\"/contract/create\",params)\n end", "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def post_data(graph, context=\"\")\n synchronize do\n # Prepares the dir to connect with the repository\n dir = \"#{@options[\"host\"]}:#{@options[\"port\"]}/openrdf-sesame/repositories/#{@options[\"repo\"]}/statements?context=%3C#{CGI::escape(context)}%3E\"\n data = graph.serialize(:ntriples)\n\n # Adds the data to Sesame\n RestClient.post dir, data, :content_type=>select_type\n end\n end", "def create\n @bank_statement = current_book.bank_statements.new(bank_statement_params)\n\n respond_to do |format|\n if @bank_statement.save\n format.html { redirect_to @bank_statement, notice: 'Bank statement was successfully created.' }\n format.json { render :show, status: :created, location: @bank_statement }\n else\n format.html { render :new }\n format.json { render json: @bank_statement.errors, status: :unprocessable_entity }\n end\n end\n end", "def commit(request)\n url = test? ? TEST_URL : LIVE_URL\n \n @response = parse(ssl_post(url, request)) \n success = @response[:status] == DATACASH_SUCCESS\n message = @response[:reason]\n \n Response.new(success, message, @response,\n :test => test?,\n :authorization => \"#{@response[:datacash_reference]};#{@response[:authcode]}\"\n )\n end", "def create\n @statement = Statement.new(statement_params)\n\n if @statement.save\n redirect_to edit_event_path(@event), notice: t('actions.save.success')\n else\n set_embeded_models\n flash.now[:error] = t('actions.save.error')\n render 'events/edit'\n end\n end", "def insert_condition_params\n params.require(:insert_condition).permit(:conditionname, :responsecode)\n end", "def statement_params\n params.require(:statement).permit(:year, :month, :payment_type, :payment_status, :invoice, :store_id)\n end", "def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend", "def create_request\n raise AttributeMissing.new \"(2500) TransactionReference or OrderReference need to be present.\" if (transaction_reference.nil? && order_reference.nil?)\n raise AttributeMissing.new \"(2500) SiteReference must be present.\" if (site_reference.nil? && (REXML::XPath.first(@request_xml, \"//SiteReference\").text.blank? rescue true))\n REXML::XPath.first(@request_xml, \"//Request\").attributes[\"Type\"] = \"TRANSACTIONQUERY\"\n ops = REXML::XPath.first(@request_xml, \"//Operation\")\n [\"TermUrl\", \"MerchantName\", \"Currency\", \"SettlementDay\"].each { |e| ops.delete_element e }\n (ops.elements[\"SiteReference\"] || ops.add_element(\"SiteReference\")).text = self.site_reference if self.site_reference\n (ops.elements[\"TransactionReference\"] || ops.add_element(\"TransactionReference\")).text = self.transaction_reference if self.transaction_reference\n order = REXML::XPath.first(@request_xml, \"//Operation\")\n (order.elements[\"OrderReference\"] || order.add_element(\"OrderReference\")).text = self.order_reference if self.order_reference\n root = @request_xml.root\n (root.elements[\"Certificate\"] || root.add_element(\"Certificate\")).text = self.site_alias if self.site_alias\n end", "def create\n @opening_statement = OpeningStatement.new(opening_statement_params)\n\n respond_to do |format|\n if @opening_statement.save\n format.html { redirect_to @opening_statement.debate notice: 'Opening statement was successfully created.' }\n format.json { render :show, status: :created, location: @opening_statement }\n else\n format.html { render :new }\n format.json { render json: @opening_statement.errors, status: :unprocessable_entity }\n end\n end\n end", "def execute_new_order(action, money, credit_card, options)\n request = build_request do |xml|\n add_identification_new_order(xml, options)\n add_payment(xml, action, money, options)\n add_account(xml, credit_card)\n add_customer(xml, credit_card, options)\n end\n\n commit(request)\n end", "def authorizeAndCaptureXML(params)\n begin\n Nokogiri::XML::Builder.new do |xml|\n xml.AuthorizeAndCaptureTransaction('xmlns:i' => 'http://www.w3.org/2001/XMLSchema-instance', \n 'xmlns' => 'http://schemas.ipcommerce.com/CWS/v2.0/Transactions/Rest',\n 'i:type' =>\"AuthorizeAndCaptureTransaction\" ) {\n xml.ApplicationProfileId application_profile_id\n xml.MerchantProfileId merchant_profile_id \n xml.Transaction('xmlns:ns1' => \"http://schemas.ipcommerce.com/CWS/v2.0/Transactions/Bankcard\", \n 'i:type' => \"ns1:BankcardTransaction\" ){\n xml['ns1'].TenderData{\n if params[:SwipeStatus].present? && params[:IdentificationInformation].present? && params[:SecurePaymentAccountData].present? && params[:EncryptionKeyId].present?\n #p \"Swipe card..maga...\"\n xml['ns5'].SecurePaymentAccountData('xmlns:ns5' =>\n \"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text(params[:SecurePaymentAccountData])\n xml['ns6'].EncryptionKeyId('xmlns:ns6' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text(params[:EncryptionKeyId])\n xml['ns7'].SwipeStatus('xmlns:ns7' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text(params[:SwipeStatus])\n xml['ns1'].CardSecurityData{\n xml['ns1'].IdentificationInformation params[:IdentificationInformation]\n }\n xml['ns1'].CardData('i:nil' =>\"true\")\n elsif params[:SecurePaymentAccountData].present? && params[:EncryptionKeyId].present? \n #p \"Swipe card..Dukp...\"\n xml['ns5'].SecurePaymentAccountData('xmlns:ns5' =>\n \"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text(params[:SecurePaymentAccountData])\n xml['ns6'].EncryptionKeyId('xmlns:ns6' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text(params[:EncryptionKeyId])\n xml['ns7'].SwipeStatus('xmlns:ns7' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\",'i:nil' =>\"true\") \n xml['ns1'].CardSecurityData{\n xml['ns1'].IdentificationInformation('i:nil' =>\"true\")\n }\n xml['ns1'].CardData('i:nil' =>\"true\")\n xml['ns1'].EcommerceSecurityData('i:nil' =>\"true\") \n elsif params[:PaymentAccountDataToken].present?\n #p \"PaymentAccountDataToken...........\"\n xml['ns4'].PaymentAccountDataToken('xmlns:ns4' =>\n \"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text(params[:PaymentAccountDataToken])\n xml['ns5'].SecurePaymentAccountData('xmlns:ns5' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\",'i:nil' =>\"true\")\n xml['ns6'].EncryptionKeyId('xmlns:ns6' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\",'i:nil' =>\"true\")\n xml['ns7'].SwipeStatus('xmlns:ns7' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\",'i:nil' =>\"true\") \n xml['ns1'].CardData('i:nil' =>\"true\")\n xml['ns1'].EcommerceSecurityData('i:nil' =>\"true\") \n else \n #p \"without token....\"\n xml['ns4'].PaymentAccountDataToken('xmlns:ns4' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\", 'i:nil' =>\"true\")\n xml['ns5'].SecurePaymentAccountData('xmlns:ns5' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\",'i:nil' =>\"true\")\n xml['ns6'].EncryptionKeyId('xmlns:ns6' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\",'i:nil' =>\"true\")\n xml['ns7'].SwipeStatus('xmlns:ns7' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\",'i:nil' =>\"true\")\n xml['ns1'].CardData{\n xml['ns1'].CardType params[:CardType] \n if params[:Track2Data].present?\n xml['ns1'].Track2Data params[:Track2Data]\n xml['ns1'].PAN('i:nil' =>\"true\") \n xml['ns1'].Expire('i:nil' =>\"true\")\n xml['ns1'].Track1Data('i:nil' =>\"true\")\n elsif params[:Track1Data].present?\n xml['ns1'].Track1Data params[:Track1Data]\n xml['ns1'].PAN('i:nil' =>\"true\") \n xml['ns1'].Expire('i:nil' =>\"true\")\n xml['ns1'].Track2Data('i:nil' =>\"true\")\n else\n xml['ns1'].PAN params[:PAN] \n xml['ns1'].Expire params[:Expire]\n xml['ns1'].Track1Data('i:nil' =>\"true\")\n xml['ns1'].Track2Data('i:nil' =>\"true\")\n end\n }\n xml['ns1'].EcommerceSecurityData('i:nil' =>\"true\") \n end\n }\n xml['ns2'].CustomerData('xmlns:ns2' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\"){\n xml['ns2'].BillingData{\n xml['ns2'].Name('i:nil' =>\"true\")\n xml['ns2'].Address{\n xml['ns2'].Street1 params[:Street1] \n xml['ns2'].Street2('i:nil' =>\"true\")\n xml['ns2'].City params[:City] \n xml['ns2'].StateProvince params[:StateProvince]\n xml['ns2'].PostalCode params[:PostalCode]\n xml['ns2'].CountryCode params[:CountryCode]\n }\n xml['ns2'].BusinessName 'MomCorp'\n xml['ns2'].Phone params[:Phone]\n xml['ns2'].Fax('i:nil' =>\"true\")\n xml['ns2'].Email params[:Email]\n }\n xml['ns2'].CustomerId 'cust123'\n xml['ns2'].CustomerTaxId('i:nil' =>\"true\")\n xml['ns2'].ShippingData('i:nil' =>\"true\")\n }\n xml['ns3'].ReportingData('xmlns:ns3' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\"){\n xml['ns3'].Comment 'a test comment'\n xml['ns3'].Description 'a test description'\n xml['ns3'].Reference '001'\n }\n xml['ns1'].TransactionData{\n if params[:Amount] != ''\n xml['ns8'].Amount('xmlns:ns8' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text(params[:Amount])\n else\n xml['ns8'].Amount('xmlns:ns8' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text('0.00')\n end\n #xml['ns8'].Amount('xmlns:ns8' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text(params[:Amount])\n xml['ns9'].CurrencyCode('xmlns:ns9' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text('USD') \n xml['ns10'].TransactionDateTime('xmlns:ns10' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text('2013-04-03T13:50:16')\n xml['ns11'].CampaignId('xmlns:ns11' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\",'i:nil' =>\"true\")\n xml['ns12'].Reference('xmlns:ns12' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text('xyt')\n xml['ns1'].AccountType 'NotSet'\n xml['ns1'].ApprovalCode('i:nil' =>\"true\")\n xml['ns1'].CashBackAmount '0.0'\n xml['ns1'].CustomerPresent 'Present'\n xml['ns1'].EmployeeId '11'\n xml['ns1'].EntryMode params[:EntryMode]\n xml['ns1'].GoodsType 'NotSet'\n xml['ns1'].IndustryType params[:IndustryType]\n xml['ns1'].InternetTransactionData('i:nil' =>\"true\")\n xml['ns1'].InvoiceNumber params[:InvoiceNumber]\n xml['ns1'].OrderNumber params[:OrderNumber]\n xml['ns1'].IsPartialShipment 'false'\n xml['ns1'].SignatureCaptured 'false'\n xml['ns1'].FeeAmount '0.0'\n xml['ns1'].TerminalId('i:nil' =>\"true\")\n xml['ns1'].LaneId('i:nil' =>\"true\")\n xml['ns1'].TipAmount '0.0'\n xml['ns1'].BatchAssignment('i:nil' =>\"true\")\n xml['ns1'].PartialApprovalCapable 'NotSet'\n xml['ns1'].ScoreThreshold('i:nil' =>\"true\")\n xml['ns1'].IsQuasiCash 'false'\n }\n }\n } \n end.to_xml \n rescue Exception => ex\n return \"Some value not set in xml for authorizeAndCaptureXML!\"\n end\n end", "def sendclaim\n require 'net/http'\n require 'uri'\n\n @visit = Visit.find(params[:id])\n @patient = Patient.find(@visit.patient_id)\n @patient.fname = @patient.full_sex unless @patient.fname.present?\n @doctor = Doctor.find(@visit.doc_id)\n @xml = render_to_string \"show.xml\"\n\n uri = URI.parse(CABMDURL)\n http= Net::HTTP.new(uri.host,uri.port)\n http.use_ssl = true\n \n req = Net::HTTP::Post.new(uri.request_uri, {'Content-Type' => 'application/xml'})\n req.body = @xml\n\n res = http.request(req)\n @xmlhash = JSON.parse(res.body)\n# {\"success\"=>true, \"errors\"=>[], \"messages\"=>[], \"reference_id\"=>\"332933\", \"accounting_number\"=>\"0004MZ4Z\"}\n \n if @xmlhash['success'] \n\t acc_num = @xmlhash['accounting_number']\n flash[:info] = \"Claim #{acc_num} sent to cab.md \" \n @visit.update_attribute(:status, BILLED)\n @visit.update_attribute(:billing_ref, acc_num)\n else\n\t errors = @xmlhash['errors']\n\t messages = @xmlhash['messages']\n\t flash[:danger] = \"Error sending claim : #{@xmlhash}\"\n @visit.update_attribute(:status, READY)\n\t @visit.update_attribute(:billing_ref, errors.join(',')) if errors.present?\n end\n\n respond_to(:html)\n redirect_to patient_visit_path\n end", "def create\n @insert_condition = InsertCondition.new(insert_condition_params)\n\n respond_to do |format|\n if @insert_condition.save\n format.html { redirect_to @insert_condition, notice: 'Insert condition was successfully created.' }\n format.json { render :show, status: :created, location: @insert_condition }\n else\n format.html { render :new }\n format.json { render json: @insert_condition.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @conseq = Conseq.new(params[:conseq])\n\n respond_to do |format|\n if @conseq.save\n format.html { redirect_to(@conseq, :notice => 'Conseq was successfully created.') }\n format.xml { render :xml => @conseq, :status => :created, :location => @conseq }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @conseq.errors, :status => :unprocessable_entity }\n end\n end\n end", "def insert_webservice_access_log(seedTrialID)\n @seed_json_data = read_json_from_dir(@converted_json_dir, @dt4_formula_json)\n @seed_data = @seed_json_data.find {|x| x['seedTrialID'] == \"#{seedTrialID}\"}\n puts @seed_data\nsql_insert_webservice_access_log =\n \"\n INSERT INTO webservice_access_log (identifier,datetime,client_ip,client_username,uri,method,headers,payload,response,response_code,processing_time,processing_errors) VALUES ('1618194','2018-02-21 08:34:32.99','172.18.0.1','ctrpsubstractor','/services/trials/complete/','POST','host=localhost:18080\\nconnection=keep-alive\\ncontent-length=4516\\naccept=application/xml\\npostman-token=8fe8effb-61da-a534-e4c5-a34613f33fec\\ncache-control=no-cache\\norigin=chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop\\nuser-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36\\nauthorization=*********\\ncontent-type=application/xml\\naccept-encoding=gzip, deflate, br\\naccept-language=en-US,en;q=0.9\\ncookie=JSESSIONID=syajca7WdyZiqoJN+WrkNoFO\\n','<tns:CompleteTrialRegistration xmlns:tns=\\\"gov.nih.nci.pa.webservices.types\\\"\\n xmlns:tns1=\\\"gov.nih.nci.po.webservices.types.trimmed\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\"\\n xsi:schemaLocation=\\\"gov.nih.nci.pa.webservices.types ../../src/resources/ws.xsd \\\">\\n\\n <tns:clinicalTrialsDotGovXmlRequired>true</tns:clinicalTrialsDotGovXmlRequired>\\n <tns:leadOrgTrialID>UPCC 348-02 II - sa1</tns:leadOrgTrialID>\\n <tns:clinicalTrialsDotGovTrialID>NCT91914266</tns:clinicalTrialsDotGovTrialID>\\n <tns:otherTrialID>818280234</tns:otherTrialID>\\n <tns:title>A Phase I/II Study Of Brentuximab Vedotin In Combination With Multi-Agent Chemotherapy II</tns:title>\\n <tns:phase>I</tns:phase>\\n <tns:pilot>false</tns:pilot>\\n <tns:accrualDiseaseTerminology>ICD10</tns:accrualDiseaseTerminology>\\n <tns:primaryPurpose>Other</tns:primaryPurpose>\\n <tns:primaryPurposeOtherDescription>Determine maximum tolerated dose (MTD) of brentuximab vedotin</tns:primaryPurposeOtherDescription>\\n <tns:interventionalDesign>\\n <tns:secondaryPurpose>Other</tns:secondaryPurpose>\\n <tns:secondaryPurposeOtherDescription>Secondary Other Description</tns:secondaryPurposeOtherDescription>\\n </tns:interventionalDesign>\\n <tns:leadOrganization>\\n <tns:existingOrganization>\\n <tns:poID>181802</tns:poID>\\n </tns:existingOrganization>\\n </tns:leadOrganization>\\n <tns:pi>\\n <tns:existingPerson>\\n <tns:poID>5000</tns:poID>\\n </tns:existingPerson>\\n </tns:pi>\\n <tns:sponsor>\\n <tns:existingOrganization>\\n <tns:poID>181802</tns:poID>\\n </tns:existingOrganization>\\n </tns:sponsor>\\n <tns:responsibleParty>\\n <tns:type>Sponsor-Investigator</tns:type>\\n <tns:investigator>\\n <tns:existingPerson>\\n <tns:poID>5000</tns:poID>\\n </tns:existingPerson>\\n </tns:investigator>\\n <tns:investigatorTitle>CEO &amp; Chairman</tns:investigatorTitle>\\n </tns:responsibleParty>\\n <tns:summary4FundingSponsor>\\n <tns:existingOrganization>\\n <tns:poID>181802</tns:poID>\\n </tns:existingOrganization>\\n </tns:summary4FundingSponsor>\\n <tns:programCode>PG00001</tns:programCode>\\n <tns:fundedByNciGrant>false</tns:fundedByNciGrant>\\n <tns:grant>\\n <tns:fundingMechanism>B09</tns:fundingMechanism>\\n <tns:nihInstitutionCode>AA</tns:nihInstitutionCode>\\n <tns:serialNumber>111111</tns:serialNumber>\\n <tns:nciDivisionProgramCode>CCR</tns:nciDivisionProgramCode>\\n <tns:fundingPercentage>100.0</tns:fundingPercentage>\\n </tns:grant>\\n <tns:trialStatus>In Review</tns:trialStatus>\\n <tns:whyStopped></tns:whyStopped>\\n <tns:trialStatusDate>2014-07-15</tns:trialStatusDate>\\n <tns:trialStartDate type=\\\"Actual\\\">2014-07-15</tns:trialStartDate>\\n <tns:primaryCompletionDate type=\\\"Anticipated\\\">2019-07-15</tns:primaryCompletionDate>\\n <tns:completionDate type=\\\"Anticipated\\\">2019-07-15</tns:completionDate>\\n <tns:ind>\\n <tns:number>111111</tns:number>\\n <tns:grantor>CDER</tns:grantor>\\n <tns:holderType>NIH</tns:holderType>\\n <tns:nihInstitution>NEI</tns:nihInstitution>\\n <tns:expandedAccess>true</tns:expandedAccess>\\n <tns:expandedAccessType>Available</tns:expandedAccessType>\\n <tns:exempt>true</tns:exempt>\\n </tns:ind>\\n <tns:ide>\\n <tns:number>222222</tns:number>\\n <tns:grantor>CDRH</tns:grantor>\\n <tns:holderType>NCI</tns:holderType>\\n <tns:nciDivisionProgramCode>CCR</tns:nciDivisionProgramCode>\\n <tns:expandedAccess>true</tns:expandedAccess>\\n <tns:expandedAccessType>Available</tns:expandedAccessType>\\n <tns:exempt>true</tns:exempt>\\n </tns:ide>\\n <tns:regulatoryInformation>\\n <tns:country>USA</tns:country>\\n <tns:authorityName>Federal Government</tns:authorityName>\\n <tns:fdaRegulated>true</tns:fdaRegulated>\\n <tns:section801>true</tns:section801>\\n <tns:delayedPosting>true</tns:delayedPosting>\\n <tns:dataMonitoringCommitteeAppointed>true</tns:dataMonitoringCommitteeAppointed>\\n </tns:regulatoryInformation>\\n <tns:protocolDocument filename=\\\"protocol.pdf\\\">dGVzdA==</tns:protocolDocument>\\n <tns:irbApprovalDocument filename=\\\"irb.pdf\\\">dGVzdA==</tns:irbApprovalDocument>\\n <tns:participatingSitesDocument\\n filename=\\\"sites.pdf\\\">dGVzdA==</tns:participatingSitesDocument>\\n <tns:informedConsentDocument filename=\\\"consent.pdf\\\">dGVzdA==</tns:informedConsentDocument>\\n <tns:otherDocument filename=\\\"other.pdf\\\">dGVzdA==</tns:otherDocument>\\n <tns:category>Externally Peer-Reviewed</tns:category>\\n <tns:trialOwner>qatest@nih.gov</tns:trialOwner>\\n</tns:CompleteTrialRegistration>\\n','JBAS014580: Unexpected Error','500','1012','');\n INSERT INTO webservice_access_log (identifier,datetime,client_ip,client_username,uri,method,headers,payload,response,response_code,processing_time,processing_errors) VALUES ('1618428','2018-02-21 08:34:55.261','172.18.0.1','ctrpsubstractor','/services/trials/complete/','POST','host=localhost:18080\\nconnection=keep-alive\\ncontent-length=4516\\naccept=application/xml\\npostman-token=67d3475f-2ca6-739b-c640-9757b881060b\\ncache-control=no-cache\\norigin=chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop\\nuser-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36\\nauthorization=*********\\ncontent-type=application/xml\\naccept-encoding=gzip, deflate, br\\naccept-language=en-US,en;q=0.9\\ncookie=JSESSIONID=syajca7WdyZiqoJN+WrkNoFO\\n','<tns:CompleteTrialRegistration xmlns:tns=\\\"gov.nih.nci.pa.webservices.types\\\"\\n xmlns:tns1=\\\"gov.nih.nci.po.webservices.types.trimmed\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\"\\n xsi:schemaLocation=\\\"gov.nih.nci.pa.webservices.types ../../src/resources/ws.xsd \\\">\\n\\n <tns:clinicalTrialsDotGovXmlRequired>true</tns:clinicalTrialsDotGovXmlRequired>\\n <tns:leadOrgTrialID>UPCC 348-02 II - sa2</tns:leadOrgTrialID>\\n <tns:clinicalTrialsDotGovTrialID>NCT91914277</tns:clinicalTrialsDotGovTrialID>\\n <tns:otherTrialID>818280244</tns:otherTrialID>\\n <tns:title>A Phase I/II Study Of Brentuximab Vedotin In Combination With Multi-Agent Chemotherapy II</tns:title>\\n <tns:phase>I</tns:phase>\\n <tns:pilot>false</tns:pilot>\\n <tns:accrualDiseaseTerminology>ICD10</tns:accrualDiseaseTerminology>\\n <tns:primaryPurpose>Other</tns:primaryPurpose>\\n <tns:primaryPurposeOtherDescription>Determine maximum tolerated dose (MTD) of brentuximab vedotin</tns:primaryPurposeOtherDescription>\\n <tns:interventionalDesign>\\n <tns:secondaryPurpose>Other</tns:secondaryPurpose>\\n <tns:secondaryPurposeOtherDescription>Secondary Other Description</tns:secondaryPurposeOtherDescription>\\n </tns:interventionalDesign>\\n <tns:leadOrganization>\\n <tns:existingOrganization>\\n <tns:poID>181802</tns:poID>\\n </tns:existingOrganization>\\n </tns:leadOrganization>\\n <tns:pi>\\n <tns:existingPerson>\\n <tns:poID>5000</tns:poID>\\n </tns:existingPerson>\\n </tns:pi>\\n <tns:sponsor>\\n <tns:existingOrganization>\\n <tns:poID>181802</tns:poID>\\n </tns:existingOrganization>\\n </tns:sponsor>\\n <tns:responsibleParty>\\n <tns:type>Sponsor-Investigator</tns:type>\\n <tns:investigator>\\n <tns:existingPerson>\\n <tns:poID>5000</tns:poID>\\n </tns:existingPerson>\\n </tns:investigator>\\n <tns:investigatorTitle>CEO &amp; Chairman</tns:investigatorTitle>\\n </tns:responsibleParty>\\n <tns:summary4FundingSponsor>\\n <tns:existingOrganization>\\n <tns:poID>181802</tns:poID>\\n </tns:existingOrganization>\\n </tns:summary4FundingSponsor>\\n <tns:programCode>PG00001</tns:programCode>\\n <tns:fundedByNciGrant>false</tns:fundedByNciGrant>\\n <tns:grant>\\n <tns:fundingMechanism>B09</tns:fundingMechanism>\\n <tns:nihInstitutionCode>AA</tns:nihInstitutionCode>\\n <tns:serialNumber>111111</tns:serialNumber>\\n <tns:nciDivisionProgramCode>CCR</tns:nciDivisionProgramCode>\\n <tns:fundingPercentage>100.0</tns:fundingPercentage>\\n </tns:grant>\\n <tns:trialStatus>In Review</tns:trialStatus>\\n <tns:whyStopped></tns:whyStopped>\\n <tns:trialStatusDate>2014-07-15</tns:trialStatusDate>\\n <tns:trialStartDate type=\\\"Actual\\\">2014-07-15</tns:trialStartDate>\\n <tns:primaryCompletionDate type=\\\"Anticipated\\\">2019-07-15</tns:primaryCompletionDate>\\n <tns:completionDate type=\\\"Anticipated\\\">2019-07-15</tns:completionDate>\\n <tns:ind>\\n <tns:number>111111</tns:number>\\n <tns:grantor>CDER</tns:grantor>\\n <tns:holderType>NIH</tns:holderType>\\n <tns:nihInstitution>NEI</tns:nihInstitution>\\n <tns:expandedAccess>true</tns:expandedAccess>\\n <tns:expandedAccessType>Available</tns:expandedAccessType>\\n <tns:exempt>true</tns:exempt>\\n </tns:ind>\\n <tns:ide>\\n <tns:number>222222</tns:number>\\n <tns:grantor>CDRH</tns:grantor>\\n <tns:holderType>NCI</tns:holderType>\\n <tns:nciDivisionProgramCode>CCR</tns:nciDivisionProgramCode>\\n <tns:expandedAccess>true</tns:expandedAccess>\\n <tns:expandedAccessType>Available</tns:expandedAccessType>\\n <tns:exempt>true</tns:exempt>\\n </tns:ide>\\n <tns:regulatoryInformation>\\n <tns:country>USA</tns:country>\\n <tns:authorityName>Federal Government</tns:authorityName>\\n <tns:fdaRegulated>true</tns:fdaRegulated>\\n <tns:section801>true</tns:section801>\\n <tns:delayedPosting>true</tns:delayedPosting>\\n <tns:dataMonitoringCommitteeAppointed>true</tns:dataMonitoringCommitteeAppointed>\\n </tns:regulatoryInformation>\\n <tns:protocolDocument filename=\\\"protocol.pdf\\\">dGVzdA==</tns:protocolDocument>\\n <tns:irbApprovalDocument filename=\\\"irb.pdf\\\">dGVzdA==</tns:irbApprovalDocument>\\n <tns:participatingSitesDocument\\n filename=\\\"sites.pdf\\\">dGVzdA==</tns:participatingSitesDocument>\\n <tns:informedConsentDocument filename=\\\"consent.pdf\\\">dGVzdA==</tns:informedConsentDocument>\\n <tns:otherDocument filename=\\\"other.pdf\\\">dGVzdA==</tns:otherDocument>\\n <tns:category>Externally Peer-Reviewed</tns:category>\\n <tns:trialOwner>qatest@nih.gov</tns:trialOwner>\\n</tns:CompleteTrialRegistration>\\n','<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\\n<TrialRegistrationConfirmation xmlns=\\\"gov.nih.nci.pa.webservices.types\\\" xmlns:ns2=\\\"gov.nih.nci.po.webservices.types.trimmed\\\">\\n <paTrialID>1618195</paTrialID>\\n <nciTrialID>NCI-2018-03030</nciTrialID>\\n</TrialRegistrationConfirmation>\\n','200','6255','');\n \"\n puts sql_insert_webservice_access_log\nend", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/creditaccount/v1\")\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 @ncco_record_action = NccoRecordAction.new(ncco_record_action_params)\n\n respond_to do |format|\n if @ncco_record_action.save\n format.html { redirect_to @ncco_record_action, notice: 'Ncco record action was successfully created.' }\n format.json { render :show, status: :created, location: @ncco_record_action }\n else\n format.html { render :new }\n format.json { render json: @ncco_record_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @clause = Clause.new(clause_params)\n\n respond_to do |format|\n if @clause.save\n format.html { redirect_to @clause, notice: 'Clause was successfully created.' }\n format.json { render :show, status: :created, location: @clause }\n else\n format.html { render :new }\n format.json { render json: @clause.errors, status: :unprocessable_entity }\n end\n end\n end", "def statements(company_number)\n client.get(\"/company/#{company_number}/persons-with-significant-control-statements/#{statement_id}\")\n end", "def post_query( xml )\n url = URI.parse( self.url )\n response = self.http.post_form( url, { \"query\" => xml } )\n return response.body\n end", "def create\n @ccl = Ccl.new(params[:ccl])\n\n respond_to do |format|\n if @ccl.save\n format.html { redirect_to(@ccl, :notice => 'Ccl was successfully created.') }\n format.xml { render :xml => @ccl, :status => :created, :location => @ccl }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ccl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def accounting_statement_params\n params.require(:accounting_statement).permit(:is_income, :net_amount, :vat_amount, :frontpage_data, :backpage_data, :frontpage_content_type, :backpage_content_type, :backpage_filename, :frontpage_filename, :bill_number, :issuedate, :payment_date, :description, :physical_location, :receiver_or_issuer_name, :accounting_category_id, :corporation_id)\n end", "def create_new_customer \n ForestOperations.link_parent_child_nodes_return_parent(\n ForestOperations.create_node(\n line_content[:sent_or_accepted_by],\n :accepted),\n ForestOperations.create_node(\n line_content[:recived_by]\n ) \n )\n end", "def content_post\n\t\t\t# POST requests seem to bomb out when they're deflated\n\t\t\t# and they probably don't need to be compressed anyway\n\t\t\t@request_params[\"SAMLRequest\"] = Base64.encode64(@request).gsub(/\\n/, \"\")\n\t\t\t\n\t\t\t#Logging.debug \"SAMLRequest=#{@request_params[\"SAMLRequest\"]}\"\n\t\t\t# kind of a cheesy method of building an HTML, form since we can't rely on Rails too much,\n\t\t\t# and REXML doesn't work well with quote characters\n\t\t\tstr = \"<html><body onLoad=\\\"document.getElementById('form').submit();\\\">\\n\"\n\t\t\tstr += \"<form id='form' name='form' method='POST' action=\\\"#{@URL}\\\">\\n\"\n\t\t\t# we could change this in the future to associate a temp auth session ID\n\t\t\tstr += \"<input name='RelayState' value='ruby-saml' type='hidden' />\\n\"\n\t\t\t@request_params.each_pair do |key, value|\n\t\t\t\tstr += \"<input name=\\\"#{key}\\\" value=\\\"#{value}\\\" type='hidden' />\\n\"\n\t\t\t\t#str += \"<input name=\\\"#{key}\\\" value=\\\"#{CGI.escape(value)}\\\" type='hidden' />\\n\"\n\t\t\tend\n\t\t\tstr += \"</form></body></html>\\n\"\n\t\t\t\n\t\t\tLogging.debug \"Created form:\\n#{str}\"\n\t\t\treturn str\n\t\tend", "def postContract_log( contract_id, date, payment_provider, response, success, amount, currency)\n params = Hash.new\n params['contract_id'] = contract_id\n params['date'] = date\n params['payment_provider'] = payment_provider\n params['response'] = response\n params['success'] = success\n params['amount'] = amount\n params['currency'] = currency\n return doCurl(\"post\",\"/contract_log\",params)\n end", "def csp_params\n params.require(:csp).permit(:number, :term_begin, :term_end, :dm_number, :grade, :password,\n nursery_attributes:[:id, :name, :address, :phone, :fax, :email, :responder, :billing_address, :status, :csp_id])\n end", "def create\n @csosn = Csosn.new(params[:csosn])\n\n respond_to do |format|\n if @csosn.save\n format.html { redirect_to @csosn, notice: 'Csosn was successfully created.' }\n format.json { render json: @csosn, status: :created, location: @csosn }\n else\n format.html { render action: \"new\" }\n format.json { render json: @csosn.errors, status: :unprocessable_entity }\n end\n end\n end", "def xml_final_output\n\n parametros = ActiveSupport::OrderedHash.new\n parametros[\"xmlns\"] = \"http://cancelacfd.sat.gob.mx\"\n parametros[\"xmlns:xsd\"] = \"http://www.w3.org/2001/XMLSchema\"\n parametros[\"xmlns:xsi\"] = \"http://www.w3.org/2001/XMLSchema-instance\"\n parametros[\"Fecha\"] = @fecha\n parametros[\"RfcEmisor\"] = @rfcemisor\n \n @certificate = CFDI::Certificado.new @certificate\n \n @builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.Cancelacion(parametros) do\n xml.Folios {\n xml.UUID(@uuid)\n }\n xml.Signature({'xmlns' => \"http://www.w3.org/2000/09/xmldsig#\" }) do\n xml.SignedInfo do \n xml.CanonicalizationMethod({'Algorithm' =>\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"})\n xml.SignatureMethod({'Algorithm' => \"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"})\n \n xml.Reference({'URI' => \"\"}) do\n \n xml.Transforms do\n xml.Transform({ 'Algorithm' => \"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" })\n end\n \n xml.DigestMethod({ 'Algorithm' => \"http://www.w3.org/2000/09/xmldsig#sha1\" })\n xml.DigestValue(self.digested_canonicalized_data)\n \n end\n \n end\n xml.SignatureValue(self.computed_signed_info)\n xml.KeyInfo do \n xml.X509Data do\n xml.X509IssuerSerial do\n xml.X509IssuerName(@certificate.issuername)\n xml.X509SerialNumber(@certificate.serial)\n end\n xml.X509Certificate(@certificate.data)\n end\n end\n end\n end\n end\n \n CGI::unescapeHTML(@builder.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::AS_XML).strip.gsub(/\\n/, ''))\n \n end", "def authorizeXML(params) \n begin\n Nokogiri::XML::Builder.new do |xml|\n xml.AuthorizeTransaction('xmlns:i' => 'http://www.w3.org/2001/XMLSchema-instance', \n 'xmlns' => 'http://schemas.ipcommerce.com/CWS/v2.0/Transactions/Rest',\n 'i:type' =>\"AuthorizeTransaction\" ) {\n xml.ApplicationProfileId application_profile_id\n xml.MerchantProfileId merchant_profile_id\n xml.Transaction('xmlns:ns1' => \"http://schemas.ipcommerce.com/CWS/v2.0/Transactions/Bankcard\",\n 'i:type' => \"ns1:BankcardTransaction\" ){\n xml['ns1'].TenderData{\n if params[:SwipeStatus].present? && params[:IdentificationInformation].present? && params[:SecurePaymentAccountData].present? && params[:EncryptionKeyId].present?\n #p \"Swipe card..maga...\"\n xml['ns5'].SecurePaymentAccountData('xmlns:ns5' =>\n \"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text(params[:SecurePaymentAccountData])\n xml['ns6'].EncryptionKeyId('xmlns:ns6' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text(params[:EncryptionKeyId])\n xml['ns7'].SwipeStatus('xmlns:ns7' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text(params[:SwipeStatus])\n xml['ns1'].CardSecurityData{\n xml['ns1'].IdentificationInformation params[:IdentificationInformation]\n }\n xml['ns1'].CardData('i:nil' =>\"true\")\n elsif params[:SecurePaymentAccountData].present? && params[:EncryptionKeyId].present? \n #p \"Swipe card..Dukp...\"\n xml['ns5'].SecurePaymentAccountData('xmlns:ns5' =>\n \"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text(params[:SecurePaymentAccountData])\n xml['ns6'].EncryptionKeyId('xmlns:ns6' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text(params[:EncryptionKeyId])\n xml['ns7'].SwipeStatus('xmlns:ns7' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\",'i:nil' =>\"true\") \n xml['ns1'].CardSecurityData{\n xml['ns1'].IdentificationInformation('i:nil' =>\"true\")\n }\n xml['ns1'].CardData('i:nil' =>\"true\")\n xml['ns1'].EcommerceSecurityData('i:nil' =>\"true\") \n elsif params[:PaymentAccountDataToken].present?\n #p \"PaymentAccountDataToken...........\"\n xml['ns4'].PaymentAccountDataToken('xmlns:ns4' =>\n \"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text(params[:PaymentAccountDataToken])\n xml['ns5'].SecurePaymentAccountData('xmlns:ns5' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\",'i:nil' =>\"true\")\n xml['ns6'].EncryptionKeyId('xmlns:ns6' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\",'i:nil' =>\"true\")\n xml['ns7'].SwipeStatus('xmlns:ns7' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\",'i:nil' =>\"true\") \n xml['ns1'].CardData('i:nil' =>\"true\")\n xml['ns1'].EcommerceSecurityData('i:nil' =>\"true\") \n else \n #p \"without token....\"\n xml['ns4'].PaymentAccountDataToken('xmlns:ns4' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\", 'i:nil' =>\"true\")\n xml['ns5'].SecurePaymentAccountData('xmlns:ns5' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\",'i:nil' =>\"true\")\n xml['ns6'].EncryptionKeyId('xmlns:ns6' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\",'i:nil' =>\"true\")\n xml['ns7'].SwipeStatus('xmlns:ns7' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\",'i:nil' =>\"true\")\n xml['ns1'].CardData{\n xml['ns1'].CardType params[:CardType] \n if params[:Track2Data].present?\n xml['ns1'].Track2Data params[:Track2Data]\n xml['ns1'].PAN('i:nil' =>\"true\") \n xml['ns1'].Expire('i:nil' =>\"true\")\n xml['ns1'].Track1Data('i:nil' =>\"true\")\n elsif params[:Track1Data].present?\n xml['ns1'].Track1Data params[:Track1Data]\n xml['ns1'].PAN('i:nil' =>\"true\") \n xml['ns1'].Expire('i:nil' =>\"true\")\n xml['ns1'].Track2Data('i:nil' =>\"true\")\n else\n xml['ns1'].PAN params[:PAN] \n xml['ns1'].Expire params[:Expire]\n xml['ns1'].Track1Data('i:nil' =>\"true\")\n xml['ns1'].Track2Data('i:nil' =>\"true\")\n end \n }\n xml['ns1'].EcommerceSecurityData('i:nil' =>\"true\") \n end\n }\n xml['ns2'].CustomerData('xmlns:ns2' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\"){\n xml['ns2'].BillingData{\n xml['ns2'].Name('i:nil' =>\"true\")\n xml['ns2'].Address{\n xml['ns2'].Street1 params[:Street1] \n xml['ns2'].Street2('i:nil' =>\"true\")\n xml['ns2'].City params[:City] \n xml['ns2'].StateProvince params[:StateProvince]\n xml['ns2'].PostalCode params[:PostalCode]\n xml['ns2'].CountryCode params[:CountryCode]\n }\n xml['ns2'].BusinessName 'MomCorp'\n xml['ns2'].Phone params[:Phone]\n xml['ns2'].Fax('i:nil' =>\"true\")\n xml['ns2'].Email params[:Email]\n }\n xml['ns2'].CustomerId 'cust123'\n xml['ns2'].CustomerTaxId('i:nil' =>\"true\")\n xml['ns2'].ShippingData('i:nil' =>\"true\")\n }\n xml['ns3'].ReportingData('xmlns:ns3' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\"){\n xml['ns3'].Comment 'a test comment'\n xml['ns3'].Description 'a test description'\n xml['ns3'].Reference '001'\n }\n xml['ns1'].TransactionData{\n if params[:Amount] != ''\n xml['ns8'].Amount('xmlns:ns8' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text(params[:Amount])\n else\n xml['ns8'].Amount('xmlns:ns8' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text('0.00')\n end\n #xml['ns8'].Amount('xmlns:ns8' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text(params[:Amount])\n xml['ns9'].CurrencyCode('xmlns:ns9' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text('USD') \n xml['ns10'].TransactionDateTime('xmlns:ns10' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text('2013-04-03T13:50:16')\n xml['ns11'].CampaignId('xmlns:ns11' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\",'i:nil' =>\"true\")\n xml['ns12'].Reference('xmlns:ns12' =>\"http://schemas.ipcommerce.com/CWS/v2.0/Transactions\").text('xyt')\n xml['ns1'].AccountType 'NotSet'\n xml['ns1'].ApprovalCode('i:nil' =>\"true\")\n xml['ns1'].CashBackAmount '0.0'\n xml['ns1'].CustomerPresent 'Present'\n xml['ns1'].EmployeeId '11'\n xml['ns1'].EntryMode params[:EntryMode]\n xml['ns1'].GoodsType 'NotSet'\n xml['ns1'].IndustryType params[:IndustryType]\n xml['ns1'].InternetTransactionData('i:nil' =>\"true\")\n xml['ns1'].InvoiceNumber params[:InvoiceNumber]\n xml['ns1'].OrderNumber params[:OrderNumber]\n xml['ns1'].IsPartialShipment 'false'\n xml['ns1'].SignatureCaptured 'false'\n xml['ns1'].FeeAmount '0.0'\n xml['ns1'].TerminalId('i:nil' =>\"true\")\n xml['ns1'].LaneId('i:nil' =>\"true\")\n xml['ns1'].TipAmount '0.0'\n xml['ns1'].BatchAssignment('i:nil' =>\"true\")\n xml['ns1'].PartialApprovalCapable 'NotSet'\n xml['ns1'].ScoreThreshold('i:nil' =>\"true\")\n xml['ns1'].IsQuasiCash 'false' \n }\n }\n } \n end.to_xml \n rescue Exception => ex\n return \"Some value not set in xml for authorizeXML!\"\n end\n end", "def create(params)\n post(\"#{domain}/complaints\", params)\n end", "def post data\n commit data\n end", "def create\n @statement_type = StatementType.new(statement_type_params)\n\n respond_to do |format|\n if @statement_type.save\n format.html { redirect_to @statement_type, notice: 'Statement type was successfully created.' }\n format.json { render :show, status: :created, location: @statement_type }\n else\n format.html { render :new }\n format.json { render json: @statement_type.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 @financial_statement = FinancialStatement.new(params[:financial_statement])\n\n respond_to do |format|\n if @financial_statement.save\n format.html { redirect_to @financial_statement, notice: 'Financial statement was successfully created.' }\n format.json { render json: @financial_statement, status: :created, location: @financial_statement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @financial_statement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n transaction = params[\"transaction\"]\n patient = Patient.generate_mckid(transaction)\n patient.save\n\n transaction[\"transaction_types\"].each do |key, value|\n if value == \"1\"\n Transaction.create(mck_id: patient&.guid.upcase, data_type: key )\n end\n end\n\n respond_to do |format|\n format.html { redirect_to new_transaction_path, notice: 'Transaction was successfully created.' }\n end\n end", "def create\n @constraint = Constraint.new(params[:constraint])\n\n respond_to do |format|\n if @constraint.save\n format.html { redirect_to @constraint, notice: 'Constraint was successfully created.' }\n format.json { render json: @constraint, status: :created, location: @constraint }\n else\n format.html { render action: \"new\" }\n format.json { render json: @constraint.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_request( xml )\n write( xml )\n read\n end", "def content_post\n # POST requests seem to bomb out when they're deflated\n # and they probably don't need to be compressed anyway\n @request_params[\"SAMLRequest\"] = Base64.encode64(@request).gsub(/\\n/, \"\")\n \n #Logging.debug \"SAMLRequest=#{@request_params[\"SAMLRequest\"]}\"\n # kind of a cheesy method of building an HTML, form since we can't rely on Rails too much,\n # and REXML doesn't work well with quote characters\n str = \"<html><body onLoad=\\\"document.getElementById('form').submit();\\\">\\n\"\n str += \"<form id='form' name='form' method='POST' action=\\\"#{@URL}\\\">\\n\"\n # we could change this in the future to associate a temp auth session ID\n str += \"<input name='RelayState' value='ruby-saml' type='hidden' />\\n\"\n @request_params.each_pair do |key, value|\n str += \"<input name=\\\"#{key}\\\" value=\\\"#{value}\\\" type='hidden' />\\n\"\n #str += \"<input name=\\\"#{key}\\\" value=\\\"#{CGI.escape(value)}\\\" type='hidden' />\\n\"\n end\n str += \"</form></body></html>\\n\"\n \n #Logging.debug \"Created form:\\n#{str}\"\n return str\n end", "def commit(request)\n data = ssl_post(test? ? self.test_url : self.live_url, request)\n response = parse(data)\n\n cvv_result = CVVResult.new(response[:cv2_result_response], true)\n\n Response.new(response[:status] == DATACASH_SUCCESS, response[:reason], response,\n :test => test?,\n :authorization => \"#{response[:datacash_reference]};#{response[:authcode]};#{response[:ca_reference]}\",\n :cvv_result => cvv_result\n )\n end", "def test_generate_request_xml_successful\n assert AxAccount.request_xml(\"CU 0100000\")\n end", "def create\n @cancellation = Cancellation.new_from_xml(request.body.read)\n respond_to do |format|\n if @cancellation.save! \n format.xml { render :action => 'show', :status => :created, :location => @cancellation }\n else\n format.xml { render :xml => @cancellation.errors, :status => :unprocessable_entity }\n end\n end \n \n #@orders.each do |order|\n end", "def create_tobacco_cessation(options={})\n options = {\n access_token: options[:access_token],\n tobacco_cessation: {\n cigarettes_allowed: options[:cigarettes_allowed],\n cigarettes_smoked: options[:cigarettes_smoked],\n cravings: options[:cravings],\n last_smoked: options[:last_smoked],\n timestamp: options[:timestamp],\n source: options[:source]\n }\n }\n\n response = post(\"/#{Validic.api_version}/tobacco_cessation.json\", options)\n response if response\n end", "def POST; end", "def commit(post)\n add_credentials(post)\n validate_request(post)\n url = URI.parse(resource_url)\n req = Net::HTTP::Post.new(url.path)\n params = post.to_s\n #display \"#{resource_url}?\" + params.map{|k,v| \"#{k}=#{v}\"}.join(\"&\")\n req.set_form_data(params)\n res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }\n case res\n when Net::HTTPSuccess#, Net::HTTPRedirection\n response(res)\n else\n raise Shipsurance::RequestError, res.error!\n end\n end", "def commit(action, parameters)\n parameters[:HTML] = 'No'\n\n url = (test? ? test_url : live_url)\n\n response = parse(ssl_post(url, post_data(action, parameters)))\n\n Response.new(\n success_from(response),\n message_from(response),\n response,\n authorization: authorization_from(response),\n avs_result: avs_result_from(response),\n cvv_result: cvv_result_from(response),\n test: test?,\n error_code: error_code_from(response)\n )\n end", "def commit(request)\n headers = { 'Content-Type' => 'text/xml',\n 'Authorization' => encoded_credentials }\n\n response = parse(ssl_post(test? ? TEST_URL : LIVE_URL, request, headers))\n \n # parse the reply into a Response object\n success = response[:TransactionState] == 'success'\n message = response[:Description]\n authorization = (success && @options[:action] == :authorization) ? response[:TransactionId] : nil\n\n Response.new(success, message, response,\n :test => test?,\n :authorization => authorization\n )\n \n end", "def commit(action)\n url = endpoint_url(action)\n response_body = ssl_post(url, post_data, headers)\n #ActiveMerchant::Billing::PaysonResponse.new(response_body)\n if action.to_sym == :payment_details\n ActiveMerchant::Billing::PaysonPaymentDetailsResponse.new(response_body)\n else\n ActiveMerchant::Billing::PaysonResponse.new(response_body)\n end\n end", "def create_crm_account_from_lead\n doc = Hpricot::XML(request.raw_post)\n doc = doc.to_s.gsub(\"&amp;\",\"&\") \n doc = Hpricot::XML(doc) \n id = parse_xml(doc/:params/'id')\n account_doc = Crm::CrmLeadCrud.generate_xml_for_account(doc) \n @accounts=Crm::CrmLeadCrud.create_account_from_lead(account_doc,id)\n account = @accounts.first if !@accounts.empty?\n if account.errors.empty?\n render:text=>'success'\n else\n respond_to_errors(account.errors)\n end\n end", "def build_status_request_body\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.transaction_request(\"version\" => \"2\") do\n xml.transaction @order.sofort_id\n end\n end\n builder.to_xml\n end", "def create\n @financial_statement = FinancialStatement.new(financial_statement_params)\n\n respond_to do |format|\n if @financial_statement.save\n format.html { redirect_to @financial_statement, notice: 'Financial statement was successfully created.' }\n format.json { render :show, status: :created, location: @financial_statement }\n else\n format.html { render :new }\n format.json { render json: @financial_statement.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_xml(url, ls_data)\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri.request_uri, HEADER_XML)\n request.body = ls_data\n request.basic_auth(@nsx_user, @nsx_password)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true,\n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|\n https.request(request)\n end\n return response.body if check_response(response, 201)\n end", "def create\n #I need :parent_id set to 0 by default for itself and next_sib\n if params[:cc_question][:cc_all_attributes][:parent_id] == \"\"\n params[:cc_question][:cc_all_attributes][:parent_id] = \"0\"\n end\n #we need the parent id to set next_sib\n params[:cc_question][:cc_all_attributes][:next_sib] += \"_\"\n params[:cc_question][:cc_all_attributes][:next_sib] += params[:cc_question][:cc_all_attributes][:parent_id] \n\n @cc_question = CcQuestion.new(params[:cc_question])\n\n respond_to do |format|\n if @cc_question.save\n format.html { redirect_to(@cc_question, :notice => 'Question component was successfully created.') }\n format.xml { render :xml => @cc_question, :status => :created, :location => @cc_question }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cc_question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def commit(request, action, amount, options)\n begin\n raw_response = ssl_post(test? ? self.test_url : self.live_url, build_request(request, options))\n rescue ResponseError => e\n raw_response = e.response.body\n end\n\n begin\n response = parse(raw_response)\n rescue REXML::ParseException => e\n response = { message: e.to_s }\n end\n\n success = success?(response)\n message = message_from(response)\n authorization = success || in_fraud_review?(response) ? authorization_from(response, action, amount, options) : nil\n\n message = auto_void?(authorization_from(response, action, amount, options), response, message, options)\n\n Response.new(\n success,\n message,\n response,\n test: test?,\n authorization: authorization,\n fraud_review: in_fraud_review?(response),\n avs_result: { code: response[:avsCode] },\n cvv_result: response[:cvCode]\n )\n end", "def commit_order\r\n order = @customer.open_orders.find params[:id]\r\n \r\n unless !order.commit\r\n headers['Content-Type'] = 'text/plain'\r\n render :text => \"Failed to connect with AX server.\"\r\n end\r\n end", "def get_copays\n raise InvalidVBSRequestError, request_data.errors unless request_data.valid?\n\n response = request.post('/Prod/GetStatementsByEDIPIAndVistaAccountNumber', request_data.to_hash)\n\n ResponseData.build(response: response).handle\n end", "def cncoperation_params\n params.require(:cncoperation).permit(:operation_name, :description, :plan_status, :cncjob_id, :tenant_id)\n end", "def build_credit_request(transaction_type, money, transaction_id, card)\n build_xml_request(transaction_type, transaction_id) do |xml|\n add_credit_card(xml, card) if card\n xml.tag! 'TotalAmount', amount(money)\n\n xml.target!\n end\n end", "def execute_transaction_data(create_response, parameters)\n url = make_url('ExecTran')\n\n data = {}\n data[:Version] = '105'\n data[:AccessID] = create_response[:AccessID]\n data[:AccessPass] = create_response[:AccessPass]\n data[:OrderID] = parameters[:OrderID]\n data[:Method] = '1' # Single lump-sum payment\n data[:CardNo] = parameters[:CardNo]\n data[:Expire] = parameters[:Expire]\n data[:SecurityCode] = parameters[:SecurityCode]\n data[:ClientField1] = clean_client_field(parameters[:ClientField1])\n data[:ClientField2] = clean_client_field(parameters[:ClientField2])\n data[:ClientField3] = clean_client_field(parameters[:ClientField3])\n\n [url, data.to_query]\n end", "def create\n @cash_transaction = CashTransaction.new(params[:cash_transaction])\n\n respond_to do |format|\n if @cash_transaction.save\n format.html { redirect_to(@cash_transaction, :notice => 'Cash transaction was successfully created.') }\n format.xml { render :xml => @cash_transaction, :status => :created, :location => @cash_transaction }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cash_transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def bank_balance_report\n doc = Hpricot::XML(request.raw_post)\n doc = doc.to_s.gsub(\"&amp;\",\"&\") \n doc = Hpricot::XML(doc) \n # xml = %{\n # <criteria> \n # <str1></str1> \n # <str2>zzzz</str2> \n # <str3></str3> \n # <str4>zzzzzzz</str4> \n # <str5>a</str5> \n # <str6>b</str6> \n # <str7></str7>\n # <str8>zzz</str8> \n # <dt2>2025-12-25</dt2>\n # <str10>zzz</str10> \n # <multiselect1></multiselect1>\n # <multiselect4></multiselect4>\n # <str12>zzz</str12>\n # <str14>z</str14>\n # <str16>zzz</str16>\n # <user_id>1</user_id>\n # <default_request>N</default_request>\n # </criteria> \n # }\n # doc = Hpricot::XML(xml)\n @bank_transactions = GeneralLedger::BankTransactionReport.bank_balance_report(doc)\n # respond_to_action('bank_balance_report') \n render :xml=>'<encoded>'+Base64.encode64(Zlib::Deflate.deflate(@bank_transactions[0]['xmlcol']))+'</encoded>'\n end", "def create\n @csrelation = Csrelation.new(csrelation_params)\n\n respond_to do |format|\n if @csrelation.save\n format.html { redirect_to @csrelation, notice: 'Csrelation was successfully created.' }\n format.json { render :show, status: :created, location: @csrelation }\n else\n format.html { render :new }\n format.json { render json: @csrelation.errors, status: :unprocessable_entity }\n end\n end\n end", "def statement \n\n\t$cst.add_branch(\"Statement\")\n\n\tcase scout_token\n\twhen \"T_PRINT\"\n\t\tprint_stmt\n\twhen \"T_ID\"\n\t\tassignment_stmt\n\twhen \"T_TYPE\"\n\t\tvardecl\n\twhen \"T_WHILE\"\n\t\twhile_stmt\n\twhen \"T_IF\"\n\t\tif_stmt\n\twhen \"T_LBRACE\"\n\t\tblock\n\telse\n\t\traise FaultyTokenError.new(\"T_PRINT, T_ID, T_TYPE, T_WHILE, T_IF, or T_LBRACE\", $tokens[$index])\n\tend\n\t\n\t$cst.ascend\n\t\nend", "def create\n @statement = @store.statements.build(statement_params)\n\n y = statement_params[:year].to_i\n m = statement_params[:month].to_i\n os = Statement.find_by_year_and_month_and_store_id(y, m, @store.id)\n\n respond_to do |format|\n if os.nil? && @statement.save\n # Calculate Fax Fee\n b = Time.new(y, m)\n (1 .. Time.days_in_month(m, y)).each do |n|\n c = Order.where(:created_at => b + (n-1).days .. b + n.days, store_id: @store.id).count\n @statement.statement_items.create(day: n, price: 0.1, quantity: c, note: \"good\", name: \"fax\") if c > 0\n end\n\n # Calculate Subscription Fee\n @store.subscriptions.each do |subscription|\n @statement.statement_items.create(day: 1, price: subscription.subscribable.price, quantity: 1, note: \"hello\", name: subscription.subscribable.name)\n end\n\n format.html { redirect_to store_statements_url(@store), notice: 'Statement was successfully created.' }\n format.json { render action: 'show', status: :created, location: @statement }\n else\n format.html { render action: 'new' }\n format.json { render json: @statement.errors, status: :unprocessable_entity }\n end\n end\n end", "def post\n if phase.has_key?('post')\n execute(\"post\", phase['post'])\n end\n end", "def post(cnpj, branch, contractId, body)\n self.class.post(\"/aldebaran-carriers/carriers/#{cnpj}/contracts/#{branch}/#{contractId}/regions\", :basic_auth => @auth, :body => body.to_json)\n end", "def account_statement_params\n params.require(:account_statement).permit(:ledger_id, :account_id, :current_balance, :minimum_payment)\n end", "def create\n @server_ins_transaction = ServerInsTransaction.new(params[:server_ins_transaction])\n\n respond_to do |format|\n if @server_ins_transaction.save\n format.html { redirect_to @server_ins_transaction, notice: 'Server ins transaction was successfully created.' }\n format.json { render json: @server_ins_transaction, status: :created, location: @server_ins_transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server_ins_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def coutline_params\n params.require(:coutline).permit(:code, :ename, :name, :des, :major, :ctype)\n end", "def consignment_params\n params.require(:consignment).permit(:merchant_id, :plan_id, :tracking_code, :receiver_name, :receiver_phone, :receiver_addr, :amount, :weight, :charge, :additional_cost, :compensation, :payment_status, :merchant_order_no, :package_description, :delivered_on, :current_hub_id, :target_hub_id, :rider, :assigned_by, :data_entry_by, :completed_by, :assigned_on, :assigned_on, :completed_on, :data_entry_on, :status)\n end", "def add_credit_card(xml, credit_card, address)\n xml.tag! :Card do\n \n # DataCash calls the CC number 'pan'\n xml.tag! :pan, credit_card.number\n xml.tag! :expirydate, format_date(credit_card.month, credit_card.year)\n \n # optional values - for Solo etc\n if [ 'switch', 'solo' ].include?(credit_card.type.to_s)\n \n xml.tag! :issuenumber, credit_card.issue_number unless credit_card.issue_number.blank?\n \n if !credit_card.start_month.blank? && !credit_card.start_year.blank?\n xml.tag! :startdate, format_date(credit_card.start_month, credit_card.start_year)\n end\n end\n \n xml.tag! :Cv2Avs do\n xml.tag! :cv2, credit_card.verification_value if credit_card.verification_value?\n xml.tag! :street_address1, address[:address1] unless address[:address1].blank?\n xml.tag! :street_address2, address[:address2] unless address[:address2].blank?\n xml.tag! :street_address3, address[:address3] unless address[:address3].blank?\n xml.tag! :street_address4, address[:address4] unless address[:address4].blank?\n xml.tag! :postcode, address[:zip] unless address[:zip].blank?\n \n # The ExtendedPolicy defines what to do when the passed data \n # matches, or not...\n # \n # All of the following elements MUST be present for the\n # xml to be valid (or can drop the ExtendedPolicy and use\n # a predefined one\n xml.tag! :ExtendedPolicy do\n xml.tag! :cv2_policy, \n :notprovided => POLICY_REJECT,\n :notchecked => POLICY_REJECT,\n :matched => POLICY_ACCEPT,\n :notmatched => POLICY_REJECT,\n :partialmatch => POLICY_REJECT\n xml.tag! :postcode_policy,\n :notprovided => POLICY_ACCEPT,\n :notchecked => POLICY_ACCEPT,\n :matched => POLICY_ACCEPT,\n :notmatched => POLICY_REJECT,\n :partialmatch => POLICY_ACCEPT\n xml.tag! :address_policy, \n :notprovided => POLICY_ACCEPT,\n :notchecked => POLICY_ACCEPT,\n :matched => POLICY_ACCEPT,\n :notmatched => POLICY_REJECT,\n :partialmatch => POLICY_ACCEPT\n end\n end\n end\n end", "def send_xml(out_xml)\n uri = URI.parse(@url)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new(uri.request_uri)\n\n @logger.error \"#$%$ #{@user}\"\n request.basic_auth @user, @password\n request.body = out_xml\n\n log(\"Sending request: #{request.inspect}\")\n response = http.request(request)\n\n log(\"Response: #{response}\")\n return response.body\n end", "def tn_cols\n puts \"AAAAAAA id=\"+params[:id]\n @cg_tn = CgTn.find(params[:id])\n \n if !params[:tn_cn_id].blank?\n params[:tn_cn_id].each do |cn|\n puts \"aaaaaa cn id=\"+cn\n @cg_tn_cn = CgTnCn.find(cn)\n @cg_tn_cn.display_order = params[:display_order][cn]\n @cg_tn_cn.status_flag = params[:status_flag][cn] \n @cg_tn_cn.save\n end\n end\n @cg_tn_cns = CgTnCn.where(\"cg_tn_id = \"+params[:id]).find(:all,:order=>\"display_order\")\n respond_to do |format|\n format.html \n format.xml { head :ok }\n end\n end", "def add!(data, data_format=DATA_TYPES[:Turtle])\n easy = Curl::Easy.new\n easy.headers[\"Content-Type\"] = data_format\n\n easy.url = self.uri + \"/statements\"\n easy.http_post(data)\n raise(SesameException.new(easy.body_str)) unless easy.response_code == 204\n end", "def createTransaction(toAcc, json)\n\t\turl = \"#{self.urlWithEntity}/#{toAcc}/transactions?key=#{self.apiKey}\"\n\t\turi = URI.parse(url)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\trequest = Net::HTTP::Post.new(uri.request_uri, initheader = {'Content-Type' => 'application/json'})\n\t\trequest.body = json\n\t\tresp = http.request(request)\n\tend", "def process(statements); end", "def postTransactionComplete( transaction_id, paypal_doexpresscheckoutpayment, user_id, entity_id)\n params = Hash.new\n params['transaction_id'] = transaction_id\n params['paypal_doexpresscheckoutpayment'] = paypal_doexpresscheckoutpayment\n params['user_id'] = user_id\n params['entity_id'] = entity_id\n return doCurl(\"post\",\"/transaction/complete\",params)\n end", "def build_void_or_capture_request(type, money, authorization, options)\n reference, auth_code = authorization.to_s.split(';')\n \n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct!\n xml.tag! :Request do\n add_authentication(xml)\n \n xml.tag! :Transaction do\n xml.tag! :HistoricTxn do\n xml.tag! :reference, reference\n xml.tag! :authcode, auth_code\n xml.tag! :method, type\n end\n \n if money\n xml.tag! :TxnDetails do\n xml.tag! :merchantreference, format_reference_number(options[:order_id])\n xml.tag! :amount, amount(money), :currency => options[:currency] || currency(money)\n end\n end\n end\n end\n xml.target!\n end", "def commit(action, params = {})\n unless VALID_ACTIONS.include? action.to_sym\n raise \"Invalid action\"\n end\n @action = action\n @params = params\n \n conn = Faraday.new(:url => API_URL) do |c|\n c.request :soap\n c.response :soap, \"item\"\n c.adapter :net_http\n end\n \n request = conn.post do |r|\n r.body = format_params_for_fantastico\n r.headers = {'Content-Type' => 'text/xml; charset=utf-8'}\n end\n \n response = request.body\n \n @success = !(response.is_a?(Hash) && response.has_key?(\"faultcode\"))\n \n response\n end", "def post\n begin\n charge = Stripe::Charge.create({\n amount: params[:amount],\n currency: 'sgd',\n customer: params[:customer_id],\n source: params[:card_id]\n })\n\n json_response(charge, :created)\n\n rescue Stripe::InvalidRequestError => exception\n response = Hash.new\n response[:error] = exception.message\n\n json_response(response, :bad_request)\n end\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/rewardsaccount/v1\")\n end" ]
[ "0.559584", "0.55821294", "0.55568284", "0.5278184", "0.52586275", "0.5129247", "0.511046", "0.50929016", "0.5020656", "0.49388093", "0.4929368", "0.49190983", "0.4900148", "0.4897338", "0.4892051", "0.48857144", "0.48697066", "0.48474568", "0.4824941", "0.47993812", "0.47952032", "0.4759409", "0.47508743", "0.4731032", "0.47275972", "0.47213265", "0.471468", "0.47133672", "0.4706939", "0.46887735", "0.4630254", "0.46251896", "0.4623892", "0.46213382", "0.46115562", "0.46100968", "0.4600018", "0.45949337", "0.45918196", "0.45915118", "0.45895743", "0.45882472", "0.458608", "0.4584088", "0.45796597", "0.4573744", "0.456987", "0.45523492", "0.4546556", "0.4543005", "0.45397243", "0.4539375", "0.45339295", "0.45336634", "0.45305428", "0.45233935", "0.45225778", "0.45195016", "0.45138258", "0.45133352", "0.4511314", "0.450127", "0.45002946", "0.449644", "0.449112", "0.44836524", "0.44818762", "0.44724318", "0.44701704", "0.446703", "0.44644627", "0.4461403", "0.4459805", "0.4450541", "0.4445572", "0.44454497", "0.44382182", "0.443613", "0.44321513", "0.44294402", "0.44125956", "0.44114834", "0.44098842", "0.4409003", "0.4406481", "0.43988693", "0.43905437", "0.4390371", "0.43888697", "0.43880114", "0.43871725", "0.4382352", "0.43726355", "0.43716466", "0.43713805", "0.43710864", "0.43708134", "0.43683562", "0.43665045", "0.4365103" ]
0.5629144
0
PUT /cc_statements/1 PUT /cc_statements/1.xml
def update @cc_statement = CcStatement.find(params[:id]) #we need the parent id to set next_sib params[:cc_statement][:cc_all_attributes][:next_sib] += "_" params[:cc_statement][:cc_all_attributes][:next_sib] += params[:cc_statement][:cc_all_attributes][:parent_id] respond_to do |format| if @cc_statement.update_attributes(params[:cc_statement]) format.html { redirect_to(@cc_statement, :notice => 'Statement component was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @cc_statement.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n @conseq = Conseq.find(params[:id])\n\n respond_to do |format|\n if @conseq.update_attributes(params[:conseq])\n format.html { redirect_to(@conseq, :notice => 'Conseq was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @conseq.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @statement = Statement.find(params[:id])\n\n respond_to do |format|\n if @statement.update_attributes(params[:statement])\n format.html { redirect_to @statement, notice: 'Statement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @statement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n with_error_handling do\n attrs = parsed_body(format: ctype)\n\n Lark::Transactions::UpdateAuthority\n .new(event_stream: event_stream, adapter: adapter)\n .call(id: params['id'], attributes: attrs)\n\n [204, cors_allow_header, []]\n end\n end", "def update\n @csosn = Csosn.find(params[:id])\n\n respond_to do |format|\n if @csosn.update_attributes(params[:csosn])\n format.html { redirect_to @csosn, notice: 'Csosn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @csosn.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ccl = Ccl.find(params[:id])\n\n respond_to do |format|\n if @ccl.update_attributes(params[:ccl])\n format.html { redirect_to(@ccl, :notice => 'Ccl was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ccl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def update\n @constraint = Constraint.find(params[:id])\n\n respond_to do |format|\n if @constraint.update_attributes(params[:constraint])\n format.html { redirect_to @constraint, notice: 'Constraint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @constraint.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n Neo4j::Transaction.run do\n @q_resource = QResource.find(params[:id])\n @q_resource.update_attributes!(params[:q_resource])\n respond_to do |format|\n if @q_resource.update_attributes(params[:q_resource])\n format.html { redirect_to @q_resource, :notice => 'Q resource was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @q_resource.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def update\n @condolence = Condolence.find(params[:id])\n\n respond_to do |format|\n if @condolence.update_attributes(params[:condolence])\n format.html { redirect_to @condolence, notice: 'Condolence was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @condolence.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @statement.update(statement_params)\n format.html { redirect_to @statement, notice: 'Statement was successfully updated.' }\n format.json { render :show, status: :ok, location: @statement }\n else\n format.html { render :edit }\n format.json { render json: @statement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n flash[:notice] = 'Contract was successfully updated.'\n format.html { redirect_to(@contract) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contract.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @statement.update(statement_params)\n format.html { redirect_to store_statements_url(@store), notice: 'Statement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @statement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to(\"/contractview\", :notice => 'Contract was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contract.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @constraint.update(constraint_params)\n format.html { redirect_to @constraint, notice: 'Constraint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @constraint.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end", "def update\n @cc_ifthenelse = CcIfthenelse.find(params[:id])\n\n #we need the parent id to set next_sib\n params[:cc_ifthenelse][:cc_all_attributes][:next_sib] += \"_\"\n params[:cc_ifthenelse][:cc_all_attributes][:next_sib] += params[:cc_ifthenelse][:cc_all_attributes][:parent_id] \n\n respond_to do |format|\n if @cc_ifthenelse.update_attributes(params[:cc_ifthenelse])\n format.html { redirect_to(@cc_ifthenelse, :notice => 'Ifthenelse component was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cc_ifthenelse.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @cc_question = CcQuestion.find(params[:id])\n\n #we need the parent id to set next_sib\n params[:cc_question][:cc_all_attributes][:next_sib] += \"_\"\n params[:cc_question][:cc_all_attributes][:next_sib] += params[:cc_question][:cc_all_attributes][:parent_id] \n\n respond_to do |format|\n if @cc_question.update_attributes(params[:cc_question])\n format.html { redirect_to(@cc_question, :notice => 'Question component was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cc_question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end", "def update\n @cash_transaction = CashTransaction.find(params[:id])\n\n respond_to do |format|\n if @cash_transaction.update_attributes(params[:cash_transaction])\n format.html { redirect_to(@cash_transaction, :notice => 'Cash transaction was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cash_transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def make_put_request\n options = {\n use_ssl: true,\n cert: OpenSSL::X509::Certificate.new(@certificate),\n key: OpenSSL::PKey::RSA.new(@key),\n ca_file: @uw_ca_file,\n verify_mode: OpenSSL::SSL::VERIFY_PEER\n }\n Net::HTTP.start(@uri.host, @uri.port, options) do |http|\n request = Net::HTTP::Put.new(@uri.request_uri)\n request.body = @request_text\n @response = http.request(request)\n end\n puts \"Response is: #{get_response_code}\"\n puts \"Body is: #{@response.body}\"\n @response.body\n end", "def update\n @sentence = Sentence.find(params[:id])\n\n respond_to do |format|\n if @sentence.update_attributes(params[:sentence])\n format.html { redirect_to(@sentence, :notice => 'Sentence was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sentence.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @contract_doc_category = ContractDocCategory.find(params[:id])\n\n respond_to do |format|\n if @contract_doc_category.update_attributes(params[:contract_doc_category])\n format.html { redirect_to @contract_doc_category, notice: 'Contract doc category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract_doc_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @casualcomment = Casualcomment.find(params[:id])\n\n respond_to do |format|\n if @casualcomment.update_attributes(params[:casualcomment])\n format.html { redirect_to @casualcomment, notice: 'Casualcomment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @casualcomment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n fn = params[:id].gsub('DOTDOT','.').gsub('SLASHSLASH','/')\n File.open(fn,'w+') { |f| \n f.puts params[:content]\n }\n respond_to do |format|\n format.json { render json: { success: true} }\n end\n end", "def update\n @cerc = Cerc.find(params[:id])\n\n if @cerc.update_attributes(params[:cerc])\n head :no_content\n else\n render json: @cerc.errors, status: :unprocessable_entity\n end\n end", "def update\n head :forbidden\n\n #@action = Action.find(params[:id])\n\n #if @action.update_attributes(params[:action])\n # head :no_content\n # else\n # render json: @action.errors, status: :unprocessable_entity\n # end\n end", "def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end", "def update\n cb = Coin.retrieve_from_api(transaction_params[\"CB_apikey\"])\n cs = Coin.retrieve_from_api(transaction_params[\"CS_apikey\"])\n\n respond_to do |format|\n if @transaction.update_values(transaction_params.merge(wallet_id: current_user.wallet.id, CBought_id: cb, CSold_id: cs))\n format.html { redirect_to @transaction, notice: \"Transaction was successfully updated.\" }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.find(params[:id])\n\n respond_to do |format|\n if @absence_request.update_attributes(params[:absence_request])\n format.html { redirect_to(@absence_request, :notice => 'Absence request was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @absence_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @title = \"Update Operations\"\n @operation = Operation.find(params[:id])\n\n respond_to do |format|\n if @operation.update_attributes(params[:operation])\n flash[:notice] = 'Operation was successfully updated.'\n format.html { redirect_to(@operation) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @operation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @graph.update_attributes_from_request(update_params)\n head :no_content\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 @cst_icm = CstIcm.find(params[:id])\n\n respond_to do |format|\n if @cst_icm.update_attributes(params[:cst_icm])\n flash[:notice] = 'S.T. para Icm atualizada.'\n format.html { redirect_to(@cst_icm) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cst_icm.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # returning connection.put(element_path(prefix_options), to_xml, self.class.headers) do |response|\n returning connection.put(element_path(prefix_options), to_ssj, self.class.headers) do |response|\n load_attributes_from_response(response)\n end\n end", "def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end", "def test_update\n set = ResourceSet.new('SemanticExpression.new().spo(\\'<http://www.w3.org/2000/01/rdf-schema#Class>\\',\\'<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>\\',\\'<http://www.w3.org/2000/01/rdf-schema#Class>\\')') \n size = set.resources.size\n #create a new resourceset. Note that the expression must return more resource than the first one.\n #we will check the number of resources to verify whether the set was updated.\n post :update, :exp => 'SemanticExpression.new.union(:s,Namespace.lookup(:rdf,:type),:o)', :id => set.rsid\n assert @controller.resourceset.resources.size > size #assert that set was remove\n assert_response :success #assert that the request was executed successful\nend", "def update\n @colonoscopytest = Colonoscopytest.find(params[:id])\n\n respond_to do |format|\n if @colonoscopytest.update_attributes(params[:colonoscopytest])\n format.html { redirect_to(@colonoscopytest, :notice => 'Colonoscopytest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @colonoscopytest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @contract_template = ContractTemplate.find(params[:id])\n\n respond_to do |format|\n if @contract_template.update_attributes(params[:contract_template])\n format.html { redirect_to(@contract_template, :notice => 'ContractTemplate was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contract_template.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n params.permit!\n @security_case = SecurityCase.find(params[:id])\n\n respond_to do |format|\n if @security_case.update_attributes(params[:security_case])\n format.html { redirect_to(@security_case, :notice => 'Security case was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @security_case.errors, :status => :unprocessable_entity }\n end\n end\n end", "def _update(type, current_name, metadata={})\n type = type.to_s.camelize\n request :update do |soap|\n soap.body = {\n :metadata => {\n :current_name => current_name,\n :metadata => prepare(metadata),\n :attributes! => { :metadata => { 'xsi:type' => \"ins0:#{type}\" } }\n }\n }\n end\n end", "def edit_carbonXML(carbon_home,url_port,url_contextRoot,contextRoot) \n\tFile.open(File.join(carbon_home , 'conf','carbon.xml')) do |config_file|\n\t\t# Open the document and edit the port (carbon.xml)\n\t\tconfig = Document.new(config_file)\n\t\tif !url_port.eql? \"\"\n\t\t\tconfig.root.elements['ServerURL'].text = 'https://localhost:' + url_port + url_contextRoot + '/services/'\n\t\tend\t\t\n\t\t\tconfig.root.elements['WebContextRoot'].text = contextRoot\n\n\t\t# Write the result to a new file.\n\t\tformatter = REXML::Formatters::Default.new\n\t\tFile.open(File.join(carbon_home , 'conf','result_carbon.xml'), 'w') do |result|\n\n\t\tformatter.write(config, result)\n\t\tend\n\tend \n\tFile.delete(File.join(carbon_home , 'conf','carbon.xml'))\n\tFile.rename( File.join(carbon_home , 'conf','result_carbon.xml'),File.join(carbon_home , 'conf','carbon.xml') )\n\n\nend", "def update\n @concert = Concert.find(params[:id])\n\n respond_to do |format|\n if @concert.update_attributes(concert_params)\n format.html { redirect_to(@concert, :notice => 'Concert was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => 'edit' }\n format.xml { render :xml => @concert.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @lifecycle_phase = LifecyclePhase.find(params[:id])\n\n respond_to do |format|\n if @lifecycle_phase.update_attributes(params[:lifecycle_phase])\n flash[:notice] = 'Lifecycle Phase was successfully updated.'\n format.html { redirect_to(:controller => 'catalogs') }\n # format.xml { head :ok }\n else\n flash[:error] = error_html(@lifecycle_phase.errors)\n format.html { render :action => \"edit\" }\n #format.xml { render :xml => @lifecycle_phase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @rule = Rule.find(params[:id])\n\t@account = Account.find(params[:account_id])\n params[:rule][:pocket_id] = params[:prefix][:pocket_id]\n respond_to do |format|\n if params[:commit].eql?('Cancel') || @rule.update_attributes(params[:rule])\n format.html { redirect_to(account_rules_url(@account)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def put!\n request! :put\n end", "def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end", "def update\n @clique = Clique.find(params[:id])\n\n respond_to do |format|\n if @clique.update_attributes(params[:clique])\n flash[:notice] = 'Clique was successfully updated.'\n format.html { redirect_to(@clique) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @clique.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if singular_resource?\n entity = ConnecEntity.where(group_id: @group_id, entity_name: entities_key).first\n entity ||= ConnecEntity.create(group_id: @group_id, entity_name: entities_key)\n else\n entity = ConnecEntity.where(group_id: @group_id, entity_name: entities_key, uid: params[:id]).first\n end\n \n entity.document = (entity.document || {}).merge(params[entities_key])\n \n if entity\n if entity.save\n logger.info(\"INSPECT: #{entities_key} => #{process_entity(entity.reload).to_json}\")\n render json: { entities_key => process_entity(entity.reload) }\n else\n render json: { errors: process_errors(entity.errors.full_messages, 400, entity) }, status: :bad_request\n end\n else\n render json: { errors: process_errors([\"Resource not found\"], 404) }, status: :not_found\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n @scout_master = ScoutMaster.find(params[:id])\n\n respond_to do |format|\n if @scout_master.update_attributes(params[:scout_master])\n format.html { redirect_to(@scout_master, :notice => 'Scout master was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @scout_master.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @csrelation.update(csrelation_params)\n format.html { redirect_to @csrelation, notice: 'Csrelation was successfully updated.' }\n format.json { render :show, status: :ok, location: @csrelation }\n else\n format.html { render :edit }\n format.json { render json: @csrelation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transcendence.update(transcendence_params)\n format.html { redirect_to @transcendence, notice: 'Transcendence was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @transcendence.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_changeset(xml, changeset_id)\n xml_attr_rewrite(xml, \"changeset\", changeset_id)\n end", "def update\n @entity = Entity.find(params[:id])\n\n respond_to do |format|\n if @entity.update_attributes(params[:entity])\n format.html { redirect_to(session[:company_id].c, :notice => 'Entity was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.save!\n\n respond_to do |format|\n if @config_xml.update_attributes(params[:config_xml])\n flash[:notice] = 'ConfigXml was successfully updated.'\n format.html { redirect_to(@config_xml) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @config_xml.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def update\n respond_to do |format|\n if @contract_document.update(contract_document_params)\n format.html { redirect_to @contract_document, notice: 'Contract document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contract_document.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @crawl_request = CrawlRequest.find(params[:id])\n\n if @crawl_request.update_attributes(params[:crawl_request])\n head :no_content\n else\n render json: @crawl_request.errors, status: :unprocessable_entity\n end\n end", "def update\n @crawl_request = CrawlRequest.find(params[:id])\n\n if @crawl_request.update_attributes(params[:crawl_request])\n head :no_content\n else\n render json: @crawl_request.errors, status: :unprocessable_entity\n end\n end", "def save\n return if @content.nil?\n put_rest \"rules/#{@name}\", @content, :content_type => \"application/octet-stream\"\n end", "def update\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n if @cso.update_attributes(params[:cso])\n format.html { redirect_to @cso, notice: 'Cso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity } \n end\n end\n end", "def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end", "def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def update\n @server_ins_transaction = ServerInsTransaction.find(params[:id])\n\n respond_to do |format|\n if @server_ins_transaction.update_attributes(params[:server_ins_transaction])\n format.html { redirect_to @server_ins_transaction, notice: 'Server ins transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server_ins_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_axis2XML(carbon_home,http_port,https_port) \n\n\tFile.open(File.join(carbon_home , 'conf','axis2.xml')) do |config_file|\n\t\t# Open the document and edit the port (axis2.xml)\n\t\tconfig = Document.new(config_file)\n\t\t\n\t\tconfig.root.elements[25].elements[1].text=http_port\n\t\tconfig.root.elements[26].elements[1].text=https_port\n\t\n\t\t\n\t\t# Write the result to a new file.\n\t\tformatter = REXML::Formatters::Default.new\n\t\tFile.open(File.join(carbon_home , 'conf','result_axis2.xml'), 'w') do |result|\n\t\tformatter.write(config, result)\n\t\tend\n\tend \n\tFile.delete(File.join(carbon_home , 'conf','axis2.xml'))\n\tFile.rename( File.join(carbon_home , 'conf','result_axis2.xml'),File.join(carbon_home , 'conf','axis2.xml') )\n\nend", "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) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n concept = params[:concept] || \"\"\n type = params[:type] || \"\"\n note = params[:note] || \"\"\n no_update_note = params[:no_update_note] \n review_result = (params[:review_result] || 1).to_i\n type.strip!\n concept = @document.project.normalize_concept_id(concept, type)\n @error = nil \n if @project.collaborate_round?\n annotator = @document.assigns.map{|a| a.user.email_or_name}.uniq.sort.join(',')\n else\n annotator = current_user.email_or_name\n end\n \n Document.transaction do \n if (params[:mode] == \"true\" || params[:mode] == \"1\" || params[:mode] == \"concept\")\n logger.debug(\"update_concept\")\n\n if @assign.present? \n targets = Annotation.execute_sql(\"\n SELECT id FROM annotations \n WHERE assign_id = ? AND version = ? AND concept = ? AND a_type = ?\n \", @assign.id, @annotation.version, @annotation.concept, @annotation.a_type)\n elsif @project.manager?(current_user) || @project.collaborate_round\n targets = Annotation.execute_sql(\"\n SELECT id FROM annotations \n WHERE document_id = ? AND version = ? AND concept = ? AND a_type = ?\n \", @document.id, @annotation.version, @annotation.concept, @annotation.a_type)\n end\n\n @ids = targets.map{|e| e[0]}\n\n # @document.update_concept(@current_user.email, params[:id], @type, @concept, @note, @no_update_note)\n set_sql = \"concept=?, a_type=?\"\n values = [concept, type]\n set_sql = set_sql + \", review_result=? \"\n values << review_result\n\n if no_update_note.blank? || no_update_note == false\n set_sql = set_sql + \",note=? \"\n values << note\n end \n sql = \"UPDATE annotations\n SET #{set_sql}, annotator=?, updated_at=? \n WHERE \"\n values << annotator\n values << Time.now\n if @assign.present? \n sql = sql + \" assign_id = ? and version = ? \"\n values << @annotation.assign_id\n values << @annotation.version\n elsif @project.manager?(current_user) || @project.collaborate_round\n sql = sql + \" document_id = ? and version = ? \"\n values << @document.id\n values << @annotation.version\n end\n sql = sql + \" AND concept = ? AND a_type = ?\"\n values << @annotation.concept\n values << @annotation.a_type\n\n args = [sql] + values\n ret = Annotation.execute_sql(*args)\n else\n logger.debug(\"update_mention\")\n @annotation.concept = concept\n @annotation.a_type = type\n @annotation.note = note if no_update_note.blank? || no_update_note == false\n @annotation.annotator = annotator\n @annotation.review_result = review_result\n if !@annotation.save\n @error = @annotation.errors\n end\n @ids = [@annotation.id]\n end\n\n if @error.blank? && params[:annotate_all] == \"all\"\n text = (params[:text] || \"\").strip\n case_sensitive = (params[:case_sensitive] == \"y\")\n whole_word = (params[:whole_word] == \"y\")\n result = @document.annotate_all_by_text_into_db(@assign, current_user, annotator, text, type, concept, case_sensitive, whole_word, review_result, note)\n @ids += result\n end\n @annotations = Annotation.where(\"id in (?)\", @ids).all\n logger.debug(@ids.inspect)\n logger.debug(@annotations.inspect)\n @document.touch\n end\n respond_to do |format|\n if @error.blank?\n @document.create_audit(current_user, \"Update annotation\", params.to_json, @ids.join(\",\"))\n format.html { redirect_to @annotation, notice: 'The annotation was successfully updated.' }\n format.json { render :index, status: :ok, location: document_annotations_path(@document) }\n else\n format.html { render :edit }\n format.json { render json: @error, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sacco.update(sacco_params)\n format.html { redirect_to @sacco, notice: 'Sacco was successfully updated.' }\n format.json { render :show, status: :ok, location: @sacco }\n else\n format.html { render :edit }\n format.json { render json: @sacco.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cadd = Cadd.find(params[:id])\n\n respond_to do |format|\n if @cadd.update_attributes(params[:cadd])\n format.html { redirect_to(@cadd, :notice => 'Cadd was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cadd.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tx = Tx.find(params[:id])\n\n respond_to do |format|\n if @tx.update_attributes(params[:tx])\n format.html { redirect_to(@tx, :notice => 'Tx was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tx.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @xml_sample = XmlSample.find(params[:id])\n \n respond_to do |format|\n format.html do\n @xml_sample = XmlSample.update_attributes(params[:xml_sample])\n if @xml_sample.save\n return redirect_to @xml_sample, notice: 'Xml sample was successfully updated.'\n else\n return render action: \"new\"\n end\n end\n format.xml do\n rexml = REXML::Document.new(params[\"xml\"])\n attr = Hash.from_xml(rexml.to_s)\n if @xml_sample.update_attributes(attr[\"xmlsample\"])\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n else\n xml = {msg: \"failed\", status: \"NG\"}.to_xml\n end\n return render xml: xml\n end\n end\n end", "def 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 @ofx_transaction = OfxTransaction.find(params[:id])\n\n if @ofx_transaction.update(ofx_transaction_params)\n head :no_content\n else\n render json: @ofx_transaction.errors, status: :unprocessable_entity\n end\n end", "def destroy\n @cc_statement = CcStatement.find(params[:id])\n @cc_statement.destroy\n\n respond_to do |format|\n format.html { redirect_to(cc_statements_url) }\n format.xml { head :ok }\n end\n end", "def update\n respond_to do |format|\n if @caso.update_attributes(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @criteria = Criteria.find(params[:id])\n\n respond_to do |format|\n if @criteria.update_attributes(params[:criteria])\n flash[:notice] = 'criteria name was successfully updated.'\n format.html { redirect_to(:criterias) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @criteria.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def update\n @az_operation = AzOperation.find(params[:id])\n\n respond_to do |format|\n if @az_operation.update_attributes(params[:az_operation])\n flash[:notice] = 'AzOperation was successfully updated.'\n format.html { redirect_to(edit_az_operation_path(@az_operation)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @az_operation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @contratacion = Contratacion.find(params[:id])\n\n respond_to do |format|\n if @contratacion.update_attributes(params[:contratacion])\n flash[:notice] = 'Contratacion was successfully updated.'\n format.html { redirect_to(@contratacion) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contratacion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @command = Command.accessible_by(current_ability).find(params[:id])\n\n respond_to do |format|\n if @command.update_attributes(params[:command])\n format.xml { head :ok }\n else\n format.xml { render :xml => @command.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to @contract.lead, notice: 'Contract was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @centro = Centro.find(params[:id])\n\n respond_to do |format|\n if @centro.update_attributes(params[:centro])\n format.html { redirect_to(@centro, :notice => 'Centro atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @centro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # checks if user is authorized\n if authorise(request)\n # operation parameter tells what put operation should be done on vertex\n operation = params[:operation]\n case operation\n when 'connection'\n update_connection(params[:from_vertex_id], params[:to_vertex_id])\n when 'transformation'\n update_transformation(params[:id], params[:pos_x], params[:pos_y], params[:width],\n params[:height], params[:z_index])\n when 'attribute'\n update_attribute(params[:id], params[:name], params[:estimated_time], params[:clue],\n params[:description])\n else\n render json: { success: false, message: 'Operation does not exist' }, status: :bad_request\n end\n else\n render json: { success: false, message: 'Unauthorized' }, status: 401\n end\n end", "def put(*args)\n request :put, *args\n end", "def update\n respond_to do |wants|\n if @definition.update_attributes(params[:definition])\n flash[:notice] = 'Definition was successfully updated.'\n wants.html { redirect_to(@definition) }\n wants.xml { head :ok }\n else\n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @definition.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n \n\t\t# logger.debug \"Hello\"\n # logger.debug params.to_yaml\n # logger.debug \"Hello\"\n # logger.debug params[\"company\"][\"code\"].upcase!\n # params[\"company\"[\"code\"]].to_upper!\n code_to_upper(params)\n \n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to(@company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @node_rack = @object\n\n respond_to do |format|\n if @node_rack.update_attributes(params[:node_rack])\n flash[:notice] = 'NodeRack was successfully updated.'\n format.html { redirect_to node_rack_url(@node_rack) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node_rack.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end", "def commit(action, xml)\n headers = { 'Content-Type' => 'application/x-qbmsxml',\n 'Content-length' => xml.size.to_s }\n \n # Post to server\n url = get_post_url\n @request = xml\n data = ssl_post(url, xml, headers)\n \n response = parse(action, data)\n message = message_from(response)\n \n # Post Processing - Create the Response object\n case action\n \n when 'session_ticket'\n @response = Response.new(success?(response), message, response, \n :test => test?,\n :authorization => response[:session_ticket]\n )\n @response\n \n else\n @response = Response.new(success?(response), message, response, \n :test => test?,\n :authorization => response[:transaction_id],\n :cvv_result => cvv_result(response),\n :avs_result => avs_result(response)\n ) \n end\n end", "def update\n @node = Node.scopied.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end", "def commit(xml)\n url = (test? ? test_url : live_url)\n\n response = parse(ssl_post(url, post_data(xml), 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'))\n\n Response.new(\n success_from(response),\n message_from(response),\n response,\n authorization: authorization_from(response),\n test: test?,\n error_code: error_code_from(response)\n )\n end", "def update\n # @contract = Contract.find(cfile_params[:contract_id])\n\n puts cfile_params.inspect\n \n # respond_to do |format|\n # if \n @cfile.update(cfile_params)\n puts @cfile.errors.full_messages\n \n # format.html { render \"contracts/show\", notice: 'Cfile was successfully updated.' }\n # format.json { render :show, status: :ok, location: @cfile }\n # else\n # format.html { render \"contracts/show\" }\n # format.json { render json: @cfile.errors, status: :unprocessable_entity }\n # end\n # end\n end" ]
[ "0.59867", "0.57625973", "0.5627057", "0.55521697", "0.55391717", "0.5527649", "0.54677486", "0.5454499", "0.5450926", "0.54061204", "0.5397487", "0.53304625", "0.5282188", "0.5259503", "0.51997775", "0.5170253", "0.5165421", "0.5160235", "0.5158506", "0.5150662", "0.5147112", "0.51466626", "0.514566", "0.51359683", "0.51243466", "0.51180536", "0.5113034", "0.5084979", "0.5082978", "0.50730544", "0.50596464", "0.5049807", "0.50462085", "0.5031925", "0.5030299", "0.5029772", "0.50295675", "0.50270456", "0.50200635", "0.5009246", "0.50077844", "0.5007109", "0.49986938", "0.4997157", "0.49820483", "0.49809977", "0.4974767", "0.49720785", "0.49702203", "0.49684557", "0.4966177", "0.49645984", "0.49628899", "0.49589616", "0.49581444", "0.495263", "0.4949266", "0.49456382", "0.49405152", "0.49320954", "0.49260724", "0.49237445", "0.49143723", "0.4909071", "0.49086323", "0.49086323", "0.49054545", "0.4903921", "0.4902253", "0.49018252", "0.49005005", "0.48996964", "0.4893004", "0.48902565", "0.48902273", "0.488952", "0.48858172", "0.4880271", "0.48731837", "0.48713973", "0.4871381", "0.48701927", "0.48679397", "0.4865276", "0.4864112", "0.48639134", "0.48638332", "0.48614898", "0.48613745", "0.48607746", "0.485956", "0.48534453", "0.48506725", "0.4849483", "0.48469758", "0.48446715", "0.48433787", "0.48414162", "0.483777", "0.4836538" ]
0.62415546
0
DELETE /cc_statements/1 DELETE /cc_statements/1.xml
def destroy @cc_statement = CcStatement.find(params[:id]) @cc_statement.destroy respond_to do |format| format.html { redirect_to(cc_statements_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def test_set3_06b_delete_res_object()\n user = \"test_user\"\n priv = \"test_privilege\"\n res_ob_type = \"test\"\n res_ob_adr = \"/db/temporary/testsource\"\n \n @test_acl.create_principal(user)\n @test_acl.create_resource_object(res_ob_type, res_ob_adr, user)\n id = @test_acl.create_ace(user, \"allow\", priv, res_ob_type, res_ob_adr)\n \n @test_acl.delete_res_object(res_ob_type, res_ob_adr)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def destroy\n @conseq = Conseq.find(params[:id])\n @conseq.destroy\n\n respond_to do |format|\n format.html { redirect_to(conseqs_url) }\n format.xml { head :ok }\n end\n end", "def test_set3_04c_delete_principal()\n user = \"test_user\"\n @test_acl.create_principal(user)\n id = @test_acl.create_ace(user, \"allow\", \"SELECT\", \"test\", \"/db/temporary/testsource\")\n \n @test_acl.delete_principal(user)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def test_set3_04b_delete_group()\n group = \"test_group\"\n user = \"test_user\"\n \n @test_acl.create_principal(user)\n @test_acl.create_group(group, [\"ALL\"], [user])\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n #puts query\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(1, hits)\n \n @test_acl.delete_principal(group)\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def delete!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 45 )\n\n type = DELETE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 166:10: 'delete'\n match( \"delete\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 45 )\n\n end", "def destroy\n @statement = Statement.find(params[:id])\n @statement.destroy\n\n respond_to do |format|\n format.html { redirect_to statements_url }\n format.json { head :no_content }\n end\n end", "def delete()\n sql = \"DELETE FROM transactions\n WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\nend", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def delete_statements!(options={}, safety=true)\n\n unless !safety || options.keys.select {|x| [:subj, :pred, :obj].include?(x) }.size > 0\n raise Exception.new(\"You asked to delete all statements in the repository. Either give a subj/pred/obj qualifier, or set safety=false\")\n end\n\n # We have to use net/http, because curb has not yet implemented DELETE as of this writing.\n\n uri = URI.parse(self.uri + \"/statements?\" + self.class.get_parameterize(options.reject{|k,v|\n ![:subj, :pred, :obj, :context, :infer].include?(k)\n }))\n http = Net::HTTP.start(uri.host, uri.port)\n http.delete(uri.path)\n raise(SesameException.new(easy.body_str)) unless easy.response_code == 204\n end", "def delete\n binding.pry\n DATABASE.execute(\"DELETE FROM contents WHERE id = #{id}\")\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @concert = Concert.find(params[:id])\n @concert.destroy\n\n respond_to do |format|\n format.html { redirect_to(concerts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ccl = Ccl.find(params[:id])\n @ccl.destroy\n\n respond_to do |format|\n format.html { redirect_to(ccls_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @colonoscopytest = Colonoscopytest.find(params[:id])\n @colonoscopytest.destroy\n\n respond_to do |format|\n format.html { redirect_to(colonoscopytests_url) }\n format.xml { head :ok }\n end\n end", "def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "def delete(sql, name = nil) end", "def delete *args, &block\n res = @conn.delete *args, &block\n handle res, parse: false\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def destroy\n @ofx_transaction.destroy\n\n head :no_content\n end", "def destroy\n @concert = Concert.find(params[:id])\n @concert.destroy\n\n respond_to do |format|\n format.html { redirect_to(concerts_url, :notice=> 'Concert was deleted.') }\n format.xml { head :ok }\n end\n end", "def destroy\n @statement.destroy\n respond_to do |format|\n format.html { redirect_to store_statements_url(@store) }\n format.json { head :no_content }\n end\n end", "def delete(connection)\n response = Hpricot.XML(connection.process(Document::Delete.new(self).xml))\n raise Exception, response.at('error').innerHTML if response.at('error')\n self.handle = nil\n self\n end", "def delete_all\n Neo.db.execute_query(\"#{initial_match} OPTIONAL MATCH (n0)-[r]-() DELETE n0,r\")\n end", "def destroy\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n @auto1h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto1h_fold_changes_url) }\n format.xml { head :ok }\n end\n end", "def clear_graph(graphname)\n update(\"WITH <#{graphname}> DELETE { ?s ?p ?o } WHERE { ?s ?p ?o .}\")\nend", "def destroy\n @cso = Cso.find(params[:id])\n @cso.destroy\n\n respond_to do |format|\n format.html { redirect_to(csos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cash_transaction = CashTransaction.find(params[:id])\n @cash_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to(cash_transactions_url) }\n format.xml { head :ok }\n end\n end", "def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def delete_file_from_database(file_id)\n $db.execute(\"DELETE FROM files WHERE id = ?\", file_id)\n $db.execute(\"DELETE FROM file_share_table WHERE file_id = ?\", file_id)\nend", "def destroy \n Link.connection.execute(\"delete from links where id in (#{params[:id].join(',')})\") unless params[:id].blank?\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cadd = Cadd.find(params[:id])\n @cadd.destroy\n\n respond_to do |format|\n format.html { redirect_to(cadds_url) }\n format.xml { head :ok }\n end\n end", "def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end", "def destroy\n Conshejointable.where(:contact_id =>@contact.id).delete_all\n Description.where(:contact_id =>@contact.id).delete_all\n puts @contact.id.to_s + \": \" + @contact.name\n @contact.delete\n respond_to do |format|\n format.html { redirect_to contacts_path, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(id)\r\n connection.delete(\"/#{@doctype}[@ino:id=#{id}]\")\r\n end", "def destroy\n @correspondence = Correspondence.find(params[:id])\n @correspondence.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondences_url) }\n format.xml { head :ok }\n end\n end", "def delete\n CONNECTION.execute(\"DELETE FROM links WHERE id = #{self.id};\")\n end", "def destroy\n @statement.destroy\n respond_to do |format|\n format.html { redirect_to statements_url, notice: 'Statement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(browsenodeids_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @statement.destroy\n respond_to do |format|\n format.html { redirect_to admin_statements_url, notice: 'Statement was successfully destroyed.' }\n\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @charge_transaction = ChargeTransaction.find(params[:id])\n @charge_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to charge_transactions_url }\n format.xml { head :ok }\n end\n end", "def delete_all(xpath); end", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "def delete()\n db = PG connect( {dbname: 'bounty_hunter',\n host: 'localhost'\n })\n sql = 'DELETE from bounty_hunter'\n db.prepare('delete_one', sql)\n db.exec_prepared('delete_one', value)\n db.close()\nend", "def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end", "def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def delete_all\n neo4j_query(\"MATCH (n:`#{mapped_label_name}`) OPTIONAL MATCH (n)-[r]-() DELETE n,r\")\n end", "def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend", "def delete_entry\n\t\t#delete product from cards\n\t\t\tstatement=@connection.prepare(\"delete from cards where card_no=?\")\n\t\t\tstatement.execute(@card_no)\n\t\t#delete product from inline_products\n\t\t\tstatement1=@connection.prepare(\"delete from inline_products where card_no=?\")\n\t\t\tstatement1.execute(@card_no)\n\tend", "def clean_neo4j\n neo_connection.execute_query(\"START n0=node(0),nx=node(*) MATCH n0-[r0?]-(),nx-[rx?]-() WHERE nx <> n0 DELETE r0,rx,nx\")\nend", "def delete(contactname)\n\n end", "def destroy\n @absence_request = AbsenceRequest.find(params[:id])\n @absence_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(absence_requests_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n sql = \"DELETE from customers WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n# => Deleting customer record, nothing to return\n end", "def delete_file_from_db(file_id)\n $db.execute(\"DELETE FROM files WHERE file_id = ?\", file_id)\nend", "def delete\n DB.exec(\"DELETE FROM line WHERE id = #{self.id};\")\n end", "def delete(name)\n @ctx.delete(@path + name)\n end", "def destroy\n @user_testcase_xref = UserTestcaseXref.find(params[:id])\n @user_testcase_xref.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_testcase_xrefs_url) }\n format.xml { head :ok }\n end\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def delete\n \n end", "def destroy\n logger.debug 'destroy_some interesting information'\n @comdty = Comdty.find(params[:id])\n @comdty.destroy\n\n respond_to do |format|\n format.html { redirect_to(comdties_url) }\n format.xml { head :ok }\n end\n end", "def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend", "def delete_nsset(nsset)\n builder = build_epp_request do |xml|\n xml.command {\n xml.delete {\n xml.delete('xmlns:nsset' => XML_NS_NSSET, 'xsi:schemaLocation' => XML_NSSET_SCHEMALOC) {\n xml.parent.namespace = xml.parent.namespace_definitions.first\n xml['nsset'].id_ nsset\n }\n }\n xml.clTRID UUIDTools::UUID.timestamp_create.to_s\n }\n end\n \n NssetDeleteResponse.new(send_request(builder.to_xml))\n end", "def delete\n @options[:connection].delete(\"/namespaces/#{path}\") && true\n end", "def destroy\n @contract_doc_category = ContractDocCategory.find(params[:id])\n @contract_doc_category.destroy\n\n respond_to do |format|\n format.html { redirect_to contract_doc_categories_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityDocument( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/document\",params)\n end", "def delete_trust(xml) \n if current_user \n trust_root = xml.root.get_elements('TrustRoot').first.text \n unless trust_root.empty? \n @trust = current_user.trusts.find(:first, :conditions => ['trust_root = ?', trust_root]) \n if @trust \n @trust.destroy \n return render(:text => \"<Response>success</Response>\") \n end \n end \n end \n render :text => '<Response>trust root does not exist</Response>' \n end", "def delete(id)\n @conn.exec(\"DELETE FROM students WHERE id = '#{id}';\");\nend", "def destroy\n @contratacion = Contratacion.find(params[:id])\n @contratacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(contratacions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @charge_master = ChargeMaster.find(params[:id])\n @charge_master.destroy\n\n respond_to do |format|\n format.html { redirect_to(charge_masters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @mode = params[:deleteMode]\n type = params[:type] || \"\"\n concept = params[:concept] || \"\"\n type.strip!\n concept.strip!\n\n Document.transaction do \n if @mode == \"batch\"\n @ids = params[:ids]\n if @document.has_reference_relation?(@ids)\n return render json: 'Cannot delete annotation because there is a relation that refers to this node' , status: 422 \n end\n ret = Annotation.execute_sql(\"DELETE FROM annotations WHERE id in (?)\", @ids)\n elsif @mode == \"concept\"\n if @assign.present?\n targets = Annotation.execute_sql(\"\n SELECT id FROM annotations \n WHERE assign_id = ? AND version = ? AND concept = ? AND a_type = ?\n \", @assign.id, @annotation.version, @annotation.concept, @annotation.a_type)\n elsif @project.manager?(current_user) || @project.collaborate_round\n targets = Annotation.execute_sql(\"\n SELECT id FROM annotations \n WHERE document_id = ? AND version = ? AND concept = ? AND a_type = ?\n \", @document.id, @annotation.version, @annotation.concept, @annotation.a_type)\n end\n @ids = targets.map{|e| e[0]}\n if @document.has_reference_relation?(@ids)\n return render json: 'Cannot delete annotation because there is a relation that refers to this node' , status: 422 \n end\n ret = Annotation.execute_sql(\"DELETE FROM annotations WHERE id in (?)\", @ids)\n elsif @mode == \"mention\"\n if @document.has_reference_relation?([@annotation.id])\n return render json: 'Cannot delete annotation because there is a relation that refers to this node' , status: 422 \n end\n @ids = [@annotation.id]\n @annotation.destroy\n end\n @document.touch\n end\n @document.create_audit(current_user, \"Delete annotation\", params.to_json, @ids.join(\",\"))\n\n # @annotation.destroy\n respond_to do |format|\n format.html { redirect_to @document, notice: 'The annotation was successfully deleted.' }\n format.json { render json: @ids, status: :ok }\n end\n end", "def destroy\n @tx = Tx.find(params[:id])\n @tx.destroy\n\n respond_to do |format|\n format.html { redirect_to(txes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cg_tn_cn = CgTnCn.find(params[:id])\n @cg_tn_cn.destroy\n\n respond_to do |format|\n format.html { redirect_to(cg_tn_cns_url) }\n format.xml { head :ok }\n end\n end", "def delete(id)\n @conn.exec(\"DELETE FROM students WHERE id = '#{id}';\")\nend", "def destroy\n\n @cita = Cita.find(params[:id])\n paciente_id=@cita.paciente_id\n Operation.delete_all \"cita_id = #{@cita.id}\"\n consulta=Consulta.find_by_cita_id(params[:id])\n consulta.update_attributes(:cita_id => nil)\n @cita.destroy\n \n respond_to do |format|\n format.html { redirect_to :controller => \"lab\",:action => \"crea_cita\",:id => paciente_id,:id_cons => consulta.id }\n format.xml { head :ok }\n end\n end", "def delete_symptom(db, id)\n $db.execute( <<-SQL\n DELETE FROM symptoms\n WHERE id=\"#{id}\";\n SQL\n )\nend", "def report_delete(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id } \r\n\t\tdocxml=nessus_request('report/delete', post)\r\n\t\treturn docxml\r\n\tend", "def destroy\n #@rule = Rule.find(params[:id])\n @rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(rules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def delete(id)\n @conn.exec(\"DELETE FROM students WHERE id = '#{id}'\")\nend", "def delete_by_query query, opts = {}\n update opts.merge(:data => xml.delete_by_query(query))\n end", "def destroy\n @clique = Clique.find(params[:id])\n @clique.destroy\n\n respond_to do |format|\n format.html { redirect_to(cliques_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bank_reconciliations = AccountingBankReconciliations.find(params[:id])\n @bank_reconciliations.destroy\n\n respond_to do |format|\n format.html { redirect_to(accounting_bank_reconciliations_url) }\n format.xml { head :ok }\n end\n end", "def remove\n valid = parse_valid(params)\n # puts valid\n choose = $db.search(\"//book[\"+valid+\"]\").remove\n size = 0\n for i in choose\n size += 1\n end\n $file = open PATH, \"w\"\n $file.write $db\n $file.close\n render :soap => \"<result>\"+size.to_s+\"</result>\"\n end", "def destroy\n client = Connection::MarkLogic.new.client\n client.send_corona_request(\"/v1/documents?uri=/amandments/amandment_#{@amandment.id}.xml\", :delete)\n @amandment.destroy\n respond_to do |format|\n format.html { redirect_to home_meeting_path, notice: 'Amandman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @centru = Centru.find(params[:id])\n @centru.destroy\n\n respond_to do |format|\n format.html { redirect_to(centrus_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @deposit_threshold = DepositThreshold.find(params[:id])\n @deposit_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(deposit_thresholds_url) }\n format.xml { head :ok }\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def delete\n ruta = \"/actions/#{action_id}\"\n client.delete(ruta)\n end", "def destroy\n @cp_change.destroy\n\n head :no_content\n end", "def destroy\n @xml_sample = XmlSample.find(params[:id])\n @xml_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to xml_samples_url }\n format.xml do\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n return render xml: xml\n end\n end\n end" ]
[ "0.662174", "0.6168364", "0.6022061", "0.6020586", "0.6015052", "0.5917231", "0.5910602", "0.5893439", "0.58675194", "0.5865821", "0.58591783", "0.5834734", "0.58099306", "0.5794646", "0.5792098", "0.5773454", "0.57732546", "0.57552093", "0.5739053", "0.57134885", "0.57123095", "0.56908417", "0.5688533", "0.5682635", "0.5673943", "0.5670554", "0.5663609", "0.5663415", "0.56600934", "0.56539106", "0.5636387", "0.5633756", "0.5624549", "0.5619071", "0.56067055", "0.5601701", "0.5588272", "0.55782473", "0.5577288", "0.5575521", "0.55754787", "0.5569236", "0.5567769", "0.55671346", "0.5565354", "0.5562248", "0.55615824", "0.5556212", "0.5555639", "0.5555639", "0.555157", "0.55450207", "0.5541212", "0.55370975", "0.5536453", "0.5530753", "0.55222535", "0.5520256", "0.5516842", "0.55156857", "0.5514517", "0.5513894", "0.5511154", "0.55111146", "0.5495779", "0.5493827", "0.54935884", "0.54935086", "0.54904914", "0.54875946", "0.5481763", "0.54764426", "0.54716945", "0.5471348", "0.54711205", "0.54701376", "0.54655504", "0.5464393", "0.54624665", "0.54617965", "0.5461082", "0.54595524", "0.54588765", "0.54544854", "0.54512227", "0.5450607", "0.5449144", "0.54460883", "0.5444044", "0.5443342", "0.5438724", "0.54355985", "0.54350954", "0.54333615", "0.54322755", "0.54320973", "0.5430659", "0.5430406", "0.5426973", "0.5426471" ]
0.70043576
0
return the name for DocumentFragment
def name '#document-fragment' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodeName\n \"#document-fragment\"\n end", "def name\n 'document'\n end", "def name\n \"document\"\n end", "def nodeName\n \"#document\"\n end", "def identify doc = @doc\n doc.elements.first.name.to_sym\n end", "def element_name() @stag.element_name end", "def name\n @name ||= section.symstr.name_at(header.st_name)\n end", "def first_node_name\n first_child = @fragment.children.first\n (first_child && first_child.respond_to?(:name)) ? first_child.name : nil\n end", "def name\n @content[pn(:Name)]\n end", "def name\n @name ||= to_s.split(\"#\").last.delete(\">\")\n end", "def name\n node.name\n end", "def name\n node.name\n end", "def name(force_refresh = false)\n if @name && !force_refresh\n @name\n else\n @name = document.at('h1').text.strip rescue nil\n end\n end", "def docname(doctype)\n \"#{self.class.class_prefix(self.class)}:#{self.app_id}:#{self.doc_suffix(doctype)}\"\n end", "def get_document_id()\n return @doc_name #Remember, name = id in xmldb API\n end", "def get_id()\n return @doc_name\n end", "def name\n @changed_values[:name] || @document.root.attributes[\"refObjectName\"]\n end", "def name(vertex)\n vertex.is_a?(::Oga::XML::Element) ? vertex.name : nil\n end", "def get_name(node)\n node.content.titleize.gsub('/', ' / ').squish unless node.nil? || node.content.nil?\n end", "def name()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.Segment_name(@handle.ptr)\n result\n end", "def tagname\n @node[0].gsub(/[^a-zA-Z]/, \"\")\n end", "def name\n @name ||= @node['name']\n end", "def name\n return @discovery_document['name']\n end", "def name\n\t\tself.content\n\tend", "def name\n @name || Vedeu.focus\n end", "def cache_fragment_name(name = T.unsafe(nil), skip_digest: T.unsafe(nil), digest_path: T.unsafe(nil)); end", "def nodeType\n DOCUMENT_FRAGMENT_NODE\n end", "def name\n @name ||= @node['name']\n end", "def root_name\n return unless document.root\n\n document.root.name\n end", "def get_page_name\n # TODO: Get from content.\n @name.match(/.*?-(.+)\\./)[1]\n end", "def child_name name\n if name =~ /^:+/\n $' #'\n elsif RDoc::TopLevel === self then\n name\n else\n \"#{self.full_name}::#{name}\"\n end\n end", "def name\n self.text =~ /^(.*)$/\n return $1\n end", "def document_partial_name(document)\n document[Blacklight.config[:show][:display_type]]\n end", "def name\n tag['name'].gsub(/\\[\\]$/, '')\n end", "def name\n @elements[:name]\n end", "def name\n _name = nil\n self.tags.each do |x|\n if x.tkey == \"name\"\n _name = x.tvalue\n end\n end\n _name\n end", "def document_partial_name(document)\n display_type = document[blacklight_config.show.display_type]\n\n return 'default' unless display_type \n\n Array(display_type).first.gsub(/^[^\\/]+\\/[^:]+:/,\"\").gsub(/\\./, '_').underscore\n end", "def element_name; end", "def reference_name\n name + (section && \"(#{section})\").to_s\n end", "def name\n definition[:name]\n end", "def tag_name\n @tag_name ||= name && name.to_s.split(\"::\")[-1].downcase\n end", "def name\n @name ||= doc.search('.moviename-big').text\n end", "def name\n return text_get(0, id)\n end", "def fragment_of_variable_or_method_name(name)\n \t_IDENTIFIER14 = nil\n\n\n\n\n # 269:7: '.' IDENTIFIER\n match(:DOT)\n _IDENTIFIER14 = @input.look_ahead(1)\n match(:IDENTIFIER)\n name << \".#{_IDENTIFIER14.text}\"\n\n\n\n end", "def name\n definition.name\n end", "def tagname\n @tagname.id2name\n end", "def name\n tag.name\n end", "def element_name\n @element_name ||= Utils.string_underscore(Utils.string_demodulize(name))\n end", "def xml_full_name(name, context_el)\n if name.start_with? '#'\n name = context_el.namespaces[\"xmlns\"] + name\n name.gsub!('##', '#') # remove '##' if ns also ends in '#'\n end\n name\n end", "def tag_name\n return @tag_name\n end", "def standard_document_name\n object.standard_document ? object.standard_document.name : nil\n end", "def get_tag_name(element)\n element.tag_name\n end", "def elem_name\n elem_name = self.class.to_s.split('::').last.gsub(/([a-z])([A-Z])/, '\\1_\\2').downcase\n end", "def element_name\n adapter.element_name\n end", "def name(element)\n get(element)[:name]\n end", "def name\n [self[:namespace], self[:short_name]].reject(&:blank?).join(Tag.namespace_separator)\n end", "def name\n return @name unless @name.nil?\n io = _parent.strings._io\n _pos = io.pos\n io.seek(ofs_name)\n @name = (io.read_bytes_term(0, false, true, true)).force_encoding(\"UTF-8\")\n io.seek(_pos)\n @name\n end", "def _xml_name()\n if name = self.sfa_class\n return name\n end\n self.class.name.gsub('::', '_')\n end", "def page_name\n # return the name if name starts with a digit\n return name if name =~ /^\\s*\\d+.*$/ || !sg_parent\n pos = 0\n sg_parent.pages.each_with_index do |p, i|\n if self.id == p.id\n pos = i + 1\n break\n end\n end\n \"#{pos} #{name}\"\n end", "def name\n chunk_name = nil\n File.open(@file_name) do |file|\n file.seek(@offset, IO::SEEK_CUR)\n chunk_name = file.read(4)\n end\n puts \"[WARNING] - Doesn't look like a valid chunk name: #{chunk_name}\" if @warnings && !(chunk_name =~ /^[\\w ]{4}$/)\n chunk_name\n end", "def tag\n `#{@el}.tagName`.downcase\n end", "def tag\n `#{@el}.tagName`.downcase\n end", "def tag_name; end", "def tag_name; end", "def tag_name; end", "def full_name\n m = self.module\n RDoc::ClassModule === m ? m.full_name : @name\n end", "def text_name\n if target\n if target.respond_to?(:real_text_name)\n target.real_text_name\n else\n target.text_name\n end\n else\n orphan_title.t.html_to_ascii.sub(/ (\\d+)$/, \"\")\n end\n end", "def text_name\n if target\n if target.respond_to?(:real_text_name)\n target.real_text_name\n else\n target.text_name\n end\n else\n orphan_title.t.html_to_ascii.sub(/ (\\d+)$/, \"\")\n end\n end", "def tagName\n ''\n end", "def id_fragment\n return ActiveSupport::Inflector.demodulize(self.class.name)\n end", "def post_name\n POSITION[self.position.to_s]\n end", "def post_name\n POSITION[self.position.to_s]\n end", "def name\n text_get(6, @id)\n end", "def name\n name_ppointer = FFI::MemoryPointer.new :pointer, 1\n len_pointer = FFI::MemoryPointer.new :int, 1 \n name_type_pointer = FFI::MemoryPointer.new :int, 1 \n XDo::FFILib.xdo_get_window_name @_xdo_pointer, @_window, name_ppointer,\n len_pointer, name_type_pointer\n name_pointer = name_ppointer.read_pointer\n name_pointer.nil? ? nil : name_pointer.read_string(len_pointer.read_int)\n end", "def get_node_name(node)\n begin\n node.name\n rescue NoMethodError\n node.to_s\n end\n end", "def components_schema_name(_doc, _path_component, _tag_name, _verb, schema_name)\n schema_name\n end", "def tag_name\n self.class.name.downcase.match(/[^:]+$/)[0]\n end", "def name\n nodename = @nodes_xml.at_css 'node_name'\n nodename.text\n end", "def name\n @name ||= parse_name(id.name)\n end", "def name\n\n tree[0]\n end", "def _tag_name\n @tag_name\n end", "def name\n @name || path_name\n end", "def name_document(name)\n Kamelopard::DocumentHolder.instance.current_document.name = name\n return Kamelopard::DocumentHolder.instance.current_document\n end", "def eventname\n query_root_node(\"gdacs:eventname/text()\", @@NAMESPACES)\n end", "def filename_for(diagram, name_option)\n base_name = diagram_base_name(diagram, name_option)\n if @diagram_base_names.include?(base_name)\n idx = 2\n idx += 1 while @diagram_base_names.include?(base_name + \" - #{idx}\")\n base_name += \" - #{idx}\"\n end\n base_name\n end", "def type_name\n \"_doc\"\n end", "def name\n attachment.name\n end", "def full_name\n self.name + ' ' + self.section\n end", "def getName()\n\t\t\treturn @_name\n\t\tend", "def name\n @name ||= elf.shstrtab.name_at(header.sh_name)\n end", "def node_name\n name = self.class.name.gsub(/^.*::/, '')\n name.gsub!(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2')\n name.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n name.downcase!\n name\n end", "def full_filename (for_file = model.document.file)\n for_file\n end", "def build_name(name)\n \"_design/#{name}\"\n end", "def qualified_name\n if @demangled\n # The 'demangled' attribute of the node for methods / functions is the \n # full signature, so cut that part out.\n @demangled.split(/\\(/)[0]\n else\n @parent ? \"#{@parent.qualified_name}::#{@name}\" : @name\n end\n end", "def _name\n @link['name']\n end", "def name\n revision_data[\"name\"]\n end", "def identifier_string\n name\n end", "def full_name\n @full_name ||= if RDoc::ClassModule === parent then\n \"#{parent.full_name}::#{@name}\"\n else\n @name\n end\n end", "def name\n name = nil\n if root?\n name = path.to_s\n else\n name = @path.basename.to_s\n end\n return name\n end" ]
[ "0.74869055", "0.657811", "0.6546116", "0.651247", "0.6367251", "0.63114816", "0.618698", "0.6081865", "0.60559905", "0.60472465", "0.6040165", "0.6040165", "0.5963048", "0.5959108", "0.5940602", "0.58966523", "0.58788687", "0.5871114", "0.58604616", "0.5835952", "0.583393", "0.58199596", "0.58191574", "0.58155733", "0.5795401", "0.57952887", "0.5770858", "0.5764463", "0.5757759", "0.5723395", "0.5705186", "0.56971294", "0.5682697", "0.5663552", "0.5661044", "0.56560194", "0.5640942", "0.56256884", "0.5607594", "0.5599026", "0.5585633", "0.55809397", "0.5578403", "0.55750185", "0.5572605", "0.55641747", "0.55544096", "0.5547638", "0.55418515", "0.5530464", "0.55301744", "0.5527212", "0.5523711", "0.55126643", "0.5509161", "0.5505654", "0.54822457", "0.5478511", "0.5465796", "0.54618484", "0.5461452", "0.5461452", "0.5439334", "0.5439334", "0.5439334", "0.54369736", "0.5436091", "0.54360807", "0.5430737", "0.5429302", "0.5428441", "0.5428441", "0.54269236", "0.54116493", "0.5400283", "0.53944385", "0.5390871", "0.5390788", "0.5383555", "0.5380006", "0.537519", "0.53707093", "0.53663486", "0.536596", "0.5363357", "0.5362689", "0.5354795", "0.5351543", "0.5339202", "0.5339091", "0.53266895", "0.53150797", "0.53125685", "0.5309987", "0.5306262", "0.5304305", "0.52961963", "0.5291034", "0.5283159" ]
0.75937766
1
Convert this DocumentFragment to a string
def to_s children.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_text\n @fragment.as_text\n end", "def to_s\n return @doc.to_s\n end", "def to_html\n output_options = Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML ^\n Nokogiri::XML::Node::SaveOptions::FORMAT\n @fragment.children.inject(\"\") do |out, child|\n out << child.serialize(:save_with => output_options, :encoding => 'UTF-8')\n end\n end", "def to_s\n @doc.to_s\n end", "def to_s\n ret = \"<?#{@value}?>\"\n ret << \"\\n\" if parentNode.nodeType == DOCUMENT_NODE\n ret\n end", "def to_s\n @node.content\n end", "def to_s\n document.xml? ? to_xml : to_html\n end", "def to_s\n if is_xhtml?\n @doc.to_xhtml(:encoding => nil)\n else\n @doc.to_html(:encoding => nil)\n end\n end", "def string\n @fragments.join(\" \")\n end", "def to_s\n return self.xml_header + self.xml_docs.join + self.xml_footer\n end", "def to_s # :nodoc:\n _current_node.content.strip\n end", "def to_str\n str = \"\"\n REXML::Formatters::Pretty.new(1).write(@xml,str)\n \n return str \n end", "def to_str\n str = \"\"\n REXML::Formatters::Pretty.new(1).write(@xml,str)\n\n return str \n end", "def to_s\n \"<#{tag_name}>#{content}</#{tag_name}>\"\n end", "def to_s\n @doc\n end", "def to_s\n @node.to_s\n end", "def to_s\n\t\t@node_string\n\tend", "def to_s\n content.to_s\n end", "def to_s\n content.to_s\n end", "def to_s(&blk)\n # The @__to_s variable is used as a cache. \n # If it's useful we should add a test for it. -ac\n return @__to_s if @__to_s\n render(&blk)\n @__to_s = @doc.to_s\n end", "def to_s\n \"#{tag} #{[@from.source, @to].quoteize.compact.flatten * \" \"}\"\n end", "def fragment string\n XML::DocumentFragment.parse(string)\n end", "def to_s\n PgQuery::Deparse.from ast\n end", "def to_s\n Utils::Escape::SafeString.new(@nodes.map(&:to_s).join(NEWLINE))\n end", "def to_s\n\t\treturn self.stringify_nodes( @output )\n\tend", "def to_s\n return @text\n end", "def to_s\n value = \"\"\n nodeValue.scan(/./um) do |c|\n code = c.unpack(\"U\")[0]\n if code == 9 || code == 10 || code == 13\n value << sprintf(\"&#x%X;\", code)\n elsif c == \"&\"\n value << \"&amp;\"\n elsif c == \"\\\"\"\n value << \"&quot;\"\n elsif c == \"<\"\n value << \"&lt;\"\n else\n value << c\n end\n end\n \"#{@name}=\\\"#{value}\\\"\"\n end", "def xml_str # :nodoc:\n @writer.string\n end", "def to_s\n @content.call(self)\n\n nil\n end", "def string\n element().to_s\n end", "def to_s\n return content unless node?\n props = properties || {}\n html = props.collect{ |key, value| '%s=\"%s\"' % [key, value] }\n attrs = \"\" \n attrs = (\" \" << html.join(\" \")) unless html.empty?\n \n if SELF_CLOSING_TAGS.include?(node)\n return \"\" unless attrs.strip.blank?\n \"<%s%s />\" % [node, attrs]\n else\n \"<%s%s>%s</%s>\" % [node, attrs, content, node]\n end\n end", "def to_s\n @content.to_s\n end", "def to_s\n result = ''\n\n # If the document starts with comments, we want to print those at the top.\n top_comments = @nodes.take_while { |node| node.is_a? CommentNode }\n top_comments.each do |comment|\n result += comment.to_s\n end\n\n # Vanity new lines ftw.\n result += \"\\n\"\n\n # Pop the top comments off the node list.\n top_comments.length.times do\n @nodes.shift\n end\n\n if @lightordark == :dark\n result += \"set background=dark\\n\\n\"\n else\n result += \"set background=light\\n\\n\"\n end\n\n result += \"highlight clear\\n\\n\"\n result += \"if exists('syntax_on')\\n\"\n result += \" syntax reset\\n\"\n result += \"endif\\n\\n\"\n result += \"let g:colors_name = '#{@name.to_s}'\\n\\n\"\n\n @nodes.each do |node|\n result += node.to_s\n end\n\n return result\n end", "def to_s\n $test_logger.log(\"to_s\")\n outp = \"ILV Hex = #{@ilv_hex_str}\\n\"\n formatter = REXML::Formatters::Pretty.new(2)\n formatter.compact = true\n formatter.write(@xml_ilv_node, outp)\n outp.to_s\n end", "def to_s\n @content.inspect\n end", "def to_s\n return self.xml\n end", "def to_s\n\t\t\"<Node:#{@e}>\"\n\tend", "def to_s\n text.to_s\n end", "def to_s\n if ((@p).equal?(-1))\n fill_buffer\n end\n buf = StringBuffer.new\n i = 0\n while i < @nodes.size\n t = @nodes.get(i)\n buf.append(\" \")\n buf.append(@adaptor.get_type(t))\n i += 1\n end\n return buf.to_s\n end", "def to_s\n @text\n end", "def to_s\n @text\n end", "def to_s\n @text\n end", "def to_s\n @content\n end", "def to_string\n contents\n end", "def to_s\n\t\t\treturn @buffer.to_s\n\t\tend", "def fragment string, encoding = nil\n HTML::DocumentFragment.parse string, encoding\n end", "def to_s\n body.to_s\n end", "def to_xml\n return @doc.to_s\n end", "def to_s\n \"<#{@name}\" + @attrs.sort.map{|k,v| \" #{k}='#{v.xml_attr_escape}'\"}.join +\n if @contents.size == 0\n \"/>\"\n else\n \">\" + @contents.map{|x| if x.is_a? String then x.xml_escape else x.to_s end}.join + \"</#{name}>\"\n end\n end", "def to_s\n text\n end", "def to_s\n \"id: #{self.object_id} start_node: #{start_node.id} end_node: #{end_node.id} type:#{@type}\"\n end", "def to_s\n to_buffer.to_s\n end", "def toEncodedString()\n s = \"<\" + @name.to_s\n key_count = 0\n @attrkeys.each do |key|\n s = s + \" \" + key.to_s + \"=\\\"\" + @attrvals[key_count].to_s + \"\\\"\"\n key_count = key_count + 1\n end\n s = s + \">\"\n @children.each do |child|\n unless(child.class.name.eql?(\"NaElement\"))\n abort(\"Unexpected reference found, expected NaElement not \" + child.class.name)\n end\n s = s + child.toEncodedString()\n end\n cont = @content.to_s\n cont = NaElement::escapeHTML(cont)\n s = s + cont\n s = s + \"</\" + @name.to_s + \">\"\n s\n end", "def get_content_string(options = nil)\n xml_str = ''\n get_content(options).each do |element|\n xml_str << element.to_s\n end\n xml_str\n end", "def text\n res = \"\"\n @contents.each{|c|\n if c.is_a? XML\n res << c.text\n elsif c.is_a? String\n res << c\n end # Ignore XML_PI/XML_Comment\n }\n res\n end", "def to_s\n @element ? DOM.to_s(@element) : \"(null handle)\"\n end", "def to_s\n Utils::Escape.html(@content)\n end", "def to_s\n @body.to_s\n end", "def to_s\n text\n end", "def to_s\n text\n end", "def to_s\n \"[#{@type}]#{@content}\"\n end", "def to_s\n text = \"\"\n text << self.header\n @body.each do |section|\n text << section\n end\n text << self.footer\n\n #return\n text\n end", "def to_s\n @vertices.to_s\n end", "def to_s\n contents.to_s\n end", "def to_s\n @xml\n end", "def to_s\n text\n end", "def body\n @document.to_s\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n to_text\n end", "def to_s\n nodes.map(&:to_s).join(';')\n end", "def to_s(ast)\n @file = ''\n process(ast)\n @file\n end", "def to_s\n @segment\n end", "def to_xml\n return to_s\n end", "def to_xml\n return to_s\n end", "def to_s\n # Update length of the stream.\n @content[pn(:Length)] = @stream.length\n # Convert to String.\n out = []\n out << \"#{@element_id} #{@revision} obj\"\n out << @content.to_s\n out << @stream.to_s\n out << \"endobj\"\n return out.join(LF)\n end", "def to_s\n source\n end", "def to_s\n source\n end", "def to_s\n \"#{@text}: #{@context}\"\n end", "def to_s(attributes = nil)\r\n assert_exists\r\n hash_properties = {\"text\"=>\"innerHTML\"}\r\n hash_properties.update(attributes) if attributes != nil\r\n r = super(hash_properties)\r\n #r = string_creator\r\n #r += span_div_string_creator\r\n return r.join(\"\\n\")\r\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def html\n @doc.to_s\n end", "def html\n @doc.to_s\n end", "def to_s\n @text\n end", "def to_s\n @text\n end", "def to_s\n NodePrinter.new(@root).to_s\n end", "def to_s\n object_identifier = \"#<#{self.class.to_s}:0x#{'%x' % (self.object_id << 1)}\\n\"\n close_object = \">\\n\"\n \n case self\n when RubyBBCode::BBTree\n object_identifier + \"Children: #{count_child_nodes}\\n\" + self.to_v + close_object\n when RubyBBCode::TagNode # when inspecting TagNodes, it's better not to show the tree display\n if self[:is_tag]\n object_identifier + \"Tag: #{self[:tag].to_s}, Children: #{count_child_nodes}\\n\" + close_object\n else\n object_identifier + '\"' + self[:text].to_s + \"\\\"\\n\" + close_object\n end\n end\n end", "def to_s(opts = {})\n if opts[:template]\n to_templated_s(opts)\n else\n @node_id[0..5].hexlify\n end\n end", "def as_html(serializer = nil)\n @fragment.as_html(serializer)\n end", "def to_s\n\t\tstr = \"\\n<\" + @type\n\t\t@attributes.each{ |key,value|\n\t\t\tstr += \" \" + key.to_s + \" = \" + value.to_s\n\t\t}\n\t\tif @type == 'text'\n\t\t\tstr += \"> \" + @content[0] + \" </\" + @type + \">\"\n\t\telse\n\t\t\tstr += \"> \"\n\t\t\t@content.each { |c|\n\t\t\t\tstr += c.to_s\n\t\t\t}\n\t\t\tstr += \"\\n</\" + @type + \">\"\n\t\tend\n\t\tstr\n\tend", "def to_s\n s = \"\"\n @nodes.each do |identifier, node|\n s += \"#{identifier} (#{node.contigs.join(\",\")}) => #{@edges[identifier]} \\n\"\n end\n s\n end", "def to_s\n @content\n end", "def to_s\n\t\t\t\t\t\tstr = @content\n\t\t\t\t\t\tstr.gsub!(/\\t/,' ')\n\t\t\t\t\t\t# rdoc syntax\n\t\t\t\t\t\tstr.gsub!(/^=head(\\d+)/) do\n \t\t\t\t\"=\" * $1.to_i\n \t\t\t\tend\n \t\t\t\tstr.gsub!(/=item\\s+/, '')\n \t\t\t\tstr.gsub!(/C<(.*?)>/, '<tt>\\1</tt>')\n \t\t\t\tstr.gsub!(/I<(.*?)>/, '<i>\\1</i>')\n \t\t\t\tstr.gsub!(/B<(.*?)>/, '<b>\\1</b>')\n\t\t\t\t\t\tstr.gsub!(/^=(over|back)[^\\n]*\\n/m, '')\n\n\t\t\t\t\t\t# yard syntax\n\t\t\t\t\t\t# convert first code block to example\n\t\t\t\t\t\tstr.gsub!(/\\A(\\s+)^(\\t| \\s*\\S)/, \"\\\\1@example\\n\\\\2\")\n\t\t\t\t\t\t# convert links\n \t\t\t\tstr.gsub!(/L<(.*?)>/) do |link|\n\t\t\t\t\t\t\tlink_and_ref = $1.split(/\\|/)\n\t\t\t\t\t\t\tthing = link_and_ref[0]\n\t\t\t\t\t\t\ttext = link_and_ref[1]\n\t\t\t\t\t\t\ttext ? \"{#{thing}|#{text}}\" : \"{#{thing}}\"\n\t\t\t\t\t\tend\n\t\t\t\t\t\tstr\n\t\t\t\t\tend", "def to_s()\n r = \"\"\n t = \"\"\n\n # the parent node\n case @type\n when Type::NONE then t = ''\n when Type::TEXT then t = 't'\n when Type::NUMBER then t = 'n'\n when Type::OPERATOR then t = 'o'\n end\n r << t << '(' << \"#{@value}\"\n\n # childs nodes\n \n if !empty()\n size = @childs.size\n for i in 0..size\n r << @childs[i].to_s()\n if i < size-1\n r << ' '\n end\n end\n end\n\n r << \")\"\n end", "def to_s\n \"#{tag} #{[@from.quoteize, @to.quoteize, @options].compact.flatten * \" \"}\"\n end", "def content(vertex)\n vertex.is_a?(::Oga::XML::Element) ? vertex.text : nil\n end" ]
[ "0.7040761", "0.6586485", "0.6585457", "0.65789", "0.6465131", "0.6439616", "0.642836", "0.6408994", "0.63858193", "0.6223103", "0.6211244", "0.6164128", "0.61508507", "0.6039766", "0.6024613", "0.5984041", "0.59819186", "0.5965711", "0.5940833", "0.59408134", "0.5932487", "0.59279627", "0.58672714", "0.58191556", "0.5802081", "0.58016247", "0.57763094", "0.576027", "0.5743197", "0.5730457", "0.5721197", "0.5693215", "0.5685506", "0.5684485", "0.56693625", "0.56659776", "0.56609964", "0.56442815", "0.56414765", "0.56337047", "0.56337047", "0.5599168", "0.55980784", "0.55964077", "0.5586551", "0.5572383", "0.55536187", "0.5552596", "0.5551014", "0.55420125", "0.5532547", "0.5530958", "0.5523334", "0.5520865", "0.5515775", "0.5515742", "0.5514367", "0.55129856", "0.55074006", "0.55074006", "0.5496565", "0.5491939", "0.5465713", "0.5433435", "0.54318255", "0.54304683", "0.5426404", "0.5399722", "0.5399722", "0.5399722", "0.5399722", "0.5398174", "0.5392725", "0.5391788", "0.5389392", "0.53622216", "0.53622216", "0.5361069", "0.5355942", "0.5355942", "0.5355327", "0.53456837", "0.53453493", "0.53453493", "0.53453493", "0.53453493", "0.5336081", "0.5336081", "0.5326491", "0.5326491", "0.53155947", "0.53101623", "0.52977157", "0.5294502", "0.529222", "0.52835345", "0.5281485", "0.52796865", "0.5274902", "0.5270142", "0.52686536" ]
0.0
-1
Convert this DocumentFragment to html See Nokogiri::XML::NodeSetto_html
def to_html *args children.to_html(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_html\n output_options = Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML ^\n Nokogiri::XML::Node::SaveOptions::FORMAT\n @fragment.children.inject(\"\") do |out, child|\n out << child.serialize(:save_with => output_options, :encoding => 'UTF-8')\n end\n end", "def to_html\n HtmlConversion.node_to_html(node)\n end", "def to_html\n @doc.at(\"body\").children.to_html(encoding: ENCODING).lstrip\n end", "def markup_manipulation(html_fragment)\n html_doc = Nokogiri::HTML html_fragment\n html_doc = link_manipulations html_doc\n html_doc = image_manipulations html_doc\n return html_doc.css('body').children.to_s\n end", "def purify_html\n doc= Nokogiri::XML::DocumentFragment.parse(self.to_s)\n doc.search(\".//strong\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h4\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h3\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h2\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h1\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n\n doc.search(\".//em\").each do |e|\n e.swap \"<i>#{e.inner_html}</i>\"\n end\n\n doc.search(\".//ul\").each do |e|\n e.swap \"#{e.inner_html}\"\n end\n doc.search(\".//ol\").each do |e|\n e.swap \"#{e.inner_html}\"\n end\n doc.search(\".//li\").each do |e|\n e.swap \"<p>#{e.inner_html}</p>\"\n end\n doc.search(\".//span\").each do |e|\n e.swap \"#{e.inner_html}\"\n end\n\n doc.to_xml(:encoding => \"UTF-8\").gsub(/\\n/,\" \").gsub(/\\s+/,\" \")\n end", "def as_html(serializer = nil)\n @fragment.as_html(serializer)\n end", "def html\r\n @rootNode.html_node()\r\n end", "def html\n node.inner_html\n end", "def inner_html=(node_or_tags); end", "def normalise_html(html)\n Nokogiri::HTML5.fragment(html).to_s\n end", "def fix!\n fragment = Nokogiri::HTML.fragment(self.html)\n fragment.to_html\n end", "def to_html_frag\n build(false)\n end", "def nice_html(indent=2)\n Nokogiri::HTML.fragment(self).to_xhtml(indent: indent)\n end", "def to_html\n self.load_page!\n self.parsed_page.to_xhtml indent: 3, indent_text: \" \"\n end", "def xml_to_html()\n @parser.parse()\n @exporter.html = @parser.html_output\n return @exporter.html\n end", "def htmlify_except(nodes)\n nodes.reduce(to_html) do |output, node|\n output.gsub(node.to_html, node.to_xhtml)\n end\n end", "def node_raw_html(node)\n node.to_s\n end", "def to_html_fragment\n to_markdown_slices.map do |tagged_markdown|\n tagged_markdown.to_html\n end.join(\"\\n\\n\")\n end", "def to_s\n if is_xhtml?\n @doc.to_xhtml(:encoding => nil)\n else\n @doc.to_html(:encoding => nil)\n end\n end", "def convert_to_xml(nokogiri_html)\n Nokogiri::XML(nokogiri_html.to_xhtml)\n end", "def to_s\n document.xml? ? to_xml : to_html\n end", "def to_xhtml()\n nil\n end", "def clean!(html)\n @whitelist_nodes = []\n fragment = Nokogiri::HTML::DocumentFragment.parse(html)\n clean_node!(fragment)\n @whitelist_nodes = []\n\n output_method_params = {:encoding => 'utf-8', :indent => 0}\n\n if @config[:output] == :xhtml\n output_method = fragment.method(:to_xhtml)\n output_method_params[:save_with] = Nokogiri::XML::Node::SaveOptions::AS_XHTML\n elsif @config[:output] == :html\n output_method = fragment.method(:to_html)\n else\n raise Error, \"unsupported output format: #{@config[:output]}\"\n end\n\n result = output_method.call(output_method_params)\n\n # Ensure that the result is always a UTF-8 string in Ruby 1.9, no matter\n # what. Nokogiri seems to return empty strings as ASCII for some reason.\n result.force_encoding('utf-8') if RUBY_VERSION >= '1.9'\n\n return result == html ? nil : html[0, html.length] = result\n end", "def normalise_html(html)\n Nokogiri::HTML5.fragment(html).to_s.gsub(\"\\n\", \"\")\n end", "def make_html\n @document.encoding = 'UTF-8'\n @best_candidate = nil\n end", "def fragment(tags)\n type = document.html? ? Nokogiri::HTML : Nokogiri::XML\n type::DocumentFragment.new(document, tags, self)\n end", "def to_xhtml(options = T.unsafe(nil)); end", "def to_xhtml(options = T.unsafe(nil)); end", "def createDocumentFragment\n ret = DocumentFragment.new\n ret.ownerDocument = self\n ret\n end", "def to_html\n writer = Writer.new(StringIO.new)\n \n bookmarks.each{|b| writer << b }\n writer.done\n \n writer.io.string\n end", "def to_dom\n end", "def to_xhtml *args\n children.to_xhtml(*args)\n end", "def replace_nodes\n doc.xpath(\".//text()\").each do |node|\n next if has_ancestor?(node, ignored_ancestor_tags)\n\n content = node.to_html\n html = yield content, node\n\n next if html == content || html.nil?\n if html.length == 0\n node.parent.remove\n else\n node.replace(html)\n end\n end\n end", "def normalize!\n data = read\n html = Nokogiri::XML.parse(data)\n html.encoding = 'utf-8'\n\n # Process the @DOM\n standardize_dom(html)\n remove_scripts(html)\n change_hrefs(html)\n\n write(html.to_s)\n end", "def trans_html\n @doc.to_html\n end", "def html\n @html ||= Nokogiri::HTML html_source, nil, HTML_ENCODING if html_source\n @html\n end", "def to_html_fragment(wrap_class = 'mp')\n frag_nodes = html.at('body').children\n out = frag_nodes.to_s.rstrip\n out = \"<div class='#{wrap_class}'>#{out}\\n</div>\" unless wrap_class.nil?\n out\n end", "def html\n @doc.to_s\n end", "def html\n @doc.to_s\n end", "def xml_to_html(tag)\n tag.children().each do |c|\n # Rename the attributes\n c.keys.each do |k|\n c[\"data-#{k}\"] = c.delete(k)\n end\n # Rename the tag and replace lb with br\n c['class'] = \"xml-tag #{c.name.gsub(':', '-')}\"\n # To avoid invalid void tags: Use \"br\" if \"lb\", otherwise \"span\"\n c.name = c.name == 'lb' ? \"br\" : \"span\"\n # Use recursion\n xml_to_html(c)\n end\n end", "def to_opml\n\t\tdoc = Nokogiri::XML::DocumentFragment.parse \"\"\n\t\tNokogiri::XML::Builder.with(doc) { |xml|\n\t\t\txml.outline(:title => self.title, :text => self.title) {\n\t\t\t\tself.feeds.each do |feed|\n\t\t\t\t\txml.__send__ :insert, feed.to_opml\n\t\t\t\tend\n\t\t\t}\n\t\t}\n\t\treturn doc\n\tend", "def fragment(&blk)\n @nodes << HtmlFragment.new(&blk)\n self\n end", "def safe_xhtml_sanitize(html, options = {})\n sanitized = xhtml_sanitize(html.purify)\n doc = Nokogiri::XML::Document.parse(\"<div xmlns='http://www.w3.org/1999/xhtml'>#{sanitized}</div>\", nil, (options[:encoding] || 'UTF-8'), 0)\n sanitized = doc.root.children.to_xml(:indent => (options[:indent] || 2), :save_with => 2 )\n rescue Nokogiri::XML::SyntaxError\n sanitized = sanitized.escapeHTML\n end", "def process_nodes(html_nodes, properties); end", "def fragment string, encoding = nil\n HTML::DocumentFragment.parse string, encoding\n end", "def to_html\n @page.to_html\n end", "def render\r\n if self.has_content?\r\n self.to_a.inject(''){|loop_str, i|\r\n loop_str += i.nodes.inject(''){|nodes_str, j|\r\n nodes_str += j.render\r\n }\r\n }\r\n else\r\n ''\r\n end\r\n end", "def to_xml\n to_node.document.to_xml\n end", "def gsub_tags(string, &block)\n raise \"No block given\" unless block_given?\n\n fragment = Nokogiri::HTML::DocumentFragment.parse string\n fragment.traverse do |node|\n node.content = yield(node.content) if node.text?\n end\n fragment.to_html\n end", "def to_html\n @html ||= format_html\n end", "def convert_to_document() \n Nokogiri::HTML.parse(convert())\n end", "def to_html\n __html__.dup.scrub!(:escape).to_html\n end", "def to_html\n # output the segments, but adjust the indentation\n indent = 0\n html = \"<!-- begin generated output -->\\n\"\n @out.each do |part|\n case\n when part =~ /^<\\/.*>$/\n indent -= 1\n html << write_html(indent,part)\n when part =~ /^<.*<\\/.*>$/\n html << write_html(indent,part)\n when part =~ /^<.*\\/>$/\n html << write_html(indent,part)\n when part =~ /^<.*>$/\n html << write_html(indent,part)\n indent += 1\n else\n html << write_html(indent,part)\n end\n end\n # return the formatted string\n html << \"<!-- end generated output -->\\n\"\n return html\n end", "def to_html\n @to_html ||= traite_to_html\n end", "def ncx_to_html\n html = <<EOF\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<html xmlns=\"http://www.w3.org/1999/xhtml\" profile=\"http://www.idpf.org/epub/30/profile/content/\">\n <head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/>\n <title>#{title}</title>\n </head>\n <body>\n <section>\n <nav id=\"toc\" epub:type=\"toc\">\n <ol>\nEOF\n selector = \"ncx > navMap > navPoint\"\n @xml.css(selector).each do |point|\n html += \"<li id=\\\"#{point.attr('id').to_s}\\\"><a href=\\\"#{point.css('content').attr('src').to_s}\\\">#{point.css('navLabel text').text}</a></li>\"\n end\n html += <<EOF\n </ol>\n </nav>\n </section>\n </body>\n</html>\nEOF\n html\n end", "def to_html(*)\n self\n end", "def to_xhtml(*args); end", "def to_xhtml(*args); end", "def to_xhtml(*args); end", "def to_xhtml(*args); end", "def node_text(node)\n node.content.gsub('<', '&lt;').gsub('>', '&gt;')\n end", "def html\n `#{@el}.innerHTML`\n end", "def to_html()\n @html ||= cmark(\"--to\", \"html\")\n @html\n end", "def fragment(*args, &block)\n Loofah::HTML::DocumentFragment.parse(*args, &block)\n end", "def render_node(node, base_url='')\n params = _transform_params({'base_url' => base_url})\n\n if node.id\n params += ['root_elem', \"//*[@id='#{node.id}']\"]\n doc = node.document\n else\n # create a new document with just this element at the root\n doc = Nokogiri::XML::Document.new\n doc.root = node\n params += ['root_elem', '*']\n end\n\n _run_xslt(:fragment, doc, params)\n end", "def xhtml(x)\n doc = <<-HERE\n <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n <html xmlns=\"http://www.w3.org/1999/xhtml\">\n <head><meta charset=\"UTF-8\" /></head><body>#{x}</body></html>\n HERE\n Nokogiri::XML(doc).css('body').children\n end", "def inner_html=(node_or_tags)\n self.children = node_or_tags\n self\n end", "def build_document_components_array(node_set)\n node_set\n .reject { |node| node.respond_to?(:html_dtd?) && node.html_dtd? }\n .map { |node| build_document_component(node) }\n end", "def to_html(stream)\n until @strscan.eos?\n stream << generate_html\n end\n\n stream\n end", "def to_html(options = T.unsafe(nil)); end", "def to_html(options = T.unsafe(nil)); end", "def replace_references_node(set, inner_html)\n set.each do |references_node|\n ol_node = references_node.document.create_element \"ol\"\n ol_node.inner_html = inner_html\n references_node.parent.replace(ol_node)\n end\n\n nil\n end", "def inner_html\n self.inner_xml\n end", "def bend_html\n\t\t@bendable_html = Nokogiri::HTML(@unbendable_html.body)\n\tend", "def html *o\n if o.empty?\n a = []\n each do |e| a << e.get_inner_html end\n return(a)\n end\n \n each do |e| e.set_inner_html o[0] end\n end", "def xml\n @_node.asXml\n end", "def to_xml\n @node.flatten.map(&:to_s).join\n end", "def to_html\n end", "def parse html\n return if html.nil?\n @fragment = Nokogiri::HTML.fragment(html)\n @fragment_copy = Nokogiri::HTML.fragment(html)\n end", "def trees_to_html(trees)\nend", "def read_html\n array = nodes.to_a\n array.each_with_index do |node, index|\n header = (index.modulo(10) == 0) ? \"<h2>!!!!!SLOW DOWN AND ENUNCIATE!!!!!</h2>\" : \"\"\n anchor = \"<a id=section_#{index} href=/pages/#{self.id}/edit?section=#{index}>#{index}</a>\"\n type = nodes.at(index).name\n array[index]=nodes.at(index).replace \"#{header}<#{type}>#{anchor} #{nodes.at(index).inner_html}</#{type}>\"\n end\n array.map(&:to_html).join\n end", "def write_xhtml_to(io, options = T.unsafe(nil)); end", "def write_xhtml_to(io, options = T.unsafe(nil)); end", "def strip_html(text)\n Nokogiri::HTML.fragment(text).content\n end", "def get_outer_html(node_id: nil, backend_node_id: nil, object_id: nil)\n {\n method: \"DOM.getOuterHTML\",\n params: { nodeId: node_id, backendNodeId: backend_node_id, objectId: object_id }.compact\n }\n end", "def to_html(md)\n Kramdown::Document\n .new(md, {input: \"GFM\"})\n .to_html\n end", "def to_html\n @root_component.to_html\n end", "def dom\n div = DOM::Element.new 'div'\n div.html = @body\n fragment = DOM::Fragment.new\n fragment << div\n fragment\n end", "def html_string\n @html.join(\"\")\n end", "def to_html\n map { |x| x.output(\"\") }.join\n end", "def encode(options={})\n self.class.format.encode(attributes, {:root => nil}.merge(options)).gsub(\n /<\\/?>/, \"\")\n end", "def fragment(string, encoding = nil)\n HTML4::DocumentFragment.parse(string, encoding)\n end", "def view(node, slice, &block)\n slice = slice.to_i\n case node\n when ::HTML::Tag then\n children_view = node.children.map {|child| view(child, slice, &block)}.compact.join\n if resized?\n resizing.resize_node(node)\n end\n if sliced?\n if slicing.map.get(node, slice) || children_view.present?\n if node.closing == :close\n \"</#{node.name}>\"\n else\n s = \"<#{node.name}\"\n node.attributes.each do |k,v|\n s << \" #{k}\"\n s << \"=\\\"#{v}\\\"\" if String === v\n end\n s << \" /\" if node.closing == :self\n s << \">\"\n s += children_view\n s << \"</#{node.name}>\" if node.closing != :self && !node.children.empty?\n s\n end\n end\n else\n node.to_s\n end\n when ::HTML::Text then\n if sliced?\n if range = slicing.map.get(node, slice)\n (range.is_a?(Array) ? node.content[Range.new(*range)] : node.content).tap do |export|\n unless range == true || (range.is_a?(Array) && range.last == -1) # broken text\n export << slicing.options.text_break if slicing.options.text_break\n if block_given?\n yield self, export\n end\n end\n end\n end\n else\n node.to_s\n end\n when ::HTML::CDATA then\n node.to_s\n when ::HTML::Node then\n node.children.map {|child| view(child, slice, &block)}.compact.join\n end\n end", "def to_html; end", "def fragment\n <<~HTML\n my html here\n HTML\n end", "def to_html\n fail NoMethodError, \"Engines need to implement this method\"\n end", "def xhtml_transitional(attrs = {}, &block)\n self.tagset = Markaby::XHTMLTransitional\n xhtml_html(attrs, &block)\n end", "def xhtml_transitional(attrs = {}, &block)\n self.tagset = Markaby::XHTMLTransitional\n xhtml_html(attrs, &block)\n end", "def standardize_dom(html)\n if !html.css(\"body\")\n html.css(\":not(head)\").wrap(\"<body></body>\")\n end\n\n if !html.css(\"html\")\n html.wrap(\"<html></html>\")\n end\n nil\n end", "def set_outer_html(node_id:, outer_html:)\n {\n method: \"DOM.setOuterHTML\",\n params: { nodeId: node_id, outerHTML: outer_html }.compact\n }\n end", "def mark_up_fragments(fragmented_string)\n tags = fragmented_string.fragments.map do |fragment|\n classes = ['string-fragment', FRAGMENT_CLASSES[fragment]].join(' ')\n\n content_tag(:span, fragment, class: classes)\n end\n\n tags.join\n end" ]
[ "0.7797146", "0.67270243", "0.64741755", "0.63890094", "0.61691463", "0.6167444", "0.6130691", "0.6108589", "0.60983074", "0.60131896", "0.6011186", "0.5843235", "0.58066255", "0.57945496", "0.579302", "0.57503366", "0.57231814", "0.57043225", "0.55740035", "0.55669665", "0.5536594", "0.5507742", "0.54801095", "0.5466744", "0.543099", "0.5410785", "0.539942", "0.539942", "0.5388298", "0.5331296", "0.5329537", "0.5303474", "0.5299859", "0.52842003", "0.5268415", "0.52504826", "0.52447855", "0.5236016", "0.5236016", "0.5234684", "0.52215433", "0.5221375", "0.5203931", "0.5192364", "0.5189544", "0.5156396", "0.5141097", "0.51324016", "0.51143897", "0.5102847", "0.5085356", "0.5076318", "0.5074904", "0.5060229", "0.5035041", "0.5034708", "0.5033199", "0.5033199", "0.5033199", "0.5033199", "0.50292003", "0.50282973", "0.5009278", "0.5007447", "0.49894747", "0.49883524", "0.49849063", "0.4984532", "0.49778947", "0.49744204", "0.49744204", "0.4970068", "0.49691734", "0.49572608", "0.49420038", "0.49229142", "0.4911289", "0.49046072", "0.49016136", "0.4901543", "0.48989853", "0.48891953", "0.48891953", "0.4887783", "0.48844147", "0.4878489", "0.4873211", "0.48628676", "0.4833635", "0.48164207", "0.48045853", "0.4803292", "0.48026535", "0.48020846", "0.47998458", "0.47989798", "0.47933355", "0.47933355", "0.47881773", "0.47830182", "0.4774194" ]
0.0
-1
Convert this DocumentFragment to xhtml See Nokogiri::XML::NodeSetto_xhtml
def to_xhtml *args children.to_xhtml(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_html\n output_options = Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML ^\n Nokogiri::XML::Node::SaveOptions::FORMAT\n @fragment.children.inject(\"\") do |out, child|\n out << child.serialize(:save_with => output_options, :encoding => 'UTF-8')\n end\n end", "def convert_to_xml(nokogiri_html)\n Nokogiri::XML(nokogiri_html.to_xhtml)\n end", "def to_s\n if is_xhtml?\n @doc.to_xhtml(:encoding => nil)\n else\n @doc.to_html(:encoding => nil)\n end\n end", "def to_xhtml()\n nil\n end", "def to_xhtml(options = T.unsafe(nil)); end", "def to_xhtml(options = T.unsafe(nil)); end", "def to_xhtml(*args); end", "def to_xhtml(*args); end", "def to_xhtml(*args); end", "def to_xhtml(*args); end", "def purify_html\n doc= Nokogiri::XML::DocumentFragment.parse(self.to_s)\n doc.search(\".//strong\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h4\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h3\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h2\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h1\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n\n doc.search(\".//em\").each do |e|\n e.swap \"<i>#{e.inner_html}</i>\"\n end\n\n doc.search(\".//ul\").each do |e|\n e.swap \"#{e.inner_html}\"\n end\n doc.search(\".//ol\").each do |e|\n e.swap \"#{e.inner_html}\"\n end\n doc.search(\".//li\").each do |e|\n e.swap \"<p>#{e.inner_html}</p>\"\n end\n doc.search(\".//span\").each do |e|\n e.swap \"#{e.inner_html}\"\n end\n\n doc.to_xml(:encoding => \"UTF-8\").gsub(/\\n/,\" \").gsub(/\\s+/,\" \")\n end", "def xhtml(x)\n doc = <<-HERE\n <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n <html xmlns=\"http://www.w3.org/1999/xhtml\">\n <head><meta charset=\"UTF-8\" /></head><body>#{x}</body></html>\n HERE\n Nokogiri::XML(doc).css('body').children\n end", "def to_xhtml(options = {})\n to_format SaveOptions::DEFAULT_XHTML, options\n end", "def safe_xhtml_sanitize(html, options = {})\n sanitized = xhtml_sanitize(html.purify)\n doc = Nokogiri::XML::Document.parse(\"<div xmlns='http://www.w3.org/1999/xhtml'>#{sanitized}</div>\", nil, (options[:encoding] || 'UTF-8'), 0)\n sanitized = doc.root.children.to_xml(:indent => (options[:indent] || 2), :save_with => 2 )\n rescue Nokogiri::XML::SyntaxError\n sanitized = sanitized.escapeHTML\n end", "def to_html\n HtmlConversion.node_to_html(node)\n end", "def to_html_frag\n build(false)\n end", "def save_as_xhtml document, filename\n @document = document\n remove_remaining_tags\n FileWriter.write document.to_html, get_full_path(filename.force_html_extension)\n end", "def to_s\n document.xml? ? to_xml : to_html\n end", "def to_html\n @doc.at(\"body\").children.to_html(encoding: ENCODING).lstrip\n end", "def xml_to_html()\n @parser.parse()\n @exporter.html = @parser.html_output\n return @exporter.html\n end", "def htmlify_except(nodes)\n nodes.reduce(to_html) do |output, node|\n output.gsub(node.to_html, node.to_xhtml)\n end\n end", "def nice_html(indent=2)\n Nokogiri::HTML.fragment(self).to_xhtml(indent: indent)\n end", "def to_html\n self.load_page!\n self.parsed_page.to_xhtml indent: 3, indent_text: \" \"\n end", "def as_html(serializer = nil)\n @fragment.as_html(serializer)\n end", "def fix!\n fragment = Nokogiri::HTML.fragment(self.html)\n fragment.to_html\n end", "def markup_manipulation(html_fragment)\n html_doc = Nokogiri::HTML html_fragment\n html_doc = link_manipulations html_doc\n html_doc = image_manipulations html_doc\n return html_doc.css('body').children.to_s\n end", "def write_xhtml_to(io, options = {})\n write_format_to SaveOptions::DEFAULT_XHTML, io, options\n end", "def write_xhtml_to(io, options = T.unsafe(nil)); end", "def write_xhtml_to(io, options = T.unsafe(nil)); end", "def createDocumentFragment\n ret = DocumentFragment.new\n ret.ownerDocument = self\n ret\n end", "def to_xml\n to_node.document.to_xml\n end", "def xhtml_transitional(attrs = {}, &block)\n self.tagset = Markaby::XHTMLTransitional\n xhtml_html(attrs, &block)\n end", "def xhtml_transitional(attrs = {}, &block)\n self.tagset = Markaby::XHTMLTransitional\n xhtml_html(attrs, &block)\n end", "def render_node(node, base_url='')\n params = _transform_params({'base_url' => base_url})\n\n if node.id\n params += ['root_elem', \"//*[@id='#{node.id}']\"]\n doc = node.document\n else\n # create a new document with just this element at the root\n doc = Nokogiri::XML::Document.new\n doc.root = node\n params += ['root_elem', '*']\n end\n\n _run_xslt(:fragment, doc, params)\n end", "def html\r\n @rootNode.html_node()\r\n end", "def inner_html=(node_or_tags); end", "def fragment(tags)\n type = document.html? ? Nokogiri::HTML : Nokogiri::XML\n type::DocumentFragment.new(document, tags, self)\n end", "def clean!(html)\n @whitelist_nodes = []\n fragment = Nokogiri::HTML::DocumentFragment.parse(html)\n clean_node!(fragment)\n @whitelist_nodes = []\n\n output_method_params = {:encoding => 'utf-8', :indent => 0}\n\n if @config[:output] == :xhtml\n output_method = fragment.method(:to_xhtml)\n output_method_params[:save_with] = Nokogiri::XML::Node::SaveOptions::AS_XHTML\n elsif @config[:output] == :html\n output_method = fragment.method(:to_html)\n else\n raise Error, \"unsupported output format: #{@config[:output]}\"\n end\n\n result = output_method.call(output_method_params)\n\n # Ensure that the result is always a UTF-8 string in Ruby 1.9, no matter\n # what. Nokogiri seems to return empty strings as ASCII for some reason.\n result.force_encoding('utf-8') if RUBY_VERSION >= '1.9'\n\n return result == html ? nil : html[0, html.length] = result\n end", "def xhtml? \n opts[:tags][:tag_output_format_is_xhtml] ? ' />' : '>'\n end", "def xhtml(filename)\n filename.sub('.html', '.xhtml')\n end", "def createDocbookToXHtmlTask()\n\treturn Schmant::XsltTF.new.\n\t\tsetTransformerFactoryClassName(XSL_TRANSFORMER).\n\t\tsetParameter(\"img.src.path\", \"\").\n\t\tsetParameter(\"use.role.for.mediaobject\", \"1\").\n\t\tsetParameter(\"chunk.section.depth\", \"0\").\n\t\tsetParameter(\"html.ext\", \".xhtml\")\nend", "def xml\n @_node.asXml\n end", "def normalise_html(html)\n Nokogiri::HTML5.fragment(html).to_s\n end", "def to_xml\n xml = children.map(&:to_xml).join('')\n\n if doctype\n xml = doctype.to_xml + \"\\n\" + xml.strip\n end\n\n if xml_declaration\n xml = xml_declaration.to_xml + \"\\n\" + xml.strip\n end\n\n return xml\n end", "def to_xhtml\n with_protected_tags(self, VERBATIM_TAGS, true) do |text|\n html = with_protected_tags(text, PROTECTED_TAGS, false) do\n |s| s.thru_maruku\n end\n\n # Markdown's \"code spans\" should really be \"pre spans\"\n while html.gsub! %r{(<pre>)<code>(.*?)</code>(</pre>)}m, '\\1\\2\\3'\n end\n\n # allow \"code spans\" annotated with Maruku's IAL (Inline\n # Attribute List) Markdown extension to be syntax colored\n while html.gsub! %r{<pre[^>]+>(<code[^>]+>.*?</code>)</pre>}m, '\\1'\n end\n\n # allow user to type <pre> blocks on single lines\n # without affecting the display of their content\n html.gsub! %r{(<pre>)[ \\t]*\\r?\\n|\\r?\\n[ \\t]*(</pre>)}, '\\1\\2'\n\n # ensure tables have a border: this *greatly* improves\n # readability in text-based web browsers like w3m and lynx\n html.gsub! %r/<table\\b/, '\\& border=\"1\"'\n\n # add syntax coloring\n html.thru_coderay\n end\n end", "def fix_docbook_xhtml(xhtml)\r\n sf=File.new(xhtml, 'r')\r\n\t nf=File.new(xhtml+'~', 'w')\r\n\t sf.each_line do |l|\r\n r=l.gsub(/ =\"\"/, ' class=\"\"')\r\n\t\t nf << r\r\n\t end\r\n\t sf.close\r\n\t nf.close\r\n\t cp nf.path, sf.path\r\n\t rm nf.path\r\n end", "def xml_to_html(tag)\n tag.children().each do |c|\n # Rename the attributes\n c.keys.each do |k|\n c[\"data-#{k}\"] = c.delete(k)\n end\n # Rename the tag and replace lb with br\n c['class'] = \"xml-tag #{c.name.gsub(':', '-')}\"\n # To avoid invalid void tags: Use \"br\" if \"lb\", otherwise \"span\"\n c.name = c.name == 'lb' ? \"br\" : \"span\"\n # Use recursion\n xml_to_html(c)\n end\n end", "def to_docx(tag); end", "def html\n node.inner_html\n end", "def replace_nodes\n doc.xpath(\".//text()\").each do |node|\n next if has_ancestor?(node, ignored_ancestor_tags)\n\n content = node.to_html\n html = yield content, node\n\n next if html == content || html.nil?\n if html.length == 0\n node.parent.remove\n else\n node.replace(html)\n end\n end\n end", "def ncx_to_html\n html = <<EOF\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<html xmlns=\"http://www.w3.org/1999/xhtml\" profile=\"http://www.idpf.org/epub/30/profile/content/\">\n <head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/>\n <title>#{title}</title>\n </head>\n <body>\n <section>\n <nav id=\"toc\" epub:type=\"toc\">\n <ol>\nEOF\n selector = \"ncx > navMap > navPoint\"\n @xml.css(selector).each do |point|\n html += \"<li id=\\\"#{point.attr('id').to_s}\\\"><a href=\\\"#{point.css('content').attr('src').to_s}\\\">#{point.css('navLabel text').text}</a></li>\"\n end\n html += <<EOF\n </ol>\n </nav>\n </section>\n </body>\n</html>\nEOF\n html\n end", "def to_xml\n render_xml\n end", "def trans_html\n @doc.to_html\n end", "def xsl_html\n Nokogiri::XSLT(File.open(File.join(File.dirname(__FILE__), '../xslt/iso2html.xsl')))\n end", "def to_xml\n if @xml_header.nil?\n xml = ''\n else\n xml = @xml_header.to_xml + \"\\n\"\n end\n self.document.__types.each do |t|\n xml += self.document.send(t).to_xml\n end\n return xml\n end", "def to_opml\n\t\tdoc = Nokogiri::XML::DocumentFragment.parse \"\"\n\t\tNokogiri::XML::Builder.with(doc) { |xml|\n\t\t\txml.outline(:title => self.title, :text => self.title) {\n\t\t\t\tself.feeds.each do |feed|\n\t\t\t\t\txml.__send__ :insert, feed.to_opml\n\t\t\t\tend\n\t\t\t}\n\t\t}\n\t\treturn doc\n\tend", "def to_dom\n end", "def xhtml_strict(attrs = {}, &block)\n self.tagset = Markaby::XHTMLStrict\n xhtml_html(attrs, &block)\n end", "def xhtml_strict(attrs = {}, &block)\n self.tagset = Markaby::XHTMLStrict\n xhtml_html(attrs, &block)\n end", "def node_raw_html(node)\n node.to_s\n end", "def to_xml(*args)\n to_node.to_xml(*args)\n end", "def fragment string, encoding = nil\n HTML::DocumentFragment.parse string, encoding\n end", "def make_html\n @document.encoding = 'UTF-8'\n @best_candidate = nil\n end", "def xsl_html\n Nokogiri::XSLT(File.open(File.join(File.dirname(__FILE__), '/xslt/fgdc2html.xsl')))\n end", "def to_html_fragment\n to_markdown_slices.map do |tagged_markdown|\n tagged_markdown.to_html\n end.join(\"\\n\\n\")\n end", "def fragment(*args, &block)\n Loofah::HTML::DocumentFragment.parse(*args, &block)\n end", "def to_xml(options = T.unsafe(nil), &block); end", "def render\r\n if self.has_content?\r\n self.to_a.inject(''){|loop_str, i|\r\n loop_str += i.nodes.inject(''){|nodes_str, j|\r\n nodes_str += j.render\r\n }\r\n }\r\n else\r\n ''\r\n end\r\n end", "def to_xml(opts = {})\n to_raw.to_xml({ :root => 'document', :dasherize => true }.merge(opts))\n end", "def convert_to_document() \n Nokogiri::HTML.parse(convert())\n end", "def fragment(&blk)\n @nodes << HtmlFragment.new(&blk)\n self\n end", "def to_html_fragment(wrap_class = 'mp')\n frag_nodes = html.at('body').children\n out = frag_nodes.to_s.rstrip\n out = \"<div class='#{wrap_class}'>#{out}\\n</div>\" unless wrap_class.nil?\n out\n end", "def to_xml\n @node.flatten.map(&:to_s).join\n end", "def to_xml(*args)\n @doc.to_xml(*args)\n end", "def to_xml\n output=\"\"\n self.to_rexml.write output\n end", "def normalize!\n data = read\n html = Nokogiri::XML.parse(data)\n html.encoding = 'utf-8'\n\n # Process the @DOM\n standardize_dom(html)\n remove_scripts(html)\n change_hrefs(html)\n\n write(html.to_s)\n end", "def to_xml(opt={})\n to_markup(opt).target!\n end", "def to_xml(opt={})\n to_markup(opt).target!\n end", "def process_fragment_node(node)\n append(\"#{\n @as_module ? \"import * as HTX from '#{@import_path}'\\n\\n\"\n : \"#{@assign_to}['#{@name}'] = ((HTX) => {\\n#{@indent}\"\n }function render($renderer) {\\n\")\n\n @indent = @base_indent * 2 unless @as_module\n\n node.children.each do |child|\n process(child)\n end\n\n append(\"\\n\\n#{@indent}return $renderer.rootNode\")\n\n @indent = @as_module ? '' : @base_indent\n\n append(\n <<~JS\n\n #{@indent}}\n\n #{@indent}#{@as_module ? 'export' : 'return'} function Template(context) {\n #{@indent}#{@base_indent}this.render = render.bind(context, new HTX.Renderer)\n #{@indent}}#{\n \"\\n})(globalThis.HTX ||= {});\" unless @as_module}\n JS\n )\n\n flush\n end", "def to_xml(envelope)\n to_doc(envelope).to_xml save_with: Nokogiri::XML::Node::SaveOptions::NO_DECLARATION\n end", "def method_missing(method, *arguments, &block)\n if xhtml_block?(method, arguments)\n @xml.__send__(method, *arguments) do\n @xml.div(xmlns: \"http://www.w3.org/1999/xhtml\") do |xhtml|\n block.call(xhtml)\n end\n end\n else\n @xml.__send__(method, *arguments, &block)\n end\n end", "def to_xml()\n builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|\n xml.Types(:xmlns => Axlsx::XML_NS_T) {\n each { |type| type.to_xml(xml) }\n }\n end\n builder.to_xml(:save_with => 0)\n end", "def to_xml\n return @doc.to_s\n end", "def gsub_tags(string, &block)\n raise \"No block given\" unless block_given?\n\n fragment = Nokogiri::HTML::DocumentFragment.parse string\n fragment.traverse do |node|\n node.content = yield(node.content) if node.text?\n end\n fragment.to_html\n end", "def to_xml\n prune!(@root)\n\n Nokogiri::XML::Builder.new do |xml|\n to_xml_recursive(@root.children, xml)\n end.to_xml\n end", "def to_xml\n doc = Nokogiri::XML::Document.new\n element = to_nokogiri(doc)\n element.to_s\n end", "def to_xml\n doc = Nokogiri::XML::Document.new\n element = to_nokogiri(doc)\n element.to_s\n end", "def to_xml\n builder = Builder::XmlMarkup.new(:indent=>2)\n builder.instruct! :xml, version: '1.0', encoding: 'UTF-8'\n xml = builder.items{ self.each{|x| builder.item(x) } }\n xml\n end", "def inner_html\n self.inner_xml\n end", "def render_xml\n end", "def transform(xml)\n xml = xml.root if xml.is_a? Nokogiri::XML::Document\n xml = Nokogiri::XML(xml, nil, nil, Nokogiri::XML::ParseOptions.new).root unless xml.is_a? Nokogiri::XML::Node\n @document = xml.document\n generate_element(xml)\n end", "def to_xml\n to_xml_builder.to_xml\n end", "def to_xml\n to_xml_builder.to_xml\n end", "def render_xml\n @xml = Builder::XmlMarkup.new\n @xml.gauge do\n @xml.license( @license ) unless @license.nil?\n render_extra_components \n render_components\n end\n @xml.to_s.gsub( /<to_s\\/>/, '' ) \n end", "def to_xml\n before_validate\n validate\n render File.expand_path('../../haml/block.haml', __FILE__), self\n end", "def fragment(string, encoding = nil)\n HTML4::DocumentFragment.parse(string, encoding)\n end", "def create_document_fragment\n DOM(`#@native.createDocumentFragment()`)\n end", "def to_xml_fragment\n Exporters::XML::DDI::Fragment.export_3_2 Exporters::XML::DDI::QuestionGrid, self\n end", "def show\n\tcnv = ODT_to_XHTML.new\n\txmldata = cnv.get_html(@document.content, @document.styles)\n\t@head = xmldata[:head].get_text(\"style\")\n\t@body = xmldata[:body].to_s.sub(/<body>/,\"<div class=\\\"document\\\">\").sub(/<\\/body>/,\"</div>\")\n end", "def node_text(node)\n node.content.gsub('<', '&lt;').gsub('>', '&gt;')\n end" ]
[ "0.75909334", "0.65748703", "0.64304495", "0.63292396", "0.6203852", "0.6203852", "0.61794204", "0.61794204", "0.61794204", "0.61794204", "0.60379475", "0.6004587", "0.59434855", "0.5938037", "0.5936284", "0.5931177", "0.5924429", "0.5878168", "0.5856903", "0.58411366", "0.5747571", "0.5666986", "0.5641798", "0.5580748", "0.5544397", "0.553892", "0.55387604", "0.5537583", "0.5537583", "0.54783905", "0.5462075", "0.54470533", "0.54470533", "0.5365915", "0.5363249", "0.53500015", "0.53230214", "0.5298481", "0.5297775", "0.51943326", "0.5178534", "0.51403236", "0.5097889", "0.50945604", "0.50808525", "0.507744", "0.5076021", "0.5070276", "0.50592875", "0.50406843", "0.501985", "0.5008116", "0.50009155", "0.49957985", "0.49828574", "0.4979687", "0.49766546", "0.49753702", "0.49753702", "0.4968421", "0.49428475", "0.49427426", "0.4937736", "0.49270517", "0.48940894", "0.48880172", "0.48790264", "0.48646042", "0.48612246", "0.48581675", "0.4850867", "0.4846418", "0.48335227", "0.48111102", "0.48099333", "0.48032582", "0.47914752", "0.47914752", "0.4767885", "0.4764162", "0.47544777", "0.47455353", "0.4744332", "0.47414157", "0.47400984", "0.47327504", "0.47327504", "0.4731448", "0.47220883", "0.4708943", "0.47057313", "0.46975693", "0.46975693", "0.4689845", "0.46623203", "0.46431565", "0.4635269", "0.46288574", "0.46269193", "0.46237868" ]
0.6413968
3
Convert this DocumentFragment to xml See Nokogiri::XML::NodeSetto_xml
def to_xml *args children.to_xml(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_xml\n to_node.document.to_xml\n end", "def to_xml\n @node.flatten.map(&:to_s).join\n end", "def to_html\n output_options = Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML ^\n Nokogiri::XML::Node::SaveOptions::FORMAT\n @fragment.children.inject(\"\") do |out, child|\n out << child.serialize(:save_with => output_options, :encoding => 'UTF-8')\n end\n end", "def xml\n @_node.asXml\n end", "def to_xml\n xml = children.map(&:to_xml).join('')\n\n if doctype\n xml = doctype.to_xml + \"\\n\" + xml.strip\n end\n\n if xml_declaration\n xml = xml_declaration.to_xml + \"\\n\" + xml.strip\n end\n\n return xml\n end", "def to_xml\n prune!(@root)\n\n Nokogiri::XML::Builder.new do |xml|\n to_xml_recursive(@root.children, xml)\n end.to_xml\n end", "def to_xml(*args)\n to_node.to_xml(*args)\n end", "def to_xml\n to_xml_builder.to_xml\n end", "def to_xml\n to_xml_builder.to_xml\n end", "def to_xml\n if @xml_header.nil?\n xml = ''\n else\n xml = @xml_header.to_xml + \"\\n\"\n end\n self.document.__types.each do |t|\n xml += self.document.send(t).to_xml\n end\n return xml\n end", "def to_xml()\n @xml ||= Nokogiri::XML(cmark(\"--to\", \"xml\"))\n @xml\n end", "def to_xml(*args)\n @doc.to_xml(*args)\n end", "def to_xml\n return @doc.to_s\n end", "def to_xml\n doc = Nokogiri::XML::Document.new\n element = to_nokogiri(doc)\n element.to_s\n end", "def to_xml\n doc = Nokogiri::XML::Document.new\n element = to_nokogiri(doc)\n element.to_s\n end", "def to_xml()\n builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|\n xml.Types(:xmlns => Axlsx::XML_NS_T) {\n each { |type| type.to_xml(xml) }\n }\n end\n builder.to_xml(:save_with => 0)\n end", "def to_xml\n @xml ||= get_xml\n end", "def to_xml(opts = {})\n to_raw.to_xml({ :root => 'document', :dasherize => true }.merge(opts))\n end", "def to_xml\n output=\"\"\n self.to_rexml.write output\n end", "def to_xml(*)\n self\n end", "def to_xml\n Ox.to_xml document\n end", "def to_xml\n builder.target!\n end", "def to_xml(xml)\n xml.way(attributes) do\n nodes.each do |node|\n xml.nd(:ref => node)\n end\n tags.to_xml(xml)\n end\n end", "def to_xml(options = T.unsafe(nil), &block); end", "def to_xml\n builder = Builder::XmlMarkup.new(:indent=>2)\n builder.instruct! :xml, version: '1.0', encoding: 'UTF-8'\n xml = builder.items{ self.each{|x| builder.item(x) } }\n xml\n end", "def _to_xml(xml)\n end", "def to_xml\n @builder.to_xml\n end", "def to_xml\n @xml.to_xml\n end", "def to_xml(envelope)\n to_doc(envelope).to_xml save_with: Nokogiri::XML::Node::SaveOptions::NO_DECLARATION\n end", "def to_xml\n Nokogiri::XML::Builder.new do |xml|\n xml.network do\n xml.name name if name\n xml.uuid uuid if uuid\n\n bridge.to_xml(xml)\n ip.to_xml(xml)\n end\n end.to_xml\n end", "def xml_document\n @root_node.to_s\n end", "def xml_document\n @root_node.to_s\n end", "def to_xml\n return to_s\n end", "def to_xml\n return to_s\n end", "def to_opml\n\t\tdoc = Nokogiri::XML::DocumentFragment.parse \"\"\n\t\tNokogiri::XML::Builder.with(doc) { |xml|\n\t\t\txml.outline(:title => self.title, :text => self.title) {\n\t\t\t\tself.feeds.each do |feed|\n\t\t\t\t\txml.__send__ :insert, feed.to_opml\n\t\t\t\tend\n\t\t\t}\n\t\t}\n\t\treturn doc\n\tend", "def convert_to_xml(nokogiri_html)\n Nokogiri::XML(nokogiri_html.to_xhtml)\n end", "def to_xml_recursive(nodes, xml)\n nodes.each do |node|\n if node.name == 'comment'\n xml.comment \" #{node.content} \"\n else\n attributes = {}\n comments = []\n\n attribute_nodes, element_nodes = node.children.partition do |child|\n child.attribute?\n end\n\n attribute_nodes.each do |attribute_node|\n attributes[attribute_node.name] = attribute_node.content\n if attribute_node.comments.any?\n comments << attribute_node.comment\n end\n end\n\n if comments.any?\n xml.comment comments.join('|')\n end\n\n xml.send(node.name, attributes) do\n content = node.content\n if content\n xml.text content\n end\n if node.comments.any?\n xml.comment node.comment\n end\n to_xml_recursive(element_nodes, xml)\n end\n end\n end\n end", "def to_xml\n RAGE::XMLCodec.new.encode(self)\n end", "def to_xml(options = T.unsafe(nil)); end", "def to_xml(options = T.unsafe(nil)); end", "def to_xml(*args); end", "def to_xml(*args); end", "def to_xml(*args); end", "def to_xml(*args); end", "def to_xml(*args); end", "def to_xml(*args); end", "def to_xml\r\n @request_set.ToXMLString\r\n end", "def to_xml\n\t\tend", "def to_xml\n\t\tend", "def toxml\n\t\tend", "def to_xml()\n XmlSimple.xml_out( { :address => self.to_hash() }, { :KeepRoot=>true, :NoAttr=>true } )\n end", "def to_xml\n render_xml\n end", "def to_xml(options={})\r\n a = attributes.clone\r\n a.delete(\"ino:id\")\r\n a.to_xml({:root => self.class.doctype}.merge(options))\r\n end", "def to_xml\n ns = namespace ? \"#{namespace}:\" : ''\n body = children.map(&:to_xml).join('')\n attrs = ''\n\n attributes.each do |key, value|\n attrs << \"#{key}=#{value.inspect}\"\n end\n\n attrs = \" #{attrs}\" unless attrs.empty?\n\n return \"<#{ns}#{name}#{attrs}>#{body}</#{name}>\"\n end", "def to_xml(doc)\n doc.to_xml(indent: 2)\n end", "def to_xml(xml_builder = Builder::XmlMarkup.new)\n xml_builder.tag!('Group') do\n %w(Name Handle GroupType Explicit).each do |tag_name|\n xml_builder.tag!(tag_name, self.edits[tag_name]) if self.edits[tag_name]\n end\n \n self.tracks.to_xml(xml_builder)\n self.permissions.to_xml(xml_builder)\n \n %w(AllowSubscription).each do |tag_name|\n xml_builder.tag!(tag_name, self.edits[tag_name]) if self.edits[tag_name]\n end\n self.external_feed.to_xml(xml_builder) if self.external_feed\n end\n end", "def document\n return nil if @document.nil?\n @document.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML)\n end", "def to_xml(xml)\n xml.relation(attributes) do\n members.each do |member|\n member.to_xml(xml)\n end\n tags.to_xml(xml)\n end\n end", "def to_xml(builder) # rubocop:disable Metrics/MethodLength\n xml = builder.series do\n formattedref&.to_xml builder\n builder.title { title.to_xml builder }\n builder.place place if place\n builder.organization organization if organization\n builder.abbreviation { abbreviation.to_xml builder } if abbreviation\n builder.from from if from\n builder.to to if to\n builder.number number if number\n builder.partnumber partnumber if partnumber\n builder.run run if run\n end\n xml[:type] = type if type\n end", "def to_xml(options = {})\r\n options.update :root => @root ||\r\n self.class.name.split('::').last.underscore\r\n attributes.to_xml options\r\n end", "def to_xml(opt={})\n to_markup(opt).target!\n end", "def to_xml(opt={})\n to_markup(opt).target!\n end", "def to_xml(opts = {})\n mapper.to_xml(self, opts)\n end", "def to_xml(options = nil)\n all_attributes.to_xml(options || {})\n end", "def to_xml\n xml = String.new\n builder = Builder::XmlMarkup.new(:target => xml, :indent => 2)\n \n # Xml instructions (version and charset)\n builder.instruct!\n \n builder.source(:primary => primary_source) do\n builder.id(id, :type => \"integer\")\n builder.uri(uri.to_s)\n end\n \n xml\n end", "def to_xml\n Builder.new(self).to_s\n end", "def to_xml(builder)\n builder.series type: type do\n builder.title { title.to_xml builder } if title\n builder.place place if place\n builder.organization organization if organization\n builder.abbreviation { abbreviation.to_xml builder } if abbreviation\n builder.from from if from\n builder.to to if to\n builder.number number if number\n builder.part_number part_number if part_number\n end\n end", "def to_xml(options={})\n attributes.to_xml({:root => self.class.element_name}.merge(options))\n end", "def to_xml(options={})\n attributes.to_xml({:root => self.class.element_name}.merge(options))\n end", "def xml_document\n xml = XML::Document.new\n xml.root = self.to_xml\n xml\n end", "def to_xml\n return self.to_s\n end", "def to_xml\n IO::XMLExporter.new.to_xml(self)\n end", "def to_rootless_xml(options = {})\n require \"active_support/builder\" unless defined?(Builder)\n\n options = options.dup\n options[:indent] ||= 2\n options[:builder] ||= Builder::XmlMarkup.new(indent: options[:indent])\n\n builder = options[:builder]\n builder.instruct! unless options.delete(:skip_instruct)\n\n each { |key, value| ActiveSupport::XmlMini.to_tag(key, value, options) }\n yield builder if block_given?\n builder.target! \n end", "def to_xml(options = {})\n doc = super\n ns = self.class.ns\n\n if ns and ns.size == 2 # prefix and name\n doc.add_namespace_definition(*ns)\n doc.name = \"#{ns.first}:#{doc.name}\"\n end\n\n doc\n end", "def xml_document\n xml = XML::Document.new\n xml.root = self.to_xml\n xml\n end", "def to_xml(builder=nil)\n builder = ::Builder::XmlMarkup.new if builder.nil?\n builder.sitemap do\n builder.loc self[:loc]\n builder.lastmod w3c_date(self[:lastmod]) if self[:lastmod]\n end\n builder << '' # force to string\n end", "def to_xml(params = {})\n params.reverse_merge!(\n :name => self.class.tag_name,\n :namespace => self.class.roxml_namespace\n )\n params[:namespace] = nil if ['*', 'xmlns'].include?(params[:namespace])\n str = [params[:namespace], params[:name]].compact.join(':')\n XML.new_node(str).tap do |root|\n refs = if self.roxml_references.present?\n self.roxml_references\n else\n self.class.roxml_attrs.map { |attr| attr.to_ref(self) }\n end\n # Add audience_range_qualifier as is\n refs[0].update_xml(root, refs[0].to_xml(self))\n # Zip audience_range_values with audience_range_precisions\n precisions = refs[1].to_xml(self)\n values = refs[2].to_xml(self)\n (0..precisions.size-1).each do |i|\n refs[1].update_xml(root, [precisions[i]])\n refs[2].update_xml(root, [values[i]])\n end\n end\n end", "def to_xml\n self.to_s\n end", "def to_xml\n self.to_s\n end", "def to_xml(ns=nil)\n x = super.chomp(\"/>\").chomp(\" \")\n x << %[>]\n #self.class.inherited_elements.each do |name, kind, opts|\n xml_schema_elements.each do |name, kind, opts|\n obj = send(name)\n next unless obj\n case obj\n when Array\n obj.each do |v|\n if v.is_a? Tag\n x << v.to_xml(xml_namespace)\n else\n x << %[<#{name}>#{xml_escape(v.to_s)}</#{name}>]\n end\n end\n else\n if obj.is_a? Tag\n x << obj.to_xml(xml_namespace)\n else\n x << %[<#{name}>#{xml_escape(obj.to_s)}</#{name}>]\n end\n end\n end\n x << %[</#{xml_tagname}>]\n x\n end", "def to_xml(obj)\n obj.to_xml\n end", "def to_xml(ns=nil)\n x = super.chomp(\"/>\").chomp(\" \")\n x << \">\"\n x << xml_escape(xml_value.to_s)\n x << \"</#{xml_tagname}>\"\n x\n end", "def to_s\n @xml\n end", "def xml_nodes\n @xml_nodes ||= Nokogiri::XML(xml)\n end", "def to_s\n document.xml? ? to_xml : to_html\n end", "def extents_to_xml(options = {})\n e = get_extents()\n options[:indent] ||= 2\n xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])\n xml.instruct! unless options[:skip_instruct]\n xml.extents do\n xml.min_point do\n xml.tag!(:x, e[:minX])\n xml.tag!(:y, e[:minY])\n end\n xml.max_point do\n xml.tag!(:x, e[:maxX])\n xml.tag!(:y, e[:maxY])\n end\n end\n end", "def to_xml(*args)\n super\n end", "def to_xml(options = {})\n options[:save_with] ||= SaveOptions::DEFAULT_XML\n serialize(options)\n end", "def to_xml(options={}, &block)\n super(options.reverse_merge(:include => :parts), &block)\n end", "def to_xml(options = {})\n to_xml_opts = {:skip_types => true} # no type information, not such a great idea!\n to_xml_opts.merge!(options.slice(:builder, :skip_instruct))\n # a builder instance is provided when to_xml is called on a collection,\n # in which case you would not want to have <?xml ...?> added to each item\n to_xml_opts[:root] ||= \"retailer\"\n self.attributes.to_xml(to_xml_opts)\n end", "def build_xml(node, doc = nil, xml_node=nil)\n if doc.nil?\n doc = Nokogiri::XML('<opt></opt>')\n xml_node = doc.root\n end\n if node.respond_to?(:each)\n node.drop(1).each do |child|\n if position_node?(child)\n pos = Nokogiri::XML::Node.new(\"pos\", doc)\n pos['line'] = child.first.to_s\n pos['column'] = child[1].to_s\n xml_node.add_child(pos)\n else\n if child.respond_to?(:first)\n n = Nokogiri::XML::Node.new(child.first.to_s.gsub(/[^a-z_]/, ''), doc)\n xml_node.add_child(build_xml(child, doc, n))\n else\n xml_node['value'] = child.to_s unless child.nil?\n end\n end\n end\n end\n xml_node\n end", "def build_xml(node, doc = nil, xml_node=nil)\n if doc.nil?\n doc = Nokogiri::XML('<opt></opt>')\n xml_node = doc.root\n end\n if node.respond_to?(:each)\n node.drop(1).each do |child|\n if position_node?(child)\n pos = Nokogiri::XML::Node.new(\"pos\", doc)\n pos['line'] = child.first.to_s\n pos['column'] = child[1].to_s\n xml_node.add_child(pos)\n else\n if child.respond_to?(:first)\n n = Nokogiri::XML::Node.new(child.first.to_s.gsub(/[^a-z_]/, ''), doc)\n xml_node.add_child(build_xml(child, doc, n))\n else\n xml_node['value'] = child.to_s unless child.nil?\n end\n end\n end\n end\n xml_node\n end", "def to_xml\n \n text = \"<node id=\\\"#{self.id}\\\" label=\\\"#{self.label}\\\">\\n\"\n \n unless self.attributes.nil?\n text << \"\\t<attvalues>\\n\"\n self.attributes.each do |key, value|\n text << \"\\t\\t<attvalue for=\\\"#{key}\\\" value=\\\"#{value}\\\"></attvalue>\\n\"\n end\n text << \"\\t</attvalues>\\n\"\n end\n \n unless self.viz_size.nil?\n text << \"\\t<viz:size value=\\\"#{self.viz_size}\\\"/>\\n\"\n end\n \n unless self.viz_color.nil?\n text << \"\\t<viz:color b=\\\"#{self.viz_color[:b]}\\\" g=\\\"#{self.viz_color[:g]}\\\" r=\\\"#{self.viz_color[:r]}\\\"/>\\n\"\n end\n \n unless self.viz_position.nil?\n text << \"\\t<viz:position x=\\\"#{self.viz_position[:x]}\\\" y=\\\"#{self.viz_position[:z]}\\\"/>\\n\"\n end\n \n text << \"</node>\\n\"\n text \n end", "def build_xml(builder)\n super(builder)\n builder.EquivalentSegment {|b| equivalent_segment.build_xml(b) } if equivalent_segment\n end", "def to_node\n Nokogiri::XML::Builder.new do |xml|\n build xml\n end.doc.root\n end", "def to_xml(options={})\n options = options.reverse_merge(:root => false)\n to_hash(options).to_xml(:root => data_name(@_data))\n end", "def to_xml(xml)\n xml.Override(self.instance_values)\n end", "def to_xml(options={})\n to_a.to_xml options.reverse_merge(:root => \"hints\", :skip_types => true)\n end", "def to_xml_change\n doc = Nokogiri::XML::Document.new\n root = doc.create_element(\"#{identifier.tag_name.gsub(/Id$/, '')}Change\")\n root << identifier.to_xml\n root << to_xml_updates\n root\n end", "def to_s\n return self.xml\n end" ]
[ "0.7067382", "0.6635989", "0.6484199", "0.6475789", "0.64724755", "0.6376166", "0.6314287", "0.62018013", "0.62018013", "0.614489", "0.6102177", "0.607421", "0.60266334", "0.5977745", "0.5977745", "0.5961017", "0.59442425", "0.5932489", "0.59320796", "0.5918805", "0.5890942", "0.5844865", "0.5822506", "0.5815853", "0.58050543", "0.58045965", "0.57983077", "0.57749885", "0.5774045", "0.5764053", "0.57426924", "0.57426924", "0.5694725", "0.5694725", "0.56825614", "0.5668966", "0.56664383", "0.5666428", "0.5652165", "0.5652165", "0.56293064", "0.56293064", "0.56293064", "0.56293064", "0.56293064", "0.56293064", "0.56261545", "0.5604641", "0.5604641", "0.55996555", "0.5587712", "0.55835664", "0.5580644", "0.55689615", "0.55658114", "0.55578893", "0.5547657", "0.5525146", "0.5507662", "0.5502563", "0.5500168", "0.5500168", "0.54829156", "0.5476671", "0.5475225", "0.54615045", "0.5452431", "0.5436705", "0.5436705", "0.54190326", "0.5414535", "0.539927", "0.539601", "0.53808063", "0.53736913", "0.5372243", "0.5368005", "0.53643966", "0.53643966", "0.53562784", "0.53465456", "0.5336098", "0.5324137", "0.53125376", "0.5312287", "0.53062385", "0.5303071", "0.5302731", "0.52780116", "0.5275203", "0.5274023", "0.5274023", "0.52707916", "0.52676773", "0.52665013", "0.5251766", "0.5250902", "0.52465296", "0.52440435", "0.52410734" ]
0.57565
30
Search this fragment. See Nokogiri::XML::Nodecss
def css *args if children.any? children.css(*args) else NodeSet.new(document) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(xpath)\n return self.each_element( xpath ){}\n end", "def process_node_bookmark(xn)\n pull_node(xn)\n flag_match_found\n end", "def search(xpath)\n xpath = \".#{xpath}\" if !self.is_a?(REXML::Document) and xpath =~ /^\\//\n ret = REXML::XPath.match(self,xpath).map{|elm|\n elm.extend(ElementHelper)\n elm\n block_given? ? (yield elm) : elm\n }\n end", "def find text\n preorder_traverse @fragment do |node|\n if node.text? then\n if not node.text.index(text).nil? then\n return node\n end\n end\n end\n end", "def cib_section_nodes_state\n REXML::XPath.match cib, '//node_state'\n end", "def scanned_node?(node); end", "def search(node, qry)\n node.search(qry)\n end", "def find_fragment(jid, node)\n raise 'subclass must implement'\n end", "def find_within(tags, span, pointer); end", "def find_within(tags, span, pointer); end", "def search(xpath, &proc)\n @doc.search(xpath, &proc)\n end", "def search_for_a_node( nokogiri_nodeset, text_key_word )\n matches_found = 0\n\n # Convert node content to text lines and scan them all:\n nokogiri_nodeset.text.split(\"\\n\").each do |line|\n# DEBUG\n# puts line\n matches_found += 1 if !( line =~ /#{ text_key_word }/ui ).nil?\n end\n matches_found\n end", "def nodeName\n \"#document-fragment\"\n end", "def find css_selector\n @scene.lookup css_selector\n end", "def where(query)\n components = query.match(NODE_QUERY_SYNTAX)\n\n raise BadReferenceError, \"for reference: #{query}\" unless components\n search_node_components(components)\n end", "def fragment string\n doc = parse(string)\n finder = lambda { |children, f|\n children.each do |child|\n return children if string =~ /<#{child.name}/\n finder.call(child.children, f)\n end\n }\n finder.call(doc.children, finder)\n end", "def find(query)\n path = if xml.namespaces.empty?\n \"//#{query}\"\n else\n \"//xmlns:#{query}\"\n end\n\n xml.xpath(path).map do |node|\n hsh = XMLUtils.to_hash node\n block_given? ? yield(hsh) : hsh\n end\n end", "def node_contains_content?(node)\n node.name == '#cdata-section'\n end", "def match(node)\n raise_unless_xpath!(node)\n pos = node.xpath('descendant::pos').first\n return nil if pos.nil?\n {:matched => node.respond_to?(:name) ? node.name : '',\n :line => pos['line'].to_i, :column => pos['column'].to_i}\n end", "def searches(ast)\n ast.xpath(\"//fcall/ident[@value = 'search']\")\n end", "def searches(ast)\n ast.xpath(\"//fcall/ident[@value = 'search']\")\n end", "def matches?(node); end", "def search(ent, txtvu)\n start = txtvu.buffer.start_iter\n first, last = start.forward_search(ent.text, Gtk::TextIter::SEARCH_TEXT_ONLY, nil)\n count = 0\n while (first)\n start.forward_char\n first, last = start.forward_search(ent.text, Gtk::TextIter::SEARCH_TEXT_ONLY, nil)\n start = first\n txtvu.buffer.apply_tag(\"highlight\", first, last)\n count += 1\n end\nend", "def find_attributes(node, &block); end", "def find_sections_atx(content)\n find_sections_regexp(content, /((\\A|\\s*\\n)#+(.*))$/)\n end", "def find(xpath)\n\t\t\t@document.xpath(xpath)\n\t\tend", "def fragment(&blk)\n @nodes << HtmlFragment.new(&blk)\n self\n end", "def find(selector)\n nodes = @_node.getByXPath(selector).map { |node| Node.new(node) }\n @nodes << nodes\n nodes\n end", "def css(query)\n\t\treturn is_valid ? @doc.css(query) : nil\n\tend", "def node_within_block_or_conditional?(node, stop_search_node); end", "def css css_selector\n @scene.get_root.lookup_all(css_selector).map {|e| e}\n end", "def elements(selector)\n @doc.search(selector)\n end", "def css_search_first(path)\n\t\tself.cs(path).first\n\tend", "def find! css_selector\n res = find(css_selector)\n raise \"Selector(#{css_selector}) returned no results!\" unless res\n res\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def search2(doc)\n doc.search('.subtext > a:nth-child(3)').map {|link| link['href'] }\n end", "def match parser, index\r\n raise \"multiple element child not set\" unless child\r\n raise \"multiple element range not set\" unless range\r\n count = 0\r\n while count < range.last\r\n found = child.match parser, index\r\n break unless found\r\n index = found\r\n count += 1\r\n end\r\n report range === count ? index : NO_MATCH\r\n end", "def search(search_crit)\n return @head if @head.value == search_crit\n node_before(search_crit).nexxt\n end", "def search(path)\n self.find_by_xpath(path)\n end", "def find_node ast, klass\n ast.find {|n| n.content.class == klass }\nend", "def search_children(node, attribute, search_term)\n matches = []\n end", "def find(selector)\n nodes = current_frame.getByXPath(selector).map { |node| Node.new(node) }\n @nodes << nodes\n nodes\n end", "def find_nodes\n puts '1st pass: find nodes'\n find :nodes\n self\n end", "def search *paths\n ns = paths.last.is_a?(Hash) ? paths.pop : {}\n xpath(*(paths.map { |path|\n path =~ /^(\\.\\/|\\/)/ ? path : CSS.xpath_for(path, :prefix => \".//\")\n }.flatten.uniq) + [ns])\n end", "def have_element(search, content = nil)\n lambda do |obj|\n doc = Nokogiri.parse(obj.to_s)\n node_set = doc.search(search)\n if node_set.empty?\n false\n else\n collected_content = node_set.collect {|t| t.content }.join(' ')\n case content\n when Regexp\n collected_content =~ content\n when String\n collected_content.include?(content)\n when nil\n true\n end\n end\n end\n end", "def derived_css(html, selector)\n runon = html.css('.runon')\n runon.each do |r|\n n = r.css('[title=\"Derived word\"]')\n if n.text == @word\n node = r.css(selector)\n yield(node)\n end\n end\n end", "def xpath_search\n return unless grafana_url.present?\n\n %(descendant-or-self::a[starts-with(@href, '#{grafana_url}')])\n end", "def on_match_pattern(node); end", "def find_feed\n @feed = @node.content\n end", "def search(*args)\n return \"No XML\" if !@ndoc\n @ndoc.search(*args)\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def find_fragments(criteria = {:host => \"\", :version => \"\"})\n selected = fragments\n if (criteria[:host])\n selected = selected.select {|b| b.fragment.name == criteria[:host]}\n end\n if (criteria[:version])\n selected = selected.select {|b| b.fragment.version == criteria[:version]}\n end\n selected\n end", "def match_node?(key_type, search_term, data)\n if key_type == 'class' && data['class']\n data['class'].each do |cls|\n if cls == search_term\n return true\n end\n end\n elsif data[key_type] == search_term\n return true\n end\n false\n end", "def fragment(*args, &block)\n Loofah::HTML::DocumentFragment.parse(*args, &block)\n end", "def each_node\n return to_enum(__method__) unless block_given?\n\n doc.xpath(query).each do |node|\n yield node\n end\n end", "def find_visibility_end(node); end", "def xpath; end", "def xpath; end", "def process_nodes(html_nodes, properties); end", "def start_of_element? node\n node.node_type==Nokogiri::XML::Reader::TYPE_ELEMENT\n end", "def searches(ast)\n return [] unless ast.respond_to?(:xpath)\n ast.xpath(\"//fcall/ident[@value = 'search']\")\n end", "def search keyword\n result = Set.new\n matched = Array.new\n @frame_tree_root_node.each{|node|\n if node.content =~ /#{keyword}/i\n matched << node.name\n end\n } \n @frame_tree_root_node.each{|node|\n if node.is_root?\n result << node.name\n elsif matched.include? node.name\n result << node.name #add id\n node.parentage.each{|item|\n result << item.name\n }\n end\n }\n @frame_tree_root_node.print_tree\n result\n end", "def css_class(hay, needle); end", "def find_css\n @dom.css(STYLE_ELEMENT_QUERY).map { |element| read_stylesheet(element) }.compact\n end", "def find(selector)\n DOM::Element.from_node `#{@el}.querySelector(#{selector}) || Opal.nil`\n end", "def find_child(search_term, category)\n found_nodes = []\n traverse do |node|\n case category\n when \"description\"\n if node.description =~ /#{Regexp.quote(search_term)}/i\n found_nodes << node\n end\n when \"structure_marker\"\n if node.structure_marker =~ /#{Regexp.quote(search_term)}/i\n found_nodes << node\n end\n when \"file_name\"\n #first steps to make search robust; replace whitespace with underscore to mimic file string\n search_term.strip!\n search_term.gsub!(/\\s+/, '_')\n if node.file_name =~ /#{Regexp.quote(search_term)}/i\n found_nodes << node\n end\n else\n end\n end\n found_nodes\n end", "def search_results\r\n @browser.divs(class: 'rc').collect do |div|\r\n div.h3.a.text\r\n end\r\n end", "def find_place(match)\n find = proc do |node|\n if node.text?\n formatted_text = node.text.strip\n unless formatted_text.empty?\n res = formatted_text.match?(\n /^[a-záàâãéèêíïóôõöúçñ\\-\\s]+ - [a-záàâãéèêíïóôõöúçñ\\s\\-]+ - [A-Z]{2}$/i\n )\n next formatted_text if res\n end\n end\n nil\n end\n\n depth_search(match, find)\n end", "def fragment string\n doc = parse(string)\n fragment = XML::DocumentFragment.new(doc)\n finder = lambda { |c, f|\n c.each do |child|\n if string == child.content && child.name == 'text'\n fragment.add_child(child)\n end\n fragment.add_child(child) if string =~ /<#{child.name}/\n end\n return fragment if fragment.children.length > 0\n\n c.each do |child|\n finder.call(child.children, f)\n end\n }\n finder.call(doc.children, finder)\n fragment\n end", "def parts\n @body.xpath('./a:part', a: NS)\n end", "def jira_search\n\n @lunch_special = SlackJIRABot.new\n doc = Nokogiri::HTML(open('http://www.truetastes.com/anitas-cafe-lunch-catering/'))\n\n ####\n # Search for nodes by css\n\n if(doc)\n doc.css('div.specials_copy').each do |specials|\n @lunch_special.html_content = specials.inner_html\n @lunch_special.text_content = specials.content\n end\n end\n\n return @lunch_special\n\nend", "def scan_tags(string, &block)\n raise \"No block given\" unless block_given?\n\n fragment = Nokogiri::HTML::DocumentFragment.parse string\n fragment.traverse do |node|\n yield(node.content) if node.text?\n end\n nil\n end", "def html_nodes\n document = Nokogiri::HTML(@file.content)\n document.css(@config['record_css_selector'])\n end", "def query_selector(selector)\n document.query_selector selector\n end", "def find_node(results, node_name)\n document = ::Nokogiri::XML(results.body)\n document.remove_namespaces!\n document.xpath(\"//#{node_name}\").first\n end", "def node_css_selector(node)\n return nil if node.nil?\n\n # Use the CSS id if one is set\n return \"##{node['id']}\" if node['id']\n\n # Default Nokogiri selector\n node.css_path.gsub('html > body > ', '')\n end", "def search(finish, node = @root, complete = [], inprogress = [])\n inprogress << node\n\n print_path(finish, inprogress) if node.value == finish\n\n node.children.each do |child|\n search(finish, child, complete, inprogress)\n end\n\n complete << node\n inprogress.delete(node)\n end", "def css_class_standard(hay, needle); end", "def find_fragment(type)\n @documents.each do |document|\n return document.find_fragment(type)\n end\n end", "def each_element (xpath=\"*\", &block)\n self.find_match(xpath).each{ |n| yield n }\n end", "def fragment?\n start_with?('#')\n end", "def search(xpath)\n context = current_context\n begin\n if namespaces.default && !xpath.include?(':') \n find(namespaced(xpath),\n in_default_namespace(namespaces.default.href))\n else \n #find(xpath)\n context.find(xpath) \n end\n rescue Exception => ex\n raise ex, xpath\n end\n end", "def find_header_node(doc)\n case @page.format\n when :asciidoc\n doc.css(\"div#gollum-root > h1:first-child\")\n when :pod\n doc.css(\"div#gollum-root > a.dummyTopAnchor:first-child + h1\")\n when :rst\n doc.css(\"div#gollum-root > div > div > h1:first-child\")\n else\n doc.css(\"div#gollum-root > h1:first-child\")\n end\n end", "def node_at(line, column); end", "def parse\n #Target\n doc = nokogiriDoc(@target)\n \n doc.xpath(\"//#{@xmlns}spectrum_query\").each do |query|\n count = query.xpath(\".//#{@xmlns}search_hit\").length\n 1.upto(count) {|i| @matches << psm(query, \"1\", i)}\n end\n GC.start # More memory can be salvaged by placing this before the end, but speed greatly declines.\n \n #Decoy\n doc = nokogiriDoc(@decoy)\n \n doc.xpath(\"//#{@xmlns}spectrum_query\").each do |query|\n count = query.xpath(\".//#{@xmlns}search_hit\").length\n 1.upto(count) {|i| @matches << psm(query, \"-1\", i)}\n end\n GC.start\n end", "def section(index)\n nodes.at(index)\n end", "def on_match_pattern_p(node); end", "def parsed_search(selector)\n parsed.respond_to?(:search) ? parsed.search(selector) : []\n end", "def node_search\n while (current_node = queue.shift).present? && final.nil?\n @processed += 1\n yield(current_node)\n log \"\\rProcessing #{start.name}.... %d / %d / %d / %d @ %ds - depth: %d\", @unmarked, @requeued, @processed, @steps, (Time.now - @started), current_node.depth\n end\n\n format_results\n save_results if final.present?\n self.final_path\n end", "def parse_search; end", "def sections\n @body.xpath('.//a:section', a: NS)\n end", "def search3(doc)\n doc.search('.title > a:first-child').map { |link| link.inner_text}\n end", "def search_for(index)\n p index\n @structure.each do |node|\n if node.edge_id == index \n return node end\n end\n end", "def find_refs\n # should always be there\n @proj_xml_node.css(\"Project Reference\")\n end", "def filter_tags(document)\n # Filter down and get the tags.\n @tags = document.css(TAG_CSS).map(&:children).map(&:text)\n end", "def findContact(query)\n curNode = @head\n while curNode != nil\n if curNode.data.name == query\n return curNode\n elsif curNode.next == nil\n return -1\n else\n curNode = curNode.next\n end\n end\n end", "def at_xpath(*args); end", "def at_xpath(*args); end", "def search_for_a_node_after_another( nokogiri_nodeset, first_key_word, last_key_word )\n matches_found = 0\n start_copy = false\n\n # Convert node content to text lines and scan them all:\n nokogiri_nodeset.text.split(\"\\n\").each do |line|\n\n # Search for a terminator key only if we have begun:\n if start_copy\n start_copy = false if !( line =~ /#{ last_key_word }/ui ).nil?\n # Increase sequences found on end copy:\n matches_found += 1 if !start_copy\n# DEBUG\n puts line if start_copy\n\n # Search for a start only if we haven't already found one:\n else\n start_copy = !( line =~ /#{ first_key_word }/ui ).nil?\n end\n end\n matches_found\n end" ]
[ "0.55615526", "0.5490382", "0.54466534", "0.5430819", "0.5322685", "0.5289006", "0.5241278", "0.524103", "0.5239676", "0.5239676", "0.523279", "0.5231627", "0.5204589", "0.5183271", "0.517583", "0.51520944", "0.514349", "0.5092402", "0.5076242", "0.5072232", "0.5072232", "0.5062126", "0.5038326", "0.50349855", "0.5034279", "0.50288165", "0.49916884", "0.49635", "0.49599412", "0.49582994", "0.4955555", "0.49123377", "0.49082044", "0.4906448", "0.49052012", "0.49024692", "0.49009418", "0.49005717", "0.48965", "0.4879667", "0.48781916", "0.48560733", "0.4855471", "0.4849132", "0.4837855", "0.48372132", "0.48301044", "0.48275986", "0.47937775", "0.47928324", "0.47874266", "0.47874266", "0.47868818", "0.47823012", "0.47724035", "0.47633782", "0.47618684", "0.47508246", "0.47508246", "0.4738789", "0.47317967", "0.47283643", "0.4724507", "0.47109646", "0.47102287", "0.46884906", "0.4679101", "0.46745738", "0.46642008", "0.46552938", "0.46463218", "0.46407962", "0.46404433", "0.46341962", "0.46246213", "0.4624138", "0.46237364", "0.4622747", "0.46169615", "0.46116367", "0.4610914", "0.4608629", "0.46082768", "0.46082067", "0.46034652", "0.45980033", "0.45837066", "0.4558762", "0.4557622", "0.45572957", "0.45451137", "0.45445797", "0.45413056", "0.4540383", "0.45341972", "0.45315683", "0.45282376", "0.4528071", "0.4528071", "0.45256835" ]
0.45222113
100
Renders venture setup page
def index @venture = Venture.find(params[:venture_id]) @setups = @venture.setups.order(:year) @selected_setup = @setups.where(year: params[:year]).first @categories = @selected_setup.categories @dimension = params[:dimension] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html(req)\n @subsection = 'vehicle-view'\n @title = \"#{@vehicle.name}\"\n log.info('type=measure.render template=admin/vehicle/view.erb')\n render 'admin/vehicle/view.erb'\n end", "def speaker_tunings\n @page_title = \"Speaker Tunings\"\n render_template\n end", "def before_GET(req)\n super\n @subsection = 'vehicle-list'\n @title = \"Welcome back #{dealership(req).name}\"\n end", "def index\n @main_page = \"Admin\"\n @page_title = \"Configurações\"\n @setups = Setup.all\n end", "def show\n render_wizard\n end", "def setup\n # If account setup, redirect to Studies page\n # if @me.setup\n # flash.alert = \"Error: Page not accessible\"\n # redirect_to studies_path\n # end\n end", "def index\n #respond(\"<pre>\" + request.env.inspect + \"</pre>\")\n @title = \"Welcome to Pastr!\"\n end", "def show\n\t\t#will have template\n\tend", "def index\n # seeker_result Site, \"div.site_list\" # , clear_tags: true\n response_service.title = 'Sites'\n smartrender \n end", "def about; render; end", "def verify_landing_page\n @higgs.page_title_present?('Puppet Enterprise Installer')\n @higgs.link_present?('email the CEO.')\n @higgs.select_link(\"Let's get started\")\n @higgs.page_title_present?('Puppet Enterprise Installer - Choose your deployment')\n end", "def setup \n @pdf_name = \"pdf name\"\n @options = { :pdf_layout => \"reports_layout.pdf.erb\", :pdf_template => \"reports/report.pdf.erb\", \n :render_options => {\n :header_right => 'Page [page] of [toPage]',\n :grayscale => true,\n :page_size => 'Letter'} \n } \n @page = \"<html><head><head><body><b>Hello</b> World</body></html>\" \n \n TooRendermonkey.configure = {\n :uri => \"http://localhost:4567/generate\",\n :api_key => \"835a3161dc4e71b\",\n :hash_key => \"sQQTe93eWcpV4Gr5HDjKUh8vu2aNDOvn3+suH1Tc4P4=\"\n } \n end", "def signup\r\n\t@title = \"Sign Up\"\r\n end", "def GoToVMFVendorPage\n vmf_vendor_section.vendor_page_link.click\n\n ShopByVendorPage.new\n end", "def display\n if command\n write_green \"\\t#{hname}\"\n command && write_cyan(\"\\t vite-faits #{command}\")\n end\n # TODO Quand on pourra sortir une version HTML, on pourra mettre\n # un lien vers le mode d'emploi.\n # manuel && puts(\"\\t Ancre manuel : ##{manuel}\")\n end", "def show\n @page_title='Aktuator'\n end", "def show\n @main_page = \"Admin\"\n @page_title = \"Configuração\"\n end", "def set_info\n @page_header = 'Insight Engine'\n @page_secondary = 'Let\\'s get a view at 10,000 feet.'\n @page_title = 'LeadAccount | Insight Engine'\n @page_icon = 'lightbulb'\n end", "def create\n venture = Venture.create!(venture_params.merge(user_id: current_user.id))\n redirect_to setup_path(venture.id, venture.setups.first.year)\n end", "def show_intro_fish_tank\n display_title_intro\n Visual.show_intro_fish_tank\n end", "def visit_header\n composer.text_box 'Prepare for your visit', at: [30, composer.bounds.top - 405], size: 16, style: :bold\n end", "def show\n view_options(\n full_width: true,\n small_footer: @game.uses_small_footer? || enable_scrolling?,\n has_i18n: @game.has_i18n?\n )\n end", "def init\n @title_page = 'Pine app'\n erb :welcome, layout: :template\nend", "def show\n setup_variables(params)\n\n end", "def show\n redirect_to configattribs_path \n end", "def after_view_setup\n end", "def new\n @option = Vger::Resources::Suitability::Option.new\n respond_to do |format|\n format.html\n end\n end", "def create\n @setup = EsSetup.new(params[:setup])\n if @setup.save\n flash[:notice] = 'Ce paramétrage a été correctement créé.'.trn\n redirect_to :action => \"list\"\n else\n render :action => 'new'\n end\n end", "def show\n @bg_gray = true\n respond_to do |format|\n format.html\n format.pdf do\n render :pdf => 'obj_vend_pdf', \n :template => 'vendedors/obj_vend_pdf.html.erb',\n :layout => 'pdf.html.erb',\n :orientation => 'Portrait',# default Portrait\n :page_size => 'Legal'\n end\n end\n end", "def show\n puts \"------------------- settings -------------------\"\n puts \"Application: #{application}\"\n puts \"Branch: #{branch}\"\n puts \"Stage: #{stage}\"\n puts \"Deployer: #{deployer}\"\n puts \"Local User: #{get_local_user}\"\n puts \"URL: #{webhook_url}\"\n puts \"------------------------------------------------\"\n end", "def prepare_view\n @title = \"Hothackers\"\n end", "def sign_up\n request_params = {\n host_url_with_protocol: host_url_with_protocol,\n host_url: host_url,\n entity_type: GlobalConstant::TemplateType.registration_template_type\n }\n service_response = GlobalConstant::StTokenSale.get_client_details(request_params)\n\n # Check if error present or not?\n unless service_response.success?\n render_error_response(service_response)\n return\n end\n\n @presenter_obj = ::Web::Client::Setup.new(service_response, params)\n\n redirect_to '/token-sale-blocked-region', status: GlobalConstant::ErrorCode.temporary_redirect and return if @presenter_obj.is_blacklisted_ip?(get_ip_to_aml_countries)\n redirect_to \"/login\", status: GlobalConstant::ErrorCode.temporary_redirect and return if @presenter_obj.has_registration_ended?\n set_page_meta_info(@presenter_obj.custom_meta_tags)\n end", "def get_signup(req)\n render template_path()\n end", "def show\n @page_title = \"Voluntips | Projekt: \" + @project.title\n set_show_keywords\n end", "def about\n render :template =>\"bodysize/about\"\n end", "def show\n @venue = Venue.from_param(params[:id])\n @page_title = @venue.page_title \n# render :layout => \"user\"\n end", "def generate_vagrant_config\n template = Souffle::Template.new('Vagrantfile.erb')\n temp_binding = OpenStruct.new\n temp_binding.version = Souffle::VERSION\n \n template.render(temp_binding)\n end", "def generate_version_list\n @list_title = 'Version List'\n @list_type = 'version'\n\n asset('version_list.html', erb(:full_list))\nend", "def index\n @title = \"Welcome to Pastr, #{request.env[\"REMOTE_USER\"]}.\"\n end", "def preview\r\n\t\t\trender(\"option_#{self.id}_preview\")\r\n\t\tend", "def show\n load_service\n return if (@service.blank?)\n\n # Add custom views paths\n prepend_view_path \"app/views/services\"\n prepend_view_path \"lib/probes/#{@service.probe}/views\"\n\n respond_to do|format|\n format.html\n end\n end", "def new_config_content\n return <<-VHOST\n\n# vh configuration file\nInclude #{@target}\n# /vh configuration file\n VHOST\n end", "def index \n \n @title=\"Administration page - \"\n \n end", "def template_guide\n @title = \"Template Guide\"\n end", "def show\n \n if current_account\n @header_tab = \"tour\"\n @review = Review.new\n render :layout => \"admin\"\n else\n if (@tour.interest and @tour.place == false) then\n @header_tab = \"interest\"\n elsif (@tour.place) then\n @header_tab = \"location\"\n else\n @header_tab = \"tour\"\n end\n render :template => \"tours/show\", :layout => \"application\"\n end\n end", "def view; end", "def show\n _render member: @shop_claim, flag: :complete\n end", "def body(opts={})\n <<-END\n <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>\n <Enabled>#{opts[:enabled]}</Enabled>\n <ChangeSid>#{opts[:change_sid]}</ChangeSid>\n <VirtualMachineId>#{opts[:virtual_machine_id]}</VirtualMachineId>\n <JoinDomainEnabled>#{opts[:join_domain_enabled]}</JoinDomainEnabled>\n <UseOrgSettings>#{opts[:use_org_settings]}</UseOrgSettings>\n <AdminPasswordEnabled>#{opts[:admin_password_enabled]}</AdminPasswordEnabled>\n <AdminPasswordAuto>#{opts[:admin_password_auto]}</AdminPasswordAuto>\n <ResetPasswordRequired>#{opts[:reset_password_required]}</ResetPasswordRequired>\n <CustomizationScript>#{CGI::escapeHTML(opts[:customization_script]).gsub(/\\r/, \"&#13;\")}</CustomizationScript>\n <ComputerName>#{opts[:computer_name]}</ComputerName>\n END\n end", "def configure\n render_text ''\n end", "def show_fusion_vm_config(options)\n fusion_vmx_file = \"\"\n exists = check_fusion_vm_exists(options)\n if exists == true\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n if File.exist?(fusion_vmx_file)\n print_contents_of_file(options,\"#{options['vmapp']} configuration\",fusion_vmx_file)\n end\n end\n return\nend", "def view_label_for_carton_setup\n params[:id].gsub!(\"!\", \"\")\n\n pack_station = session[:current_pack_stations].find { |s| s.id.to_s == params[:id] }\n link = CartonLink.find_by_production_run_id_and_station_code(session[:current_production_run].id, pack_station.station_code)\n carton_setup = CartonSetup.find(link.carton_setup_id)\n puts \" carton_setup_id = \" + carton_setup.id.to_s\n @carton_label_preview = carton_setup.fg_setup.get_carton_label_preview\n carton_setup.fg_setup.set_label_values_for_run(session[:current_production_run], @carton_label_preview)\n render :template => \"/production/carton_setup/carton_label.rhtml\", :layout => 'content'\n end", "def create\n\t\tsuper\n\t\tshow(PLACEMENT_SCREEN)\n\tend", "def show\n @user = current_user\n @organization = Organization.find(session[:organization_id])\n render_wizard\n end", "def index\n @venues = Venue.all.order('name')\n @page_title = \"Event venues around Cornwall\"\n end", "def show\n\t\t end", "def load_index_page\n @page ||= Language.current_root_page\n render template: \"alchemy/welcome\", layout: false if signup_required?\n end", "def show\n redirect_to root_path unless ViewTemplate.new(current_merchant_user, current_admin).check\n end", "def show\n @titulo = \"Ver Pedido\"\n @clase = \"Pedidos\"\n end", "def set_info\n @page_header = 'Dashboard'\n @page_title = 'LeadAccount | Dashboard'\n @page_icon = 'dashboard'\n end", "def render\n Vedeu.render_output(output) if visible?\n end", "def configure_pack_material\n return if authorise_for_web('pack_material_product','create')== false\n\tbegin\n\t\trender :inline => %{\n\t\t<% @content_header_caption = \"'select pack material type and subtype'\"%> \n\n\t\t<%= build_set_type_form('configure_pack_material_step2')%>\n\n\t\t}, :layout => 'content'\n\t rescue\n\t handle_error(\"Pack material form could not be rendered\")\n\t end\n\n\nend", "def show\n set_page_title_for 'show',\n name: @theme.radical,\n description: @theme.description.present? && \": #{@theme.description}\"\n\n @screenshot = @variant.screenshots.find_by(mode: @mode)\n @url = @theme.url.nil? ? \"https://melpa.org/#/#{@theme.name}\" : @theme.url\n end", "def show\n # redirect_to \"/jugadalots/new\", notice: \"NO PERMITIDO SHOW.\" and return \n # Ahora entra en la parte de la vista. Esta contiene el ticket a enviar para la impresion.\n end", "def get_started\n \t@title= \"Antes de empezar...\" #Page title\n end", "def create\n super\n show(PLACEMENT_SCREEN)\n end", "def show\n\t\t@user = current_user\n\t\trender_wizard\n\tend", "def show\n\n \n end", "def show\n smartrender\n end", "def show\n smartrender\n end", "def before_GET(req)\n super\n @subsection = 'vehicle-list'\n @title = \"Manage Vehicles\"\n end", "def notemplate\n @title = 'Welcome to Viziframe!'\n \n return 'There is no template associated with this action.'\n end", "def index\n @user = current_user\n render 'signup/step2'\n end", "def show\r\n\r\n end", "def show\r\n\r\n end", "def show\r\n\r\n end", "def show\n #render template: \"hello_world/show\"\n render template: \"layouts/_commoncorelogo\"\n end", "def show\n # If not authenticating/-ed: block all further action.\n step == :authenticate or session[:authenticated] or\n return redirect_to wizard_path(:authenticate)\n\n # Differ the current step to load the current settings for display.\n case step\n\n # The first step authenticates the server-root-user. Generate a token that\n # he can read from the file-system.\n when :authenticate\n File.write('SETUP_CODE', SecureRandom.base64(32))\n\n # Domain- and mailer-steps alter global server configuration via the\n # SettingsHelper. They are provided with current settings.\n when :domain, :mailer\n get_settings\n\n # If no setting is set, provide the user with default settings.\n defaults = {\n domain: request.base_url,\n redis: 'redis://localhost:6379',\n timezone: 'UTC',\n email_server: 'smtp.gmail.com',\n email_port: 587\n }\n defaults.each { |k, v| @settings[k] ||= v }\n\n # Here a new server is generated. Create an empty one to not let the form\n # screw up.\n when :server\n @server = Server.new\n\n # Something went wrong: Nobody should be here.\n when :finish\n return redirect_to root_path\n end\n\n # Finally let wicked decide what to render.\n render_wizard\n end", "def get_started\n html = Views::MainHtmlWrapper.new(:helper_template => @helper_template).to_pretty\n end", "def complement_revenu\n render layout: 'landing'\n end", "def show_result(collection:)\n show do\n title 'Test Plate Setup'\n table highlight_non_empty(collection)\n end\n end", "def show\n\t#@step = user_information\n end", "def initialize ()\n\t\t\t\t@template_info =\n\t\t\t\t{\n\t\t\t\t\t:name => \"talking_points\",\n\t\t\t\t\t:author => \"hammackj\",\n\t\t\t\t\t:version => \"0.0.2\",\n\t\t\t\t\t:renderer => \"PDF\",\n\t\t\t\t\t:description => \"Generates a Talking Points NessusReport\"\n\t\t\t\t}\n\t\t\tend", "def version\n render layout: \"layouts/full_page\"\n end", "def version\n render layout: \"layouts/full_page\"\n end", "def print_employer_instructions\n\n # Start new page.\n self.start_new_page()\n\n # Employer copy.\n employer = File.read(Rails.root.join('lib', 'assets', 'w2_employer.htm'))\n self.vms_text_box(employer, 0.25, 10.75, 3.75, 5, 8, :normal, :left, :center)\n self.vms_text_box(employer, 4.5, 10.75, 3.75, 5, 8, :normal, :left, :center)\n self.vms_text_box(employer, 0.25, 5.25, 3.75, 5, 8, :normal, :left, :center)\n self.vms_text_box(employer, 4.5, 5.25, 3.75, 5, 8, :normal, :left, :center)\n\n end", "def create\n super\n show(PLACEMENT_SCREEN)\n end", "def show\n\t end", "def shareview\n # set default\n @template = 'slideshow_customv3'\n if @view_options.has_key?(params[:v].to_i) \n @template = 'slideshow_customv'+ params[:v] \n end\n # the main share view\n # pulls in the child view\n render 'shareshow' \n \n end", "def home\n # check if signed_in and then display (you are currently signed in, view your profile)\n # automatically renders page 'users/home'\n if signed_in?\n redirect_to current_user\n else\n @event = Event.find(ENV['demopage'].to_i)\n @event_code = @event.event_code\n @url = demo_record_vg_url(:event_code => @event.event_code)\n\n\n @first_plan = Plan.find_by_my_plan_id(plan_set_one) # sets @first_plan the first plan object ACCORDING TO MY LEGEND (with my_plan_id)\n @second_plan = Plan.find_by_my_plan_id(plan_set_two)\n @third_plan = Plan.find_by_my_plan_id(plan_set_three)\n render :unsigned_home, :layout => nil\n end\n\n end", "def show\n case step\n when :verify_mobile\n skip_step if current_user.mobile_verified?\n # TODO: Remove this once SMS provider has been added\n @otp = Redis.current&.get(current_user.id)\n when :enter_address\n skip_step if current_user.address_entered?\n @address = Address.find_or_initialize_by(user: current_user, address_type: :permanent)\n when :upload_docs\n skip_step if current_user.docs_uploaded?\n @user_document = UserDocument.find_or_initialize_by(user: current_user)\n end\n render_wizard\n end", "def show\n @full_width = true\n\n @volunteer = @agency.volunteers.new\n @client = @agency.clients.new\n end", "def template_setup\n content_for :content_title, \"Dashboard\".html_safe\n end", "def options\n render nothing: true\n end", "def display_intro\n # Display Company Logo\n display_logo\n # Display Emergency Information\n display_emergency_info\n end", "def view\n end", "def rendered; end", "def show\n # DEMO_EMAILS allows interal salespeople to continue using the same voucher and keep pushing the 'redeem button' during demos\n if @voucher.customer.demo_account\n render :show\n elsif @voucher.redeemed\n if @voucher.within_redemtion_period?\n # Not sure why the time is 8hrs ahead on Heroku's servers. Something with timezone for sure\n @redemtion_expiration = @voucher.redeemed.localtime + Voucher::REDEMPTION_PERIOD + 1.hour\n render :good\n else\n render :no_good\n end\n else\n render :show\n end\n end", "def create_landing\r\n\r\n end", "def initialize\n\t\t\t\t@template_info =\n\t\t\t\t{\n\t\t\t\t\t:name => \"talking_points\",\n\t\t\t\t\t:author => \"hammackj\",\n\t\t\t\t\t:version => \"0.0.2\",\n\t\t\t\t\t:renderer => \"PDF\",\n\t\t\t\t\t:description => \"Generates a Talking Points Report\"\n\t\t\t\t}\n\t\t\tend", "def install_sample_files\n super\n inject_line_before root.join('apps/web/templates/application.html.erb'), '</head>', <<-HTML\n <%= vite_client %>\n <%= vite_javascript 'application' %>\n HTML\n end", "def second_step\n\t\trender :layout => 'signup' \n\t\tend" ]
[ "0.58311015", "0.5781177", "0.56914216", "0.56742245", "0.564032", "0.56344867", "0.56220275", "0.55522627", "0.5528812", "0.55119693", "0.5511121", "0.5509864", "0.550881", "0.5497669", "0.54769564", "0.5457166", "0.5448989", "0.54335266", "0.54163194", "0.5392797", "0.5379624", "0.5377406", "0.53750426", "0.537029", "0.53632545", "0.53255624", "0.53200537", "0.5317254", "0.53122216", "0.5307644", "0.53021735", "0.52746314", "0.52668786", "0.52664804", "0.52569807", "0.52502453", "0.5236939", "0.5231551", "0.5222771", "0.52131325", "0.52124286", "0.52001643", "0.5196898", "0.51964206", "0.51954526", "0.51939386", "0.5193089", "0.51894945", "0.51784515", "0.5175635", "0.51707244", "0.51659656", "0.516437", "0.51559615", "0.5149807", "0.5149461", "0.5145603", "0.51433116", "0.51425797", "0.51409376", "0.5140225", "0.5136346", "0.5133238", "0.5122765", "0.5121392", "0.5114092", "0.51098067", "0.5109032", "0.5109032", "0.5106387", "0.5104034", "0.5103667", "0.51005435", "0.51005435", "0.51005435", "0.5099812", "0.5094033", "0.50876445", "0.5084747", "0.5081071", "0.5080618", "0.5079818", "0.5075673", "0.5075673", "0.5074886", "0.50747895", "0.5073945", "0.5073907", "0.5069647", "0.50696087", "0.50685793", "0.5067958", "0.5066189", "0.50651485", "0.50648135", "0.50612247", "0.50586987", "0.504905", "0.5048253", "0.50458115", "0.5045537" ]
0.0
-1
Renders archived positions page
def archived_positions @positions = Venture.find(params[:venture_id]).setups.where(year: params[:year]).first.positions.archived end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def archive\n render :file => cache_file and return if cached_file?\n @document = Document.public.find_by_path(params[:path].join('/'))\n raise ActiveRecord::RecordNotFound if @document.nil?\n\n \n @documents = @document.archive_for(params[:month], params[:year]).paginate :page => params[:page], :per_page => Settings.documents.per_page\n render :template => view_for(:suffix => '_archive')\n cache_this_page!\n end", "def archived\n now = Time.now\n @title = 'Menneet tapahtumat'\n @events = Event.find_recent(100).select { |e| e.date < now }\n\n respond_to do |format|\n format.html { render :action => :index }\n format.xml { render :xml => events }\n end\n end", "def index\n @positions = Position.all(:order=>'name')\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end", "def show\n redirect_to positions_path\n end", "def index\n @positions = Position.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end", "def show\r\n @positions.each do |p|\r\n\t puts p.inspect\r\n\tend\r\n end", "def index\n @company = Company.find(params[:company_id])\n @positions = @company.positions\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end", "def index\n @committee_positions = CommitteePosition.all\n end", "def archive\n next_offset = params[:offset].to_i + MEDITATIONS_PER_PAGE\n @meditations = Meditation.publicly_visible.preload_for(:preview).offset(params[:offset]).limit(MEDITATIONS_PER_PAGE)\n return unless stale?(@meditations)\n\n if Meditation.publicly_visible.count <= next_offset\n @loadmore_url = nil\n else\n @loadmore_url = archive_meditations_path(format: 'js', offset: next_offset)\n end\n\n respond_to do |format|\n format.html do\n @breadcrumbs = [\n { name: StaticPage.preview(:home).name, url: root_path },\n { name: StaticPage.preview(:meditations).name, url: meditations_path },\n { name: translate('meditations.title'), url: archive_meditations_path },\n { name: translate('meditations.archive.title') },\n ]\n\n set_metadata({ 'title' => translate('meditations.title') })\n render :archive\n end\n\n format.js do\n render :archive\n end\n end\n end", "def show\n @executive_position = ExecutivePosition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @executive_position }\n end\n end", "def index\n @positions = Position.all\n end", "def index\n @positions = @portfolio.positions\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 index\n @drafts = @compare.drafts.reorder('id')\n #order(\"id DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @drafts }\n end\n end", "def index\n @archived_page = request.path =~ /archived/\n @job_offers = @archived_page ? @job_offers_archived : @job_offers_active\n\n render layout: 'admin/simple'\n end", "def update_positions\n params[\"edit_template_area_#{params[:id]}\"].each_with_index do |id, position|\n TemplateBox.update(id, :position => position)\n end\n init_template_areas\n #render :layout => false,\n # :partial => \"template_area\",\n # :object => @template_areas.find{|a| a.id == params[:id].to_i} #TODO Dry it\n flash[:notice] = \"Reihenfolge gespeichert\"\n render :update do |page|\n page.reload\n end\n end", "def index\n respond_to do |format|\n format.html { render action: 'index' } # index.html.erb\n format.json # index.json.erb\n format.xml { render xml: positions }\n end\n end", "def index\n @archive_faqs = ArchiveFaq.order('position ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @archive_faqs }\n end\n end", "def index\n @az_tariffs = AzTariff.find(:all, :order => 'position')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @az_tariffs }\n end\n end", "def show\n @alignment_position = AlignmentPosition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @alignment_position }\n end\n end", "def index\n page_title = params[:page]\n @page = @wiki.find_or_new_page(page_title)\n if @page.new_record?\n edit\n render :action => 'edit' and return\n end\n @content = @page.content_for_version(params[:version])\n if params[:export] == 'html'\n export = render_to_string :action => 'export', :layout => false\n send_data(export, :type => 'text/html', :filename => \"#{@page.title}.html\")\n return\n elsif params[:export] == 'txt'\n send_data(@content.text, :type => 'text/plain', :filename => \"#{@page.title}.txt\")\n return\n end\n render :action => 'show'\n end", "def show\n @position = Position.find(params[:id])\n @dictionary = Dictionary.find(:all)\n @conceptual = @position.responsibilities.find(:all, :order => \"r_position\", :conditions => {:indicator => 1})\n @implementation = @position.responsibilities.find(:all, :order => \"i_position\", :conditions => {:indicator => 2})\n @support = @position.responsibilities.find(:all, :order => \"s_position\", :conditions => {:indicator => 3})\n @compliance = @position.responsibilities.find(:all, :order => \"c_position\", :conditions => {:indicator => 4})\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position }\n format.pdf do\n pdf = PositionPdf.new(@position, @dictionary, @conceptual, @implementation, @support, @compliance)\n send_data pdf.render, filename: \"JD_#{@position.job_title}\",\n type: \"application/pdf\",\n disposition: \"inline\"\n end\n end\n end", "def show\n respond_to do |format|\n format.html { redirect_to(archive_url) if @game.finished? }\n format.xml { render :xml => @game }\n end\n end", "def index\n @pages = Page.find(:all, :order => \"position DESC\")\n\n respond_to do |wants|\n wants.html # index.html.erb\n wants.xml { render :xml => @pages }\n end\n end", "def index\n @template_positions = TemplatePosition.all\n end", "def show\n @position = Position.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @position }\n \n end\n end", "def archive\n perform_action(:post, 'archive')\n end", "def show\n @cad_position = CadPosition.find(params[:id])\n render :layout=>\"admins\"\n end", "def show\r\n @position_hist = PositionHist.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.rhtml\r\n format.xml { render :xml => @position_hist.to_xml }\r\n end\r\n end", "def index\n @department_positions = DepartmentPosition.all\n end", "def render_index(updates)\n @updates = updates\n set_pagination\n render :index, :layout => show_layout?\n end", "def archives\n render :template => \"blog_posts/archives\"\n end", "def index\n @pos = Po.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pos }\n end\n end", "def show\n @position = Position.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @position }\n end\n end", "def index\n logger.debug \"cm/archives/index - session_id: #{request.session_options[:id]}\"\n @archives = @current_user.archives\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @archives }\n end\n end", "def positions\n @boards = current_company.boards.decorate\n end", "def archive\n @truncate_posts = true\n year = params[:year]\n month = params[:month]\n @date = Date.parse(\"#{year}-#{month}-01\").strftime('%B, %Y')\n @posts = Post.from_archive(year, month)\n\n if can? :read_drafts, Post\n @posts = @posts.recent\n else\n @posts = @posts.recently_published\n end\n\n respond_to do |format|\n format.html { @posts = @posts.page(params[:page]).per(10) }\n format.json { }\n end\n end", "def process\n self.reset\n self.read_layouts\n\n self.zones = self.read_zones\n # pp self.zones\n\n self.transform_pages\n end", "def index\n @order_positions = OrderPosition.all\n end", "def pos_page_body\n pos_fil_header + size_fil_header\n end", "def index\n @positions = Position.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @positions }\n end\n end", "def index\n @positions = current_user.positions.all\n end", "def archives\n @response, @documents = search_service.fetch(Array(params[:id]))# unless !params[:id].to_s.include?(\"repositories\")\n respond_to do |format|\n format.refworks_archives { render :layout => false }\n end\n end", "def index\n if params[:archived]\n @pages = Page.deleted.order(updated_at: :desc).page(params[:page]).preload(:versions)\n else\n @pages = Page.not_deleted.order(updated_at: :desc).page(params[:page]).preload(:versions)\n end\n end", "def index\n prawnto :prawn => {\n :page_size => PdfSpecs::PAGE_SIZE, # (Handy Dandy page size)\n :margin => PdfSpecs::PAGE_MARGIN # Top, Right, Bottom, Left\n }\n @dispatch_centers = DispatchCenter.find(:all, :order => :name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dispatch_centers }\n format.pdf # index.pdf.prawn\n end\n end", "def index\n set_sort_params(params, params[:edition])\n find_editions(params)\n \n #exclude_unpublished\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @editions }\n format.atom\n end\n end", "def update_order\n update_positions params[:sorted_ids]\n render nothing: true\n end", "def archive\n delete_content\n filename = 'archive.' + $el.file_name_nondirectory(buffer_file_name)\n timestamp = \"--- archived on #{Time.now.strftime('%Y-%m-%d at %H:%M')} --- \\n\"\n append_to_file timestamp, nil, filename\n append_to_file content, nil, filename\n end", "def index\n @part_positions = PartPosition.paginate(:page => params[:page])\n end", "def archive\n delete_content\n filename = 'archive.' + $el.file_name_nondirectory(buffer_file_name)\n timestamp = \"--- archived on #{Time.now.strftime('%Y-%m-%d at %H:%M')} --- \\n\"\n $el.append_to_file timestamp, nil, filename\n $el.append_to_file content, nil, filename\n end", "def active_positions\n authenticated_post(\"auth/positions\").body\n end", "def show_document\n\tprint_header\n\tprint_document\n\tprint_footer\nend", "def update\n respond_to do |format|\n if position.save\n format.html { redirect_to( position, flash: { success: 'Position updated.' } ) }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: position.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @part_positions = PartPosition.paginate(:page => params[:page], :per_page => 100)\n end", "def index\n @revisions = @page.revisions.sort { |a, b| b.created_at <=> a.created_at }\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @revisions }\n end\n end", "def archive\n @project = Project.find(params[:id])\n @project.archive\n\n respond_to do |format|\n format.html { redirect_to request.referer}\n format.json { head :no_content }\n end\n end", "def create\n\t\t@archive = Archive.new(params[:archive])\n\n\t\trespond_to do |format|\n\t\t\tif @archive.save\n\t\t\t\tformat.html { redraw() }\n\t\t\t\tformat.xml { render :xml => @archive, :status => :created, :location => @archive }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @archive.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def index\n get_sorted_objects(params)\n render :template => 'sortable/index'\n end", "def index\n @events = Event.where(archived: nil).order(\"updated_at desc\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end", "def index\r\n \r\n @position_hists = session[:facility].position_hists\r\n \r\n respond_to do |format|\r\n format.html # index.rhtml\r\n format.xml { render :xml => @position_hists.to_xml }\r\n end\r\n end", "def index\n @item_formats = ItemFormat.find(:all, :order => 'position ASC')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @item_formats.to_xml }\n end\n end", "def destroy\n @executive_position = ExecutivePosition.find(params[:id])\n @executive_position.destroy\n\n respond_to do |format|\n format.html { redirect_to(executive_positions_url) }\n format.xml { head :ok }\n end\n end", "def in_archive?\n self.display\n end", "def index\n @image_position_templates = ImagePositionTemplate.ordered\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @image_position_templates }\n end\n end", "def save_pos\n output_stream.print \"#{CSI}s\"\n if block_given?\n yield\n load_pos\n end\n end", "def create\n @position = Position.new(params[:position])\n positions = Position.find(:all, :conditions => [\"layout_template_id = ?\",params[:position][:layout_template_id]])\n if positions.size == 0\n @position.main_position = true\n else\n @position.main_position = false\n end\n\n render :update do |page|\n if @position.save\n page.insert_html :after, \"layout_template_#{@position.layout_template_id}\", :partial => \"positions/row_form\",\n :locals => {:position => @position, :counter => LayoutTemplate.find(:all).index(@position.layout_template)}\n end\n end\n end", "def index\n @managers_positions = Managers::Position.all\n end", "def export_archive\n if flash[:archive]\n if flash[:archive] == \"true\"\n result = Urlmaster.where(:archive => \"archive\").order(:archiveTime => :desc)\n nameArc = \"Archive\"\n elsif flash[:archive] == \"false\"\n result = Urlmaster.where(:archive => nil)\n nameArc = \"NotArchive\"\n end \n end\n # `result` variable contains list needed to export\n head = 'EF BB BF'.split(' ').map{|a|a.hex.chr}.join()\n exportFile = CSV.generate(csv = head) do |writer|\n writer << [\"mapId\", \"venueName\", \"floor\", \"typeMap\", \"venueFloorMapImageUrl\", \"venueFloorMapUrl\"]\n result.each do |r|\n writer << [r[:mapId], r[:venueName], r[:floor], r[:typeMap], r[:venueFloorMapImageUrl], r[:venueFloorMapUrl]]\n end\n end\n send_data exportFile, filename: \"MapCrawler-\" + nameArc + \"-#{Time.now.in_time_zone(\"Asia/Tokyo\").strftime(\"%y%m%d%H%M%S\")}.csv\", type: \"text/csv\"\n end", "def index\n @positions = @mold.positions\n @photos = @mold.photos.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @positions }\n end\n end", "def index\n @port_items = Portfolio.by_position\n @page_title = \"Portfolio Projects\"\n end", "def index\n @facility_position_numbers = PositionNumber.send(:with_exclusive_scope) do\n session[:facility].position_numbers.sort {|a,b| a.position_num <=> b.position_num}\n end\n @employee_position_hists = EmployeePositionHist.generic_for_position_numbers(@facility_position_numbers.map(&:id))\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @employee_position_hists.to_xml }\n end\n end", "def render_index(updates)\n @updates = updates\n set_pagination\n render :index, :layout => show_layout?\n end", "def index\n @articles = Article.all(:order=> \"created_at DESC\")\n @archive_items = Article.all(:order=> \"created_at DESC\")\n @title = \"Archive\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def render(debug = false)\n add_page_numbers\n @compression = false if $DEBUG or debug\n @arc4.init(@encryption_key) unless @arc4.nil?\n\n check_all_here\n\n xref = []\n\n content = \"%PDF-#{@version}\\n%âãÏÓ\\n\"\n pos = content.size\n\n objects.each do |oo|\n cont = oo.to_s\n content << cont\n xref << pos\n pos += cont.size\n end\n\n# pos += 1 # Newline character before XREF\n\n content << \"\\nxref\\n0 #{xref.size + 1}\\n0000000000 65535 f \\n\"\n xref.each { |xx| content << \"#{'%010d' % [xx]} 00000 n \\n\" }\n content << \"\\ntrailer\\n\"\n content << \" << /Size #{xref.size + 1}\\n\"\n content << \" /Root 1 0 R\\n /Info #{@info.oid} 0 R\\n\"\n # If encryption has been applied to this document, then add the marker\n # for this dictionary\n if @arc4 and @encryption\n content << \"/Encrypt #{@encryption.oid} 0 R\\n\"\n end\n\n if @file_identifier\n content << \"/ID[<#{@file_identifier}><#{@file_identifier}>]\\n\"\n end\n content << \" >>\\nstartxref\\n#{pos}\\n%%EOF\\n\"\n content\n end", "def index\n @posts = Post.find(:all, :order => \"position, created_at DESC\", :include => [:assets, :comments], :conditions => \"archive=0\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "def index\n @posm_store_inventories = PosmStoreInventory.all.order(created_at: :desc)\n if @posm_store_inventories.present?\n render :index, status: :ok\n else\n @message = \"no posm found\"\n render :error, status: :not_found\n end\n end", "def generate_archives(layout)\n return unless config.archive_enabled?\n\n template = Liquid::Template.parse(File.read(\"_templates/archive_page.html\"))\n\n months = posts.group_by { |post| Date.new(post.created.year, post.created.month) }\n\n months.each do |month, posts|\n archive_path = tmp_path(archive_url_for_date(month))\n \n FileUtils.mkdir_p(archive_path)\n\n File.open(File.join(archive_path, \"index.html\"), \"w\") do |f|\n f.puts layout.render!(\"content\" => template.render!(\"site\" => self, \"month\" => month, \"posts\" => posts))\n end\n end\n end", "def index\n @niveaus = Niveau.order('position')\n authorize! :index, Niveau\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @niveaus }\n format.pdf do \n pdf = NiveauoverzichtPdf.new()\n pdf.number_pages \"<page>/<total>\", :size => 9, :at => [500, 0]\n send_data pdf.render, filename: \"niveauoverzicht.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\"\n end\n format.xls do\n send_data( Niveau.to_xls, :filename => \"niveaus_(#{Time.now.strftime(\"%d-%m-%y\")}).xls\" )\n end\n end\n end", "def index\n @position_scene1s = PositionScene1.all\n end", "def show\n respond_to do |format|\n format.html\n\n # Require on a .pdf request\n format.pdf do\n\n # Use open-uri to open images via url\n require \"open-uri\"\n\n # Create a blank pdf document with var pdf\n pdf = Prawn::Document.new\n\n # Home address\n pdf.text \"#{@home.address}\", size: 16, style: :bold\n pdf.move_down 15 \n pdf.stroke_horizontal_rule\n\n # Check to see if there is a home image.\n if @home.image_outside.present?\n # If present print image\n pdf.image open(\"#{@home.image_outside}\"), :width => 270, :at => [0, 670]\n end\n if @home.image_inside.present?\n # If present print image\n pdf.image open(\"#{@home.image_inside}\"), :width => 270, :at => [280, 670]\n end\n\n pdf.image open(\"https://chart.googleapis.com/chart?chs=100x100&cht=qr&chl=http://homey.io/homes/#{@home.id}\"), :width => 55, :at => [480, 745]\n \n table_data = \n [[\"<b>Price</b>\", \"$#{@home.price}\"], \n [\"<b>Beds</b>\", \"#{@home.beds}\"], \n [\"<b>Baths</b>\", \"#{@home.baths}\"],\n [\"<b>House Size</b>\", \"#{@home.house_size} square ft.\"],\n [\"<b>Lot Size</b>\", \"#{@home.lot_size} acres\"],\n [\"<b>Year Built</b>\", \"#{@home.year}\"]]\n pdf.move_down(230)\n pdf.table(table_data, :width => 280, :cell_style => { :inline_format => true }) \n pdf.bounding_box([300, 455], :width => 230) do\n pdf.text \"#{@home.description}\", size: 11\n end\n\n # Print the static map\n pdf.image open(\"http://maps.google.com/maps/api/staticmap?size=600x500&sensor=false&zoom=15&markers=#{@home.latitude}%2C#{@home.longitude}\"), :width => 280, :at => [0, 280]\n pdf.draw_text \"Made with <3 by Homey.io\", size: 11, :at => [0,0]\n \n # Render the pdf and set the filename to the address\n # Make the pdf render in the browser\n send_data pdf.render, filename: \"#{@home.address}.pdf\",\n type: \"application/pdf\", disposition: \"inline\"\n end\n end\n end", "def index\n \t@categories = Category.find(:all)\n if params[:query]\n\t @positions = current_user && current_user.admin? ? Position.find(:all, :conditions => [\"category_id = :query\", {:query => params[:query]}]) : Position.active\n\t\telse\n\t\t @positions = current_user && current_user.admin? ? Position.find(:all, :order => 'created_at DESC') : Position.active\n\t\tend\n\t\t\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end", "def show_avisos_publicados_fecha\n fecha = params[:fecha].to_date\n @pizarra = Pizarra.find(params[:id])\n @avisos = @pizarra.avisos.find_publicados_a_la_fecha(fecha)\n render(:update) { |page| page.replace_html 'contentNote', \n :partial =>\"pizarraHistorial\",\n :locals => {:fecha => fecha} } \n \n end", "def denormalize_position\n pages.update_all( position: position )\n end", "def index\n @projects = @sprint.projects.find(:all, :order => 'position ASC')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @projects.to_xml }\n end\n end", "def display_position\n # Fill this in\n end", "def display_position\n # Fill this in\n end", "def actualizar_view\n @usuario=@plan_horario.usuario\n @planes_horarios=@usuario.planes_horarios\n @action_name=\"edit\"\n render :update do |page|\n page.replace_html \"planes_horarios\", :file => \"planes_horarios/index\"\n page.visual_effect(:highlight, \"tr-planhorario-#{@plan_horario.id}\", :duration=>2.5)\n page << \"makeColorBox()\"\n end\n end", "def show\n @position = Position.find(params[:id])\n end", "def show\n \n if Page.count==0\n ensure_homepage\n else\n @page = @page || Page.find_by_alias(app_path)\n # TODO: add the ability for the user to choose whether to render the page or use it as a redirect\n #path = @page.path == '/' ? 'index' : @page.path\n #redirect_to @page.url unless path==app_path\n end\n\n if @page.nil?\n if admin?\n flash[:notice]=\"The page you requested does not exist. Would you like to create it?\"\n @page = Page.new(:path=>app_path)\n @page_template = \"admin\"\n render :action=>'new'\n else\n render :file => \"#{RAILS_ROOT}/public/404.html\", :layout => false, :status => 404\n end\n else\n @app_path=@page.path\n @title = @page.title\n @page_description = @page.description\n\n # Even though the printable pages are rendered in a different layout\n # they also need a different template, since this template should only\n # have a single column\n \n if params[:print] && params[:print] == \"true\"\n @page_template = \"print\"\n elsif @page.url =~ /moving_from_caregivers_menu/\n @page_template = \"template_caregivers\"\n elsif @page.url =~ /moving_from_providers_menu/\n @page_template = \"template_providers\"\n else\n @page_template = @page.template.name\n end\n \n # This isn't really necessary, but it makes the print view very clean\n @pages = [@page]\n\n if params[:popup] && params[:popup] == \"true\"\n render :action => \"show\", :layout => false\n end \n\n if params[:save] && params[:save] == \"true\"\n render_for_save\n end \n \n #Setting the body_id to caregivers to access Noah's customized css. \n #Setting the body_id to caregivers to access Noah's customized css. \n if @page.template.name == 'template_caregivers'\n @body_id = \"Caregivers\" \n @other_perspective, @other_persepective_title = 'moving_from_providers_menu' + $1, 'Health Care Provider Perspective' if @page.url =~ /moving_from_caregivers_menu(.*)/\n elsif @page.template.name == 'template_providers'\n @body_id = \"Providers\" \n @other_perspective, @other_persepective_title = 'moving_from_caregivers_menu' + $1, 'Family Caregiver Perspective' if @page.url =~ /moving_from_providers_menu(.*)/\n elsif @page.template.name == 'template_caregivers_no_menu'\n @body_id = \"Caregivers\" \n elsif @page.template.name == 'template_providers_no_menu'\n @body_id = \"Providers\" \n elsif @page.template.name == 'template_index'\n @body_id = \"Home\" \n end\n \n @left_top_menu = Page.find_by_path 'left_top_menu' \n @left_bottom_menu = Page.find_by_path 'left_bottom_menu' \n \n \n @page_template, @page_type = 'template_pdf', 1 if @page.path == 'CaregiverTool'\n @page_template, @page_type = 'template_pdf', 2 if @page.path == 'ProviderTool'\n \n end\n end", "def show\n @position = Position.find(params[:id])\n unless @position.active? || (current_user && current_user.admin?)\n flash[:notice] = \"This position is not yet avaliable, please try again later.\"\n redirect_to \"/\"\n else\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @position }\n end\n end\n end", "def update_position\n end", "def update_position\n end", "def update_position\n end", "def index\n @os_types = OsType.find(:all, :order => 'position')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @os_types }\n end\n end", "def cad\n @page_title = \"CAD Files\"\n render_template\n end", "def index\n order = params[:order] || 'updated_at DESC'\n @survivors = Survivor.paginate :page => params[:page], \n :per_page => per_page, \n :order => order, \n :include => [:profile, :location, :user]\n @locations = Location.find :all, :order => 'name ASC'\n \n respond_to do |format|\n format.fbml # index.fbml.erb\n format.xml { render :xml => @survivors }\n end\n end", "def to_entry(container, position)\n super\n Spontaneous::PagePiece.new(container.try(:owner), self, position)\n end", "def index\n @admin_archives = @login_author.archives.order(\"created_at DESC\")\n end", "def destroy\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position }\n end\n end" ]
[ "0.5944505", "0.5888091", "0.5882026", "0.5821814", "0.5705978", "0.56214726", "0.5610472", "0.5539115", "0.5460223", "0.5452496", "0.5449358", "0.5410006", "0.540135", "0.5375389", "0.53616065", "0.53390783", "0.53328735", "0.53272414", "0.5319085", "0.5318837", "0.52595586", "0.5254865", "0.52511585", "0.5249348", "0.52229154", "0.52199674", "0.52133775", "0.520555", "0.51647604", "0.5163398", "0.51580274", "0.5156407", "0.51499116", "0.51476735", "0.5145658", "0.51401", "0.5111901", "0.5111155", "0.5105127", "0.510358", "0.5097583", "0.50915504", "0.5086473", "0.5079783", "0.50638634", "0.50584334", "0.5050456", "0.5029121", "0.502112", "0.5018668", "0.5018532", "0.501578", "0.50106925", "0.499271", "0.4989499", "0.49883994", "0.49880788", "0.49875927", "0.4975184", "0.49747774", "0.49699396", "0.496861", "0.4963343", "0.4959263", "0.49577823", "0.49556896", "0.49555078", "0.49429828", "0.49421662", "0.49399608", "0.49397457", "0.49377376", "0.49354324", "0.49350795", "0.4934973", "0.49347416", "0.49321955", "0.49302647", "0.49299973", "0.49292776", "0.4923714", "0.49191642", "0.4918209", "0.4912817", "0.4912769", "0.4912769", "0.49125594", "0.4909893", "0.4908113", "0.49050498", "0.49040234", "0.49040234", "0.49040234", "0.4890952", "0.48726925", "0.48672667", "0.48628077", "0.48600578", "0.4859828", "0.4855205" ]
0.56917876
5
Renders deleted positions page
def deleted_positions @positions = Venture.find(params[:venture_id]).setups.where(year: params[:year]).first.positions.deleted end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @position = Position.find(params[:id])\n\n if @position.layout_template.positions.count > 1 && !@position.main_position\n position_id = @position.id\n @position.destroy\n render :update do |page|\n page[\"position_row_#{position_id}\"].replace \"\"\n end\n else\n render :update do |page|\n page.insert_html :top, \"layouts_errors\",:partial => \"shared/error_div\", :locals => {:errors => [t(\"cant_delete_main_panel\")]}\n page << \"$('#layouts_errors').fadeIn('slow').animate({opacity: 1.0}, 3000).fadeOut('slow', function() {$(this).html('');});\" \n end\n end\n end", "def destroy\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @position.destroy\n respond_to do |format|\n format.html { redirect_to positions_url, notice: 'Position was successfully destroyed.' }\n end\n end", "def remove_mapping\n @renderer = Renderer.find params[:id]\n @renderer.remove_mapping params[:position].to_i\n render :text => 'foo'\n end", "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_positions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @entried_position.destroy\n respond_to do |format|\n format.html { redirect_to entried_positions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n destroy_helper(@position)\n end", "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n position.destroy\n\n respond_to do |format|\n format.html { redirect_to( positions_url, flash: { success: \"Position destroyed.\" } ) }\n format.xml { head :ok }\n end\n end", "def destroy\n @position.destroy\n respond_to do |format|\n format.html { redirect_to positions_url, notice: 'Position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @position.destroy\n respond_to do |format|\n format.html { redirect_to positions_url, notice: 'Position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @position.destroy\n respond_to do |format|\n format.html { redirect_to positions_url, notice: 'Position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n \n respond_to do |format|\n format.html { redirect_to(positions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to(positions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @template_position.destroy\n respond_to do |format|\n format.html { redirect_to template_positions_url, notice: 'Template position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n\n\n @committee_position.destroy\n flash[:danger] = \"Committee Position Deleted.\"\n respond_to do |format|\n format.html { redirect_to committee_positions_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @text_position = TextPosition.find(params[:id])\n @text_position.destroy\n\n respond_to do |format|\n format.html { redirect_to text_positions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unko_position = UnkoPosition.find(params[:id])\n @unko_position.destroy\n\n respond_to do |format|\n format.html { redirect_to unko_positions_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @position_hist = PositionHist.find(params[:id])\r\n @position_hist.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to position_hists_url }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @part_position.destroy\n respond_to do |format|\n format.html { redirect_to part_positions_url, notice: 'Part position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @part_position.destroy\n respond_to do |format|\n format.html { redirect_to part_positions_url, notice: 'Part position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @position_history = PositionHistory.find(params[:id])\n @position_history.destroy\n\n respond_to do |format|\n format.html { redirect_to position_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hrms_position.destroy\n respond_to do |format|\n format.html { redirect_to hrms_positions_url, notice: 'Position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @position_state.destroy\n respond_to do |format|\n format.html { redirect_to position_states_url, notice: 'Position state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cad_position = CadPosition.find(params[:id])\n @cad_position.destroy\n\n respond_to do |format|\n format.html { redirect_to(cad_positions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @executive_position = ExecutivePosition.find(params[:id])\n @executive_position.destroy\n\n respond_to do |format|\n format.html { redirect_to(executive_positions_url) }\n format.xml { head :ok }\n end\n end", "def deco_pos; end", "def destroy\n @lcb_image_position.destroy\n respond_to do |format|\n format.html { redirect_to lcb_image_positions_url, notice: 'Lcb image position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def draw_page_index\n self.contents.gradient_fill_rect(0,0,contents.width, line_height, sc1, sc2, true)\n contents.clear_rect(0,0,1,1)\n contents.clear_rect(contents.width-1, 0,1,1)\n contents.clear_rect(0,line_height-1,1,1)\n contents.clear_rect(contents.width-1,line_height-1,1,1)\n draw_page_state\n end", "def page_drop; end", "def destroy\n @position.destroy\n respond_to do |format|\n format.html { redirect_to portfolio_positions_path(@portfolio), notice: 'Position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order_position.destroy\n respond_to do |format|\n format.html { redirect_to order_positions_url, notice: 'Order position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @circle.destroy\n head :no_content \n end", "def destroy\n @point_of_contact.destroy\n\n head :no_content\n end", "def destroy\n @open_positions_list.destroy\n respond_to do |format|\n format.html { redirect_to open_positions_lists_url, notice: 'Open positions list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n begin\n @position = Position.find(params[:id])\n if @position.destroy\n @@request_result[:success] = true\n @@request_result[:notice] = 'Operation ended successfully.'\n else\n @request_result[:errormsg] = @position.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end", "def update_positions\n params[\"edit_template_area_#{params[:id]}\"].each_with_index do |id, position|\n TemplateBox.update(id, :position => position)\n end\n init_template_areas\n #render :layout => false,\n # :partial => \"template_area\",\n # :object => @template_areas.find{|a| a.id == params[:id].to_i} #TODO Dry it\n flash[:notice] = \"Reihenfolge gespeichert\"\n render :update do |page|\n page.reload\n end\n end", "def destroy\n @map.destroy\n\n head :no_content\n end", "def destroy\n @position_mapper = PositionMapper.find(params[:id])\n @position_mapper.destroy\n\n respond_to do |format|\n format.html { redirect_to position_mappers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alignment_position = AlignmentPosition.find(params[:id])\n @alignment_position.destroy\n\n respond_to do |format|\n format.html { redirect_to(alignment_positions_url) }\n format.xml { head :ok }\n end\n end", "def destroy_output_order\n\n if @order.destroy\n @msg = 'Ordine eliminato'\n else\n @msg = 'Errore'\n end\n # respond_to do |format|\n # format.js { render :js, :partial => 'orders/output_orders' }\n # end\n index\n end", "def destroy\n @image_position_template = ImagePositionTemplate.find(params[:id])\n @image_position_template.destroy\n\n respond_to do |format|\n format.html { redirect_to image_position_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy #remove_score_item\n elem = \"score_item_\" << params[:id]\n\n ScoreItem.destroy(params[:id])\n # if ScoreItem.destroy(params[:id])\n # render :update do |page|\n # page[elem].visual_effect :blind_up\n # page[elem].remove\n # end\n # end\n end", "def destroy\n @crew_position = CrewPosition.find(params[:id])\n @crew_position.destroy\n\n respond_to do |format|\n format.html { redirect_to crew_positions_url }\n format.json { head :ok }\n end\n end", "def destroy\n device = @position.device\n @position.destroy\n respond_to do |format|\n format.html { redirect_to device_positions_url(device), notice: 'Position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_dimension_editor\n dimension_id = params[:id]\n render :update do |page| \n page.replace_html(\"div_dimension_extra_#{dimension_id}\", \"\")\n end\n end", "def destroy\n client = Client.find(params[:id])\n client.deleted = true\n\t\tclient.save\n\n respond_to do |format|\n format.html do\n render :update do |page|\n\t\t\t\t\tpage.hide \"#{client.id}\", \"#{client.id}_line\"\n end\n end\n format.xml { head :ok }\n\t\t\tformat.js do\n render :update do |page|\n\t\t\t\t\tpage.hide \"#{client.id}\", \"#{client.id}_line\"\n end\n end\n end\n end", "def render_delete_activity(activity)\n render_repo_activity(activity, \"deleted\")\n end", "def delete_view\n super\n end", "def destroy\n @admin_position = Position.find(params[:id])\n if @admin_position.roles.count == 0\n @admin_position.destroy\n flash[:notice] = 'Position item has been deleted'\n else\n flash[:notice] = 'Must be empty'\n end\n\n redirect_to admin_positions_path\n\n end", "def destroy\n @position = Position.find(params[:id])\n Activity.create(content: \"#{@position.job_title}\", action: \"deleted\", office: \"#{@position.office}\", user_name: \"#{@position.user_name}\", link: \"#{@position.id}\")\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n # find the page with with\n @page = Page.find(params[:id])\n\n # calling class method of PagePart model to delete page parts of a page\n PagePart.delete_page_parts(@page)\n\n #destroy the page\n @page.destroy\n\n #sends in data in different format to index action\n respond_to do |format|\n\n format.html { redirect_to admin_pages_url }\n format.json { head :no_content }\n\n end # end respond_to block\n\n end", "def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to admin_pages_url, notice: 'Страница успешно удалена!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @position_scene1.destroy\n respond_to do |format|\n format.html { redirect_to position_scene1s_url, notice: 'Position scene1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def clean_positions\n self.x_pos = self.x_pos.strip.to_i.to_s\n self.y_pos = self.y_pos.strip.to_i.to_s\n end", "def destroy\n @point.destroy\n respond_to do |format|\n format.html { redirect_to :root }\n format.js { render \"block_details\" }\n end\n end", "def destroy\n @gpsd.destroy\n\n head :no_content\n end", "def destroy\n @point_of_diversion.destroy\n respond_to do |format|\n format.html { redirect_to point_of_diversions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n self.littles.each do | little|\n little.big_id = nil;\n end\n self.positions.each do | pos |\n pos.dke_info_id = nil;\n end\n return super\n end", "def destroy\n @finanzposition = Finanzposition.find(params[:id])\n @finanzposition.destroy\n\n respond_to do |format|\n format.html { redirect_to finanzpositions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cash_position = CashPosition.find(params[:id])\n @cash_position.destroy\n\n respond_to do |format|\n format.html { redirect_to(cash_positions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @disponible.destroy\n\n head :no_content\n end", "def destroy\n @lineas_asignado = LineasAsignado.find(params[:id])\n @lineas_asignado.destroy\n @existencia = Existencia.find(@lineas_asignado.existencia_id)\n @existencia.update_attribute(:es_asignado, false)\n @asignados = LineasAsignado.find(:all, :conditions => [\"asignado_id = ?\", @lineas_asignado.asignado_id])\n\n render :partial => \"linea_asignado\"\n end", "def destroy\n @user_position = UserPosition.find(params[:id])\n @user_position.destroy\n\n respond_to do |format|\n format.html { redirect_to user_positions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest_position.destroy\n respond_to do |format|\n format.html { redirect_to contest_positions_url }\n format.json { head :no_content }\n end\n end", "def deleteCard(pos)\n @cardsShown.delete_at(pos)\n end", "def destroy\n @page.delete\n @message = {message: 'Page deleted'}\n respond_with(@message)\n end", "def create\n @position = Position.new(params[:position])\n positions = Position.find(:all, :conditions => [\"layout_template_id = ?\",params[:position][:layout_template_id]])\n if positions.size == 0\n @position.main_position = true\n else\n @position.main_position = false\n end\n\n render :update do |page|\n if @position.save\n page.insert_html :after, \"layout_template_#{@position.layout_template_id}\", :partial => \"positions/row_form\",\n :locals => {:position => @position, :counter => LayoutTemplate.find(:all).index(@position.layout_template)}\n end\n end\n end", "def render\n system(\"clear\")\n puts \" #{(0...size).to_a.join(\" \")}\"\n @grid.each_with_index do |row, i|\n puts \"#{i} #{row.join(\" \")}\"\n end\n end", "def destroy\n @place.destroy\n head :no_content\n end", "def destroy\n @member = PositionMember.find(params[:id])\n @member.destroy\n redirect_to '/board_members_and_positions', notice: \"Virkailija poistettu\"\n end", "def destroy\n @size.destroy\n\n render :nothing => true\n end", "def destroy\n \t@internship_position = InternshipPosition.find(params[:id])\n \t@internship_position.destroy\n\n \trespond_to do |format|\n \t\tformat.html { redirect_to root_path, notice: 'Posiiton was successfully destroyed.' }\n \t\tformat.json { head :no_content }\n \tend\n end", "def destroy\n if Pizzerium.exists?(:id => params[:id])\n pizzeria = Pizzerium.find(params[:id])\n position = Position.find(pizzeria.position_id)\n menus = Menu.where(pizzeria_id: params[:id])\n\n menus.each do |m|\n Dish.where(menu_id: m.id).destroy_all\n end\n PizzeriaTag.where(pizzeria_id: pizzeria.id).delete_all\n menus.destroy_all\n position.destroy\n pizzeria.destroy\n \n render 'delete'\n else\n @message = \"Pizzerian gick inte att radera. Pizzerian existerar inte.\"\n error400\n end\n end", "def remove!\n update_attributes(x_position: nil, y_position: nil)\n end", "def destroy\n @proposal_position.destroy\n respond_to do |format|\n format.html { redirect_to proposal_positions_url, notice: 'Proposal position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\r\n @positions.each do |p|\r\n\t puts p.inspect\r\n\tend\r\n end", "def destroy\n @position_member = PositionMember.find(params[:id])\n @position_member.destroy\n\n respond_to do |format|\n format.html { redirect_to(position_members_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @department_position.destroy\n respond_to do |format|\n format.html { redirect_to department_positions_url, notice: 'Department position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def trash_aviso\n aviso = Aviso.find(params[:idNote])\n aviso.logic_destroy\n render :update do |page|\n render(:update) { |page| page.reload }\n\n end\n end", "def destroy\n @position = Position.find(params[:id])\n user = @position.user\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to(user) }\n format.xml { head :ok }\n end\n end", "def destroy\n @position_scene3.destroy\n respond_to do |format|\n format.html { redirect_to position_scene3s_url, notice: 'Position scene3 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 admin_pages_url, notice: 'Page was successfully destroyed.' }\n end\n end", "def del\n\t\t#methode ruft show auf ==> !?! ==> err aber funktioniert\n\tend", "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 delete\n Vision.destroy_all\n Goal.destroy_all\n render 'welcome/index'\n end", "def destroy\n @page_chunk.destroy\n respond_to do |format|\n format.html { redirect_to page_chunks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trein_coord_pedag.destroy\n respond_to do |format|\n format.html { redirect_to trein_coord_pedags_url }\n format.json { head :no_content }\n end\n end", "def erase\n @pages.clear\n @page_counter = 0\n close\n end", "def before_destroy\n if supplier_pos.count != 0\n return false\n else\n return true\n end\n end", "def destroy\n @managers_position.destroy\n respond_to do |format|\n format.html { redirect_to managers_positions_url, notice: 'Position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page.destroy\n redirect_to @notebook, notice: 'Page was successfully destroyed.'\n end", "def destroy\n @position = Position.find(params[:id])\n \n if !@position.agency_ids.nil?\n Agency.any_in(:position_ids => [@position.id]).each do |p|\n p.positions.delete(@position)\n p.save\n end\n @position.destroy\n else\n @position.destroy\n end\n respond_to do |format|\n format.html { redirect_to(\"/positions/#{params[:company_id]}/index\") }\n end\n \n \n \n end", "def destroy\n @normal.destroy\n respond_to do |format|\n format.html { redirect_to normals_url, notice: '과목 정보가 삭제되었습니다.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order.line_items.clear\n respond_to do |format| \n format.html { redirect_to(edit_object_url) } \n end\n end", "def destroy\n if current_user.admin\n @access_list_to_ea_point.destroy\n respond_to do |format|\n format.html { redirect_to access_list_to_ea_points_url, notice: 'Access list to ea point was successfully destroyed.' }\n format.json { head :no_content }\n end\n else \n redirect_to \"/ea_points\", notice: 'Cannot delete uploaded document.'\n end\n end", "def destroy\n render :nothing => true\n end", "def destroy\n begin\n @viewer = 'locations'\n @mensaje = 'Para poder eliminar un departamento no debe tener contratos asociados- Elimina primero los contratos-!!!'\n \n @catalogs_location.destroy\n respond_to do |format|\n format.html { redirect_to catalogs_locations_url, notice: t('.destroyed') }\n format.json { head :no_content }\n end\n rescue\n respond_to do |format|\n \n format.html { render '/layouts/_warning.html.haml'}\n format.json { head :no_content }\n format.js { render '/layouts/_warning.html.haml' }\n end\n end\n end", "def destroy\n @tip.destroy\n head :no_content\n end" ]
[ "0.6936866", "0.62388176", "0.612356", "0.6112984", "0.60941917", "0.60399437", "0.5991937", "0.5991523", "0.59908736", "0.59902906", "0.59902906", "0.59902906", "0.5972272", "0.5962419", "0.5942675", "0.5901983", "0.5777597", "0.576103", "0.57317376", "0.5725054", "0.56623465", "0.56623465", "0.5601531", "0.5594583", "0.5591781", "0.5584444", "0.5570204", "0.5563551", "0.55565125", "0.5545403", "0.5542706", "0.55358636", "0.5521303", "0.5517205", "0.55158097", "0.5513588", "0.55131", "0.55042845", "0.5501291", "0.55000275", "0.54909474", "0.54788697", "0.5470283", "0.5460154", "0.54585975", "0.54579544", "0.54385674", "0.54281926", "0.5409096", "0.5393744", "0.5392782", "0.5390394", "0.5361224", "0.53601277", "0.53588855", "0.5350977", "0.534609", "0.5342714", "0.5336802", "0.53094155", "0.5307943", "0.52978814", "0.529742", "0.5289943", "0.52888685", "0.52781415", "0.52700996", "0.5260351", "0.5260301", "0.52561027", "0.52557", "0.52543736", "0.5251306", "0.5249103", "0.5247951", "0.5234519", "0.5230814", "0.5229725", "0.521857", "0.51963305", "0.5188382", "0.51883596", "0.5181783", "0.5179167", "0.51771545", "0.51761836", "0.51752555", "0.5172123", "0.5159895", "0.5154461", "0.5151126", "0.51488924", "0.5141891", "0.51287717", "0.51258063", "0.512355", "0.5121789", "0.5113267", "0.509876", "0.5095276" ]
0.5706772
20
Creates a new setup
def create from_setup = Setup.where(venture_id: params[:venture_id], year: params[:from_year]).first to_setup = Setup.where(venture_id: params[:venture_id], year: params[:to_year]).first # It is possible to overwrite the setup to_setup.destroy! if to_setup.present? # Create to year setup and copy all categories and positions and plan months if params[:mode] == "complete" return if from_setup.blank? to_setup = Setup.copy_setup_with_plan_months(from_setup, params[:to_year]) # Create to year setup and copy all categories and positions elsif params[:mode] == "structure" return if from_setup.blank? to_setup = Setup.copy_setup(from_setup, params[:to_year]) # Create to year setup elsif params[:mode] == "scratch" to_setup = Setup.create!(venture_id: from_setup.venture_id, year: params[:to_year]) end redirect_to setup_path(to_setup.venture_id, to_setup.year) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup()\n create_directories\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup_create\n\t\traise NotImplementedError, \"machine_create is not implemented\"\n\tend", "def setup()\n end", "def setup\n templates = ['default']\n templates << @opts[:testkitchen] if @opts[:testkitchen]\n\n templates.each { |type| create_file(type) }\n end", "def create\n @setup = Setup.new(setup_params)\n\n respond_to do |format|\n if @setup.save\n format.html { redirect_to @setup, notice: 'Setup was successfully created.' }\n format.json { render :show, status: :created, location: @setup }\n else\n format.html { render :new }\n format.json { render json: @setup.errors, status: :unprocessable_entity }\n end\n end\n end", "def setup\r\n end", "def setup\n\n end", "def setup\n\n end", "def setup\n make_config\n make_users_file\n end", "def setup\n @story = Story.create( :text => 'Hello world' )\n end", "def setup(description=nil, &procedure)\n if procedure\n @_setup = TestSetup.new(@test_case, description, &procedure)\n end\n end", "def setup(*args) ; end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n\t\tend", "def setup\n\t\tend", "def new\n @setup = EsSetup.new()\n @setup.read_only = 'N'\n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n # no setup\n\tend", "def setup\n @configure = Hatemile::Util::Configure.new\n end", "def setup\n\n end", "def setup\n\n end", "def setup\n\n end", "def setup\n # override this if needed\n end", "def setup(options); end", "def setup(options); end", "def setup(options = {}); end", "def setup(&block)\n @setups << block\nend", "def setup(&block)\n scenario.setups << block\n end", "def setup\n add_standard_properties\n #\n create_banner\n create_standard_options\n create_advanced_options\n create_mode_options\n create_application_options\n create_feature_options\n create_tail_options\n #\n parse_options\n load_config_configuration\n create_result_directory\n load_results_archive\n end", "def setup\n true\n end", "def setup\n # Create a standard project (30 days)\n @Project1 = Project.new(Date.new(2000, 1, 1), Date.new(2000, 1, 10))\n # Create a standard calendar (30 days, 1 hour per day)\n @Calendar1 = {}\n 10.times do |iIdx|\n @Calendar1[Date.new(2000, 1, iIdx+1)] = 1\n end\n # Create standard resources\n @Resource1 = Resource.new('R1', @Calendar1)\n end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup(&code)\n @setup = code\n end", "def setup; end", "def setup\n debug 'No custom setup defined'\n end", "def setup\n raise NotImplementedError\n end", "def create\n create_checkpoints\n create_config_base\n generate_deploy_files\n generate_hiera_template\n end", "def setup\n ''\n end", "def setup\n # noop\n end", "def setup\n generate_profile\n load_profile\n create_namespace\n end", "def do_setup; \"\" end", "def setup\n\t\t\t\tp \"mytest1 setup\"\n\t\tend", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n # Build the portfolio\n self.portfolio = Portfolio.new(:login => self.login)\n self.portfolio.save\n \n # Build the design editor\n self.design = Design.new\n self.design.save\n \n # Set the plan at level 1\n self.plan = Plan.new(:level => 1)\n self.plan.save\n \n # Activate\n self.activate!\n \n # Save the user at the end.\n self.save\n end", "def setup\n\t\t# Do nothing\n\tend", "def setup\n\t\t# Do nothing\n\tend", "def setup(target)\n Dir.mkdir(target) unless File.directory?(target)\nend", "def setup\n copy_definitions\n package_agent\n end", "def setup\n copy_definitions\n package_agent\n end", "def command_setup(args)\n setup(args)\n end", "def set_up!\n create! unless created?\n attach! unless attached?\n wait_for_up! unless up?\n end", "def setup\n # override and do something appropriate\n end", "def setup\n yield self\n self\n end", "def setup\n\n create_new_user({id: 1,\n username: \"user1\",\n email: \"user1@example.com\",\n password: \"password\",\n password_confirmation: \"password\"})\n create_new_user({id: 2,\n username: \"user2\",\n email: \"user2@example.com\",\n password: \"password\",\n password_confirmation: \"password\"})\n create_new_user({id: 3,\n username: \"user3\",\n email: \"user3@example.com\",\n password: \"password\",\n password_confirmation: \"password\"})\n create_new_user({id: 4,\n username: \"user4\",\n email: \"user4@example.com\",\n password: \"password\",\n password_confirmation: \"password\"})\n end" ]
[ "0.68910825", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.6706532", "0.66938454", "0.66938454", "0.66938454", "0.66938454", "0.66938454", "0.6692558", "0.6633317", "0.6594617", "0.65832293", "0.6574954", "0.6529802", "0.6529802", "0.6481859", "0.6478104", "0.64519393", "0.6447895", "0.64435863", "0.64435863", "0.64435863", "0.64435863", "0.64435863", "0.64435863", "0.64225507", "0.64225507", "0.6403556", "0.63584304", "0.63584304", "0.63584304", "0.63584304", "0.63584304", "0.63584304", "0.63584304", "0.63525134", "0.63399386", "0.6336129", "0.6336129", "0.6336129", "0.6333426", "0.6316434", "0.6316434", "0.63044506", "0.6263046", "0.6239838", "0.62385786", "0.622797", "0.6227775", "0.62239754", "0.62239754", "0.62239754", "0.62239754", "0.62239754", "0.62239754", "0.62239754", "0.62239754", "0.62239754", "0.62239754", "0.62239754", "0.62239754", "0.62239754", "0.62239754", "0.62239754", "0.62239754", "0.62239754", "0.62239754", "0.62239754", "0.62154067", "0.61970514", "0.6195969", "0.61897403", "0.6172779", "0.6169932", "0.61649597", "0.6164637", "0.60928285", "0.6088329", "0.6088291", "0.6088291", "0.6072712", "0.6058189", "0.6058189", "0.603327", "0.6014984", "0.6014984", "0.60109925", "0.599943", "0.5993554", "0.5990203", "0.5983109" ]
0.0
-1
Only the owner of the venture is allowed to perform certain actions
def authenticate_venture_owner! render "errors/404" unless Venture.find(params[:venture_id]).user_id == current_user.id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 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 check_ownership\n redirect_to animals_path, notice: \"You are not authorized for that action.\" if !current_user&.admin? && Animal.find(params[:id]).owner != current_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 end", "def owner\n @mycars = Car.where(user_id: @user.id)\n authorize @mycars\n end", "def can_vote\n if owner_user?\n redirect_back_or root_url \n flash[:info] = \"You are the owner.\"\n end\n end", "def can_vote\n if owner_user?\n redirect_back_or root_url \n flash[:info] = \"You are the owner.\"\n end\n end", "def volunteer_portal\n authorize! :volunteer_portal, :Reservation\n end", "def require_owner\n unless @product.owned_by?(current_user)\n flash[:alert] = \"Access denied\"\n redirect_to root_path\n end\n end", "def authenticate_owner!\n render \"errors/404\" unless Venture.exists?(id: params[:id], user_id: current_user.id)\n end", "def check_ownership \t\n \taccess_denied(:redirect => @check_ownership_of) unless current_user_owns?(@check_ownership_of)\n end", "def allow_edit(owner)\n return true if allow(owner)\n respond_to do |format|\n format.html { redirect_to user_path(session[:user_id]), notice: 'You are not authorized to perform the action' }\n end\n end", "def allow(owner)\n u = User.find(session[:user_id])\n if u.role == :admin\n return true\n else\n if u.id == owner.id\n return true\n else\n return false\n end\n end\n end", "def is_view_permitted?(given_user = nil)\r\n return false unless self.active?\r\n \r\n given_user ||= self.current_user\r\n \r\n # If item is public, no need for further permission checks\r\n return true if self.public? && self.user && self.user.public? \r\n \r\n # Base case of identity, no need to check relationships\r\n return true if given_user && ((given_user.id == self.author_id) || (given_user.id == self.foruser_id) || given_user.is_self_or_owner?(self.user))\r\n\r\n # Special case -- allow recipient and owners to see private messages\r\n if self.is_a?(Pvtmessage)\r\n return true if given_user.is_self_or_owner?(self.foruser) || given_user.is_self_or_owner?(self.user)\r\n return false\r\n end\r\n\r\n return true if given_user.admin?\r\n \r\n # Otherwise no can do if only my owner can see it (if you got to here, you aren't my owner)\r\n return false if self.restriction_level == Relationshiptype.nobody\r\n\r\n # Content of private or blocked projects cannot be seen\r\n return false if self.user && !self.user.is_view_permitted?\r\n\r\n # Fine, we'll actually run some DB queries...\r\n return Relationship.has_follower?(self.user, given_user, self.levels_can_see)\r\n end", "def edit\n authorize @volunteer_position\n end", "def check_write_access(ven)\r\n #KS- if it's a public venue raise an exception\r\n raise \"Current user doesn't have rights to edit public place #{ven.id}\" if ven.public_venue\r\n\r\n #KS- if it's owned by someone else, raise an exception\r\n raise \"Current user doesn't have rights to edit place #{ven.id}\" if ven.user_id != current_user.id\r\n end", "def editable_check(_traversal_env)\n Result::DENY\n end", "def user_owns\n if !@freerange.has_owner(@user)\n redirect_to @user\n end\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 deny\n self.granted = -1\n restaurant = Restaurant.find(self.restaurant_id)\n restaurant.mark_collaborative\n end", "def ensure_is_authorized_to_view\n @is_member_of_company = (@relation == :company_admin_own_site || @relation == :company_employee || @relation == :rentog_admin_own_site)\n\n # ALLOWED\n return if @relation == :rentog_admin ||\n @relation == :rentog_admin_own_site ||\n @relation == :domain_supervisor ||\n @relation == :company_admin_own_site\n\n\n # NOT ALLOWED\n # with error message\n flash[:error] = t(\"listing_events.you_have_to_be_company_member\")\n redirect_to root\n return false\n end", "def require_permission\n if current_user.id != @squad.owner_id\n redirect_to api_squads_path, notice: 'You must be owner of a squad to do that action.'\n end\n end", "def appctrl_ensure_is_owner\n model = controller_name.camelize.singularize.constantize # :-)\n @item = model.find( params[ :id ] )\n\n if ( @item.user_id != current_user.id )\n render_optional_error_file( 401 ) unless current_user.is_admin?\n end\n end", "def valid_edit_check(_traversal_env)\n Result::DENY\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 auth_as_owner\n unless current_user == @vm.lab_user.user or @admin\n respond_to do |format|\n #You don't belong here. Go away.\n format.html { redirect_to root_path , :notice=> 'Sorry, this machine does not belong to you!' }\n format.json { render :json=> {:success => false , :message=> 'Sorry, this machine does not belong to you!'} }\n end\n end\n end", "def permission_required \n render_403 unless admin? || @item.is_editable_by?(current_user)\n end", "def check_instance_permissions\n unless @bot_instance.user == current_user || current_user.is_owner?(@bot_instance.bot) || current_user.is_admin?\n render status: :forbidden, plain: \"You're not allowed to modify this instance\" and return\n end\n\n render status: :forbidden, plain: 'This instance does not belong to this bot.' and return unless @bot_instance.bot_id.to_s == params[:bot_id]\n end", "def owner_only\n @room = current_user.rooms.find(params[:id]) \n unless current_user == @room.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_rooms_url\n end\n end", "def permitted?; end", "def require_costume_ownership\n redirect_to root_path(message: 'Only can owner or assigned dancer can access') unless current_user.costumes.include?(@costume)\n end", "def authorize_owner\n head :unauthorized unless current_user.owns_nilm?(@nilm)\n end", "def user_owns_reflection?\n unless @reflection.student.uid == current_user.uid\n flash[:notice] = 'You may only edit your own reflections.'\n redirect_to reflections_url\n end\n end", "def allow_to\n # owner of story can do anything? editing?\n super :owner, :all => true\n # approved users can create new stories\n super :user, :only => [:show, :index, :search, :new, :create]\n # everybody can list and watch\n super :all, :only => [:show, :index, :search]\n end", "def user_actions(user)\n can_act_as_logged_in_user(user) unless Revs::Application.config.restricted_beta # also have logged in privileges if we are not in beta\n end", "def check_update_permission\n return if owner? || @article.is_public_editable\n redirect_to articles_url\n end", "def is_allowed_to_edit?(person)\n if person.id == item_owner.id && status.eql?(\"pending_owner\")\n return true\n elsif person.id != item_owner.id && status.eql?(\"pending_reserver\")\n return true\n end\n return false \n end", "def owner?\n return if current_user == @event.creator\n\n redirect_back(fallback_location: root_path, alert: 'Unauthorized request!')\n end", "def owner\n redirect_to shelters_path, notice: 'Woah there! Only owners can edit shelters.' unless current_user.owner || current_user.admin\n end", "def define_eccept\n if current_user.info.id==@resource.id || can_manage_has_one(current_user.info, @resource, @model)\n return true\n else\n redirect_to root_path \n end\n end", "def check_user_admin_permissions\n return if params[:action] == 'confirm_invitation' && params[:controller] == 'teammates'\n current_user_teammate = @current_user.teammates.where(pitch_id: @pitch.id).take\n redirect_to forbidden_path unless admin_teammate(current_user_teammate)\n end", "def define_eccept\n if current_user.info.id == @resource.id || can_manage_has_one(current_user.info, @resource, Info)\n true\n else\n redirect_to root_path\n end\n end", "def check_novel_user\n owner = Novel.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 require_authorization!\n unless current_user == @event.user\n render json: {}, status: :forbidden\n end\n end", "def action_allowed?\n current_user_has_ta_privileges?\n end", "def action_allowed?\n current_user_has_ta_privileges?\n end", "def is_view_permitted?(given_user = nil)\n given_user ||= self.current_actor\n\n # Guests can't see circles unless they log in\n return false if given_user.guest?\n \n # Oh look, it's me\n return true if given_user.is_self_or_owner?(self.user)\n \n # Fine, let's check the db\n return Relationship.has_follower?(self.user, given_user, self.levels_can_see)\n end", "def check_resource_ownership\n if admin_user.is_not_root?\n\n condition_typus_users = @item.respond_to?(Typus.relationship) && !@item.send(Typus.relationship).include?(admin_user)\n condition_typus_user_id = @item.respond_to?(Typus.user_foreign_key) && !admin_user.owns?(@item)\n\n not_allowed if (condition_typus_users || condition_typus_user_id)\n end\n end", "def mayView? ( other_user )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"same user as owner\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end\n if ( ( self.public_policy == Dfile::PP_MAYVIEW ) or ( self.public_policy == Dfile::PP_MAYEDIT ) )\n return true\n end\n if self.special_users\n special = self.special_users[other_user.id.to_s]\n if special\n if ( ( special == Dfile::PP_MAYVIEW ) or ( special == Dfile::PP_MAYEDIT ) )\n return true\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has special permission but not right one\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has no special permission\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n \n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"no special permissions\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n return false\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 curator_actions(user)\n can_act_as_logged_in_user(user)\n can_curate\n can_update_metadata\n end", "def authorize_edit\n authorize! :edit, @opportunity\n end", "def authorize_pot\n authorize @pot, :contribute?\n end", "def voter(user)\n if RuntimeConfig.vote_signin_active? || RuntimeConfig.voting_active?\n can :access, :elections\n can :access, Election\n end\n\n if RuntimeConfig.voting_active?\n can :access, :votes\n end\n end", "def can_approve?(target)\n is_staff? && target && target.active? && !target.approved?\n end", "def allowed?(action,user)\n\n if user.tenant?\n flash[:notice] = \"Sorry. You are not allowed to perform this action as a tenant\"\n return redirect_to action, notice:\"Sorry. You can't list a property as a tenant\"\n end\n\n\n\n end", "def access_robot\n raise 'unauthorised' if current_user != @robot.user \n end", "def service_user(_user)\n can :access, :stats\n can :access, :export unless RuntimeConfig.elections_active?\n can :access, :voters if RuntimeConfig.elections_started? && RuntimeConfig.elections_active?\n end", "def restrict_access\n render :\"/home/http_404\" unless @pet && @pet.user == current_user\n end", "def owned_by? a_user\n a_user == program.moderator\n end", "def is_owner\n object == current_user\n end", "def verify_ownership\n\t\tif @current_user.id != Cart.find(params[:id]).user.id\n\t\t\tflash.now[:error] = \"Oops! You do not have permission to view this page.\"\n\t\t\trender :file => File.join(Rails.root, 'public', '403.html'), \n \t :status => 403\n\t\tend\n\tend", "def check_buyable\n raise PermissionDeniedError, \"出品したアイテムはサポートできません\" if @item.owner?(current_user)\n end", "def show\n authorize @shooting_velocity\n end", "def show\n authorize @moderation\n end", "def allowed_user\n unless current_user.id == Design.find(params[:design_id]).user.id\n flash[:notice] = 'Voce não tem permissão para fazer isso!'\n redirect_to root_url\n end\n end", "def test_voter_as_authorized_actor\n election = Election.new\n voter = Voter.new\n voter.election = election\n as_anything_goes_user do \n voter.save!\n election.save!\n end\n # AuthorizedActor.current_actor = voter\n \n as_user(voter) do\n assert AuthorizedActor.current_actor.check_permissions_for_action_on_model(:vote, Election), \n \"Expected voter to be permitted to vote in election\"\n \n assert AuthorizedActor.current_actor.check_permissions_for_action_on_model(:belong_in, Election, election), \n \"Expected voter to belong_in the election it belongs_to\"\n \n assert AuthorizedActor.current_actor.check_permissions_for_action_on_model(:belong_in, Election, Proc.new{ election }), \n \"Expected voter to belong_in a Proc that returns the election it belongs_to\"\n \n assert !AuthorizedActor.current_actor.check_permissions_for_action_on_model(:belong_in, Election, nil), \n \"Expected voter to not belong_in a nil election\"\n \n assert !AuthorizedActor.current_actor.check_permissions_for_action_on_model(:belong_in, Election, Election.new), \n \"Expected voter to not belong_in an election it does not belong_to\"\n \n assert !AuthorizedActor.current_actor.check_permissions_for_action_on_model(:rig, Election), \n \"Expected voter NOT to be permitted to rig election\"\n end\n end", "def denied\n end", "def authenticate_owner!\n category = Category.find(params[:id])\n render \"errors/404\" unless category.order != 0 && category.setup.venture.user_id == current_user.id\n end", "def edit\n authorize @car\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 check_toy_owner\n return if params[:id].nil? or params[:id].empty? or @login_user.nil?\n\n begin\n owner_id = Toy.find(params[:id]).user_id\n rescue\n owner_id = -1\n end\n if !@login_user.admin?(User::AUTH_DESKTOP) and owner_id != @login_user.id\n Log.add_check(request, '[check_toy_owner]'+request.to_s)\n\n flash[:notice] = t('msg.need_to_be_owner')\n redirect_to(:controller => 'desktop', :action => 'show')\n end\n end", "def authorized_user\n @event = Event.friendly.find(params[:id])\n if @event.creator_id != current_user.id\n if current_user.email == 'pubudu@eventhub.lk' || current_user.email == 'pavithra@eventhub.lk'\n return true\n end\n redirect_to root_path, alert: \"Oops! You don't have permission to do that\"\n end\n end", "def restrict_developer\n if (controller_name == 'user_sessions' and action_name == 'destroy') or\n (controller_name == 'users' and (action_name == 'edit' || action_name == 'update'))\n return\n end\n if current_user and is_developer \n redirect_to :controller => 'efforts'\n end\n end", "def plan_only\n unless current_user\n redirect_to \"/\", :alert => \"Access denied. You must be a member to suggest a charity. Explore with us as a member now for free.\"\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 enforce_permissions\n bounce unless is_admin?\n end", "def view_authorized(current_user)\n return self.goal.public? || self.edit_authorized(current_user)\n end", "def show\n authorize @vote_candidate\n end", "def verify_not_owner\n unless current_user && @dog && @dog.owner != current_user\n redirect_to root_path\n end\n end", "def show\n render status: :forbidden, text: \"Forbidden!\" unless @transaction.user == current_user\n end", "def allows?(action, user)\n case action.to_sym\n when :view then user.may_edit or user == self\n when :edit then user.may_authorize or user == self\n else false\n end\n end", "def guard_against_tampering(event)\n if event.user != current_user # Must be the event's owner\n if current_user.admin? != true # or they must be a site Administrator\n redirect_to event, alert: \"You are not the creator of this event or a Protest45 Admin.\"\n end\n end\n end", "def is_owner?(person)\n return person !=nil && person.team_id == self.id && person.role == \"captain\"\n end", "def is_owner? (opportunity)\n \topportunity.user_id == self.id\n end", "def is_permitted_for?( user )\n ( user.id == self.user.id ) or ( user.privileged? )\n end", "def check_user_rights\n if( params[:id] && !admin_authorized? )\n @bundle = Bundle.find(params[:id])\n if( ! @bundle.public )\n if( @bundle.created_by_user_id != @user.id )\n \t\t\t\trender :action => \"not_allowed\" \n end\n end\n end\n end", "def check_owner\n return if params[:id].blank? or @login_user.nil?\n\n begin\n owner_id = Workflow.find(params[:id]).user_id\n rescue\n owner_id = -1\n end\n if !@login_user.admin?(User::AUTH_WORKFLOW) and owner_id != @login_user.id\n Log.add_check(request, '[check_owner]'+request.to_s)\n\n flash[:notice] = t('msg.need_to_be_owner')\n redirect_to(:controller => 'desktop', :action => 'show')\n end\n end", "def owner\n permission_denied unless session[:user_id] == @idea.user_id\n end", "def validate_owner\r\n expense = @current_user.expenses.find(params[:id]) rescue nil\r\n !expense.blank?\r\n end", "def _admin_or_self\n not_authorizaed unless current_user.admin? || current_user == @user\n end", "def require_ownership\n\t\tunless current_user\n\t\t\tredirect_to login_path\n\t\tend\n\tend", "def edit\n authorize @vlan\n end", "def require_owner\n @course = Course.find_by_id(params[:id])\n if (!@course || @course.user != current_user)\n redirect_to :root, notice: 'Not yours. Pas touche.' \n end\n end", "def owner_authorize(member_id)\n unless logged_in? and (current_member.id == member_id or admin?)\n unauthorized_access\n end\n end", "def validate_owner\n unless @article.owner == current_user\n redirect_to root_path, notice: 'You do not have edit access to the article!'\n end\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 update_authorized?(target)\n @from_member.roles_include?(:moderator) || target == @from_member\n end", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def vheroauthorize\n redirect_to vherologin_path, alert: 'You must be logged in as a Volunthero to access this page.' if current_vhero.nil?\n end" ]
[ "0.6973081", "0.6841731", "0.6821679", "0.6813689", "0.6787564", "0.67339927", "0.67339927", "0.6612551", "0.6594413", "0.6590633", "0.65861136", "0.6556369", "0.6508762", "0.64926624", "0.6481037", "0.64808524", "0.64669216", "0.6453985", "0.6416339", "0.63913333", "0.6382941", "0.6358538", "0.63446283", "0.6333017", "0.6323941", "0.6319739", "0.63117635", "0.6293695", "0.6291967", "0.62846917", "0.6280719", "0.62804866", "0.6255363", "0.62551105", "0.6250568", "0.6249908", "0.62435174", "0.62390053", "0.6234399", "0.6232256", "0.6227033", "0.621877", "0.6218738", "0.62043446", "0.6197779", "0.6197779", "0.6194448", "0.618232", "0.6174378", "0.616874", "0.6164385", "0.61597323", "0.6159529", "0.6145499", "0.6141885", "0.6136516", "0.6135759", "0.6133783", "0.6130769", "0.6129837", "0.61268663", "0.61259836", "0.612434", "0.61211115", "0.61200726", "0.61197495", "0.6116928", "0.61062026", "0.6102208", "0.6096017", "0.60805774", "0.60785973", "0.60740703", "0.6072966", "0.60644466", "0.6064196", "0.6062364", "0.6061114", "0.60518", "0.60497445", "0.60470927", "0.60445493", "0.6040035", "0.602827", "0.6027497", "0.6023003", "0.601957", "0.60133255", "0.6012632", "0.6006424", "0.599915", "0.59969044", "0.59948874", "0.59946144", "0.5989863", "0.5985706", "0.5985168", "0.59811926", "0.59760547", "0.5975419" ]
0.6882936
1
Permit parameters for setup
def setup_params params.require(:setup).permit(:year) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(*args) ; end", "def setup()\n setupParamListTable(getConf(:paramList)) ;\n super() ;\n end", "def setup(options = {}); end", "def setup(options); end", "def setup(options); end", "def setup_params\n params.require(:setup).permit(:tab_id, :jamma, :kick_harness, :button_layout, :region, :position)\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n\t\tend", "def setup\n\t\tend", "def setup\n # override this if needed\n end", "def setup\n\n end", "def setup\n\n end", "def setup\r\n end", "def setup()\n end", "def setup\n # noop\n end", "def setup(&b)\r\n\t\t\t@setup = b\r\n\t\tend", "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 setup(params)\n self.delivery = '1' == params['delivery']\n if !params['sku'].empty?\n self.sku = params['sku'].strip\n end\n end", "def setup(params)\n self.game_type = params[:game_type]\n self.difficulty_level = params[:level]\n self.board_id = params[:board_id]\n self.player_setup(params[:player1], params[:player2], params[:names], params[:symbols])\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n raise NotImplementedError\n end", "def setup(hash_args); end", "def setup(opts={})\n if meets_restrictions?(opts)\n if require_user_pass(opts)\n @username = opts[:username]\n @password = opts[:password]\n @id = opts[:id] || SecureRandom.uuid\n @email = opts[:email] || false\n @real_name = opts[:real_name] || false\n end\n end\n true\n end", "def setup_config\n # To be Extended\n end", "def setup\n\t\t# Do nothing\n\tend", "def setup\n\t\t# Do nothing\n\tend", "def initialize_before_opts\n end", "def configure_with(params)\r\n\r\n\t\tend", "def setup(_context)\n end", "def application_setting_params\n params.require(:application_setting).permit(:setup)\n end", "def setup\n raise \"Unimplemented method #setup\"\n end", "def setup(params)\n\n\t\t@selected = []\n\t\t@driver = []\n\t\t@errors = []\n\t\t# @output_tmp = Dir.mktmpdir\n\n\tend", "def setup(&code)\n @setup = code\n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup(options)\n NotImplementedError \n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup(&block)\n @setup = block\n end", "def setup\n # override and do something appropriate\n end", "def setup\n add_standard_properties\n #\n create_banner\n create_standard_options\n create_advanced_options\n create_mode_options\n create_application_options\n create_feature_options\n create_tail_options\n #\n parse_options\n load_config_configuration\n create_result_directory\n load_results_archive\n end", "def setup\n true\n end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def setup\n\n end", "def setup\n\n end", "def setup\n\n end", "def setup\n self.setup! unless self.setup?\n end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup\n debug 'No custom setup defined'\n end", "def setup(&block)\n block.call config if block_given?\n end", "def before_setup; end", "def setup\n raise \"setup must be defined in a subclass\"\n end", "def setup\n #implement in subclass;\n end", "def transport_setup_params\n params.require(:transport_setup).permit(:transport_mode, :port_of_loading, :port_of_dischange, :final_destination, :clearing_agent, :container_type)\n end", "def setup(&block)\n Config.setup(&block)\n end", "def setup()\n super() ;\n setupScatterPolicy(getConf(:scatterPolicy)) ;\n end", "def setup; end" ]
[ "0.70338935", "0.6993196", "0.67867893", "0.67655873", "0.67655873", "0.67441666", "0.67251885", "0.67251885", "0.67251885", "0.67251885", "0.67251885", "0.6672237", "0.6672237", "0.6634777", "0.66115165", "0.66115165", "0.6569988", "0.6564882", "0.65622264", "0.6518694", "0.6497446", "0.6497446", "0.6492789", "0.6491738", "0.6466028", "0.6466028", "0.6466028", "0.6466028", "0.6466028", "0.6466028", "0.6466028", "0.6466028", "0.6466028", "0.6466028", "0.6466028", "0.6466028", "0.64457995", "0.6415629", "0.63973737", "0.63767046", "0.63601524", "0.63601524", "0.6348973", "0.6348312", "0.63317263", "0.6330543", "0.63182294", "0.63178056", "0.63137096", "0.6310885", "0.6310885", "0.6310885", "0.6310885", "0.6310885", "0.6310885", "0.6310885", "0.63078624", "0.6290914", "0.6290914", "0.6290914", "0.6290914", "0.6290914", "0.6290914", "0.62789005", "0.6278647", "0.62764174", "0.62566715", "0.6255203", "0.62525356", "0.62525356", "0.62525356", "0.62415534", "0.62088865", "0.62088865", "0.62088865", "0.62088865", "0.62088865", "0.62088865", "0.62088865", "0.62088865", "0.62088865", "0.62088865", "0.62088865", "0.62088865", "0.62088865", "0.62088865", "0.62088865", "0.62088865", "0.62088865", "0.62088865", "0.62088865", "0.6189487", "0.61800927", "0.6163513", "0.6161727", "0.61456347", "0.6141488", "0.6141236", "0.6139989", "0.6118742" ]
0.6227736
72
==== Parameters env:: A hash of environment keys to be merged into the default list. opt:: A hash of options (see below). ==== Options (opt) :post_body:: The post body for the request. :req:: The request string. This will only be used if :post_body is left out. ==== Returns FakeRequest:: A Request object that is built based on the parameters. ==== Notes If you pass a post body, the contenttype will be set to URLencoded.
def fake_request(env = {}, opt = {}) if opt[:post_body] req = opt[:post_body] env[:content_type] ||= "application/x-www-form-urlencoded" else req = opt[:req] end FakeRequest.new(env, StringIO.new(req || '')) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_request(params = {}, env = {})\n params = Merb::Parse.params_to_query_string(params)\n\n query_string = env[:query_string] || env['QUERY_STRING']\n env[:query_string] = query_string ? \"#{query_string}&#{params}\" : params\n \n post_body = env[:post_body] || env['POST_BODY']\n fake_request(env, { :post_body => post_body, :req => env[:req] })\n end", "def request(req, body = nil, &block)\n response = alias_for_request(req, body)\n path = \"http://#{req.bauth if req.bauth}#{req['host']}#{req.path}\"\n if @@fakes[req.method][path]\n @@fakes[req.method][path] << {:body => response.body.to_s}\n else\n @@fakes[req.method][path] = [:body => response.body.to_s]\n end\n return response\n end", "def multipart_fake_request(env = {}, params = {})\n if params.empty?\n fake_request(env)\n else\n m = Post.new(params)\n body, head = m.to_multipart\n fake_request(env.merge( :content_type => head, \n :content_length => body.length), :post_body => body)\n end\n end", "def make_request url, method: ::Rack::GET, body: nil, headers: []\n env = Testing.build_standard_env URI(url), headers\n env[::Rack::REQUEST_METHOD] = method\n env[::Rack::RACK_INPUT] = ::StringIO.new body if body\n ::Rack::Request.new env\n end", "def request_from_env(env)\n request = {}\n request['path'] = env['REQUEST_URI'].to_s\n request['method'] = env['REQUEST_METHOD']\n request['query'] = env['QUERY_STRING'].to_s\n request['Body'] = env['rack.input'].read\n\n env.each do |key, value|\n if key.match(/HTTP_(.+)/)\n request[$1.downcase.gsub('_','-')] ||= value\n end\n end\n request\n end", "def env_for(uri, env)\n env = DEFAULT_ENV.merge(@env).merge!(env)\n\n env['HTTP_HOST'] ||= [uri.host, (uri.port if uri.port != uri.default_port)].compact.join(':')\n env['HTTPS'] = 'on' if URI::HTTPS === uri\n env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' if env[:xhr]\n env['REQUEST_METHOD'] ||= env[:method] ? env[:method].to_s.upcase : 'GET'\n\n params = env.delete(:params)\n query_array = [uri.query]\n\n if env['REQUEST_METHOD'] == 'GET'\n # Treat params as query params\n if params\n append_query_params(query_array, params)\n end\n elsif !env.key?(:input)\n env['CONTENT_TYPE'] ||= 'application/x-www-form-urlencoded'\n params ||= {}\n multipart = env.has_key?(:multipart) ? env.delete(:multipart) : env['CONTENT_TYPE'].start_with?('multipart/')\n\n if params.is_a?(Hash)\n if !params.empty? && data = build_multipart(params, false, multipart)\n env[:input] = data\n env['CONTENT_LENGTH'] ||= data.length.to_s\n env['CONTENT_TYPE'] = \"#{multipart_content_type(env)}; boundary=#{MULTIPART_BOUNDARY}\"\n else\n env[:input] = build_nested_query(params)\n end\n else\n env[:input] = params\n end\n end\n\n if query_params = env.delete(:query_params)\n append_query_params(query_array, query_params)\n end\n query_array.compact!\n query_array.reject!(&:empty?)\n uri.query = query_array.join('&')\n\n set_cookie(env.delete(:cookie), uri) if env.key?(:cookie)\n\n Rack::MockRequest.env_for(uri.to_s, env)\n end", "def parse_env_into_request(rack_env)\n Rack::Request.new(rack_env)\n end", "def request(req, body = nil, &block)\n response = alias_for_request(req, body)\n\n if NetRecorder.recording?\n scope = NetRecorder.scope || 'global'\n path = \"http://#{req.bauth if req.bauth}#{req['host']}#{req.path}\"\n\n existing_fake = @@fakes.detect{|fake| fake[0] == path && fake[1][scope] && fake[1][scope][:method] == req.method}\n existing_fake[1][scope][:response] << {:response => response} and return response if existing_fake\n\n @@fakes << [path, {scope => {:method => req.method, :response => [{:response => response}]}}]\n end\n\n yield response if block\n response\n end", "def request # :doc:\n @request ||= begin\n environment = Rails.application.env_config.merge(env) if defined?(Rails.application) && Rails.application\n ActionDispatch::Request.new(environment || env)\n end\n end", "def build_request(req, http_method, path, opts = {})\n opts[:query_params].each_key do |key|\n if opts[:query_params][key].kind_of?(Array)\n opts[:query_params][key] = opts[:query_params][key].join[\",\"]\n end\n end\n if @config.http_request_timeout > 0\n req.options.timeout = @config.http_request_timeout\n end\n req.url path.sub(/^\\/+/, '')\n req.headers = opts[:header_params]\n req.params = opts[:query_params]\n req.body = build_request_body(req.headers, opts[:body], opts[:files])\n set_headers(req.headers)\n if @config.debugging\n @config.logger.debug \"HTTP request\\nMethod: #{req.method}\\nPath: #{req.path}\\nParams: #{req.params}\\nHeaders: #{req.headers}\\nBody: #{req.body}\\n\"\n end\n end", "def make_request(request = nil, meth: nil, manifest: nil, **opt)\n request, meth = [nil, request] if request.is_a?(Symbol)\n request ||= pre_flight(meth, manifest, **opt)\n # noinspection RubyMismatchedArgumentType\n SubmissionService.make_request(request, **opt, service: self)\n end", "def request\n @request ||= Rack::Request.new(env)\n end", "def request\n @request ||= Rack::MockRequest.new(mack_app)\n end", "def request\n @request ||= Rack::Request.new(@env)\n end", "def request\n @request ||= Rack::Request.new(@env)\n end", "def http_request_options(env)\n opts = {}\n if [:put, :post].include? @request[:method]\n opts[:body] = @request[:body] || extract_request_body(env)\n end\n opts\n end", "def build_request(method, path, body, request_options)\n request = {}\n request[:method] = method.downcase\n request[:path] = build_uri_path(path, request_options.params)\n request[:body] = build_body(body, request_options, method)\n request[:headers] = generate_headers(request_options)\n request[:timeout] = request_options.timeout\n request[:connect_timeout] = request_options.connect_timeout\n request\n end", "def mock_req\n Waxx::Req.new(ENV, {}, 'GET', \"/test/test/1\", {}, {}, {}, Time.new).freeze\n end", "def build_request(verb, uri, opts = {})\n opts = @default_options.merge(opts)\n uri = make_request_uri(uri, opts)\n headers = make_request_headers(opts)\n body = make_request_body(opts, headers)\n\n req = HTTP::Request.new(\n :verb => verb,\n :uri => uri,\n :uri_normalizer => opts.feature(:normalize_uri)&.normalizer,\n :proxy => opts.proxy,\n :headers => headers,\n :body => body\n )\n\n wrap_request(req, opts)\n end", "def env_with_params(path = '/', params = {}, env = {})\n method = params.delete(:method) || 'GET'\n env = {'HTTP_VERSION' => '1.1', 'REQUEST_METHOD' => \"#{method}\"}.merge(env)\n Rack::MockRequest.env_for(\"#{path}?#{Rack::Utils.build_query(params)}\", env)\nend", "def make_post_request(route:, headers: nil, body: nil)\n post route, params: body, headers: headers\nend", "def call(env, options = {})\n req = Request.new(env)\n convert_params(env, req) if path_matches?(req)\n app.call(env)\n end", "def request_to_env(io, req)\n req.headers.merge(\n Shelf::REQUEST_METHOD => req.method,\n Shelf::PATH_INFO => req.path || ROOT_PATH,\n Shelf::QUERY_STRING => req.query,\n Shelf::HTTP_VERSION => HTTP_VERSION,\n Shelf::SERVER_NAME => 'mruby-simplehttpserver',\n Shelf::SERVER_ADDR => host,\n Shelf::SERVER_PORT => port,\n Shelf::SHELF_URL_SCHEME => req.schema,\n Shelf::SHELF_INPUT => io\n )\n end", "def env_for(env, params = {}, options = {})\n require \"rack/mock\"\n\n case env\n when ::String\n ::Rack::MockRequest.env_for(env, options)\n when ::Symbol\n begin\n url = path(env, params)\n return env_for(url, params, options) # rubocop:disable Style/RedundantReturn\n rescue Hanami::Router::MissingRouteError\n {} # Empty Rack env\n end\n else\n env\n end\n end", "def generate_request(request)\n\n\t\t\trequest_uri = request[:uri].request_uri\n\n\t\t\tcase request[:method]\n\t\t\twhen :get\n\t\t\t\treq = Net::HTTP::Get.new request_uri\n\t\t\twhen :post\n\t\t\t\treq = Net::HTTP::Post.new request_uri, {'Content-Type' => \"application/json\"}\n\t\t\t\treq.body = request[:body]\n\t\t\t\treq\n\t\t\twhen :put\n\t\t\t\treq = Net::HTTP::Put.new request_uri, {'Content-Type' => \"application/json\"}\n\t\t\t\treq.body = request[:body]\n\t\t\t\treq\n\t\t\twhen :patch\n\t\t\t\treq = Net::HTTP::Patch.new request_uri, {'Content-Type' => \"application/json\"}\n\t\t\t\treq.body = request[:body]\n\t\t\t\treq\n\t\t\twhen :delete\n\t\t\t\treq = Net::HTTP::Delete.new request_uri\n\t\t\tend\n\t\tend", "def make_post_request url, body, headers = []\n make_request url, method: ::Rack::POST, body: body, headers: headers\n end", "def make_request_body(opts, headers)\n case\n when opts.body\n opts.body\n when opts.form\n form = make_form_data(opts.form)\n headers[Headers::CONTENT_TYPE] ||= form.content_type\n form\n when opts.json\n body = MimeType[:json].encode opts.json\n headers[Headers::CONTENT_TYPE] ||= \"application/json; charset=#{body.encoding.name.downcase}\"\n body\n end\n end", "def build_net_http_request request\n\n # Net::HTTP adds a content-type header automatically unless its set\n # and this messes with request signature signing. Also, it expects\n # all header values to be strings (it call strip on them).\n headers = { 'content-type' => '' }\n request.headers.each_pair do |key,value|\n headers[key] = value.to_s\n end\n\n request_class = case request.http_method\n when 'GET' then Net::HTTP::Get\n when 'PUT' then Net::HTTP::Put\n when 'POST' then Net::HTTP::Post\n when 'HEAD' then Net::HTTP::Head\n when 'DELETE' then Net::HTTP::Delete\n else raise \"unsupported http method: #{request.http_method}\"\n end\n\n net_http_req = request_class.new(request.uri, headers)\n net_http_req.body = request.body\n net_http_req\n\n end", "def request_for(method, options = {})\n request = {}\n if options[:params]\n case method\n when :post, :put\n request[:body] = options[:params]\n else\n request[:query] = options[:params]\n end\n end\n request\n end", "def create_new_http_request\n # Create a new HTTP request instance\n request_spec = @data[:request][:instance]\n http_class = \"Net::HTTP::#{request_spec.verb._camelize}\"\n http_request = http_class._constantize::new(request_spec.path)\n # Set the request body\n if request_spec.is_io?\n http_request.body_stream = request_spec.body\n else\n http_request.body = request_spec.body\n end\n # Copy headers\n request_spec.headers.each { |header, value| http_request[header] = value }\n # Save the new request\n request_spec.raw = http_request\n # Set user-agent\n if @data[:options].has_key?(:connection_user_agent)\n http_request['user-agent'] ||= @data[:options][:connection_user_agent]\n end\n http_request\n end", "def request\n @request ||= ::Lotus::Action::Request.new(@_env)\n end", "def setup\n @requester = Rack::MockRequest.new(SampleApp)\n end", "def fill_rack_env(env = {})\n env[\"rack.input\"] = @body || StringIO.new\n env[\"REQUEST_METHOD\"] = @method\n env[\"SCRIPT_NAME\"] = \"\"\n env[\"REQUEST_URI\"] = @path\n env[\"PATH_INFO\"], query = @path.split(\"?\", 2)\n env[\"QUERY_STRING\"] = query || \"\"\n if (@headers[\"HOST\"] && !env[\"SERVER_NAME\"])\n env[\"SERVER_NAME\"], port = @headers[\"HOST\"].split(\":\", 2)\n env[\"SERVER_PORT\"] = port if port\n end\n @headers.each do |key, val|\n if (key == 'CONTENT_LENGTH' || key == 'CONTENT_TYPE')\n env[key] = val\n else\n env[\"HTTP_#{key}\"] = val\n end\n end\n return env\n end", "def prepare_environment req_path, headers, params, body\n result = Hash.new\n {'header' => headers, 'param' => params}.each do |prefix, data|\n data.each do |name, value|\n result.merge! Oaf::Util.environment_item prefix, name, value\n end\n end\n result.merge! Oaf::Util.environment_item 'request', 'path', req_path\n result.merge Oaf::Util.environment_item 'request', 'body', body\n end", "def mas_net_http_post(obj_stubs = {})\n request = Spec::Mocks::Mock.new(Net::HTTP::Post)\n Net::HTTP::Post.stub!(:new).and_return(request)\n obj_stubs.each do |method, value|\n request.stub!(method).and_return(value)\n end\n request\nend", "def create_request(method, path, body = {})\n KintoRequest.new self, method, path, body\n end", "def call(env)\n\n # This ugly hack should fix the issue with Rack::Test where\n # these two variables are empty and Rack::Test will always\n # return 404.\n #\n if env['rack.test']\n env['REQUEST_URI'] = env['PATH_INFO']\n env['REQUEST_PATH'] = env['PATH_INFO']\n end\n\n # Split URI to components and then extract ;var=value pairs\n matrix_params = {}\n uri_components = (env['rack.test'] ? env['PATH_INFO'] : env['REQUEST_URI']).split('/')\n\n uri_components.each do |component|\n sub_components, value = component.split(/\\;(\\w+)\\=/), nil\n next unless sub_components.first # Skip subcomponent if it's empty (usually /)\n while param=sub_components.pop do\n if value\n matrix_params[sub_components.first] ||= {}\n matrix_params[sub_components.first].merge!(param => value)\n value=nil\n next\n else\n value = param.gsub(/\\?.*$/, '')\n end\n end\n end\n\n # Two things need to happen to make matrix params work:\n # (1) the parameters need to be appended to the 'normal' params\n # for the request. 'Normal' really depends on the content\n # type of the request, which does not seem accessible from\n # Middleware, so we use the existence of\n # rack.request.form_hash in the environment to distinguish\n # between basic and application/x-www-form-urlencoded\n # requests\n # (2) the parameters need to be stripped from the appropriate\n # path related env variables, so that request dispatching\n # does not trip over them\n\n # (1) Rewrite current path by stripping all matrix params from it\n ['REQUEST_PATH', 'REQUEST_URI', 'PATH_INFO'].select { |k|\n env[k] }.each do |k|\n env[k] = env[k].remove_matrix_params\n end\n\n # (2) Append the matrix params to the 'normal' request params\n # FIXME: Make this work for multipart/form-data\n if env['rack.request.form_hash']\n # application/x-www-form-urlencoded, most likely a POST\n env['rack.request.form_hash'].merge!(matrix_params)\n else\n # For other methods it's more complicated\n if env['REQUEST_METHOD']!='POST' and not matrix_params.keys.empty?\n env['QUERY_STRING'] = env['QUERY_STRING'].gsub(/;([^\\/]*)/, '')\n new_params = matrix_params.collect do |component, params|\n params.collect { |k,v| \"#{component}[#{k}]=#{CGI::escape(v.to_s)}\" }\n end.flatten\n # Add matrix params as a regular GET params\n env['QUERY_STRING'] += '&' if not env['QUERY_STRING'].empty?\n env['QUERY_STRING'] += \"#{new_params.join('&')}\"\n end\n end\n @app.call(env)\n end", "def initialize(env, settings)\n request = Rack::Request.new(env)\n\n @env = env\n @settings = settings\n @protocol = request.scheme\n if settings['use_proxy'] && @env.has_key?('HTTP_X_FORWARDED_HOST')\n @unmasked_host = @env['HTTP_X_FORWARDED_HOST']\n else\n @unmasked_host = @env['HTTP_HOST']\n end\n unless @env.has_key?('REQUEST_URI')\n # Add '/' to PATH_INFO as a possible fix for pow server\n @env['REQUEST_URI'] = (@env['PATH_INFO'] =~ /^[^\\/]/ ? '/' : '') + @env['PATH_INFO'] + (@env['QUERY_STRING'].size == 0 ? '' : \"?#{@env['QUERY_STRING']}\")\n end\n # REQUEST_URI is expected to not contain the server name\n # heroku contains http://...\n if @env['REQUEST_URI'] =~ /:\\/\\//\n @env['REQUEST_URI'] = @env['REQUEST_URI'].sub(/^.*:\\/\\/[^\\/]+/, '')\n end\n @unmasked_pathname = @env['REQUEST_URI'].split('?')[0]\n @unmasked_pathname += '/' unless @unmasked_pathname =~ /\\/$/ || @unmasked_pathname =~ /\\/[^\\/.]+\\.[^\\/.]+$/\n @unmasked_url = \"#{@protocol}://#{@unmasked_host}#{@unmasked_pathname}\"\n if settings['use_proxy'] && @env.has_key?('HTTP_X_FORWARDED_HOST')\n @host = @env['HTTP_X_FORWARDED_HOST']\n else\n @host = @env['HTTP_HOST']\n end\n @env['wovnrb.target_lang'] = self.lang_code\n @host = settings['url_pattern'] == 'subdomain' ? remove_lang(@host, self.lang_code) : @host\n @pathname, @query = @env['REQUEST_URI'].split('?')\n @pathname = settings['url_pattern'] == 'path' ? remove_lang(@pathname, self.lang_code) : @pathname\n @query = @query || ''\n @url = \"#{@host}#{@pathname}#{(@query.length > 0 ? '?' : '') + remove_lang(@query, self.lang_code)}\"\n if settings['query'].length > 0\n query_vals = []\n settings['query'].each do |qv|\n rx = Regexp.new(\"(^|&)(?<query_val>#{qv}[^&]+)(&|$)\")\n m = @query.match(rx)\n if m && m[:query_val]\n query_vals.push(m[:query_val])\n end\n end\n if query_vals.length > 0\n @query = \"?#{query_vals.sort.join('&')}\"\n else\n @query = ''\n end\n else\n @query = ''\n end\n @query = remove_lang(@query, self.lang_code)\n @pathname = @pathname.gsub(/\\/$/, '')\n @redis_url = \"#{@host}#{@pathname}#{@query}\"\n end", "def make_request_object( opts={} )\n\t\tdata = make_request( opts )\n\t\treturn Mongrel2::Request.parse( data )\n\tend", "def request(action = :echo)\n @request = Rack::MockRequest.new(RocketPants::CacheMiddleware.new(controller_class.action(action)))\n end", "def request(options = nil, &block)\n if options.nil? && !block\n Request\n else\n Request.with(options, &block)\n end\n end", "def _request_body_agent media_type, data: { }, **options\n request_body (@method_name['!'] ? :req : :opt), media_type, data: data, **options\n end", "def make_request_body(opts, headers); end", "def http_post_request(req_body)\n\t\t#New http request (uri library deals with port and host on its own when parsing the url)\n\t\thttp = Net::HTTP.new(@uri.host, @uri.port)\n\t\t#Original api url get does not need SSL (bad solution but any other way would not seem to work properly)\n\t\tif caller[1][/`.*'/].nil? or not (caller[1][/`.*'/][1..-2] == \"initialize\")\n\t\t\t#Https security stuff (don't need security when getting initial api url)\n\t\t\thttp.use_ssl = true\n\t\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\tend\n\t\t#Post request using uri\n\t\trequest = Net::HTTP::Post.new(@uri.request_uri)\n\t\t#Sets request to use basic authentication using the given username and api_key\n\t\trequest.basic_auth(@username, @api_key)\n\t\t#Sets request to use json content type\n\t\trequest.content_type = \"application/json\"\n\t\t#Sets request body to json file passed\n\t\trequest.body = req_body\n\t\t#Executes setup request and returns body\n\t\thttp.request(request).body\n\tend", "def expect_req_body(request, params)\n request.with do |r|\n if r.body\n expect(JSON.parse(r.body)).to include(params.deep_stringify_keys)\n else\n expect(params).to be_nil\n end\n end\nend", "def initialize(env)\n @env = env\n @request = Rack::Request.new(env)\n end", "def initialize(env)\n @env = env\n @request = Rack::Request.new(env)\n end", "def create_request_with_http_info(request_in, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RequestApi.create_request ...'\n end\n # verify the required parameter 'request_in' is set\n if @api_client.config.client_side_validation && request_in.nil?\n fail ArgumentError, \"Missing the required parameter 'request_in' when calling RequestApi.create_request\"\n end\n # resource path\n local_var_path = '/requests'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(request_in)\n auth_names = ['Basic_auth']\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 => 'Request')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RequestApi#create_request\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def initialize(env)\n @env = env\n @request = ActionDispatch::Request.new(env)\n end", "def make_request(req)\n if @http && @http.address == req.uri.host && !@http.started?\n @http.start\n else\n @http = Net::HTTP.new(req.uri.host, req.uri.port)\n @http.use_ssl = req.ssl?\n @http.verify_mode = OpenSSL::SSL::VERIFY_NONE if req.ssl?\n @http.set_debug_output($stderr) if req.debug\n @http.start\n end\n @http.request(req.http_request)\n end", "def make_host_agent_request(req)\n req['Accept'] = MIME_JSON\n req['Content-Type'] = MIME_JSON\n\n response = nil\n Net::HTTP.start(req.uri.hostname, req.uri.port, :open_timeout => 1, :read_timeout => 1) do |http|\n response = http.request(req)\n end\n response\n rescue Errno::ECONNREFUSED => e\n return nil\n rescue => e\n Instana.logger.error \"#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}\"\n Instana.logger.debug e.backtrace.join(\"\\r\\n\")\n return nil\n end", "def r(req = nil, body = nil, headers = {})\n if req\n met, url = req.split(/\\s+/, 2)\n send(met.downcase.to_sym, url, body, headers)\n end\n j2o\n end", "def request(req)\n self.class.paths << req.path\n self.class.params << req.body\n response = self.class.responses.shift\n if response.respond_to? :call then\n response.call req\n else\n res = Net::HTTPResponse.new '1.0', 200, 'OK'\n res.body = response\n res\n end\n end", "def setup_request\n return Typhoeus::Request.new(\n endpoint_url,\n method: @method,\n params: @params,\n body: @body,\n headers: @headers)\n end", "def make_request( opts={} )\n\t\topts = TEST_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts )\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] || '' )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\treturn \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\tend", "def mock_request( params, response_body )\n mock_post = {}\n mock_post.expects(:set_form_data).with(params)\n #mock.expects(:[]=).with('user-agent', anything)\n\n url = Smsinabox.uri\n Net::HTTP::Post.expects(:new).with( url.path ).returns(mock_post)\n\n response = Net::HTTPSuccess.new('1.1', 200, 'OK')\n response.instance_variable_set :@body, response_body\n response.instance_variable_set :@read, true\n\n mock_http = Object.new\n mock_http.expects(:start).returns(response)\n\n Net::HTTP.expects(:new).with( url.host, url.port ).returns(mock_http)\nend", "def make_request( opts={} )\n\t\topts = TEST_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts )\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] || '' )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend", "def request\n @request ||= ActionDispatch::TestRequest.create.tap do |request|\n request.request_id = SecureRandom.uuid\n end\n end", "def request\n @request ||= Request.new(::Minfraud::HTTPService.configuration)\n end", "def init_request(opts)\n raise ArgumentError, \":uri is for backwards compatibilty and conflicts with :request\" \\\n if opts[:request] && opts[:uri]\n\n # For backwards compatibilty\n if opts[:uri]\n HTTP::Request.new(:uri => opts[:uri], :verb => :get)\n else\n opts.fetch(:request)\n end\n end", "def setup_fixtured_request( action, *args )\n\t\turi = '/' + File.join( @appletname, action.to_s )\n\t\treq = Apache::Request.new( uri )\n\n\t\tparams = args.last.is_a?( Hash ) ? args.pop : {}\n\t\tdebug_msg \"Parameters hash set to: %p\" % [params]\n\t\treq.paramtable = params\n\n\t\tdebug_msg \"Request is: %p\" % [req]\n\t\t#txn = Arrow::Transaction.new( req, @config, nil )\n\t\ttxn = flexmock( \"transaction\" )\n\t\ttxn.should_receive( :request ).\n\t\t and_return( req ).zero_or_more_times\n\t\ttxn.should_receive( :vargs= ).\n\t\t with( Arrow::FormValidator ).zero_or_more_times\n\t\t\n\t\tvargs = flexmock( \"form validator\" )\n\t\ttxn.should_receive( :vargs ).\n\t\t\tand_return( vargs ).\n\t\t\tzero_or_more_times\n\t\tvargs.should_receive( :[] ).zero_or_more_times\n\t\t\n\t\tdebug_msg \"Transaction is: %p\" % [txn]\n\t\treturn txn, req, vargs, *args\n\tend", "def run_request(method, path, body, headers)\n klass = Net::HTTP.const_get(method.to_s.capitalize)\n req.klass.new(path, headers)\n req.body = body if body\n request(req)\n end", "def build_request(verb, uri, opts = T.unsafe(nil)); end", "def build_request(action, url, headers, options = {})\n # If the Expect header isn't set uploads are really slow\n headers['Expect'] ||= ''\n\n Request.new.tap do |req|\n req.action = action\n req.headers = self.headers.merge headers\n req.automatic_content_encoding = options.fetch :automatic_content_encoding, self.automatic_content_encoding\n req.timeout = options.fetch :timeout, self.timeout\n req.connect_timeout = options.fetch :connect_timeout, self.connect_timeout\n req.dns_cache_timeout = options.fetch :dns_cache_timeout, self.dns_cache_timeout\n req.low_speed_time = options.fetch :low_speed_time, self.low_speed_time\n req.low_speed_limit = options.fetch :low_speed_limit, self.low_speed_limit\n req.force_ipv4 = options.fetch :force_ipv4, self.force_ipv4\n req.max_redirects = options.fetch :max_redirects, self.max_redirects\n req.username = options.fetch :username, self.username\n req.password = options.fetch :password, self.password\n req.proxy = options.fetch :proxy, self.proxy\n req.proxy_type = options.fetch :proxy_type, self.proxy_type\n req.auth_type = options.fetch :auth_type, self.auth_type\n req.insecure = options.fetch :insecure, self.insecure\n req.ssl_version = options.fetch :ssl_version, self.ssl_version\n req.http_version = options.fetch :http_version, self.http_version\n req.cacert = options.fetch :cacert, self.cacert\n req.ignore_content_length = options.fetch :ignore_content_length, self.ignore_content_length\n req.buffer_size = options.fetch :buffer_size, self.buffer_size\n req.download_byte_limit = options.fetch :download_byte_limit, self.download_byte_limit\n req.progress_callback = options.fetch :progress_callback, self.progress_callback\n req.multipart = options[:multipart]\n req.upload_data = options[:data]\n req.file_name = options[:file]\n\n base_url = self.base_url.to_s\n url = url.to_s\n raise ArgumentError, \"Empty URL\" if base_url.empty? && url.empty?\n uri = URI.parse(base_url.empty? ? url : File.join(base_url, url))\n query = uri.query.to_s.split('&')\n query += options[:query].is_a?(Hash) ? Util.build_query_pairs_from_hash(options[:query]) : options[:query].to_s.split('&')\n uri.query = query.join('&')\n uri.query = nil if uri.query.empty?\n url = uri.to_s\n req.url = url\n end\n end", "def get_params(env)\n req = ActionDispatch::Request.new(env)\n req.GET.merge(req.POST)\n end", "def get_params(env)\n req = ActionDispatch::Request.new(env)\n req.GET.merge(req.POST)\n end", "def make_request( opts={} )\n\t\tsetup_mongrel2_config()\n\t\topts = TEST_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts )\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] || '' )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend", "def mock_env_for(url, opts={})\n env = Rack::MockRequest.env_for url, opts\n env.merge! env_extensions\n end", "def stub_post(path, filename, options={})\n opts = {:body => fixture_file(filename)}.merge(options)\n\n FakeWeb.register_uri(:post, dinero_mail_url(path, options[:url]), opts)\nend", "def request(method, uri, options = {})\n opts = @default_options.merge(options)\n headers = opts.headers\n proxy = opts.proxy\n \n if opts.form\n body = URI.encode_www_form(opts.form)\n headers['Content-Type'] ||= 'application/x-www-form-urlencoded'\n end\n\n request = Request.new method, uri, headers, proxy, body\n\n opts.callbacks[:request].each { |c| c.call(request) }\n response = perform request\n opts.callbacks[:response].each { |c| c.call(response) }\n\n format_response method, response, opts.response\n end", "def create_mock_env(source_ip, user_agent, is_periodic_task = false)\n mock_env = {\n 'REMOTE_ADDR' => source_ip,\n 'HTTP_USER_AGENT' => user_agent\n }\n\n if is_periodic_task\n mock_env['HTTP_X_AWS_SQSD_TASKNAME'] = 'ElasticBeanstalkPeriodicTask'\n else\n mock_env['rack.input'] = StringIO.new('{\"job_class\": \"ElasticBeanstalkJob\"}')\n end\n\n mock_env\n end", "def apply_request(request_env); end", "def make_request(type, headers = nil, body = nil)\n request = \"#{type.to_s.upcase} #{@path} HTTP/1.0\\r\\n\"\n request << add_headers(headers) if headers\n request << \"\\r\\n\"\n request << body if body\n request\n end", "def build_request(name, args)\n build_args(args) if args\n # build the request & http object\n build_http_request(name)\n # set the content type & request body\n update_content_type(name)\n make_request(@http, @request)\n end", "def build_request path, opts = {}\n connection.build_request path, opts\n end", "def create_request(method, path, options)\n version = options.has_key?(:api_version) ? \"/#{options[:api_version]}\" : \"\"\n\n path = \"#{version}#{path}\"\n\n instance_eval <<-RUBY, __FILE__, __LINE__ + 1\n @client.#{method}(path) do |req|\n req.body = options[:body]\n req.headers.update(options[:headers])\n req.params.update(options[:query]) if options[:query]\n end\n RUBY\n end", "def build_request(http_method, path, opts = {})\n url = build_request_url(path)\n http_method = http_method.to_sym.downcase\n\n header_params = @default_headers.merge(opts[:header_params] || {})\n query_params = opts[:query_params] || {}\n form_params = opts[:form_params] || {}\n\n\n # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)\n _verify_ssl_host = @config.verify_ssl_host ? 2 : 0\n\n req_opts = {\n :method => http_method,\n :headers => header_params,\n :params => query_params,\n :params_encoding => @config.params_encoding,\n :timeout => @config.timeout,\n :ssl_verifypeer => @config.verify_ssl,\n :ssl_verifyhost => _verify_ssl_host,\n :sslcert => @config.cert_file,\n :sslkey => @config.key_file,\n :verbose => @config.debugging,\n :proxy => @config.proxy\n }\n\n # set custom cert, if provided\n req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert\n\n if [:post, :patch, :put, :delete].include?(http_method)\n req_body = build_request_body(header_params, form_params, opts[:body])\n req_opts.update :body => req_body\n if @config.debugging\n @config.logger.debug \"HTTP request body param ~BEGIN~\\n#{req_body}\\n~END~\\n\"\n end\n end\n\n request = Typhoeus::Request.new(url, req_opts)\n download_file(request) if opts[:return_type] == 'File'\n request\n end", "def build_request(http_method, path, opts = {})\n url = build_request_url(path)\n http_method = http_method.to_sym.downcase\n\n header_params = @default_headers.merge(opts[:header_params] || {})\n query_params = opts[:query_params] || {}\n form_params = opts[:form_params] || {}\n\n\n # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)\n _verify_ssl_host = @config.verify_ssl_host ? 2 : 0\n\n req_opts = {\n :method => http_method,\n :headers => header_params,\n :params => query_params,\n :params_encoding => @config.params_encoding,\n :timeout => @config.timeout,\n :ssl_verifypeer => @config.verify_ssl,\n :ssl_verifyhost => _verify_ssl_host,\n :sslcert => @config.cert_file,\n :sslkey => @config.key_file,\n :verbose => @config.debugging\n }\n\n # set custom cert, if provided\n req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert\n\n if [:post, :patch, :put, :delete].include?(http_method)\n req_body = build_request_body(header_params, form_params, opts[:body])\n req_opts.update :body => req_body\n if @config.debugging\n @config.logger.debug \"HTTP request body param ~BEGIN~\\n#{req_body}\\n~END~\\n\"\n end\n end\n\n request = Typhoeus::Request.new(url, req_opts)\n download_file(request) if opts[:return_type] == 'File'\n request\n end", "def request\n WebRequest.create(build_request_url)\n end", "def build_request(method)\n Request.create(method) do |req|\n req.params = self.params.dup\n req.headers = self.headers.dup\n req.options = self.options\n yield(req) if block_given?\n end\n end", "def rewrite_request(env)\n rewritten = rewrite_host(env)\n @request = rewritten.merge(@request)\n end", "def make_request(action, params = {})\n path = params[:path] || \"/\"\n method = params[:method] || \"post\"\n env = Rack::MockRequest.env_for(path, params: params.except(:path).except(:method), method: method)\n status, headers, body = described_class.action(action).call(env)\n @response = ActionDispatch::TestResponse.new(status, headers, body)\n @controller = body.instance_variable_get(:@response).request.env['action_controller.instance']\nend", "def requestor(req, json = nil)\n res = Net::HTTP.start(@host, @port, {:use_ssl => true}) { |http|\n create_the_request(req, json, http)\n }\n unless res.kind_of?(Net::HTTPSuccess)\n # let rails and sinatra handle this or print out if using ruby i say if, elsif, else\n handle_error(req, res)\n end\n res\n end", "def create_post(params)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.post(new_post_endpoint, { 'router.params' => params, format: :json })\n end", "def initialize(body: \"\", debug: false, headers: {}, request:)\n @body = body\n @debug = debug\n @headers = headers\n @request = request\n @requested_url = request.path\n end", "def build_request\n client.request request_name\n end", "def post(path, params = {}, env = {}, &block)\n env[:request_method] = \"POST\"\n mock_request(path, params, env, &block)\n end", "def request(req)\n req = Request.new(req) if req.kind_of?(Hash)\n action = if req.kind_of?(Request) then req.action else '(string)' end\n debug(\"#{action}: #{req.inspect}\")\n begin\n res = get_response(req)\n info(\"#{action}: #{res.inspect}\")\n rescue Error::Casual => ex\n info(\"#{action}: (ignored) #{ex.message}\")\n raise if verbose\n res = ex.response\n rescue Error::Fatal => ex\n error(\"#{action}: #{ex.message}\")\n raise\n rescue Errno::ECONNREFUSED => ex\n error(\"#{ex.message} / #{self['host'].inspect}:#{self['port'].inspect}\")\n raise\n end\n return res\n end", "def call(env)\n # Create a NakedModel::Request from the environment\n request = Request.from_env(env,namespace)\n\n # Push pseuo-path arguments, turning http methods into special case methods to call on adapters\n # TODO wrap << in request\n# case request.request.request_method\n# when 'POST'\n# request.chain << 'create'\n# when 'PUT'\n# request.chain << 'update'\n# when 'DELETE'\n# # TODO traverse back up the chain....\n# end\n\n\n\n # Resolve the request to its end, catching errors thrown during the resolution\n begin\n resolved = request.chain.reduce(namespace) do |progress,fragment| \n request.decorate progress.rel(fragment)\n end\n\n rescue NakedModel::RecordNotFound\n return [404, {'Content-Type' => 'text/plain'}, [\"Not found: #{request.request.url}\"]]\n rescue NakedModel::CreateError => e\n return [409, {'Content-Type' => 'text/plain'}, [e.message]]\n rescue NakedModel::UpdateError => e\n return [406, {'Content-Type' => 'text/plain'}, [e.message]]\n end\n\n # Serialize the final object for returning to the client\n body = resolved.as_json request\n\n # The world's a beautiful place, acknowledge our success\n return [200, {'Content-Type' => 'application/json'}, [body.to_json]]\n end", "def make_generic_request(request)\n request_path = path(request)\n\n Puppet::Network::HTTP::Request.new(\n headers(request),\n params(request),\n http_method(request),\n request_path, # path\n request_path, # routing_path\n client_cert(request),\n body(request)\n )\n end", "def make_tn_request( opts={} )\n\t\topts = TEST_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts )\n\n\t\theaderstring = TNetstring.dump( headers )\n\t\tbodystring = TNetstring.dump( opts[:body] || '' )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\treturn \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\tend", "def call(env)\n match_content_type(env) do |data|\n params = Faraday::Utils::ParamsHash[data]\n env.body = params.to_query(env.params_encoder)\n end\n @app.call env\n end", "def http_request(verb, uri, options = {})\n opts = {\n :form_data => resource[:http_post_form_data],\n :body => resource[:http_request_body],\n :headers => resource[:http_request_headers],\n :content_type => resource[:http_request_content_type],\n :http_user => resource[:http_user],\n :http_pass => resource[:http_pass],\n }.merge(options)\n\n case verb.to_sym\n when :head\n req = Net::HTTP::Head.new(uri.request_uri)\n when :get\n req = Net::HTTP::Get.new(uri.request_uri)\n when :post\n req = Net::HTTP::Post.new(uri.request_uri)\n end\n (opts[:headers] || {}).each do |header, value|\n req[header] = value\n end\n req.body = opts[:body]\n req.content_type = opts[:content_type] || ''\n if not opts[:http_user].nil? or not opts[:http_pass].nil?\n req.basic_auth opts[:http_user], opts[:http_pass]\n end\n req.set_form_data(opts[:form_data] || {}) if verb.to_sym == :post\n req\n end", "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end", "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end", "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end", "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end", "def request_body required, media_type, data: { }, desc: '', **options\n (self[:requestBody] ||= RequestBodyObj.new(required, desc)).absorb(media_type, { data: data , **options })\n end", "def make_json_request_object( opts={} )\n\t\tdata = make_json_request( opts )\n\t\treturn Mongrel2::Request.parse( data )\n\tend", "def setup_env_params\n {\n url: @request.respond_to?(:original_url) ? @request.original_url : @request.path_info,\n referrer: @request.referer,\n http_method: action_dispatch? ? @request.method : @request.request_method,\n ip_address: @request.respond_to?(:remote_ip) ? @request.remote_ip : @request.ip,\n user_agent: @request.user_agent\n }\n end" ]
[ "0.6353609", "0.6209062", "0.6131766", "0.6115029", "0.5974974", "0.581073", "0.5722107", "0.564282", "0.56267667", "0.5513149", "0.54360497", "0.5433785", "0.5376233", "0.5373324", "0.5373324", "0.5338877", "0.5331835", "0.5328152", "0.5294705", "0.5287614", "0.5279952", "0.527627", "0.5246186", "0.5229354", "0.5158159", "0.51385474", "0.513595", "0.51133615", "0.50839305", "0.5076122", "0.5070914", "0.5028705", "0.4991834", "0.4975526", "0.49752772", "0.49589646", "0.49383423", "0.49330023", "0.49130833", "0.49027863", "0.48968044", "0.4882263", "0.4869692", "0.48634022", "0.48575068", "0.48566714", "0.48566714", "0.4853464", "0.4843677", "0.48293346", "0.4829104", "0.48282158", "0.48250788", "0.48246026", "0.4793033", "0.4793023", "0.47901076", "0.47780088", "0.4772924", "0.47717214", "0.47682095", "0.47643158", "0.47570232", "0.4751271", "0.47336736", "0.47336736", "0.47329953", "0.4729619", "0.4717486", "0.47132817", "0.47126362", "0.47118077", "0.46985117", "0.46965063", "0.4680743", "0.46612534", "0.465392", "0.4645965", "0.46447954", "0.46355775", "0.46323672", "0.46304026", "0.4629681", "0.46116012", "0.46095964", "0.4608675", "0.4591308", "0.45876527", "0.4579953", "0.45790508", "0.45759788", "0.45757973", "0.45726004", "0.45724386", "0.45724386", "0.45724386", "0.45724386", "0.45675394", "0.45658153", "0.45656547" ]
0.84626085
0
Dispatches an action to the given class. This bypasses the router and is suitable for unit testing of controllers. ==== Parameters controller_klass:: The controller class object that the action should be dispatched to. action:: The action name, as a symbol. params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see +fake_request+), including :req or :post_body for setting the request body itself. &blk:: The controller is yielded to the block provided for actions prior to the action being dispatched. ==== Example dispatch_to(MyController, :create, :name => 'Homer' ) do |controller|
def dispatch_to(controller_klass, action, params = {}, env = {}, &blk) params = merge_controller_and_action(controller_klass, action, params) dispatch_request(build_request(params, env), controller_klass, action.to_s, &blk) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch_request(request, controller_klass, action, &blk)\n controller = controller_klass.new(request)\n yield controller if block_given?\n controller._dispatch(action)\n\n Merb.logger.info controller._benchmarks.inspect\n Merb.logger.flush\n\n controller\n end", "def call(controller, action)\n lambda {\n controller = Object.const_get(controller)\n action ||= Configuration::Base.app.default_action\n\n instance = controller.new\n request.controller = instance\n request.action = action\n\n instance.send(action)\n }\n end", "def route(controller, action, **args)\n klass = Object.const_get(klass_for(controller)).new(**args)\n klass.send(action)\n end", "def route(controller, action, **args)\n klass = Object.const_get(klass_for(controller)).new(**args)\n klass.send(action)\n end", "def route(controller, action, **args)\n klass = Object.const_get(klass_for(controller)).new(**args)\n klass.send(action)\n end", "def dispatch_action(klass, action, request, response, status=200)\n # build controller\n controller = klass.build(request, response, status)\n # complete setup benchmarking\n #controller._benchmarks[:setup_time] = Time.now - start\n if @@use_mutex\n @@mutex.synchronize { controller.dispatch(action) }\n else\n controller.dispatch(action)\n end\n [controller, action]\n end", "def dispatch_multipart_to(controller_klass, action, params = {}, env = {}, &blk)\n request = multipart_fake_request(env, params)\n dispatch_request(request, controller_klass, action, &blk)\n end", "def call_action(handler, params, query_params)\n controller_name, action_name = handler.split('#')\n controller_class = lookup_controller(controller_name)\n controller = controller_class.new(self, params, query_params)\n controller.execute_action(action_name)\n end", "def route_to(klass_or_name, action)\n RouteToMatcher.new(klass_or_name, action)\n end", "def dispatch action\n @action = action\n\n invoke do\n filter(*before_filters_for(action))\n args = action_arguments action\n __send__(action, *args)\n end\n\n rescue => err\n invoke{ handle_error err }\n ensure\n filter(*after_filters_for(action))\n end", "def dispatch_action(req)\n controller = ROUTE_TO_CONTROLLER[req.path_info]\n raise Heartcheck::Errors::RoutingError if controller.nil?\n\n Logger.info \"Start [#{controller}] from #{req.ip} at #{Time.now}\"\n\n controller.new.index.tap do |_|\n Logger.info \"End [#{controller}]\\n\"\n end\n end", "def make_controller(klass)\n @controller = eval(\"#{klass.to_s.camelize}Controller\").new\n end", "def touch_controller(klass)\n klass.controller_class\n end", "def action(klass)\n def_delegator :default, klass.action_name\n define_method klass.action_name do |*args, &block|\n new_action = klass.new self, action\n directives.values.each {|it| it.setup! new_action }\n new_action.setup! *args, &block\n new_action.new_flow\n end\n end", "def requestAction(controller,action,params={})\n controller.class_eval{\n def params=(params); @params = params end\n def params; @params end\n }\n c = controller.new\n c.request = @_request\n c.response = @_response\n c.params = params\n c.send(action)\n c.response.body\n end", "def create_controller(ctrl_action)\n ctrl_name, action_name = ctrl_action.split('#')\n klass = Object.const_get \"#{ctrl_name.capitalize}Controller\"\n klass.new(name: ctrl_name, action: action_name.to_sym, request: request)\n end", "def _dispatch(action)\n _run_filters(:before, action)\n response = send(action)\n _run_filters(:after, action)\n response\n end", "def run(req, res)\n @params = req.params\n controller_class.send(action_name)\n end", "def invoke_action(action, args = {})\n raise ArgumentError, \"Browser.invoke_action expects an ActionController::Action as first parameter\"\\\n unless ::Waw::ActionController::Action===action\n location, response = fetch(relative_uri(action.uri), :post, args)\n apply_action_routing(action, JSON.parse(response.body))\n self.response\n end", "def renderActionInOtherController(controller,action,params)\n # controller.class_eval{\n # def params=(params); @params = params end\n # def params; @params end\n # }\n c = controller.new\n c.request = @_request\n c.response = @_response\n c.params = params\n c.send(action)\n c.response.body\n end", "def action(name, &blk)\n name = name.to_s\n\n klass = Class.new do\n def initialize(action, name)\n @action, @name = action, name\n end\n\n def control_flow(sym, name, mods, options={})\n @action.control_flow(sym, name, mods, options.merge({action: @name}))\n end\n\n def data_flow(sym, name, mods, options={})\n @action.data_flow(sym, name, mods, options.merge({action: @name}))\n end\n\n def flyweight(sym, name, mods, options={})\n @action.flyweight(sym, name, mods, options.merge({action: @name}))\n end\n\n def action(name, &blk)\n @action.action(\"#{@name}:#{name}\", &blk)\n end\n end\n\n blk.call klass.new(self, name)\n end", "def run(req, res)\n if matches?(req)\n controller = @controller_class.new(req, res)\n controller.send(@action_name)\n end\n end", "def make_request(action, params = {})\n path = params[:path] || \"/\"\n method = params[:method] || \"post\"\n env = Rack::MockRequest.env_for(path, params: params.except(:path).except(:method), method: method)\n status, headers, body = described_class.action(action).call(env)\n @response = ActionDispatch::TestResponse.new(status, headers, body)\n @controller = body.instance_variable_get(:@response).request.env['action_controller.instance']\nend", "def perform(controller_class_name, params)\n self.controller_class_name = controller_class_name\n self.params = params\n Karafka.monitor.notice(self.class, params: params)\n controller.perform\n end", "def call_action action=nil\n action ||= @action\n invoke{ dispatch action }\n invoke{ handle_status(@response.status) }\n content_type self.class.content_type unless @response[CNT_TYPE]\n @response.finish\n end", "def _dispatch(action=:index)\n start = Time.now\n if self.class.callable_actions.include?(action.to_s)\n super(action)\n else\n raise ActionNotFound, \"Action '#{action}' was not found in #{self.class}\"\n end\n @_benchmarks[:action_time] = Time.now - start\n end", "def dispatch(msg)\n ActiveRecord::Base.establish_connection(Serv::Configuration::database_configuration)\n\n msg = JSON.parse(msg)\n \n controller = msg['controller']\n action = msg['action']\n params = msg['params']\n session_id = msg['session_id']\n \n log \"[REQUEST] - [controller: #{controller},\" + \" action: #{action}, \" + \" params: #{params}]\"\n \n if !params.nil?\n args = \"params\"\n else\n args = nil\n end\n \n # Metaprogramming code that will dyamically call the requested controller\n # and method\n result = nil\n eval %Q(\n session = get_session(session_id)\n \n if !session.nil?\n request = #{controller.camelize}Controller.new\n request.instance_variable_set(:@session, session)\n request.instance_variable_set(:@game_mq, @game_mq)\n request.extend(Broker::Commands)\n \n result = if args.nil?\n request.#{action}\n else\n request.#{action}(#{args})\n end\n else\n raise Interrupt\n end\n )\n respond_success(result)\n rescue ArgumentError\n respond_error(Errors::ERR_ARGUMENT_ERROR, $!)\n rescue Interrupt\n respond_error(Errors::ERR_INVALID_SESSION, $!)\n rescue\n respond_error(Errors::ERR_GENERIC, $!)\n ensure\n ActiveRecord::Base.connection.disconnect!\n #ActiveRecord::Base.verify_active_connections!\n end", "def perform(action)\n @action_name = action\n begin\n self.send(@action_name)\n rescue\n Skates.logger.error {\n \"#{$!}:\\n#{$!.backtrace.join(\"\\n\")}\"\n }\n end\n self.render\n end", "def _call_action(action)\n send(action)\n end", "def method_missing *args\n @controller_instance.send *args\n end", "def receive_action(action)\n self.define_singleton_method(:perform_action, &action)\n end", "def handle(action, request)\n request.error(404) unless only.include?(action)\n protect!(request) if protect.include?(action)\n \n log_with_benchmark(request, action) do\n instance_exec(request, &self.class.actions[action][:fn])\n end\n end", "def fill_controller_action_attributes\n return if controller_action.blank?\n route = controller_action.split('#')\n self.controller, self.action = route.first, route.last\n end", "def process_action(site, action_path, env, format)\n namespace, *parts = action_path.split(S::Constants::SLASH)\n path = \"/\" << parts.join(S::Constants::SLASH)\n env[S::Constants::PATH_INFO] = path\n run_controller(site, namespace, env, format)\n end", "def get_action(obj, klass, name)\n\t\t# expects names as standard symbols, rather than in constant-symbol format\n\t\t# ex) expected - :move_over_there\n\t\t# rather than - :MoveOverThere\n\t\t\n\t\t# NOTE: I think this is a cleaner interface, but it requires a bunch of string manipulation. As this is something that needs to be called very often, it may become a major source of latency.\n\t\t# The weird part is really that you're using symbols in a not-very-symbol-like way\n\t\t# so the solution may actually be just to use Strings instead\n\t\t# as constant lookup can also be done using strings\n\t\t\n\t\t\n\t\tname_const = name.to_s.constantize\n\t\t# p [klass, name, name_const]\n\t\t\n\t\tbegin\n\t\t\treturn klass::Actions.const_get name_const\n\t\trescue NameError => e\n\t\t\t# Traverse the hierarchy to find a class that can yield the desired Action.\n\t\t\t# Mostly, you will traverse the class inheritance hierarchy,\n\t\t\t# but there are some exceptions.\n\t\t\t\n\t\t\tif BASE_CLASSES.include? klass\n\t\t\t\t# you have reached the bottom of the chain,\n\t\t\t\t# the root of the the tree.\n\t\t\t\t# The recursion stops here\n\t\t\t\t\n\t\t\t\t# end of the road:\n\t\t\t\t# this is the base of the entire Action search system.\n\t\t\t\t# If no action has been found by this point, the action is not defined.\n\t\t\t\twarn \"#{obj.class} does not define #{name || '<NIL>'}, nor does it's ancestors\"\n\t\t\t\treturn ThoughtTrace::Actions::NullAction\n\t\t\telse\n\t\t\t\t# trigger recursion to find the Action in question\n\t\t\t\tparent = get_parent(obj, klass)\n\t\t\t\t\n\t\t\t\treturn get_action(obj, parent, name)\n\t\t\tend\n\t\tend\n\tend", "def run(req, res)\n controller = controller_class.new(req, res, route_params(req))\n controller.invoke_action(action_name)\n end", "def render_action(attrs)\n controller_name = attrs[:controller] || self.controller_class.controller_name\n action_name = attrs[:action]\n @controller.action_name = action_name\n prepare_data\n self.instance_variables.collect{|v| @assigns[v[1..-1]] = self.instance_eval(\"#{v}\")}\n render_opts = {:file => \"#{controller_name}/#{action_name}\"}\n render_opts[:layout] = \"layouts/\" + (attrs[:layout] || 'application')\n\n view_html = @view.render(render_opts)\n set_response_text(view_html)\n end", "def invoke_action(opt = {})\n raise(\"Method not implemented for this class: #{@klass}\")\n end", "def _dispatch(action=:to_s)\n hook :before_dispatch\n self.action_name = action\n \n caught = catch(:halt) do\n start = Time.now\n result = _call_filters(_before_filters.reverse)\n @_benchmarks[:before_filters_time] = Time.now - start if _before_filters\n result\n end\n \n @body = case caught\n when :filter_chain_completed then _call_action(action_name)\n when String then caught\n when nil then _filters_halted\n when Symbol then send(caught)\n when Proc then caught.call(self)\n else\n raise MerbControllerError, \"The before filter chain is broken dude. wtf?\"\n end\n start = Time.now\n _call_filters(_after_filters) \n @_benchmarks[:after_filters_time] = Time.now - start if _after_filters\n hook :after_dispatch\n end", "def run(req, res)\n route_params = self.make_match_hash(req)\n controller = @controller_class.new(req, res, route_params)\n controller.invoke_action(@action_name)\n end", "def send_action(action, params={})\n set_params Hash[action: action].merge params\n @response = http_send_action\n end", "def run(req, res)\n if matches?(req)\n controller_instance = controller_class.new(req, res, route_params(req))\n controller_instance.invoke_action(action_name)\n else\n # extra precaution! won't be hit if `Router#run` is used\n res.status = 404\n res.write(\"No route matches for #{http_method} on #{controller_class}\")\n end\n end", "def perform_action\n action_name = params[:action_name].to_sym\n action = resource.member_actions[action_name]\n if action.is_method_action?\n @record.send(action.method_name)\n end\n if action.is_block_action?\n action.block.call(@record)\n end\n return redirect_to([app_kit, @record])\n end", "def add_controller(controller, klass)\n unless present?(controller)\n raise Vedeu::Error::MissingRequired,\n 'Cannot store controller without a name attribute.'\n end\n\n Vedeu.log(type: :create,\n message: \"Controller: ':#{controller}'\")\n\n if registered?(controller)\n storage[controller][:klass] = klass\n\n else\n storage.store(controller, klass: klass, actions: [])\n\n end\n\n storage\n end", "def call(env)\n Rango::Router.set_rack_env(env) # See rango/router/adapters/*\n request = Rango::Request.new(env)\n options = env[\"rango.router.params\"] || raise(\"rango.router.params property has to be setup at least to empty hash\")\n method = env[\"rango.controller.action\"].to_sym\n controller = self.new(env, options.merge(request.params))\n begin\n unless controller.respond_to?(method) # TODO: what about method_missing?\n raise NotFound, \"Controller #{self.name} doesn't have method #{method}\"\n end\n controller.run_filters(:before, method.to_sym)\n # If you don't care about arguments or if you prefer usage of params.\n if controller.method(method).arity.eql?(0)\n Rango.logger.debug(\"Calling method #{self.name}##{method} without arguments\")\n controller.response.body = controller.method(method).call\n else\n args = controller.params.values\n Rango.logger.debug(\"Calling method #{self.name}##{method} with arguments #{args.inspect}\")\n controller.response.body = controller.method(method).call(*args)\n end\n controller.run_filters(:after, method)\n return controller.response.finish\n rescue HttpError => exception\n controller.rescue_http_error(exception)\n end\n end", "def trigger(action_class, *args)\n if uses_concurrency_control\n trigger_with_concurrency_control(action_class, *args)\n else\n world.trigger { world.plan_with_options(action_class: action_class, args: args, caller_action: self) }\n end\n end", "def controller(&block)\n @config.controller.class_exec(&block) if block_given?\n @config.controller\n end", "def use_custom_controller(controller, &block)\n old_controller = self.class.controller_class\n begin\n self.class.controller_class = controller\n yield\n ensure\n self.class.controller_class = old_controller\n end\n end", "def dispatch_with_basic_authentication_to(controller_klass, action, username, password, params = {}, env = {}, &blk)\n env[\"X_HTTP_AUTHORIZATION\"] = \"Basic #{Base64.encode64(\"#{username}:#{password}\")}\"\n \n params = merge_controller_and_action(controller_klass, action, params) \n dispatch_request(build_request(params, env), controller_klass, action.to_s, &blk)\n end", "def with_controller(controller_class, &block)\n old_controller = @controller\n @controller = controller_class.new\n rc = yield(controller_class)\n @controller = old_controller\n rc\n end", "def invoke_action(path)\n controller(path).send(action_name)\n end", "def perform( action, workitem )\n @action, @workitem = action, workitem\n\n begin\n send( action )\n run_callbacks\n rescue => e\n handle_exception( e )\n end\n end", "def controller(path)\n controller_name.constantize.new(controller_name, action_name,\n get_params(path))\n end", "def klass_from_controller(c = controller_name)\n c.singularize.camelize.constantize\n end", "def switch_to_controller\n unless ( name = (path_matcher.view_name || path_matcher.model_name) )\n return\n end\n\n action = nil\n \tif path_matcher.is_view?\n \t action = File.basename(file_path).split(\".\").first\n else\n \t name = name.pluralize\n end\n\n controller = \"/app/controllers/#{name}_controller.rb\"\n\n if action\n goto_definition controller, \"def #{action}\"\n else\n open_file controller\n end\n end", "def do_dispatch(env)\n path = env['PATH_INFO']\n\n # Try to serve a public file\n ret = dispatch_public(env, path)\n return ret if not ret.nil?\n\n log.debug \"Checking for routes that match: #{path}\"\n route = router.match(env)\n\n if route.has_key? :ok\n dispatch_controller(route, env)\n else\n [404, {\"Content-Type\" => \"text/plain\"}, [\"404 Not Found: #{path}\"]]\n end\n end", "def to(params)\n set(:controller, params[:controller])\n set(:action, params[:action])\n # We now have all the properties we really need to create a route.\n route = Route.new(@routes.pop)\n @routes << route\n self\n end", "def handle(http_request, response)\n start = Time.now\n request = Merb::Request.new(http_request)\n Merb.logger.info(\"Params: #{request.params.inspect}\")\n Merb.logger.info(\"Cookies: #{request.cookies.inspect}\")\n # user friendly error messages\n if request.route_params.empty?\n raise ControllerExceptions::BadRequest, \"No routes match the request\"\n elsif request.controller_name.nil?\n raise ControllerExceptions::BadRequest, \"Route matched, but route did not specify a controller\" \n end\n Merb.logger.debug(\"Routed to: #{request.route_params.inspect}\")\n # set controller class and the action to call\n klass = request.controller_class\n dispatch_action(klass, request.action, request, response)\n rescue => exception\n Merb.logger.error(Merb.exception(exception))\n exception = controller_exception(exception)\n dispatch_exception(request, response, exception)\n end", "def process_action(...)\n send_action(...)\n end", "def klass_for(controller)\n if registered?(controller) && klass_defined?(controller)\n storage[controller][:klass]\n\n else\n raise Vedeu::Error::MissingRequired,\n \"Cannot route to #{controller} as no class defined.\"\n\n end\n end", "def rails_controller_eval(&block)\n rails_controller_instance.instance_exec(&block)\n end", "def controller(controller); end", "def get_controller_and_action env\n path_info = env.fetch \"PATH_INFO\"\n parts = path_info.split \"/\", 4\n\n _, name, action, = parts\n\n controller_name = \"#{name.capitalize}Controller\"\n\n begin\n controller_class = Object.const_get controller_name\n rescue NameError\n raise Rulers::NoSuchController.new name, controller_name, env\n end\n\n controller = controller_class.new env\n\n return controller, action\n end", "def execute(*args)\n\n # Verify if the controller answers to the @action_name value\n raise WebFlowError, \"The action step #{@action_name} is not defined in your controller.\" unless args[0].respond_to? lookup_method_to_call(@action_name)\n \n # The controller defines a method with the same name as @action_name.\n # Kewl! A 'someone else problem' !!!\n args[0].send( lookup_method_to_call( @action_name ) )\n \n end", "def create\n @controller_action = ControllerAction.new(params[:controller_action])\n\n respond_to do |format|\n if @controller_action.save\n format.html { redirect_to new_controller_action_path(:current_part_id => @controller_action.part.id), notice: 'Controller action was successfully created.' }\n format.json { render json: @controller_action, status: :created, location: @controller_action }\n else\n format.html { redirect_to new_controller_action_path(:current_part_id => @controller_action.part.id), notice: \"Didn't work!!! Did you enter a controller method?\" }\n format.json { render json: @controller_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer_to(controller_name)\n @session.controller = controller_name.new(@session)\n end", "def send_action(action, *params)\n world_lock.synchronize { self.world = Actions.send(action, world, *params) }\n end", "def modify_class(domain, klass, mindevcount, action)\n raise MogileFS::ReadOnlyError if readonly?\n res = @backend.send(\"#{action}_class\", :domain => domain, :class => klass,\n :mindevcount => mindevcount)\n\n res ? res['class'] : nil\n end", "def dispatcher(session,context,dispatch_destination = nil)\n @myclass.Dispatcher.dispatch(session,context,dispatch_destination)\n end", "def with_fixtured_action( action=nil, *args, &block )\n\t\t@action = action\n\t\ttxn, req, vargs, *args = setup_fixtured_request( action, *args )\n\t\t\n\t\tif block.arity == 3\n\t\t\tblock.call( txn, req, vargs )\n\t\telse\n\t\t\tblock.call( txn, req )\n\t\tend\n\t\t\n\t\treturn @applet.run( txn, action.to_s, *args )\n\tensure\n\t\t@action = nil\n\tend", "def _dispatch(action, match)\n # match parameter names to indices of match information\n arguments = action.parameters.map do |parameter|\n parameter_name = parameter[1].to_s\n\n if match.key? parameter_name\n match[parameter_name]\n else\n # check for the normalized name of every match to see\n # if it fits the parameter name\n match.each do |name, value|\n normalized_name = _normalize name\n\n if parameter_name == normalized_name\n break value\n end\n end\n end\n end\n\n action.call(*arguments)\n end", "def perform_action(data)\n action = extract_action(data)\n\n if processable_action?(action)\n payload = { channel_class: self.class.name, action: action, data: data }\n ActiveSupport::Notifications.instrument(\"perform_action.action_cable\", payload) do\n dispatch_action(action, data)\n end\n else\n logger.error \"Unable to process #{action_signature(action, data)}\"\n end\n end", "def mock_action_view(base = MockActionView)\n controller = ActionView::TestCase::TestController.new\n\n base.new(view_paths, {}, controller)\n end", "def run(req, res)\n match_data = @pattern.match(req.path)\n route_params = (match_data) ?\n match_data.names.zip(match_data.captures).to_h\n : {}\n\n controller_instance = @controller_class.new(req, res, route_params)\n\n controller_instance.invoke_action(@action_name)\n end", "def provider(*args, &block)\n super || self.class.action_class\n end", "def dispatch!\n if response.nil?\n raise Wirecard::Elastic::Error, \"The request failed.\"\n else\n Wirecard::Elastic::Response.const_get(action.capitalize).new(request, response)\n end\n end", "def controller(controller)\n scenario.controller = controller\n end", "def render_action(action, params)\n send(action, params)\n \n rescue RenderExit, ActionExit => e1\n # Just stop rendering. \n \n rescue ActionError => e2\n # Client Error family of errors, typically send 4XX\n # status code.\n handle_error(e2, 404)\n error e2.to_s\n \n rescue Object => e3\n # Server Error family of errors, typically send 5XX\n # status code. \n handle_error(e3, 500)\n error \"Error while handling #{self.class}##{action.to_s.gsub(/___super$/, '')}(#{params.join(', ')})\"\n error pp_exception(e3)\n end", "def dispatch(&block)\n @dispatch_block = block\n end", "def dispatch(name, req, res); end", "def switch_to_controller\n return unless ( name = path_matcher.functional_name )\n \n controller = \"/app/controllers/#{name}.rb\"\n \n if (test = find_test_under_cursor) \n # remove words from the test name that indicate the test\n # then use the first word as the name of the function/action\n #\n test.sub!(/^should /i, '')\n if test =~ /^(get|post|put|delete) /i\n test.sub!(/^[^\\s]+ /, '')\n end\n \n function = test.split(/\\s/).first\n unless function.nil?\n return goto_definition(controller, function)\n end\n end\n \n open_file controller\n end", "def issue_action\n request.request_parameters['action']\n end", "def require_action_class(filepath_and_classname)\n #; [!px9jy] requires file and finds class object.\n str = filepath_and_classname # ex: './admin/api/book:Admin::BookAPI'\n filepath, classname = filepath_and_classname.split(':', 2)\n begin\n require filepath\n rescue LoadError => ex\n #; [!dlcks] don't rescue LoadError when it is not related to argument.\n raise unless ex.path == filepath\n #; [!mngjz] raises error when failed to load file.\n raise LoadError.new(\"'#{str}': cannot load '#{filepath}'.\")\n end\n #; [!8n6pf] class name may have module prefix name.\n #; [!6lv7l] raises error when action class not found.\n begin\n klass = classname.split('::').inject(Object) {|cls, x| cls.const_get(x) }\n rescue NameError\n raise NameError.new(\"'#{str}': class not found (#{classname}).\")\n end\n #; [!thf7t] raises TypeError when not a class.\n klass.is_a?(Class) or\n raise TypeError.new(\"'#{str}': class name expected but got #{klass.inspect}.\")\n #; [!yqcgx] raises TypeError when not a subclass of K8::Action.\n klass < Action or\n raise TypeError.new(\"'#{str}': expected subclass of K8::Action but not.\")\n #\n return klass\n end", "def do_dispatch(participant, msg)\n\n do_raw_dispatch(participant, msg)\n\n rescue => err\n @context.error_handler.msg_handle(msg, err)\n end", "def add_action(controller, action)\n if present?(controller) && present?(action)\n Vedeu.log(type: :create,\n message: \"Action: ':#{action}' \" \\\n \"(for ':#{controller}')\")\n\n if registered?(controller)\n storage[controller][:actions] << action\n\n else\n add_controller(controller, '')\n add_action(controller, action)\n\n end\n\n storage\n\n else\n raise Vedeu::Error::MissingRequired,\n 'Cannot store action without a controller or name ' \\\n 'attribute.'\n\n end\n end", "def send_action action_name, service_name\n self.class.actions[action_name][service_name].run(self)\n end", "def perform_action_with_scout_instruments(*args, &block)\n req = ScoutApm::RequestManager.lookup\n req.annotate_request(:uri => request.path) # for security by-default, we don't use request.fullpath which could reveal filtered params.\n if ScoutApm::Agent.instance.context.config.value('collect_remote_ip')\n req.context.add_user(:ip => request.remote_ip)\n end\n req.set_headers(request.headers)\n req.start_layer( ScoutApm::Layer.new(\"Controller\", \"#{controller_path}/#{action_name}\") )\n\n begin\n perform_action_without_scout_instruments(*args, &block)\n rescue\n req.error!\n raise\n ensure\n req.stop_layer\n end\n end", "def dispatch(request)\n # {{{\n benchmark_start_time = Time.now \n\n params = Aurita::Attributes.new(request)\n params[:_request] = request\n params[:_session] = Aurita::Session.new(request)\n params[:_logger] = @logger\n params[:_application] = @application\n status = 200\n response_body = ''\n response_header = {}\n\n controller = params[:controller]\n action = params[:action]\n mode = params[:mode]\n controller ||= 'App_Main'\n action ||= 'start'\n mode ||= 'default'\n\n Thread.current['request'] = params\n\n Lore::Connection.reset_query_count()\n Lore::Connection.reset_result_row_count()\n\n begin\n raise ::Exception.new('No controller given') if(controller.nil? || controller == '') \n\n model_klass = @application.get_model_klass(controller)\n controller_klass = @application.get_controller_klass(controller)\n\n raise ::Exception.new('Unknown controller: ' << controller.inspect) unless controller_klass\n \n controller_instance = controller_klass.new(params, model_klass)\n\n response = false\n @logger.debug(\"Calling model interface method #{controller}.#{action}\")\n\n element = controller_instance.call_guarded(action)\n response = controller_instance.response\n if response[:html] == '' then\n if element.is_a?(Aurita::GUI::XML::Document) then\n # Don't use default decorator for XML documents: \n response[:mode] = :none if (!response[:mode] || response[:mode] == :default)\n response[:html] = element.string \n elsif element.respond_to?(:string) then\n # Response is an instance of Aurita::GUI::Element\n response[:html] = element.string \n response[:script] << element.script if element.respond_to?(:script) && element.script\n elsif element.is_a?(Array) then\n element.each { |e|\n response[:html] << e.to_s\n }\n end\n end\n\n response_header.update(response[:http_header]) if response[:http_header]\n if response_header['status_code'] then\n status = response_header['status_code'].to_i \n response_header.delete('status_code')\n end\n\n mode = response[:mode].to_sym if response && response[:mode]\n mode ||= :default \n response[:mode] = mode\n params[:_controller] = controller_instance\n\n response_body = @decorator.render(model_klass, response, params)\n\n @num_dispatches += 1\n\n @benchmark_time = Time.now-benchmark_start_time\n @num_queries = Lore::Connection.query_count\n @num_tuples = Lore::Connection.result_row_count\n Aurita::Plugin_Register.call(Hook.dispatcher.request_finished, \n controller_instance, \n :dispatcher => self, \n :controller => controller_instance, \n :action => action, \n :time => @benchmark_time, \n :num_queries => @num_queries, \n :num_tuples => @num_tuples)\n @logger.debug(\"Num queries: #{@num_queries}\")\n rescue Exception => excep\n @logger.error(excep.message)\n @logger.error(excep.backtrace.join(\"\\n\"))\n response_body = GUI::Error_Page.new(excep).string\n response_body = ''\n end\n\n return [ status, response_header, response_body ]\n end", "def perform(action)\n case action\n when :index, :new then get action\n when :show, :edit then get action, id: 1\n when :update then put :update, id: 1\n when :create then post :create\n when :destroy then delete :destroy, id: 1\n end\n end", "def actions(obj, klass=nil)\n\t\tklass ||= obj.class\n\t\t\n\t\traise TypeError, \"#{klass} does not define an Action module. Can not find Actions.\" unless klass.constants.include? 'Actions'\n\t\t\n\t\t# TODO: combine overlapping code in this method with the code from #get_action\n\t\t\n\t\t\n\t\tlist = klass::Actions.constants\n\t\t\n\t\tif klass == ThoughtTrace::Entity or klass == ThoughtTrace::Actions::EmptySpace\n\t\t\t# base case\n\t\t\treturn list\n\t\telse\n\t\t\t# recursion\n\t\t\t# trigger recursion to find the Action in question \n\t\t\tparent = get_parent(obj, klass)\n\t\t\t\n\t\t\treturn list + actions(obj, parent)\n\t\tend\n\tend", "def controller_action\n @controller_action ||= [controller.controller_name, controller.action_name].join('/')\n end", "def execute_with_controller(&block)\n Controller.new.execute(&block)\n end", "def perform_action(data)\n action = extract_action(data)\n\n raise UnproccessableActionError unless processable_action?(action)\n\n log(:debug) { log_fmt(\"Perform action #{action}(#{data})\") }\n dispatch_action(action, data)\n end", "def process(action, *args)\n @_action_name = action.to_s\n\n unless action_name = _find_action_name(@_action_name)\n raise ActionNotFound.new(\"The action '#{action}' could not be found for #{self.class.name}\", self, action)\n end\n\n @_response_body = nil\n\n process_action(action_name, *args)\n end", "def action__invoke &proc\n if (restriction = self.class.restrictions?(action_with_format))\n auth_class, auth_args, auth_proc = restriction\n (auth_request = auth_class.new(proc {}, *auth_args, &auth_proc).call(env)) && halt(auth_request)\n end\n\n (cache_control = cache_control?) && cache_control!(*cache_control)\n (expires = expires?) && expires!(*expires)\n (content_type = format? ? mime_type(format) : content_type?) && content_type!(content_type)\n (charset = __e__.explicit_charset || charset?) && charset!(charset)\n\n begin\n (self.class.hooks?(:a, action_with_format)||[]).each { |m| self.send m }\n super \n (self.class.hooks?(:z, action_with_format)||[]).each { |m| self.send m }\n rescue => e\n # if a handler defined at class level, use it\n if handler = self.class.error?(500, action)\n body = handler.last > 0 ? self.send(handler.first, e) : self.send(handler.first)\n halt 500, body\n else\n # otherwise raise rescued exception\n raise e\n end\n end\n\n end", "def exec_action_object(action)\n\t\t\taction.execute\n\t\tend", "def action_missing(name, *args)\n if name == action_name\n perform\n else\n raise AbstractController::ActionNotFound\n end\n end", "def run(request, response)\n\n match_data = @pattern.match(request.path)\n\n route_params = Hash[match_data.names.zip(match_data.captures)]\n\n @controller_class\n .new(request, response, route_params)\n .invoke_action(action_name)\n end", "def dispatch!(clazz, method, options)\n Workling.find(clazz, method).dispatch_to_worker_method(method, options)\n end", "def post_act(act, params)\n Cloudflare::Util::Component.parse_response(HTTParty.post(Cloudflare::Util::Config.get('host.base_url'), body: get_body(act, params)))\n end" ]
[ "0.65754294", "0.6272057", "0.6201761", "0.6188878", "0.6188878", "0.6165436", "0.59402746", "0.5709275", "0.5654451", "0.56012523", "0.5565367", "0.54914284", "0.5461166", "0.5456916", "0.5330146", "0.5133331", "0.51305085", "0.50572914", "0.50066924", "0.4976123", "0.49432772", "0.49248204", "0.4905166", "0.48808026", "0.48645175", "0.48017344", "0.479323", "0.4791656", "0.47769642", "0.47556713", "0.47497058", "0.47448027", "0.4733839", "0.47234046", "0.47190678", "0.47084835", "0.47053307", "0.47046658", "0.4703553", "0.46803543", "0.46766776", "0.46331605", "0.4629045", "0.46177256", "0.46041036", "0.45876756", "0.45776594", "0.45567945", "0.4539048", "0.45367333", "0.45340514", "0.44775036", "0.44749734", "0.44723937", "0.44706473", "0.44270125", "0.44148842", "0.44127205", "0.441004", "0.44057718", "0.44045258", "0.44034556", "0.44008133", "0.43660796", "0.43407586", "0.43328932", "0.4321959", "0.43080553", "0.43023214", "0.42991343", "0.42942697", "0.42940918", "0.42893177", "0.42745504", "0.42742312", "0.42733175", "0.42643455", "0.4254575", "0.4250504", "0.42474273", "0.42360833", "0.42333913", "0.42193815", "0.4218886", "0.42185348", "0.4216201", "0.42151785", "0.42105263", "0.42058572", "0.41971225", "0.41937274", "0.41912243", "0.41733664", "0.41671583", "0.4166218", "0.4163874", "0.41608113", "0.4155289", "0.41523615", "0.41480985" ]
0.82633656
0
Keep track of cookie values in CookieJar within the context of the block; you need to set this up for secific controllers. ==== Parameters controller_classes:: Controller classes to operate on in the context of the block. &blk:: The context to operate on; optionally accepts the cookie jar as an argument.
def with_cookies(*controller_classes, &blk) cookie_jar = CookieJar.new before_cb = lambda { |c| c.cookies.update(cookie_jar) } after_cb = lambda { |c| cookie_jar.update_from_request(c.request) } controller_classes.each do |klass| klass._before_dispatch_callbacks << before_cb klass._after_dispatch_callbacks << after_cb end blk.arity == 1 ? blk.call(cookie_jar) : blk.call controller_classes.each do |klass| klass._before_dispatch_callbacks.delete before_cb klass._after_dispatch_callbacks.delete after_cb end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookies\n @controller.send(:cookies)\n end", "def setup_controller(controller, env, vars)\n controller.env = env\n controller.headers = {}\n\n setup_controller_params(controller, env, vars)\n\n controller.cookies = Fastr::HTTP.parse_cookies(env)\n controller.app = self\n end", "def cookies\n controller.send(:cookies)\n end", "def cookies\n @cookies_proxy ||= Class.new do\n attr_reader :controller, :response\n\n def initialize controller\n @controller, @response = controller, controller.response\n end\n\n # set cookie header\n #\n # @param [String, Symbol] key\n # @param [String, Hash] val\n # @return [Boolean]\n def []= key, val\n return if readonly?\n response.set_cookie key, val\n end\n\n # get cookie by key\n def [] key\n controller.orig_cookies[key]\n end\n\n # instruct browser to delete a cookie\n #\n # @param [String, Symbol] key\n # @param [Hash] opts\n # @return [Boolean]\n def delete key, opts ={}\n return if readonly?\n response.delete_cookie key, opts\n end\n\n # prohibit further cookies writing\n #\n # @example prohibit writing for all actions\n # before do\n # cookies.readonly!\n # end\n #\n # @example prohibit writing only for :render and :display actions\n # before :render, :display do\n # cookies.readonly!\n # end\n def readonly!\n @readonly = true\n end\n\n def readonly?\n @readonly\n end\n\n def method_missing *args\n controller.orig_cookies.send *args\n end\n end.new @ctrl\n end", "def cookie_jar=(cookie_jar); end", "def render_cookies\n @cookies.keys.sort.each do |flavor|\n count = @cookies[flavor]\n\n Cookies::CookieUtils.instance.\n render_cookies(flavor, count)\n end\n end", "def collect_cookies_from_response; end", "def cookies() @_cookies ||= ::Merb::Cookies.new(request.cookies, @_headers) end", "def cookies(cookies); end", "def setCookies(cookies)\n @fields['cookies'] = cookies\n self\n end", "def setCookies(cookies)\n @fields['cookies'] = cookies\n self\n end", "def cookie_jar=(_arg0); end", "def cookie_jar=(_arg0); end", "def cookies; @cookies ||= CookieJar.new; end", "def cookies\n controller.respond_to?(:cookies, true) ? controller.send(:cookies) : nil\n end", "def cookie_jar; end", "def cookie_jar; end", "def cookie_jar; end", "def cookie_jar; end", "def set_cookies\r\n @sec_cookie = SecureRandom.uuid\r\n @csrf_cookie = SecureRandom.uuid\r\n\r\n post_data = \"#{rand_text_alpha(5..12)},#{rand_text_alpha(5..12)},\" +\r\n \"#{@sec_cookie},#{@csrf_cookie}\"\r\n\r\n res = send_request_cgi({\r\n 'uri' => '/ForensicsAnalysisServlet/',\r\n 'method' => 'POST',\r\n 'ctype' => 'application/json',\r\n 'cookie' => \"SEC=#{@sec_cookie}; QRadarCSRF=#{@csrf_cookie};\",\r\n 'vars_get' =>\r\n {\r\n 'action' => 'setSecurityTokens',\r\n 'forensicsManagedHostIps' => \"#{rand(256)}.#{rand(256)}.#{rand(256)}.#{rand(256)}\"\r\n },\r\n 'data' => post_data\r\n })\r\n\r\n if res.nil? or res.code != 200\r\n fail_with(Failure::Unknown, \"#{peer} - Failed to set the SEC and QRadar CSRF cookies\")\r\n end\r\n end", "def extract_headers(controller_defaults = {})\n defaults = @_cookie_defaults.merge(controller_defaults)\n cookies = []\n self.each do |name, value|\n # Only set cookies that marked for inclusion in the response header. \n next unless @_options_lookup[name]\n options = defaults.merge(@_options_lookup[name])\n if (expiry = options[\"expires\"]).respond_to?(:gmtime)\n options[\"expires\"] = expiry.gmtime.strftime(Merb::Const::COOKIE_EXPIRATION_FORMAT)\n end\n secure = options.delete(\"secure\")\n kookie = \"#{name}=#{Merb::Parse.escape(value)}; \"\n # WebKit in particular doens't like empty cookie options - skip them.\n options.each { |k, v| kookie << \"#{k}=#{v}; \" unless v.blank? }\n kookie << 'secure' if secure\n cookies << kookie.rstrip\n end\n cookies.empty? ? {} : { 'Set-Cookie' => cookies }\n end", "def controller=(value)\n Thread.current[:authlogic_controller] = value\n end", "def controller=(value)\n Thread.current[:authlogic_controller] = value\n end", "def cookies # :doc:\n request.cookie_jar\n end", "def cookies\n WEBrick::Cookie.parse_set_cookies(@headers['set-cookie']) rescue []\n end", "def store_context(status, headers)\n cookie = @cookie.merge(:value => \"#{Makara::Context.get_current}--#{status}\")\n Rack::Utils.set_cookie_header! headers, IDENTIFIER, cookie\n end", "def index\n # Test ob sich client_key-Cookie entschlüsseln lässt\n begin\n database_helper_decrypt_value(cookies[:client_key])\n rescue Exception\n cookies.delete(:client_key) # Verwerfen des nicht entschlüsselbaren Cookies\n cookies.delete(:client_salt)\n end\n\n\n unless cookies[:client_key] # Erster Zugriff in neu gestartetem Browser oder Cookie nicht mehr verfügbar\n loop_count = 0\n while loop_count < MAX_NEW_KEY_TRIES\n loop_count = loop_count+1\n new_client_key = rand(10000000)\n unless get_client_info_store.exist?(new_client_key) # Dieser Key wurde noch nie genutzt\n # Salt immer mit belegen bei Vergabe des client_key, da es genutzt wird zur Verschlüsselung des Client_Key im cookie\n cookies[:client_salt] = { :value => rand(10000000000), :expires => 1.year.from_now } # Lokaler Schlüsselbestandteil im Browser-Cookie des Clients, der mit genutzt wird zur Verschlüsselung der auf Server gespeicherten Login-Daten\n cookies[:client_key] = { :value => database_helper_encrypt_value(new_client_key), :expires => 1.year.from_now }\n get_client_info_store.write(new_client_key, 1) # Marker fuer Verwendung des Client-Keys\n break\n end\n end\n raise \"Cannot create client key after #{MAX_NEW_KEY_TRIES} tries\" if loop_count >= MAX_NEW_KEY_TRIES\n else\n cookies[:client_salt] = { :value => cookies[:client_salt], :expires => 1.year.from_now } # Timeout neu setzen bei Benutzung\n cookies[:client_key] = { :value => cookies[:client_key], :expires => 1.year.from_now } # Timeout neu setzen bei Benutzung\n end\n\n # Entfernen evtl. bisheriger Bestandteile des Session-Cookies\n cookies.delete(:locale) if cookies[:locale]\n cookies.delete(:last_logins) if cookies[:last_logins]\n session.delete(:locale) if session[:locale]\n session.delete(:last_used_menu_controller) if session[:last_used_menu_controller]\n session.delete(:last_used_menu_action) if session[:last_used_menu_action]\n session.delete(:last_used_menu_caption) if session[:last_used_menu_caption]\n session.delete(:last_used_menu_hint) if session[:last_used_menu_hint]\n session.delete(:database) if session[:database]\n session.delete(:dbid) if session[:dbid]\n session.delete(:version) if session[:version]\n session.delete(:db_block_size) if session[:db_block_size]\n session.delete(:wordsize) if session[:wordsize]\n session.delete(:dba_hist_cache_objects_owner) if session[:dba_hist_cache_objects_owner]\n session.delete(:dba_hist_blocking_locks_owner) if session[:dba_hist_blocking_locks_owner]\n session.delete(:request_counter) if session[:request_counter]\n session.delete(:instance) if session[:instance]\n session.delete(:time_selection_start) if session[:time_selection_start]\n session.delete(:time_selection_end) if session[:time_selection_end]\n\n\n set_I18n_locale(get_locale) # ruft u.a. I18n.locale = get_locale auf\n\n write_to_client_info_store(:last_used_menu_controller, 'env')\n write_to_client_info_store(:last_used_menu_action, 'index')\n write_to_client_info_store(:last_used_menu_caption, 'Start')\n write_to_client_info_store(:last_used_menu_hint, t(:menu_env_index_hint, :default=>\"Start of application without connect to database\"))\n rescue Exception=>e\n set_current_database(nil) # Sicherstellen, dass bei naechstem Aufruf neuer Einstieg\n raise e # Werfen der Exception\n end", "def cookies\n WEBrick::Cookie.parse_set_cookies(headers['Set-Cookie']) rescue []\n end", "def cookies # :doc:\n request.cookie_jar\n end", "def show_classes\n classes = Rails.cache.fetch(\"#{current_user.cache_key}/allClasses\", expires_in: 1.hours) do\n keytechAPI.classes.loadAllClasses\n end\n\n # Filter only to files, office file and folders, ignore all CAD-related types\n @classes = []\n classes.each do |element_class|\n next unless element_class.classKey.ends_with?('_WF') ||\n element_class.classKey.ends_with?('_FD') ||\n element_class.classKey.ends_with?('_FILE') ||\n element_class.classKey.ends_with?('_WW') ||\n element_class.classKey.ends_with?('_XL') ||\n element_class.classKey.ends_with?('_PRJ')\n\n if !element_class.classKey.starts_with?('DEFAULT') && element_class.isActive\n @classes.push element_class\n end\n end\n\n response.headers['Cache-Control'] = 'public, max-age=60'\n respond_to do |format|\n format.json do\n render json: @classes\n end\n end\n end", "def index\n for i in 1..200\n #cookies[\"cookie \"+i.to_s] = { value: \"Guru \"+i.to_s, secure: true}\n end\n end", "def cookies # :doc:\n request.cookie_jar\n end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def wrap_with_controller(new_controller = Kaui::SessionsController)\n old_controller = @controller\n @controller = new_controller.new\n yield\n @controller = old_controller\n end", "def wrap_with_controller(new_controller = Kaui::SessionsController)\n old_controller = @controller\n @controller = new_controller.new\n yield\n @controller = old_controller\n end", "def with_controller(controller_class, &block)\n old_controller = @controller\n @controller = controller_class.new\n rc = yield(controller_class)\n @controller = old_controller\n rc\n end", "def wrap_with_controller(new_controller = Kaui::SessionsController)\n old_controller = @controller\n @controller = new_controller.new\n yield\n @controller = old_controller\n end", "def set_classes_hash(hash_object)\n @@classes = hash_object\n end", "def handle_whitelisted_api_cookies\n new_api_cookies = request.cookies[GlobalConstant::Cookie.new_api_cookie_key.to_sym]\n return if new_api_cookies.blank?\n whitelisted_api_cookies = [GlobalConstant::Cookie.user_cookie_name]\n whitelisted_api_cookies.each do |key|\n whitelisted_cookie = new_api_cookies[key]\n if whitelisted_cookie.present? and whitelisted_cookie.is_a?(Hash)\n cookies[key.to_sym] = whitelisted_cookie\n end\n end\n end", "def cookies\n CookieJar.new(self)\n end", "def cookies\n # renders static page\n end", "def dispatch_request(request, controller_klass, action, &blk)\n controller = controller_klass.new(request)\n yield controller if block_given?\n controller._dispatch(action)\n\n Merb.logger.info controller._benchmarks.inspect\n Merb.logger.flush\n\n controller\n end", "def handle_whitelisted_api_cookies\n new_api_cookies = request.cookies[GlobalConstant::Cookie.new_api_cookie_key.to_sym]\n return if new_api_cookies.blank?\n whitelisted_api_cookies = [GlobalConstant::Cookie.user_cookie_name, GlobalConstant::Cookie.last_used_env_cookie_name, GlobalConstant::Cookie.device_verification_toast_cookie_name, GlobalConstant::Cookie.secure_data_access_cookie_name]\n whitelisted_api_cookies.each do |key|\n whitelisted_cookie = new_api_cookies[key]\n if whitelisted_cookie.present? and whitelisted_cookie.is_a?(Hash)\n cookies[key.to_sym] = whitelisted_cookie\n end\n end\n end", "def set_pickup_cookies!\n if @pickup\n cookies[:pickup_id] = @pickup.id\n cookies[:key] = @pickup.key\n elsif params[:pickup_id] && params[:key]\n cookies[:pickup_id] = params[:pickup_id]\n cookies[:key] = params[:key]\n end\n end", "def log_user_class\n if current_spree_user && !session[:logged_user_class] && session[:logged_user_class]=true\n behavior = behavior_cookie\n behavior[\"user_class\"] = user_class\n cookies.permanent[:behavior] = behavior.to_json\n end\n end", "def cookies\n call_once\n @cookies\n end", "def store_flash(res)\n chips_ahoy = WEBrick::Cookie.new('_rails_lite_flash', @slow_poke.to_json)\n res.cookies << chips_ahoy\n end", "def controller(&block)\n @config.controller.class_exec(&block) if block_given?\n @config.controller\n end", "def add_controller(controller, klass)\n unless present?(controller)\n raise Vedeu::Error::MissingRequired,\n 'Cannot store controller without a name attribute.'\n end\n\n Vedeu.log(type: :create,\n message: \"Controller: ':#{controller}'\")\n\n if registered?(controller)\n storage[controller][:klass] = klass\n\n else\n storage.store(controller, klass: klass, actions: [])\n\n end\n\n storage\n end", "def cookie_jar= cookie_jar\n @agent.cookie_jar = cookie_jar\n end", "def initialize(req)\n @req = req\n #debugger\n @flash_now = req.cookies[FLASH_NAME]\n @flash_now = @flash_now ? JSON.parse( req.cookies[FLASH_NAME] ) : Hash.new { [] }\n @flash_now = @flash_now.each.with_object( Hash.new { [] }) do |(k,v), memo|\n memo[k.to_sym] = v\n end\n @flash_keep = Hash.new { [] }\n end", "def use_custom_controller(controller, &block)\n old_controller = self.class.controller_class\n begin\n self.class.controller_class = controller\n yield\n ensure\n self.class.controller_class = old_controller\n end\n end", "def controller(controller)\n @scope = @scope.new(controller: controller)\n yield\n ensure\n @scope = @scope.parent\n end", "def add_cookies(headers)\n cookies = headers[:cookie]\n cookies_hash = Hash.new\n return false unless cookies\n cookies.split('&').each do |string|\n k,v = string.split('=')\n cookies_hash[convert_key(k)] = v\n end\n @params[:cookie] = cookies_hash\n end", "def show_cookies\n if request.post? || params[:who] == 'peter'\n ls = cookies[LIFESIZE_COOKIE]\n if ls\n @cookie_value = JSON.pretty_generate(JSON.parse(Crypt.decrypt(ls)))\n else\n @cookie_value = \"lifesize cookie not set\"\n end\n @screen_cookie_value = cookies[SCREEN_COOKIE] ? cookies[SCREEN_COOKIE] : \"Screen cookie not set\"\n render :show_cookies\n else\n render :noaccess\n end\n end", "def controller_class\n @controller_class ||= @controller&.class || self.class.class_for(@key)\n end", "def set_initial_cookies\n @initial_cookies = {}\n request.cookies.each {|k,v|\n @initial_cookies[k] = v\n }\n end", "def login\r\n cf_cookies = {}\r\n\r\n ways = {\r\n 'RDS bypass' => Proc.new { |foo| adminapi_login(datastore['USERNAME'], datastore['PASSWORD'], true) },\r\n 'RDS login' => Proc.new { |foo| adminapi_login(datastore['USERNAME'], datastore['PASSWORD'], false) },\r\n 'Administrator login' => Proc.new { |foo| administrator_login(datastore['USERNAME'], datastore['PASSWORD']) },\r\n }\r\n ways.each do |what, how|\r\n these_cookies = how.call\r\n if got_auth? these_cookies\r\n print_status \"Authenticated using '#{what}' technique\"\r\n cf_cookies = these_cookies\r\n break\r\n end\r\n end\r\n\r\n fail_with(Exploit::Failure::NoAccess, \"Unable to authenticate\") if cf_cookies.empty?\r\n cf_cookies\r\n end", "def cookies\n test_cookies\n end", "def load_cookie_jar_mechanize(jar)\n VkMusic.log.info('cookie_reader') { 'Loading Mechanize cookies' }\n jar.load(AGENT_COOKIES_PATH)\n end", "def set_cookies(response)\n cookie_str = response.header['set-cookie']\n return if cookie_str.nil?\n\n fields = cookie_str.split(\"; \").inject({}) { |h, field|\n key, value = field.split(\"=\")\n h[key] = value\n\n h\n }\n\n # This is obviously not a generalized cookie implementation. Heh.\n fields.delete('path')\n @cookies = fields\n end", "def init_cookies\n cookies[:language] = @language.code unless cookies[:language]\n cookies[:logged_in] = (admin? ? 'admin' : logged_in?.to_s) unless cookies[:logged_in]\n cookies.delete( :dont_cache ) if cookies[:dont_cache] and flash.empty? and request.request_uri =~ /^#{cookies[:dont_cache]}/\n end", "def initialize( *cookies )\n\t\t@cookie_set = Set.new( cookies.flatten )\n\tend", "def load_cookie_jar_json(jar, data)\n VkMusic.log.info('cookie_reader') { 'Loading JSON cookies' }\n JSON.parse(data).each_pair do |k, v|\n jar.add(URI('https://m.vk.com'), HTTP::Cookie.new(k, v))\n end\n end", "def get_cookies\n {\n method: \"Page.getCookies\"\n }\n end", "def index\n authorize! :show, @category\n @categories = Category.all\n\tcookies[:current_word] = \"\"\n\tcookies[:attempt] = \"0\"\n\tcookies[:current_word] = \"\"\n\tsession[:word_state] = \"\"\n end", "def call(env)\n result = Cookiefilter.filter_request_cookies(env['HTTP_COOKIE'])\n env['HTTP_COOKIE'] = result[:header]\n status, headers, body = @app.call(env)\n response = Rack::Response.new body, status, headers\n header = Cookiefilter.filter_response_cookies(\n env['HTTP_HOST'],\n response.header['Set-Cookie'],\n result\n )\n response.header['Set-Cookie'] = header\n response.finish\n end", "def store_flash(res)\n serialized_flash = @later.to_json\n res.cookies << WEBrick::Cookie.new(\"_rails_lite_flash\" , serialized_flash)\n end", "def store_flash(res)\n cookie = WEBrick::Cookie.new(\"_rails_lite_flash\", @stuff.to_json)\n cookie.path = \"/\"\n res.cookies << cookie\n end", "def delete_all_cookies; end", "def classes\n redirect_to helpers.static_page_path_for(:classes), status: :moved_permanently\n end", "def [] key\n controller.orig_cookies[key]\n end", "def login_headers(request)\n if @cookie\n request['Cookie'] = @cookie\n else\n request['Fastly-Key'] = config[:key]\n end\n\n request\n end", "def store_flash(res)\n update_flash\n res.cookies << WEBrick::Cookie.new(@cookie_key, @cookie.to_json)\n end", "def initialize(cookies)\n @cookies = cookies\n end", "def set_cookie(response)\n\t\ttest_cookie = response.get_fields('set-cookie')\n\n\t\tif @cookie_array.include? test_cookie\n\t\t\t@cookies\n\t\telse\n\t\t\t@cookie_array << test_cookie\n \t\t\t@cookies = @cookie_array.join('; ')\n \t\tend\n\t\t#@cookies = response.get_fields('set-cookie')\n\tend", "def accelerate\n @car = YAML.load(cookies[:car])\n @car.accelerate\n cookies[:car] = @car.to_yaml\n redirect_to '/car/status'\n end", "def add_cookies!(request)\n request['Cookie'] = @cookies.collect{|k, v| \"#{k}=#{v}\"}.join(\", \")\n end", "def server_cookies(response)\n raw_cookies = response.headers['Set-Cookie']\n return if raw_cookies.blank?\n\n raw_cookies.map { |ck| parse_server_cookie(ck) }\n end", "def set_time_zone(&block)\n if cookies[:tz]\n puts \"*\" * 60\n puts \"Time zone: #{cookies[:tz]}\"\n puts \"*\" * 60\n Time.use_zone(cookies[:tz], &block)\n else\n # The around method must yield to execute the action.\n # http://guides.rubyonrails.org/action_controller_overview.html#after-filters-and-around-filters\n yield\n end\n end", "def klass_for(controller)\n if registered?(controller) && klass_defined?(controller)\n storage[controller][:klass]\n\n else\n raise Vedeu::Error::MissingRequired,\n \"Cannot route to #{controller} as no class defined.\"\n\n end\n end", "def create_accesses_cookie\n cookies[:accesses] = {}.to_json\n end", "def set_page_classes(*values)\n @page_classes = []\n @page_classes += values\n @page_classes += Array.wrap(yield) if block_given?\n @page_classes\n end", "def store_flash(res)\n res.cookies << WEBrick::Cookie.new('_rails_lite_app_flash', @flash_hash.to_json)\n end", "def active?(controller)\n if (settings = controller.send(:cookies)['road_crew_engine_settings'])\n return false if JSON.parse(settings)[controller.class.parent.name] == '0'\n end\n controller.instance_eval(&@active_if)\n end", "def update( cookies )\n [cookies].flatten.compact.each do |c|\n self << case c\n when String\n begin\n Cookie.from_string( ::Arachni::Options.url.to_s, c )\n rescue\n Cookie.from_set_cookie( ::Arachni::Options.url.to_s, c )\n end\n\n when Hash\n Cookie.new( ::Arachni::Options.url.to_s, c ) if c.any?\n\n when Cookie\n c\n end\n end\n self\n end", "def controller(controller); end", "def login\n #If we go to login page we clear all data still in session to force a re-auth\n current_user = nil\n session[:user_id] = nil\n session[\"REMOTE_USER\"] = nil\n env[\"REMOTE_USER\"] = nil\n if params[:redirect_uri].nil? or params[:client_id].nil?\n redirect_to root_path\n else\n @from_application = ClientApplication.find_by_callback_url(params[:redirect_uri])\n if @from_application.nil?\n redirect_to root_path\n end\n end\n\n\n end", "def initialize(cookies, params)\n @cookies = cookies\n @params = params\n end", "def setUser\n cookies[:user_id]=current_user.id\n cookies[:is_tech]=current_user.tech\n end", "def finish\n @cookies.delete(RACK_SESSION_KEY)\n @cookies.each do |k,v|\n next unless changed?(k)\n v.nil? ? delete_cookie(k) : set_cookie(k, _merge_default_values(v))\n end if changed?\n end", "def ivars_to_ignore; ['@controller']; end", "def exploit\r\n if datastore['RAILSVERSION'] == 3\r\n cookie = rails_3\r\n elsif datastore['RAILSVERSION'] == 4\r\n cookie = rails_4\r\n end\r\n cookie_name = datastore['COOKIE_NAME']\r\n\r\n print_status(\"Checking for cookie #{datastore['COOKIE_NAME']}\")\r\n res = send_request_cgi({\r\n 'uri' => datastore['TARGETURI'] || \"/\",\r\n 'method' => datastore['HTTP_METHOD'],\r\n }, 25)\r\n if res && res.headers['Set-Cookie']\r\n match = res.headers['Set-Cookie'].match(/([_A-Za-z0-9]+)=([A-Za-z0-9%]*)--([0-9A-Fa-f]+); /)\r\n end\r\n\r\n if match\r\n if match[1] == datastore['COOKIE_NAME']\r\n print_status(\"Found cookie, now checking for proper SECRET\")\r\n else\r\n print_status(\"Adjusting cookie name to #{match[1]}\")\r\n cookie_name = match[1]\r\n end\r\n\r\n if check_secret(match[2],match[3])\r\n print_good(\"SECRET matches! Sending exploit payload\")\r\n else\r\n fail_with(Exploit::Failure::BadConfig, \"SECRET does not match\")\r\n end\r\n else\r\n print_warning(\"Caution: Cookie not found, maybe you need to adjust TARGETURI\")\r\n if cookie_name.nil? || cookie_name.empty?\r\n # This prevents trying to send busted cookies with no name\r\n fail_with(Exploit::Failure::BadConfig, \"No cookie found and no name given\")\r\n end\r\n if datastore['VALIDATE_COOKIE']\r\n fail_with(Exploit::Failure::BadConfig, \"COOKIE not validated, unset VALIDATE_COOKIE to send the payload anyway\")\r\n else\r\n print_status(\"Trying to leverage default controller without cookie confirmation.\")\r\n end\r\n end\r\n\r\n print_status \"Sending cookie #{cookie_name}\"\r\n res = send_request_cgi({\r\n 'uri' => datastore['TARGETURI'] || \"/\",\r\n 'method' => datastore['HTTP_METHOD'],\r\n 'headers' => {'Cookie' => cookie_name+\"=\"+ cookie},\r\n }, 25)\r\n\r\n handler\r\n end", "def cookies_for domain\n @cookies ||= {}\n @cookies[ domain ]\n end" ]
[ "0.54777724", "0.52980036", "0.52752024", "0.5243587", "0.5195627", "0.51925117", "0.51736873", "0.51158464", "0.50753534", "0.49427766", "0.49427766", "0.4933547", "0.4933547", "0.492929", "0.49202102", "0.49036098", "0.49036098", "0.49036098", "0.49036098", "0.48680338", "0.4855232", "0.48033872", "0.48033872", "0.47770274", "0.47519106", "0.47514662", "0.47490567", "0.47414014", "0.47235304", "0.47050875", "0.47047946", "0.46820885", "0.4678138", "0.4678138", "0.4678138", "0.4678138", "0.4678138", "0.4678138", "0.4678138", "0.46748018", "0.46748018", "0.46705863", "0.46556902", "0.46172485", "0.4597199", "0.45541197", "0.45369777", "0.45263508", "0.4526049", "0.45155865", "0.45056653", "0.4498651", "0.44983312", "0.44722307", "0.44704396", "0.4447879", "0.44422293", "0.44302893", "0.440676", "0.44014823", "0.43958753", "0.43852383", "0.4380827", "0.43796402", "0.4378664", "0.43735126", "0.43626198", "0.43619192", "0.43545026", "0.43524727", "0.43481398", "0.4343968", "0.43413338", "0.43387005", "0.43356156", "0.43310928", "0.43289018", "0.43250972", "0.42770755", "0.42769688", "0.42757255", "0.42741528", "0.4272129", "0.42675972", "0.42467254", "0.42417115", "0.42399436", "0.4237073", "0.42370117", "0.4228493", "0.4223762", "0.42179722", "0.4216662", "0.4215297", "0.42122942", "0.42088068", "0.42024544", "0.419906", "0.41978106", "0.41976625" ]
0.8127432
0
Dispatches an action to the given class and using HTTP Basic Authentication This bypasses the router and is suitable for unit testing of controllers. ==== Parameters controller_klass:: The controller class object that the action should be dispatched to. action:: The action name, as a symbol. username:: The username. password:: The password. params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see +fake_request+), including :req or :post_body for setting the request body itself. &blk:: The controller is yielded to the block provided for actions prior to the action being dispatched. ==== Example dispatch_with_basic_authentication_to(MyController, :create, 'Fred', 'secret', :name => 'Homer' ) do |controller|
def dispatch_with_basic_authentication_to(controller_klass, action, username, password, params = {}, env = {}, &blk) env["X_HTTP_AUTHORIZATION"] = "Basic #{Base64.encode64("#{username}:#{password}")}" params = merge_controller_and_action(controller_klass, action, params) dispatch_request(build_request(params, env), controller_klass, action.to_s, &blk) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch_to(controller_klass, action, params = {}, env = {}, &blk)\n params = merge_controller_and_action(controller_klass, action, params)\n dispatch_request(build_request(params, env), controller_klass, action.to_s, &blk)\n end", "def login(action, username, password, header = 'HTTP_AUTHORIZATION')\n @request.env[header] = \"Basic #{Base64.encode64(username << ':' << password)}\"\n get action\n end", "def call(controller, action)\n lambda {\n controller = Object.const_get(controller)\n action ||= Configuration::Base.app.default_action\n\n instance = controller.new\n request.controller = instance\n request.action = action\n\n instance.send(action)\n }\n end", "def basic_auth(*args, &block); end", "def dispatch_multipart_to(controller_klass, action, params = {}, env = {}, &blk)\n request = multipart_fake_request(env, params)\n dispatch_request(request, controller_klass, action, &blk)\n end", "def basic_auth(username:, password:, realm: 'Instrumentation')\n authenticate_or_request_with_http_basic(realm) \\\n do |given_name, given_password|\n ActiveSupport::SecurityUtils.secure_compare(given_name, username) &\n ActiveSupport::SecurityUtils.secure_compare(\n given_password, password\n )\n end\n end", "def route(controller, action, **args)\n klass = Object.const_get(klass_for(controller)).new(**args)\n klass.send(action)\n end", "def route(controller, action, **args)\n klass = Object.const_get(klass_for(controller)).new(**args)\n klass.send(action)\n end", "def dispatch_action(klass, action, request, response, status=200)\n # build controller\n controller = klass.build(request, response, status)\n # complete setup benchmarking\n #controller._benchmarks[:setup_time] = Time.now - start\n if @@use_mutex\n @@mutex.synchronize { controller.dispatch(action) }\n else\n controller.dispatch(action)\n end\n [controller, action]\n end", "def dispatch_request(request, controller_klass, action, &blk)\n controller = controller_klass.new(request)\n yield controller if block_given?\n controller._dispatch(action)\n\n Merb.logger.info controller._benchmarks.inspect\n Merb.logger.flush\n\n controller\n end", "def route(controller, action, **args)\n klass = Object.const_get(klass_for(controller)).new(**args)\n klass.send(action)\n end", "def perform(action, method = :get, payload = {})\n payload.merge!(username: self.username, password: self.password)\n\n headers = { 'User-Agent' => DeathByCaptcha::API_VERSION }\n\n if method == :post\n uri = URI(\"http://#{self.hostname}/api/#{action}\")\n req = Net::HTTP::Post.new(uri.request_uri, headers)\n req.set_form_data(payload)\n\n elsif method == :post_multipart\n uri = URI(\"http://#{self.hostname}/api/#{action}\")\n req = Net::HTTP::Post.new(uri.request_uri, headers)\n boundary, body = prepare_multipart_data(payload)\n req.content_type = \"multipart/form-data; boundary=#{boundary}\"\n req.body = body\n\n else\n uri = URI(\"http://#{self.hostname}/api/#{action}?#{URI.encode_www_form(payload)}\")\n req = Net::HTTP::Get.new(uri.request_uri, headers)\n end\n\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(req)\n end\n\n case res\n when Net::HTTPSuccess, Net::HTTPSeeOther\n Hash[URI.decode_www_form(res.body)]\n when Net::HTTPForbidden\n raise DeathByCaptcha::APIForbidden\n when Net::HTTPBadRequest\n raise DeathByCaptcha::APIBadRequest\n when Net::HTTPRequestEntityTooLarge\n raise DeathByCaptcha::APICaptchaTooLarge\n when Net::HTTPServiceUnavailable\n raise DeathByCaptcha::APIServiceUnavailable\n else\n raise DeathByCaptcha::APIResponseError.new(res.body)\n end\n end", "def authenticate_user_with_basic_auth!\n @username, @password = ActionController::HttpAuthentication::Basic::user_name_and_password(request)\n\n request_http_basic_authentication(ENV[\"REALM\"], \"An Authentication object was not found in the SecurityContext\") if @username.blank? || @password.blank?\n end", "def login_using_basic_auth\n @request.env['HTTP_AUTHENTICATION'] = ActionController::HttpAuthentication::Basic.encode_credntials(\"\", \"\")\nend", "def authorize_user\n unless @api_user.permit? params[:controller], params[:action]\n head :unauthorized and return\n end\n end", "def authorize\n controller.class_eval do\n define_method name, block\n self.send callback, name.to_sym, only: actions\n end\n end", "def authenticate\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"@klass=#{@klass}\",\n \"@params=#{@params}\",\n \"\" ] if browse_everything_driver_authentication_factory_debug_verbose\n @klass.new(*@params)\n end", "def authenticate_with_basic_auth\n name, token = ActionController::HttpAuthentication::Basic.user_name_and_password(request)\n @api_client = ApiClient.find_by(name: name)\n\n render(json: { errors: [{ detail: \"Access Denied\" }] }, status: 401) unless valid_key(token)\n end", "def authorize\n authorization_check(params[:controller], params[:action], request.request_method.downcase, self) || unauthorized\n end", "def http_basic_authorize!(realm, username, password)\n auth = Rack::Auth::Basic::Request.new(request.env)\n unless auth.provided? && auth.basic? && auth.credentials &&\n auth.credentials == [username, password]\n response['WWW-Authenticate'] = %(Basic realm=\"#{realm}\")\n request.halt(401)\n end\n end", "def http_basic_authorize!(realm, username, password)\n auth = Rack::Auth::Basic::Request.new(request.env)\n unless auth.provided? && auth.basic? && auth.credentials &&\n auth.credentials == [username, password]\n response['WWW-Authenticate'] = %(Basic realm=\"#{realm}\")\n throw(:halt, 401)\n end\n end", "def authenticate\n env = Figaro.env\n\n head :unauthorized unless auth_configured?(env)\n\n authenticate_or_request_with_http_basic do |username, password|\n # This comparison uses & so that it doesn't short circuit and\n # uses `secure_compare` so that length information\n # isn't leaked.\n ActiveSupport::SecurityUtils.secure_compare(\n username, env.twilio_http_basic_auth_username\n ) & ActiveSupport::SecurityUtils.secure_compare(\n password, env.twilio_http_basic_auth_password\n )\n end\n end", "def dispatch action\n @action = action\n\n invoke do\n filter(*before_filters_for(action))\n args = action_arguments action\n __send__(action, *args)\n end\n\n rescue => err\n invoke{ handle_error err }\n ensure\n filter(*after_filters_for(action))\n end", "def service(*a) \n @username, password = credentials\n app = self.class.name.gsub(/^(\\w+)::.+$/, '\\1')\n if Kernel.const_get(app).authenticate @username, password\n s = super(*a)\n else\n @status = 401\n @headers['Content-type'] = 'text/plain'\n @headers['Status'] = 'Unauthorized'\n @headers['WWW-Authenticate'] = \"Basic realm=\\\"#{app}\\\"\"\n @body = 'Unauthorized'\n s = self\n end\n s\n end", "def basic_auth\n authenticate_or_request_with_http_basic do |username, password|\n username == Rails.application.credentials.basic[:username] && \n password == Rails.application.credentials.basic[:password]\n end\n end", "def basic_authenticate(req, url, param_string = \"\")\n params = parse_quoted_wwwauth(param_string)\n\n user, pass = username_and_password_for_realm(url, params[:realm])\n\n req.basic_auth user, pass\n end", "def r(verb, path, options = {})\n headers = options[:headers] || {}\n headers['HTTP_AUTHORIZATION'] =\n ActionController::HttpAuthentication::Basic.encode_credentials(\n ComfortableMexicanSofa::AccessControl::AdminAuthentication.username,\n ComfortableMexicanSofa::AccessControl::AdminAuthentication.password\n )\n options.merge!(headers: headers)\n send(verb, path, options)\n end", "def authenticate_user(request)\n @log.info(\"Authentication user #{@username}\")\n request.basic_auth(@username, @password)\nend", "def basic_auth(*args_or_proc)\n return @basic_auth unless args_or_proc\n @basic_auth = args_or_proc\n end", "def authentication_request(controller, realm, message = T.unsafe(nil)); end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end", "def basic_auth(opts); end", "def require_http_basic_auth\n if APP_CONFIG['perform_authentication']\n authenticate_or_request_with_http_basic do |login, password|\n login==APP_CONFIG['username'] and password == APP_CONFIG['password']\n end\n end\n end", "def requestAction(controller,action,params={})\n controller.class_eval{\n def params=(params); @params = params end\n def params; @params end\n }\n c = controller.new\n c.request = @_request\n c.response = @_response\n c.params = params\n c.send(action)\n c.response.body\n end", "def authenticate(controller, realm, &password_procedure)\n authorization(controller.request) && validate_digest_response(controller.request, realm, &password_procedure)\n end", "def invoke_action(name)\n if req.request_method != \"GET\" && @@protect_from_forgery\n self.check_authenticity_token\n end\n self.send(name)\n end", "def authenticate!(request)\n if @username and @password \n request.basic_auth @username, @password\n end\n end", "def login_from_basic_auth\nauthenticate_with_http_basic do |username, password|\nself.current_user = User.authenticate(username, password)\nend\nend", "def auth\n basic_auth(env) { |user, pass| yield(user, pass) }\n end", "def basic_auth!(user = :username, pass = :password)\n @authenticates = :basic_auth\n @credentials = [user, pass]\n end", "def action__invoke &proc\n if (restriction = self.class.restrictions?(action_with_format))\n auth_class, auth_args, auth_proc = restriction\n (auth_request = auth_class.new(proc {}, *auth_args, &auth_proc).call(env)) && halt(auth_request)\n end\n\n (cache_control = cache_control?) && cache_control!(*cache_control)\n (expires = expires?) && expires!(*expires)\n (content_type = format? ? mime_type(format) : content_type?) && content_type!(content_type)\n (charset = __e__.explicit_charset || charset?) && charset!(charset)\n\n begin\n (self.class.hooks?(:a, action_with_format)||[]).each { |m| self.send m }\n super \n (self.class.hooks?(:z, action_with_format)||[]).each { |m| self.send m }\n rescue => e\n # if a handler defined at class level, use it\n if handler = self.class.error?(500, action)\n body = handler.last > 0 ? self.send(handler.first, e) : self.send(handler.first)\n halt 500, body\n else\n # otherwise raise rescued exception\n raise e\n end\n end\n\n end", "def authenticate\n\t\t \tauthenticate_basic_auth || render_unauthorized\n\t\t \tend", "def http_login(username, password)\n @request.env['HTTP_AUTHORIZATION'] = \"Basic #{Base64.encode64(username << ':' << password)}\"\n end", "def action(klass)\n def_delegator :default, klass.action_name\n define_method klass.action_name do |*args, &block|\n new_action = klass.new self, action\n directives.values.each {|it| it.setup! new_action }\n new_action.setup! *args, &block\n new_action.new_flow\n end\n end", "def send_auth_request \n request = AuthorizeRequest.new(:get, action_to_call) do |req|\n req.request_params = params\n end\n request.send_request(Config.url)\n end", "def with_fixtured_action( action=nil, *args, &block )\n\t\t@action = action\n\t\ttxn, req, vargs, *args = setup_fixtured_request( action, *args )\n\t\t\n\t\tif block.arity == 3\n\t\t\tblock.call( txn, req, vargs )\n\t\telse\n\t\t\tblock.call( txn, req )\n\t\tend\n\t\t\n\t\treturn @applet.run( txn, action.to_s, *args )\n\tensure\n\t\t@action = nil\n\tend", "def initialize(klass, action, role)\n @klass, @action, @role = klass, action, role\n @group, @route = ExampleGroup.new(klass), Route.new(action)\n\n @authorization_stubbed = false\n\n stub_current_user\n stub_authorization_load_controller_object\n stub_authorization_load_object\n stub_callbacks\n stub_action\n\n setup_response_retrieval\n group.run_example\n end", "def call_action(handler, params, query_params)\n controller_name, action_name = handler.split('#')\n controller_class = lookup_controller(controller_name)\n controller = controller_class.new(self, params, query_params)\n controller.execute_action(action_name)\n end", "def basic_authentication usr, pwd\n\t\t#str = Base64.encode64(\"#{usr}:#{pwd}\")\n\t\t#str = \"Basic #{str}\"\n \n\t\t#@request_headers[\"Authorization\"]= str\n @request_headers[\"Authorization\"]= 'Basic ' + [\"#{usr}:#{pwd}\"].pack('m').delete(\"\\r\\n\")\n\tend", "def authenticate(controller, opts = {})\n msg = opts.delete(:message) || \"Could Not Log In\"\n user = nil \n # This one should find the first one that matches. It should not run antother\n Authentication.login_strategies.detect do |s|\n user = controller.instance_eval(&s)\n end\n raise Merb::Controller::Unauthenticated, msg unless user\n self.user = user\n end", "def authenticate(controller, opts = {})\n msg = opts.delete(:message) || \"Could Not Log In\"\n user = nil \n # This one should find the first one that matches. It should not run antother\n Authentication.login_strategies.detect do |s|\n user = controller.instance_eval(&s)\n end\n raise Merb::Controller::Unauthenticated, msg unless user\n self.user = user\n end", "def auth(cl)\n\t\tuser = cl.find_by_login(params[:login])\n\t\tif user.try(:authenticate, params[:pass])\n\t\t\tres payload(user)\n\t\telse\n\t\t\terr 'invalid_credentials', 'Invalid Username/Password', :unauthorized\n\t\tend\n\tend", "def basic_auth(username, password)\n @basic_auth = {:username => username, :password => password}\n end", "def login(*credentials)\n basic_authorize(*credentials)\n end", "def authenticate\n if defined?(APPWALL_USERNAME)\n authenticate_or_request_with_http_basic do |username, password|\n !(APPWALL_USERNAME.blank?) && username == APPWALL_USERNAME && \n Digest::MD5.hexdigest(password) == APPWALL_PASSWORD_HASH\n end\n end\n end", "def authenticate\n if defined?(APPWALL_USERNAME)\n authenticate_or_request_with_http_basic do |username, password|\n !(APPWALL_USERNAME.blank?) && username == APPWALL_USERNAME && \n Digest::MD5.hexdigest(password) == APPWALL_PASSWORD_HASH\n end\n end\n end", "def authorize_action\n YamledAcl.init(current_user_group_name, params[:controller])\n allowed_to?(params[:action]) or raise(YamledAcl::AccessDenied)\n end", "def basic_authorize(username, password)\n encoded_login = [\"#{username}:#{password}\"].pack('m0')\n header('Authorization', \"Basic #{encoded_login}\")\n end", "def authorize_action!(object, action = nil)\n action ||= params[:action]\n unless action.blank?\n action = action.to_s.to_sym\n end\n authorize!(action, object)\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end", "def login_from_basic_auth\n authenticate_with_http_basic do |login, password|\n self.current_user = User.authenticate(login, password)\n end\n end", "def login_from_basic_auth\n authenticate_with_http_basic do |login, password|\n self.current_user = User.authenticate(login, password)\n end\n end", "def authorize_api!\n http_basic_authorize!('API', api_username, api_password)\n end", "def authorize_api!\n http_basic_authorize!('API', api_username, api_password)\n end", "def method_missing *args\n @controller_instance.send *args\n end", "def remote_request(klass, path, form_data = {})\n log \"#{klass} request to #{path}\"\n http = Net::HTTP.new(@uri.host, @uri.port)\n http.read_timeout = 30\n request = klass.new(@uri.request_uri + path)\n request.set_form_data(form_data) if klass == Net::HTTP::Post\n \n if @config[:http_username] && @config[:http_password]\n request.basic_auth @config[:http_username], @config[:http_password]\n end\n \n http.request(request)\n end", "def basic_auth(account, password)\n @header.merge!({ 'Authorization' => \"Basic #{[\"#{account}:#{password}\"].pack('m').delete(\"\\r\\n\")}\" })\n end", "def perform(action, payload = {})\n payload.merge!(\n cmd: action,\n version: DeathByCaptcha::API_VERSION,\n username: self.username,\n password: self.password,\n vendor_id: 5,\n )\n\n socket = create_socket()\n socket.puts(payload.to_json)\n response = socket.read()\n socket.close()\n\n begin\n response = JSON.parse(response)\n rescue\n raise DeathByCaptcha::APIResponseError.new(\"invalid JSON: #{response}\")\n end\n\n if !(error = response['error'].to_s).empty?\n case error\n when 'not-logged-in', 'invalid-credentials', 'banned', 'insufficient-funds'\n raise DeathByCaptcha::APIForbidden\n when 'invalid-captcha'\n raise DeathByCaptcha::APIBadRequest\n when 'service-overload'\n raise DeathByCaptcha::APIServiceUnavailable\n else\n raise DeathByCaptcha::APIResponseError.new(error)\n end\n end\n\n response\n end", "def call(env)\n auth = Ldap::Request.new(env)\n return unauthorized unless auth.provided?\n return bad_request unless auth.basic?\n\n if valid?(auth)\n env['REMOTE_USER'] = auth.username\n return @app.call(env)\n end\n unauthorized\n end", "def authorize_controller!\n authorize! action_name.to_sym, full_controller_name\n end", "def fill_controller_action_attributes\n return if controller_action.blank?\n route = controller_action.split('#')\n self.controller, self.action = route.first, route.last\n end", "def basic_auth(login, pass)\n set_authorization_header(:basic_auth, login, pass)\n end", "def authenticate\n authed = true\n if(resource.respond_to?(:authenticate, true))\n authed = false\n uname = nil\n password = nil\n if(request.env['HTTP_AUTHORIZATION'])\n auth = Rack::Auth::Basic::Request.new(request.env)\n if(auth.basic? && auth.credentials)\n uname = auth.credentials[0]\n password = auth.credentials[1]\n end\n end\n authed = resource.send(:authenticate, uname, password)\n end\n raise Unauthorized unless authed\n end", "def authenticate!\n # if the authentication header is an acceptible value\n if @env['HTTP_X_MY_API'] == 'foobar'\n user = { :id => 1, :name => \"some user\" }\n # warden doesn't care what the user is, so long as it's not nil.\n success! user, \"success\"\n end\n end", "def invoke_action(action, args = {})\n raise ArgumentError, \"Browser.invoke_action expects an ActionController::Action as first parameter\"\\\n unless ::Waw::ActionController::Action===action\n location, response = fetch(relative_uri(action.uri), :post, args)\n apply_action_routing(action, JSON.parse(response.body))\n self.response\n end", "def action_sendauth!()\n @action = TAC_PLUS_AUTHEN_SENDAUTH\n end", "def login_from_basic_auth\n authenticate_with_http_basic do |username, password|\n self.current_user = User.authenticate(username, password)\n end\n end", "def authenticate\n # puts _process_action_callbacks.map(&:filter)\n # if current_user\n # session['user_id'] = current_user.id\n # true\n # else\n # session[:return_to] = request.original_url\n # respond_to do |format|\n # format.html { redirect_to login_url }\n # format.any(:xml,:json) { request_http_basic_authentication }\n # end\n # false\n # end\n true\n end", "def prepare_basic_auth(request)\n user = @options[:user] || nil\n pass = @options[:pass] || nil\n\n request.basic_auth user, pass\n request\n end", "def authenticate\n @shoonga = authenticate_or_request_with_http_basic do |username, password|\n username == \"4vght\" && password == \"we8vds\"\n end\nend", "def basic_auth(username, password)\n @basic_auth = [username, password]\n end", "def perform_action_with_scout_instruments(*args, &block)\n req = ScoutApm::RequestManager.lookup\n req.annotate_request(:uri => request.path) # for security by-default, we don't use request.fullpath which could reveal filtered params.\n if ScoutApm::Agent.instance.context.config.value('collect_remote_ip')\n req.context.add_user(:ip => request.remote_ip)\n end\n req.set_headers(request.headers)\n req.start_layer( ScoutApm::Layer.new(\"Controller\", \"#{controller_path}/#{action_name}\") )\n\n begin\n perform_action_without_scout_instruments(*args, &block)\n rescue\n req.error!\n raise\n ensure\n req.stop_layer\n end\n end", "def grifter_authenticate_do\n auth_methods = self.singleton_methods.select { |m| m =~ /grifter_authenticate$/ }\n auth_methods.each do |m|\n Log.debug \"Executing a grifter_authentication on method: #{m}\"\n self.send(m)\n end\n end", "def http_basic_authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == \"mustang\" && password == 'mustang' #\"must@ngs0undm3l0n\"\n end\n end", "def authenticate( req )\n\t\treq.server.log_error \"StageLogger {%d}>> in RubyAuthenHandler authenticate(%p)\" % \n\t\t\t[ Process.pid, req ]\n\n\t\treq.auth_type = 'Basic'\n\t\treq.auth_name = 'StageLogger'\n\t\treq.user = 'stagelogger'\n\n\t\treturn Apache::OK\n\tend", "def login_from_basic_auth\n authenticate_with_http_basic do |login, password|\n self.current_user = User.authenticate(login, password)\n end\n end", "def basic_authorization(user, pass)\n @request.env[\"HTTP_AUTHORIZATION\"] = format(\"Basic %{auth}\", :auth => Base64.encode64(\"#{user}:#{pass}\"))\n end", "def authenticate_with_http_basic\n nil\n end", "def test_basic_auth_with_password\n assert_warning :type => :controller,\n :warning_type => \"Basic Auth\",\n :line => 4,\n :message => /^Basic authentication password stored in source code/,\n :confidence => 0,\n :file => /users_controller\\.rb/\n end", "def create_controller(ctrl_action)\n ctrl_name, action_name = ctrl_action.split('#')\n klass = Object.const_get \"#{ctrl_name.capitalize}Controller\"\n klass.new(name: ctrl_name, action: action_name.to_sym, request: request)\n end", "def method_missing(*args, &block)\n return nil unless @controller_context\n @controller_context.send(*args, &block)\n end", "def authenticate(username, password)\n perform_request({:action => 'client-authenticate', :username => username, :password => password})\n end", "def send_credentials\n dputs __method__.to_s\n login_req = setup_http_request($ident, @cookie, {:arg => [$CONF['user'], CGI.escape($CONF['pass'])]})\n res = @http.request(login_req)\n get_cookie(res)\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == ENV['USERNAMEV'] && password == ENV['PASSWORDV'] \n end \n end", "def authenticate(method, *params)\n case method\n when :basic, \"basic\"\n @authentication = {:method => :basic_auth, :params => params}\n @user = params.first\n when :ntlm, \"ntlm\"\n require 'net/ntlm_http'\n @authentication = {:method => :ntlm_auth, :params => params}\n @user = params.first\n else raise \"Authentication method not supported\"\n end\n end", "def make_controller(klass)\n @controller = eval(\"#{klass.to_s.camelize}Controller\").new\n end", "def authenticate\n authenticate_or_request_with_http_basic(\"algo\") do |username, password|\n username == \"dupa\" && password == \"dupa\"\n end\n end", "def process_basic_auth(auth)\n case auth\n when String\n self.username, self.password = auth.split(':', 2)\n when Hash\n self.username = auth[:username]\n self.password = auth[:password]\n end\n end", "def bounce_to_http_basic()\n unless current_user\n request_http_basic_authentication\n return\n end\n\n respond_to do |format|\n format.html do\n render 'session/forbidden', layout: false, status: :forbidden\n end\n format.json do\n render json: { error: \"You're not allowed to access that\" }\n end\n end\n end", "def authenticate\n\t\t\tcred = env['HTTP_AUTHORIZATION']\n\t\t\treturn nil unless cred\n\t\t\tusername, password = basic_decode cred\n\t\t\treturn nil unless username && password\n\n\t\t\tModel::User.authenticate username, password\n\t\tend" ]
[ "0.63134056", "0.5604175", "0.54849416", "0.5276103", "0.5151506", "0.51505333", "0.5140847", "0.5140847", "0.51384544", "0.5101595", "0.5095869", "0.5087563", "0.49385706", "0.4902698", "0.48784572", "0.47924063", "0.4785079", "0.47757378", "0.47638625", "0.47475797", "0.473033", "0.47170928", "0.471187", "0.46982634", "0.46951765", "0.46937066", "0.46862033", "0.4681847", "0.4667214", "0.46649656", "0.46443635", "0.46434474", "0.4635586", "0.46260726", "0.46147135", "0.46017578", "0.4588133", "0.45810652", "0.4574682", "0.45687607", "0.4558324", "0.45487052", "0.45295453", "0.45221746", "0.45171964", "0.4515811", "0.4498667", "0.44966274", "0.4495114", "0.44906667", "0.44906667", "0.44834632", "0.44816807", "0.4479643", "0.44787443", "0.44787443", "0.44771922", "0.44747594", "0.44621617", "0.44380018", "0.442797", "0.442797", "0.4425594", "0.4425594", "0.4423467", "0.44189152", "0.4416346", "0.4404751", "0.43981746", "0.43932316", "0.43820345", "0.43803936", "0.43774468", "0.43768167", "0.43726158", "0.4367185", "0.43630543", "0.43556705", "0.43551657", "0.43504432", "0.43392113", "0.4335589", "0.43344122", "0.43331987", "0.43213975", "0.4316774", "0.4316389", "0.43060017", "0.4299988", "0.42969528", "0.42941925", "0.42894974", "0.42882192", "0.42698398", "0.426695", "0.42656788", "0.42638305", "0.4253509", "0.4251994", "0.42511508" ]
0.8277525
0
Prepares and returns a request suitable for dispatching with dispatch_request. If you don't need to modify the request object before dispatching (e.g. to add cookies), you probably want to use dispatch_to instead. ==== Parameters params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see +fake_request+), including :req or :post_body for setting the request body itself. ==== Example req = build_request(:id => 1) req.cookies['app_cookie'] = "testing" dispatch_request(req, MyController, :edit) ==== Notes Does not use routes.
def build_request(params = {}, env = {}) params = Merb::Parse.params_to_query_string(params) query_string = env[:query_string] || env['QUERY_STRING'] env[:query_string] = query_string ? "#{query_string}&#{params}" : params post_body = env[:post_body] || env['POST_BODY'] fake_request(env, { :post_body => post_body, :req => env[:req] }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_from_env(env)\n request = {}\n request['path'] = env['REQUEST_URI'].to_s\n request['method'] = env['REQUEST_METHOD']\n request['query'] = env['QUERY_STRING'].to_s\n request['Body'] = env['rack.input'].read\n\n env.each do |key, value|\n if key.match(/HTTP_(.+)/)\n request[$1.downcase.gsub('_','-')] ||= value\n end\n end\n request\n end", "def request # :doc:\n @request ||= begin\n environment = Rails.application.env_config.merge(env) if defined?(Rails.application) && Rails.application\n ActionDispatch::Request.new(environment || env)\n end\n end", "def initialize(env)\n @env = env\n @request = ActionDispatch::Request.new(env)\n end", "def dispatch_request(env)\n @params = Hash.recursively_symbolize_graph!(Rack::Utils::parse_query(env['QUERY_STRING']))\n @json_data = @internal_proxy ? (EventMachineRPC.parse_json_from_file(@params[:json_path]) rescue {}) : {}\n method = strip_base(env)\n self.send(method.to_sym, env)\n end", "def fake_request(env = {}, opt = {})\n if opt[:post_body]\n req = opt[:post_body]\n env[:content_type] ||= \"application/x-www-form-urlencoded\"\n else\n req = opt[:req]\n end\n FakeRequest.new(env, StringIO.new(req || ''))\n end", "def parse_env_into_request(rack_env)\n Rack::Request.new(rack_env)\n end", "def call(env)\n req_id = Marlowe.make_request_id(env[config.http_header], config)\n RequestStore.store[:correlation_id] = env[config.http_header] = req_id\n\n if config.action_dispatch\n req = ActionDispatch::Request.new(env)\n req.request_id = req_id\n end\n\n app.call(env).tap { |_status, headers, _body|\n if config.return\n headers[config.header] =\n if config.action_dispatch\n req.request_id\n else\n RequestStore.store[:correlation_id]\n end\n end\n }\n end", "def make_request(action, params = {})\n path = params[:path] || \"/\"\n method = params[:method] || \"post\"\n env = Rack::MockRequest.env_for(path, params: params.except(:path).except(:method), method: method)\n status, headers, body = described_class.action(action).call(env)\n @response = ActionDispatch::TestResponse.new(status, headers, body)\n @controller = body.instance_variable_get(:@response).request.env['action_controller.instance']\nend", "def request(action = :echo)\n @request = Rack::MockRequest.new(RocketPants::CacheMiddleware.new(controller_class.action(action)))\n end", "def request\n @request ||= Rack::Request.new(env)\n end", "def rewrite_request(env)\n rewritten = rewrite_host(env)\n @request = rewritten.merge(@request)\n end", "def request\n @request ||= Rack::Request.new(@env)\n end", "def request\n @request ||= Rack::Request.new(@env)\n end", "def env_with_params(path = '/', params = {}, env = {})\n method = params.delete(:method) || 'GET'\n env = {'HTTP_VERSION' => '1.1', 'REQUEST_METHOD' => \"#{method}\"}.merge(env)\n Rack::MockRequest.env_for(\"#{path}?#{Rack::Utils.build_query(params)}\", env)\nend", "def prepare_environment req_path, headers, params, body\n result = Hash.new\n {'header' => headers, 'param' => params}.each do |prefix, data|\n data.each do |name, value|\n result.merge! Oaf::Util.environment_item prefix, name, value\n end\n end\n result.merge! Oaf::Util.environment_item 'request', 'path', req_path\n result.merge Oaf::Util.environment_item 'request', 'body', body\n end", "def apply_request(request_env); end", "def make_request url, method: ::Rack::GET, body: nil, headers: []\n env = Testing.build_standard_env URI(url), headers\n env[::Rack::REQUEST_METHOD] = method\n env[::Rack::RACK_INPUT] = ::StringIO.new body if body\n ::Rack::Request.new env\n end", "def setup_env_params\n {\n url: @request.respond_to?(:original_url) ? @request.original_url : @request.path_info,\n referrer: @request.referer,\n http_method: action_dispatch? ? @request.method : @request.request_method,\n ip_address: @request.respond_to?(:remote_ip) ? @request.remote_ip : @request.ip,\n user_agent: @request.user_agent\n }\n end", "def request\n @request ||= ::Lotus::Action::Request.new(@_env)\n end", "def env_for(uri, env)\n env = DEFAULT_ENV.merge(@env).merge!(env)\n\n env['HTTP_HOST'] ||= [uri.host, (uri.port if uri.port != uri.default_port)].compact.join(':')\n env['HTTPS'] = 'on' if URI::HTTPS === uri\n env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' if env[:xhr]\n env['REQUEST_METHOD'] ||= env[:method] ? env[:method].to_s.upcase : 'GET'\n\n params = env.delete(:params)\n query_array = [uri.query]\n\n if env['REQUEST_METHOD'] == 'GET'\n # Treat params as query params\n if params\n append_query_params(query_array, params)\n end\n elsif !env.key?(:input)\n env['CONTENT_TYPE'] ||= 'application/x-www-form-urlencoded'\n params ||= {}\n multipart = env.has_key?(:multipart) ? env.delete(:multipart) : env['CONTENT_TYPE'].start_with?('multipart/')\n\n if params.is_a?(Hash)\n if !params.empty? && data = build_multipart(params, false, multipart)\n env[:input] = data\n env['CONTENT_LENGTH'] ||= data.length.to_s\n env['CONTENT_TYPE'] = \"#{multipart_content_type(env)}; boundary=#{MULTIPART_BOUNDARY}\"\n else\n env[:input] = build_nested_query(params)\n end\n else\n env[:input] = params\n end\n end\n\n if query_params = env.delete(:query_params)\n append_query_params(query_array, query_params)\n end\n query_array.compact!\n query_array.reject!(&:empty?)\n uri.query = query_array.join('&')\n\n set_cookie(env.delete(:cookie), uri) if env.key?(:cookie)\n\n Rack::MockRequest.env_for(uri.to_s, env)\n end", "def initialize(env)\n @env = env\n @request = Rack::Request.new(env)\n end", "def initialize(env)\n @env = env\n @request = Rack::Request.new(env)\n end", "def make_request(request = nil, meth: nil, manifest: nil, **opt)\n request, meth = [nil, request] if request.is_a?(Symbol)\n request ||= pre_flight(meth, manifest, **opt)\n # noinspection RubyMismatchedArgumentType\n SubmissionService.make_request(request, **opt, service: self)\n end", "def call(env)\n\n # This ugly hack should fix the issue with Rack::Test where\n # these two variables are empty and Rack::Test will always\n # return 404.\n #\n if env['rack.test']\n env['REQUEST_URI'] = env['PATH_INFO']\n env['REQUEST_PATH'] = env['PATH_INFO']\n end\n\n # Split URI to components and then extract ;var=value pairs\n matrix_params = {}\n uri_components = (env['rack.test'] ? env['PATH_INFO'] : env['REQUEST_URI']).split('/')\n\n uri_components.each do |component|\n sub_components, value = component.split(/\\;(\\w+)\\=/), nil\n next unless sub_components.first # Skip subcomponent if it's empty (usually /)\n while param=sub_components.pop do\n if value\n matrix_params[sub_components.first] ||= {}\n matrix_params[sub_components.first].merge!(param => value)\n value=nil\n next\n else\n value = param.gsub(/\\?.*$/, '')\n end\n end\n end\n\n # Two things need to happen to make matrix params work:\n # (1) the parameters need to be appended to the 'normal' params\n # for the request. 'Normal' really depends on the content\n # type of the request, which does not seem accessible from\n # Middleware, so we use the existence of\n # rack.request.form_hash in the environment to distinguish\n # between basic and application/x-www-form-urlencoded\n # requests\n # (2) the parameters need to be stripped from the appropriate\n # path related env variables, so that request dispatching\n # does not trip over them\n\n # (1) Rewrite current path by stripping all matrix params from it\n ['REQUEST_PATH', 'REQUEST_URI', 'PATH_INFO'].select { |k|\n env[k] }.each do |k|\n env[k] = env[k].remove_matrix_params\n end\n\n # (2) Append the matrix params to the 'normal' request params\n # FIXME: Make this work for multipart/form-data\n if env['rack.request.form_hash']\n # application/x-www-form-urlencoded, most likely a POST\n env['rack.request.form_hash'].merge!(matrix_params)\n else\n # For other methods it's more complicated\n if env['REQUEST_METHOD']!='POST' and not matrix_params.keys.empty?\n env['QUERY_STRING'] = env['QUERY_STRING'].gsub(/;([^\\/]*)/, '')\n new_params = matrix_params.collect do |component, params|\n params.collect { |k,v| \"#{component}[#{k}]=#{CGI::escape(v.to_s)}\" }\n end.flatten\n # Add matrix params as a regular GET params\n env['QUERY_STRING'] += '&' if not env['QUERY_STRING'].empty?\n env['QUERY_STRING'] += \"#{new_params.join('&')}\"\n end\n end\n @app.call(env)\n end", "def call(env)\n @request = Rack::Request.new(env)\n @params = @path_params.merge(@request.params.symbolize_keys)\n process_response(instance_exec(self, params, request, &@block))\n end", "def get_request_obj(request_uri)\n\n req_obj = @request_class.new(request_uri)\n\n # Forward cookies\n req_obj['Cookie'] = @cookies.map { |k, v| \"#{k}=#{CGI.escape v.to_s}\" }.join('; ') if @cookies.present?\n\n # Forward headers\n @headers.each do |h, v|\n req_obj[h] = v\n end if @headers.present?\n\n # Attach basic auth\n if GlobalConstant::CompanyApi.basic_auth_user.present?\n req_obj.basic_auth(GlobalConstant::CompanyApi.basic_auth_user, GlobalConstant::CompanyApi.basic_auth_pass)\n end\n\n req_obj\n\n end", "def request\n @request ||= ActionDispatch::TestRequest.create.tap do |request|\n request.request_id = SecureRandom.uuid\n end\n end", "def request\n @request ||= Rack::MockRequest.new(mack_app)\n end", "def build_request(**args)\n params = {}\n\n self.class.parameter_validations.each do |validation|\n validation.call(args, params)\n end\n\n if self.class.parameter_formatter\n params = self.class.parameter_formatter.call(params)\n else\n params.except!(*self.class.parameters_to_filter)\n end\n\n request = Apidiesel::Request.new(action: self, action_arguments: args, parameters: params)\n request.url = build_url(args, request)\n\n request\n end", "def prepare_request(params)\n request = process_params(params)\n request.store(:size, extract_size(params.size)) if params.size\n request\n end", "def make_request(request)\n puts \"\\n\\n\"\n puts \"==> Request, action='#{request.path}', params = #{request.query}...\"\n\n action = request.path.to_s.split(\"/\")[-1]\n\n if action && @app.valid?(action) then\n response = @app.send(action.to_sym, request.query)\n\n return response\n end\n\n return \"Error: Unrecognised action: #{action}\"\n rescue Exception => e\n $stderr.puts \"*** [E]: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n return \"Error: #{e}\"\n end", "def resolve(env)\n @request = Rack::Request.new(env)\n method = env['REQUEST_METHOD']\n path = env['PATH_INFO']\n key = \"#{method} #{path}\"\n do_action(key)\n rescue StandardError => e\n puts e.message\n puts e.backtrace\n Controller.new.internal_error\n end", "def build_request(req, http_method, path, opts = {})\n opts[:query_params].each_key do |key|\n if opts[:query_params][key].kind_of?(Array)\n opts[:query_params][key] = opts[:query_params][key].join[\",\"]\n end\n end\n if @config.http_request_timeout > 0\n req.options.timeout = @config.http_request_timeout\n end\n req.url path.sub(/^\\/+/, '')\n req.headers = opts[:header_params]\n req.params = opts[:query_params]\n req.body = build_request_body(req.headers, opts[:body], opts[:files])\n set_headers(req.headers)\n if @config.debugging\n @config.logger.debug \"HTTP request\\nMethod: #{req.method}\\nPath: #{req.path}\\nParams: #{req.params}\\nHeaders: #{req.headers}\\nBody: #{req.body}\\n\"\n end\n end", "def build_request\n client.request request_name\n end", "def prepare_request(params)\n request = process_params(params)\n request.store(:sizes, [extract_size(params.size)]) if params.size\n request.store(:format, params.format) if params.format\n request.store(:data, params.data) if params.data\n request.store(:uploader, params.uploader) if params.uploader\n request.store(:pages, params.pages) if params.pages\n request.store(:callback_url, params.callback_url) if params.callback_url\n request\n end", "def request_to_env(io, req)\n req.headers.merge(\n Shelf::REQUEST_METHOD => req.method,\n Shelf::PATH_INFO => req.path || ROOT_PATH,\n Shelf::QUERY_STRING => req.query,\n Shelf::HTTP_VERSION => HTTP_VERSION,\n Shelf::SERVER_NAME => 'mruby-simplehttpserver',\n Shelf::SERVER_ADDR => host,\n Shelf::SERVER_PORT => port,\n Shelf::SHELF_URL_SCHEME => req.schema,\n Shelf::SHELF_INPUT => io\n )\n end", "def build_rack_env\n uri = URI.parse(request_env.url)\n headers = request_env.headers.to_h\n\n env = base_rack_env\n env.merge!({\n \"PATH_INFO\" => uri.path,\n \"QUERY_STRING\" => uri.query,\n \"SERVER_NAME\" => uri.host,\n \"SERVER_PORT\" => uri.port&.to_s,\n \"HTTP_HOST\" => uri.host,\n \"REMOTE_ADDR\" => headers.delete(\"REMOTE_ADDR\"),\n \"rack.url_scheme\" => uri.scheme&.sub(/^ws/, \"http\"),\n # AnyCable specific fields\n \"anycable.raw_cstate\" => request_env.cstate&.to_h,\n \"anycable.raw_istate\" => request_env.istate&.to_h,\n \"anycable.sid\" => request_env.sid\n }.delete_if { |_k, v| v.nil? })\n\n env.merge!(build_headers(headers))\n end", "def setup_request\n return Typhoeus::Request.new(\n endpoint_url,\n method: @method,\n params: @params,\n body: @body,\n headers: @headers)\n end", "def build_env(connection, request); end", "def create_request_context path, params, data=nil, opts={}\n url = build_url path, params\n full_url = prepend_base url\n context = {:path => path, :url => full_url, :params => params, :query => hash_to_query(params), :data => data}\n if opts[:method] == :post\n raise \"Don't send POST data when using :method => :post\" unless data.to_s.empty?\n # force a POST, use the query string as the POST body\n context.merge! :data => hash_to_query(params), :headers => {'Content-Type' => 'application/x-www-form-urlencoded'}\n elsif data\n # standard POST, using \"data\" as the POST body\n context.merge! :headers => {'Content-Type' => 'text/xml; charset=utf-8'}\n end\n context\n end", "def setup_controller_params(controller, env, vars)\n if Fastr::HTTP.method?(env, :get)\n controller.get_params = Fastr::HTTP.parse_query_string(env['QUERY_STRING'])\n controller.params = controller.get_params.merge(vars)\n elsif Fastr::HTTP.method?(env, :post)\n controller.post_params = {}\n controller.post_params = Fastr::HTTP.parse_query_string(env['rack.input'].read) if env['rack.input']\n controller.params = controller.post_params.merge(vars)\n else\n controller.params = vars\n end\n end", "def generate_request(request)\n\n\t\t\trequest_uri = request[:uri].request_uri\n\n\t\t\tcase request[:method]\n\t\t\twhen :get\n\t\t\t\treq = Net::HTTP::Get.new request_uri\n\t\t\twhen :post\n\t\t\t\treq = Net::HTTP::Post.new request_uri, {'Content-Type' => \"application/json\"}\n\t\t\t\treq.body = request[:body]\n\t\t\t\treq\n\t\t\twhen :put\n\t\t\t\treq = Net::HTTP::Put.new request_uri, {'Content-Type' => \"application/json\"}\n\t\t\t\treq.body = request[:body]\n\t\t\t\treq\n\t\t\twhen :patch\n\t\t\t\treq = Net::HTTP::Patch.new request_uri, {'Content-Type' => \"application/json\"}\n\t\t\t\treq.body = request[:body]\n\t\t\t\treq\n\t\t\twhen :delete\n\t\t\t\treq = Net::HTTP::Delete.new request_uri\n\t\t\tend\n\t\tend", "def apply_request(request_env)\n raise \"response didn't finish yet\" unless finished?\n @env = request_env.merge @env\n return self\n end", "def get_params(env)\n req = ActionDispatch::Request.new(env)\n req.GET.merge(req.POST)\n end", "def get_params(env)\n req = ActionDispatch::Request.new(env)\n req.GET.merge(req.POST)\n end", "def multipart_fake_request(env = {}, params = {})\n if params.empty?\n fake_request(env)\n else\n m = Post.new(params)\n body, head = m.to_multipart\n fake_request(env.merge( :content_type => head, \n :content_length => body.length), :post_body => body)\n end\n end", "def build_request(name, args)\n build_args(args) if args\n # build the request & http object\n build_http_request(name)\n # set the content type & request body\n update_content_type(name)\n make_request(@http, @request)\n end", "def fill_rack_env(env = {})\n env[\"rack.input\"] = @body || StringIO.new\n env[\"REQUEST_METHOD\"] = @method\n env[\"SCRIPT_NAME\"] = \"\"\n env[\"REQUEST_URI\"] = @path\n env[\"PATH_INFO\"], query = @path.split(\"?\", 2)\n env[\"QUERY_STRING\"] = query || \"\"\n if (@headers[\"HOST\"] && !env[\"SERVER_NAME\"])\n env[\"SERVER_NAME\"], port = @headers[\"HOST\"].split(\":\", 2)\n env[\"SERVER_PORT\"] = port if port\n end\n @headers.each do |key, val|\n if (key == 'CONTENT_LENGTH' || key == 'CONTENT_TYPE')\n env[key] = val\n else\n env[\"HTTP_#{key}\"] = val\n end\n end\n return env\n end", "def handle(request, env)\n params = @params.dup\n path_info, script_name = env[\"PATH_INFO\"], env[\"SCRIPT_NAME\"]\n \n return unless request_conditions.all? do |method_name, condition|\n # TODO: Refactor this... it lacks awesome\n next true unless request.respond_to?(method_name)\n matched, captures = condition.match(request)\n if matched\n params.merge!(captures)\n if method_name == :path_info\n new_path_info = @path_info.dup if @path_info\n new_path_info ||= env[\"PATH_INFO\"].sub(/^#{Regexp.escape(matched)}/, '')\n new_path_info.gsub!(SEGMENT_REGEXP) { |s| params[$2.to_sym] }\n env[\"SCRIPT_NAME\"] = Utils.normalize(request.env[\"SCRIPT_NAME\"] + matched)\n env[\"PATH_INFO\"] = Utils.normalize(new_path_info)\n end\n true\n end\n end\n \n env[\"rack_router.route\"] = self\n env[\"rack_router.params\"].merge! params\n \n @app.call(env)\n ensure\n env[\"PATH_INFO\"], env[\"SCRIPT_NAME\"] = path_info, script_name\n end", "def setup_request_environment(controller_class)\n controller_class.class_eval do\n def rescue_action(e)\n raise e\n end\n end\n @controller = controller_class.new\n @controller.request = @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n \n @controller.params = {}\n @controller.send(:initialize_current_url)\n end", "def build_request(method)\n Request.create(method) do |req|\n req.params = self.params.dup\n req.headers = self.headers.dup\n req.options = self.options\n yield(req) if block_given?\n end\n end", "def lookup(request_params)\n send_request(base_params.merge(request_params))\n end", "def build_request_headers(request)\n @request_headers.each do |key, value|\n request[key] = value\n end\n request\n end", "def set_request\n $request = request\n end", "def call(env)\n params = Rack::Request.new(env).params\n reduction = Reduction.new(@props.merge(params: params)).reduce\n @app.call env.merge(@key => reduction)\n end", "def prepare_request(request)\n request['x-api-key'] = @api_key if @api_key\n request\n end", "def initialize(request, params)\n @request = request\n @params = params\n end", "def initialize_request_and_response(env)\n @request = Rack::Request.new env\n @response = Rack::Response.new\n end", "def request_setup(method, path, params)\n proc do |request|\n if @access_token\n request.headers[\"X-ACCESS-TOKEN\"] = @access_token\n elsif @xapp_token\n request.headers[\"X-XAPP-TOKEN\"] = @xapp_token\n end\n if @logger\n params_s = (\"?\" + params.select { |k, v| k }.map { |k, v|\n \"#{k}=#{CGI.escape(v.to_s)}\"\n }.join(\"&\")) if params.any?\n @logger.info \"#{method.upcase} #{path}#{params_s}\"\n request.headers.each_pair do |k, v|\n @logger.debug \" #{k}: #{v}\"\n end\n end\n end\n end", "def request(action, params = T.unsafe(nil), header = T.unsafe(nil), query = T.unsafe(nil)); end", "def env_for(env, params = {}, options = {})\n require \"rack/mock\"\n\n case env\n when ::String\n ::Rack::MockRequest.env_for(env, options)\n when ::Symbol\n begin\n url = path(env, params)\n return env_for(url, params, options) # rubocop:disable Style/RedundantReturn\n rescue Hanami::Router::MissingRouteError\n {} # Empty Rack env\n end\n else\n env\n end\n end", "def construct_request(uri, params, credentials=[])\n Weary::Request.new uri, @method do |r|\n pass_values_onto_requestable(r)\n if !expected_params.empty?\n r.params params.reject {|k,v| !expects? k }\n end\n r.send @authenticates, *credentials if authenticates?\n end\n end", "def build_request\n case action\n when 'charge'\n self.class.include Requests::ChargeRequest\n validate_charge_params!\n @request = build_charge_request\n when 'refund'\n self.class.include Requests::RefundRequest\n validate_refund_params!\n @request = build_refund_request\n when 'payment_status'\n self.class.include Requests::PaymentStatusRequest\n validate_payment_status_params!\n @request = build_payment_status_request\n when 'create_card_token'\n self.class.include Requests::CreateCardTokenRequest\n validate_card_token_params!\n @request = build_create_card_token_request\n when 'list_tokens'\n self.class.include Requests::ListTokensRequest\n validate_list_tokens_params!\n @request = build_list_tokens_request\n when 'delete_token'\n self.class.include Requests::DeleteTokenRequest\n validate_delete_token_params!\n @request = build_delete_token_request\n end\n # rubocop:enable Metrics/AbcSize\n # rubocop:enable Metrics/MethodLength\n end", "def call(env)\n self.class.perform_request env\n end", "def build_request(*args); end", "def request_setup(method, path, params)\n Proc.new do |request|\n end\n end", "def set_request_headers!(request); end", "def custom_request(verb, uri, params = {}, env = {}, &block)\n uri = parse_uri(uri, env)\n env = env_for(uri, env.merge(method: verb.to_s.upcase, params: params))\n process_request(uri, env, &block)\n end", "def request(req)\n self.class.paths << req.path\n self.class.params << req.body\n response = self.class.responses.shift\n if response.respond_to? :call then\n response.call req\n else\n res = Net::HTTPResponse.new '1.0', 200, 'OK'\n res.body = response\n res\n end\n end", "def request_to(path, method = :get, env = {})\n env[:request_method] ||= method.to_s.upcase\n env[:request_uri] = path\n \n check_request_for_route(fake_request(env))\n end", "def build_request path, opts = {}\n connection.build_request path, opts\n end", "def build_net_http_request request\n\n # Net::HTTP adds a content-type header automatically unless its set\n # and this messes with request signature signing. Also, it expects\n # all header values to be strings (it call strip on them).\n headers = { 'content-type' => '' }\n request.headers.each_pair do |key,value|\n headers[key] = value.to_s\n end\n\n request_class = case request.http_method\n when 'GET' then Net::HTTP::Get\n when 'PUT' then Net::HTTP::Put\n when 'POST' then Net::HTTP::Post\n when 'HEAD' then Net::HTTP::Head\n when 'DELETE' then Net::HTTP::Delete\n else raise \"unsupported http method: #{request.http_method}\"\n end\n\n net_http_req = request_class.new(request.uri, headers)\n net_http_req.body = request.body\n net_http_req\n\n end", "def setup_fixtured_request( action, *args )\n\t\turi = '/' + File.join( @appletname, action.to_s )\n\t\treq = Apache::Request.new( uri )\n\n\t\tparams = args.last.is_a?( Hash ) ? args.pop : {}\n\t\tdebug_msg \"Parameters hash set to: %p\" % [params]\n\t\treq.paramtable = params\n\n\t\tdebug_msg \"Request is: %p\" % [req]\n\t\t#txn = Arrow::Transaction.new( req, @config, nil )\n\t\ttxn = flexmock( \"transaction\" )\n\t\ttxn.should_receive( :request ).\n\t\t and_return( req ).zero_or_more_times\n\t\ttxn.should_receive( :vargs= ).\n\t\t with( Arrow::FormValidator ).zero_or_more_times\n\t\t\n\t\tvargs = flexmock( \"form validator\" )\n\t\ttxn.should_receive( :vargs ).\n\t\t\tand_return( vargs ).\n\t\t\tzero_or_more_times\n\t\tvargs.should_receive( :[] ).zero_or_more_times\n\t\t\n\t\tdebug_msg \"Transaction is: %p\" % [txn]\n\t\treturn txn, req, vargs, *args\n\tend", "def set_request\n @request = Request.accessible_by(current_ability).find(params[:id])\n end", "def request\n double(ActionDispatch::Request, { path: \"/\" })\n end", "def initialize env\n @rack_environment = env\n @rack_version = env['rack.version']\n\n sanity_check!\n @rack_request = Rack::Request.new(rack_environment)\n\n initialize_uris\n end", "def adapt_request(request)\n if request.url.nil? || request.method.nil?\n raise ArgumentError, \"Url and method are required\"\n end\n\n params = {\n method: request.method,\n url: request.url,\n headers: request.headers,\n cookies: request.cookies\n }\n\n unless request.content.nil?\n if request.content.is_a?(HttpMultiPartContent)\n params[:payload] = request.content.parts\n .merge(multipart: true)\n else\n params[:payload] = request.content.as_text\n request.content.get_headers.each do |key, value|\n unless params[:headers].key?(key)\n params[:headers][key] = value\n end\n end\n end\n end\n\n params[:headers][:params] = request.parameters\n\n unless request.proxy.nil?\n params[:proxy] = request.proxy\n end\n\n unless request.timeout.nil?\n params[:timeout] = request.timeout\n end\n\n return params\n end", "def call(env)\n Rango::Router.set_rack_env(env) # See rango/router/adapters/*\n request = Rango::Request.new(env)\n options = env[\"rango.router.params\"] || raise(\"rango.router.params property has to be setup at least to empty hash\")\n method = env[\"rango.controller.action\"].to_sym\n controller = self.new(env, options.merge(request.params))\n begin\n unless controller.respond_to?(method) # TODO: what about method_missing?\n raise NotFound, \"Controller #{self.name} doesn't have method #{method}\"\n end\n controller.run_filters(:before, method.to_sym)\n # If you don't care about arguments or if you prefer usage of params.\n if controller.method(method).arity.eql?(0)\n Rango.logger.debug(\"Calling method #{self.name}##{method} without arguments\")\n controller.response.body = controller.method(method).call\n else\n args = controller.params.values\n Rango.logger.debug(\"Calling method #{self.name}##{method} with arguments #{args.inspect}\")\n controller.response.body = controller.method(method).call(*args)\n end\n controller.run_filters(:after, method)\n return controller.response.finish\n rescue HttpError => exception\n controller.rescue_http_error(exception)\n end\n end", "def requestAction(controller,action,params={})\n controller.class_eval{\n def params=(params); @params = params end\n def params; @params end\n }\n c = controller.new\n c.request = @_request\n c.response = @_response\n c.params = params\n c.send(action)\n c.response.body\n end", "def call(env)\n request = WelltreatStoreFramework::Controller::Request.initialize_from_env(env)\n response = WelltreatStoreFramework::Controller::Response.new\n options = {\n session: env['rack.session']\n }\n\n dispatch request.path, request, response, options\n render! request, response, options\n\n [response.status, response.headers, [response.content]]\n end", "def parse_request(env, path_params)\n if env[CREQUEST_METHOD] == CPOST\n validate_request!(env, path_params)\n parse_message_hash(env, path_params)\n else\n [ nil, env, path_params ]\n end\n end", "def send_request(req)\n raise TypeError if !req.is_a?(RequestContext)\n raise \"Request context seems to be sent already: #{req.state}\" if req.state != :init\n\n # possible timeout_sec values:\n # timeout_sec == -1.0 : to be overwritten to the default timeout.\n # timeout_sec == 0.0 : never be timed out.\n # timeout_sec > 0.0 : wait for the user set timeout.\n if req.timeout_sec == -1.0\n # set default timeout if no one updated the initial value.\n req.timeout_sec = config_section.timeout_sec\n end\n\n req.process_event(:on_ready)\n\n EventMachine.schedule {\n @stats[:total_request_count] += 1\n if @stats[:peak_wait_response_size] < @active_requests.size\n @stats[:peak_wait_response_size] = @active_requests.size\n end\n if !req.oneshot\n @active_requests[req.ticket] = req\n end\n\n # create receiver queue every time before publish the message.\n # This helps to receive messages from the failed receiver.\n amq.queue(endpoint_queue_name(req.endpoint), {:exclusive=>false, :auto_delete=>true})\n @requested_endpoints[req.endpoint] = 1\n\n amq.default_exchange.publish(Serializer.instance.marshal(req.request_hash),\n {:message_id => req.ticket,\n :key => endpoint_queue_name(req.endpoint),\n :reply_to=>\"command-recv.#{manifest.node_id}\"}\n )\n req.process_event(:on_sent)\n }\n end", "def route_request\n env.logger.debug \"#{self.class} ROUTING - #{env[Goliath::Request::PATH_INFO]}\"\n if has_path = ( env[Goliath::Request::PATH_INFO] =~ /^\\/(\\w+)(\\/\\w+)*/ )\n env.logger.debug \"#{self.class} route_request:\\t pathinfo = #{$1} extended = #{$2}\"\n path_info = $1\n extended_path_info = $2\n has_path = true #it will be a number or nil - let's just make it a bool\n elsif params[:id]\n has_path = true\n end\n \n method = env[Goliath::Request::REQUEST_METHOD]\n action = case method\n when 'GET'\n has_path ? 'show' : 'index'\n when 'POST'\n has_path ? ( raise BadRequestError, \"can't post to this resource\" ) : 'create'\n when 'PUT'\n !has_path ? ( raise BadRequestError, \"no resource to PUT to\" ) : 'update'\n when 'DELETE'\n !has_path ? ( raise BadRequestError, \"no resource to DELETE\" ) : 'delete'\n else\n raise MethodNotAllowedError, \"unknown request method\"\n end\n env.logger.info \"#{self.class} route_request:\\t attempting to call #{action} action\"\n if self.respond_to?(action, true) #second param includes private methods\n env['params']['id'] = params[:id] || (path_info if has_path)\n self.send(action)\n else\n error_on MethodNotAllowedError, \"#{action} not supported for this resource\"\n end\n end", "def request(req)\n req = Request.new(req) if req.kind_of?(Hash)\n action = if req.kind_of?(Request) then req.action else '(string)' end\n debug(\"#{action}: #{req.inspect}\")\n begin\n res = get_response(req)\n info(\"#{action}: #{res.inspect}\")\n rescue Error::Casual => ex\n info(\"#{action}: (ignored) #{ex.message}\")\n raise if verbose\n res = ex.response\n rescue Error::Fatal => ex\n error(\"#{action}: #{ex.message}\")\n raise\n rescue Errno::ECONNREFUSED => ex\n error(\"#{ex.message} / #{self['host'].inspect}:#{self['port'].inspect}\")\n raise\n end\n return res\n end", "def call(env)\n RequestLocals.set_current_store_id(extract_request_id(env))\n @app.call(env)\n ensure\n RequestLocals.clear!\n RequestLocals.set_current_store_id(nil)\n end", "def request(uri, env = {}, &block)\n uri = parse_uri(uri, env)\n env = env_for(uri, env)\n process_request(uri, env, &block)\n end", "def request(req, body = nil, &block)\n response = alias_for_request(req, body)\n path = \"http://#{req.bauth if req.bauth}#{req['host']}#{req.path}\"\n if @@fakes[req.method][path]\n @@fakes[req.method][path] << {:body => response.body.to_s}\n else\n @@fakes[req.method][path] = [:body => response.body.to_s]\n end\n return response\n end", "def make_request(req)\n if @http && @http.address == req.uri.host && !@http.started?\n @http.start\n else\n @http = Net::HTTP.new(req.uri.host, req.uri.port)\n @http.use_ssl = req.ssl?\n @http.verify_mode = OpenSSL::SSL::VERIFY_NONE if req.ssl?\n @http.set_debug_output($stderr) if req.debug\n @http.start\n end\n @http.request(req.http_request)\n end", "def request_to(path, method = :get, env = {})\n env[:request_method] ||= method.to_s.upcase\n env[:request_uri] = path\n \n check_request_for_route(build_request({}, env))\n end", "def request_context(request)\n @request_context ||= Request.retriever_for_request(request)&.call\n end", "def make_generic_request(request)\n request_path = path(request)\n\n Puppet::Network::HTTP::Request.new(\n headers(request),\n params(request),\n http_method(request),\n request_path, # path\n request_path, # routing_path\n client_cert(request),\n body(request)\n )\n end", "def normalize_request(rack_req)\n host = rack_req.host\n\n s_req = Request.new\n s_req.path = path_for_rack_request(rack_req)\n s_req.is_path_style = true\n s_req.rack_request = rack_req\n\n if !@root_hostnames.include?(host)\n s_req.bucket = host.split(\".\")[0]\n s_req.is_path_style = false\n end\n\n s_req.http_verb = rack_req.request_method\n\n case rack_req.request_method\n when 'PUT'\n normalize_put(rack_req,s_req)\n when 'GET','HEAD'\n normalize_get(rack_req,s_req)\n when 'DELETE'\n normalize_delete(rack_req,s_req)\n when 'POST'\n normalize_post(rack_req,s_req)\n when 'OPTIONS'\n nomalize_options(rack_req,s_req)\n else\n return false\n end\n\n if s_req.type.nil?\n return false\n end\n\n return s_req\n end", "def env\n @_request.env\n end", "def request_call # rubocop:disable CyclomaticComplexity, MethodLength, PerceivedComplexity\n setup_phase\n log :debug, 'Request phase initiated.'\n\n # store query params from the request url, extracted in the callback_phase\n session['omniauth.params'] = request.GET\n\n OmniAuth.config.request_validation_phase.call(env) if OmniAuth.config.request_validation_phase\n OmniAuth.config.before_request_phase.call(env) if OmniAuth.config.before_request_phase\n\n if options.form.respond_to?(:call)\n log :debug, 'Rendering form from supplied Rack endpoint.'\n options.form.call(env)\n elsif options.form\n log :debug, 'Rendering form from underlying application.'\n call_app!\n elsif !options.origin_param\n request_phase\n else\n if request.params[options.origin_param]\n env['rack.session']['omniauth.origin'] = request.params[options.origin_param]\n elsif env['HTTP_REFERER'] && !env['HTTP_REFERER'].match(/#{request_path}$/)\n env['rack.session']['omniauth.origin'] = env['HTTP_REFERER']\n end\n\n request_phase\n end\n rescue OmniAuth::AuthenticityError => e\n fail!(:authenticity_error, e)\n end", "def initialize(req, route_params = {})\n @params = {}\n @params = @params.merge(route_params)\n parse_www_encoded_form(req.query_string) if req.query_string\n parse_www_encoded_form(req.body) if req.body\n end", "def initialize(req, route_params = {})\n @params = parse_www_encoded_form(req.query_string)\n @params.merge!(parse_www_encoded_form(req.body))\n @params.merge!route_params\n end", "def create_new_http_request\n # Create a new HTTP request instance\n request_spec = @data[:request][:instance]\n http_class = \"Net::HTTP::#{request_spec.verb._camelize}\"\n http_request = http_class._constantize::new(request_spec.path)\n # Set the request body\n if request_spec.is_io?\n http_request.body_stream = request_spec.body\n else\n http_request.body = request_spec.body\n end\n # Copy headers\n request_spec.headers.each { |header, value| http_request[header] = value }\n # Save the new request\n request_spec.raw = http_request\n # Set user-agent\n if @data[:options].has_key?(:connection_user_agent)\n http_request['user-agent'] ||= @data[:options][:connection_user_agent]\n end\n http_request\n end", "def record_request(env)\n input = create_recording_input(env)\n env.update \"rack.input\" => input\n input\n end", "def http_request_options(env)\n opts = {}\n if [:put, :post].include? @request[:method]\n opts[:body] = @request[:body] || extract_request_body(env)\n end\n opts\n end", "def buildRequest(payload)\n # ...\n end" ]
[ "0.64752877", "0.62871164", "0.60735166", "0.6067896", "0.6020211", "0.59661824", "0.591714", "0.58941156", "0.58926606", "0.5741204", "0.57023144", "0.56853217", "0.56853217", "0.56585866", "0.5646141", "0.5642714", "0.56414986", "0.56279665", "0.55799675", "0.55749434", "0.55067754", "0.55067754", "0.54983103", "0.54933715", "0.543879", "0.53662235", "0.5362363", "0.53380746", "0.5337814", "0.5337206", "0.5324121", "0.53048193", "0.52940416", "0.5291924", "0.5282524", "0.527609", "0.52747315", "0.5272954", "0.5272862", "0.5259611", "0.5253078", "0.52414924", "0.520233", "0.5193945", "0.5193945", "0.51846087", "0.51772267", "0.51762503", "0.51510626", "0.5150617", "0.5137879", "0.51168275", "0.51078415", "0.50998896", "0.50936055", "0.50706863", "0.50688577", "0.50628483", "0.50589573", "0.50320035", "0.5023709", "0.50113004", "0.4993853", "0.4984375", "0.4973187", "0.49691626", "0.49435532", "0.49254203", "0.49159613", "0.49157843", "0.49144876", "0.49043393", "0.49034664", "0.49033973", "0.48877832", "0.48791966", "0.4877934", "0.4877629", "0.48659092", "0.48633954", "0.48624632", "0.4862156", "0.48612204", "0.48568514", "0.4855496", "0.48542282", "0.485229", "0.4843738", "0.48297867", "0.48273495", "0.48262322", "0.48173797", "0.48152947", "0.47995606", "0.47994414", "0.47954676", "0.4795388", "0.47906077", "0.47904465", "0.47891933" ]
0.6666283
0
An HTTP GET request that operates through the router. ==== Parameters path:: The path that should go to the router as the request uri. params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see +fake_request+). &blk:: The controller is yielded to the block provided for actions prior to the action being dispatched.
def get(path, params = {}, env = {}, &block) env[:request_method] = "GET" mock_request(path, params, env, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(path, params = {})\n\t\trequest(path, :get, params)\n\tend", "def get(path:, params: {})\n request(method: :get, path: path, params: params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params = {})\n request(:get, path, params)\n end", "def get(path, params = {})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params = {})\n request(:get, path, params)\n end", "def get(path, params = {})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, params.merge(:path => path))\n end", "def get(path, params = {}, request_options = {})\n request(:get, path, params)\n end", "def get(path, params={})\n RestClient.get request_base+path, {params: params}\n end", "def get(path, &block)\n route 'GET', path, &block\n end", "def get_request(path, params={}, options={})\n request(:get, path, params, options)\n end", "def get(path)\n request 'GET', path\n end", "def get(path, params={}) # :nodoc:\n handle_response(@session.get(path, params))\n end", "def get(path, params)\n parse_response @client[path].get(:params => params)\n end", "def get(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'get'}.merge(authentication))\n end", "def get(path, parameters = {})\n request(:get, path, parameters)\n end", "def get path, header={}, body_string_or_hash=\"\"\n env.http 'GET', path, header, body_string_or_hash\n end", "def get(path, params: {}, headers: nil)\n response = conn.get do |req|\n build_request(req, path: path, params: params, headers: headers)\n end\n response\n rescue StandardError => e\n puts e.inspect\n raise\n end", "def get(path, params = {})\n execute :get, path, params\n end", "def get(path, params = {}, headers = {})\n request(:get, path, params, headers).body\n end", "def get(path, params, connection = CONNECTION)\n request = Net::HTTP::Get.new(to_url(path, params))\n process_request(request, connection)\nend", "def get(path, query_params={}, opts={})\n request(:get, path, query_params, opts)\n end", "def get(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('get')\n end\n end", "def get(path)\n request(:get, path, {})\n end", "def get(params)\n request.method = :get\n execute(params)\n end", "def route_for(path, env = {}, &block)\n request = fake_request(env_for(path, env))\n yield request if block_given?\n Merb::Router.route_for(request)\n end", "def route_for(path, env = {}, &block)\n request = fake_request(env_for(path, env))\n yield request if block_given?\n Merb::Router.route_for(request)\n end", "def api_get(path, params = {})\n api_request(:get, path, :params => params)\n end", "def get(path, params = {})\n @connection.get(path, params)\n end", "def get(path, params={})\n params[:apikey] = self.api_key\n RestClient::Request.execute(\n :method => :get,\n :url => \"#{self.uri}#{path}\",\n :headers => {\n :params => params\n },\n :verify_ssl=> @ssl_verify )\n end", "def get path = \"\", payload = {}\n make_request(path, \"get\", payload)\n end", "def request(path, params={})\n request_url = \"#{API_URL}#{path}\"\n perform_get_request(request_url, params)\n end", "def get(path, params)\n github_request(path, params)\n end", "def get(params = {})\n request! do\n api[url.path + to_query(params)].get(API_HEADERS)\n end\n end", "def get(path, params = {})\n debug_log \"GET #{connection.build_url(\"#{@host}#{path}\", params)}\"\n res = connection.get path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def get(path, opts = {}, &block)\n request(:get, path, opts, &block)\n end", "def get(path, opts = {}, &block)\n request(:get, path, opts, &block)\n end", "def get(params = {})\n http_helper.send_get_request(\"#{@url_prefix}\", params)\n end", "def get(path, params={}, options={})\n request(:get, api_path(path), params, options)\n end", "def get(path)\n RequestStub.build :method => :get, :path => path\n end", "def get(action, params)\n \n request = query_string(action, params)\n logger.debug(\"request: #{request}\")\n \n url = URI.parse(@endpoint)\n response = Net::HTTP.start(url.host, url.port) { |http|\n http.get(request)\n }\n \n status = success?(response.body)\n gateway_response = GatewayResponse.new(@endpoint, request, response.body, status) \n end", "def get(uri, params = {})\n send_request(uri, :get, params)\n end", "def get(path, headers = {})\n process :get, path, headers\n end", "def get(path, &handler)\n route(\"GET\", path, &handler)\n end", "def request(method, path, params)\n full_path = format_request_uri(path, params)\n request = VERB_MAP[method.to_sym].new(full_path)\n # TODO - Enable when supporting other HTTP Verbs\n # request.set_form_data(params) unless method == :get\n\n @logger.debug \"#{method.to_s.upcase} #{path}\"\n @http.request(request)\n end", "def request_to(path, method = :get, env = {})\n env[:request_method] ||= method.to_s.upcase\n env[:request_uri] = path\n \n check_request_for_route(fake_request(env))\n end", "def get(path, rev = nil)\n invoke(Request.new(:path => path, :rev => rev, :verb => Request::Verb::GET))\n end", "def get(path, params = {})\n response = access_token.get(path + '?' + params.to_param, header)\n parse_response(response)\n end", "def request(method: :get, path:, params: {})\n authenticate\n\n uri = \"#{@base_uri}/#{path}\"\n headers = {\n \"Authorization\" => \"Token token=\\\"#{@token}\\\"\",\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json\"\n }\n\n RestClient::Request.execute(\n method: method, url: uri, payload: params.to_json, headers: headers\n ) { |response| handle_response(response) }\n end", "def get(path = '/files/', params = {})\n request :get, path, params\n end", "def get(uri, query = {}, &block) \n request(:get, uri, query, &block)\n end", "def rest_get(path, options={}, &blk)\n get path do |*args|\n @object = yield(*args) or pass\n rest_respond @object\n end\n end", "def rest_get(path, options={}, &blk)\n get path do |*args|\n @object = yield(*args) or pass\n rest_respond @object\n end\n end", "def get\n start { |connection| connection.request http :Get }\n end", "def get_request(path, params)\n params = params.merge(:publickey => @user.public_key, :userid => @user.user_id)\n response = self.class.get(path, :query => params)\n self.class.verify_response!(response, path, params)\n end", "def get(headers = {}, path = '', parameters = {})\n full_path = [path, URI.encode_www_form(parameters)].join(PARAM_STARTER)\n uri = URI.parse(\"#{@url}#{full_path}\")\n request = Net::HTTP::Get.new(uri.request_uri)\n request.body = nil\n send_request(uri, request, headers)\n end", "def get(path, query={})\n request.get(path, query_options(query))\n end", "def get(*args)\n prepare_request(:get, args)\n @@client.add(:get, @path, *args)\n end", "def get(path, payload = nil)\n req = Net::HTTP::Get.new(path)\n action(req, payload)\n end", "def request_to(path, method = :get, env = {})\n env[:request_method] ||= method.to_s.upcase\n env[:request_uri] = path\n \n check_request_for_route(build_request({}, env))\n end", "def get(path, data={})\n request(:get, path, data)\n end", "def get(parameters = {}, headers = {}, &block)\n build_get(parameters, headers, &block).invoke\n end", "def get(path)\n connection.get do |req|\n req.url path\n end.body\n end", "def get(path, data = {})\n # Allow format override\n format = data.delete(:format) || @format\n # Add parameters to URL query string\n get_params = {\n :method => \"get\", \n :verbose => DEBUG\n }\n get_params[:params] = data unless data.empty?\n # Create GET request\n get = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", get_params)\n # Send request\n do_request(get, format, :cache => true)\n end", "def call(env)\n @request = Rack::Request.new(env)\n @params = @path_params.merge(@request.params.symbolize_keys)\n process_response(instance_exec(self, params, request, &@block))\n end", "def get(path, data=nil)\n request(:get, path, data)\n end", "def get(path, options = {}, &block); add :get, path, options, &block end", "def get(path, params = {})\n request = HTTPI::Request.new(build_url(path, params))\n request.proxy = proxy unless proxy.nil?\n parse_response(HTTPI.get(request))\n end", "def get(path, &block)\n # https://www.rubyguides.com/2016/02/ruby-procs-and-lambdas/\n @routes[path] = block\n end", "def get(path, options={}, &block)\n uri = URI.join(@endpoint, path)\n headers = options.delete(:headers)\n query = options.delete(:query)\n\n if query\n uri.query = URI.encode_www_form(query)\n end\n\n request = Net::HTTP::Get.new uri.request_uri, headers\n @http.request request, &block\n end", "def get(action, params={}, options={})\n request(:get, action, params, options)\n end", "def get(path, options = {}, &block)\n execute('GET', path, options, nil, &block)\n end", "def get(path, *data, &block)\n map(path, R3::GET, *data, &block)\n end", "def get(path, params = {})\n parse_item access_token.get(\"#{@prefix}/#{path}\", params)\n end", "def get\n Iterable.request(conf, base_path).get\n end", "def get\n Iterable.request(conf, base_path).get\n end", "def get(path, params={}, args={})\n inject_token_auth_headers!(args)\n response = self.class.get(request_url(path, params), args)\n update_token_auth_headers(response)\n return response\n end", "def request(verb, path, params = nil)\n _validate_verb(verb)\n request!(verb, path.to_s, Utils.encode_www_data(params))\n end", "def get\n execute_request('GET') do |uri, headers|\n HTTP.http_client.get(\n uri,\n follow_redirect: true,\n header: headers\n )\n end\n end", "def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end", "def request(method, path, params = {})\n req = create_request path\n req.request method.upcase, params do |response|\n if (200..300).cover?(response.status)\n yield response.json if block_given?\n else\n warn response.json['error']\n end\n end\n end", "def get(path, query = {})\n make_call(mk_conn(path), :get, nil, query)\n end", "def get(uri, request_headers)\n request('get', uri, request_headers) do |response_status_code, response_headers, response_body|\n yield response_status_code, response_headers, response_body\n end\n end", "def get(path, query={})\n request_json :get, path, query\n end", "def get(path, options={})\n send_request 'get', path, options\n end", "def get(path: nil, headers: {}, query: {}, auth_method: nil)\n execute(method: :get, path: path, query: query, headers: headers, auth_method: auth_method)\n end", "def get(path, options = {})\n request(:get, path, options)\n end", "def get(path, options = {})\n request(:get, path, options)\n end", "def get(url, params={})\n @agent.get(url,params)\n end" ]
[ "0.725828", "0.7179628", "0.7128158", "0.71200424", "0.71200424", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.71187145", "0.70910823", "0.70910823", "0.6973759", "0.68960845", "0.68934894", "0.6838564", "0.6765409", "0.6655166", "0.6573738", "0.654513", "0.6540909", "0.65392417", "0.65384316", "0.6528729", "0.65143394", "0.6507559", "0.65073895", "0.6504971", "0.64877635", "0.6479384", "0.64652807", "0.64615357", "0.64615357", "0.64472145", "0.638137", "0.6379833", "0.6369671", "0.62961316", "0.62945485", "0.626758", "0.6241985", "0.6192855", "0.6192855", "0.61730975", "0.6172496", "0.61617666", "0.6092606", "0.6051824", "0.6041541", "0.59994537", "0.59931904", "0.59927535", "0.5969471", "0.59558344", "0.5954562", "0.5910701", "0.59072435", "0.5903165", "0.5903165", "0.59009343", "0.5885102", "0.5879707", "0.58731854", "0.58649504", "0.5840199", "0.5827184", "0.5816074", "0.5810451", "0.58062583", "0.5804684", "0.5802931", "0.5799619", "0.5796442", "0.5781873", "0.5774805", "0.5762423", "0.5758363", "0.573695", "0.5728507", "0.5723495", "0.5704067", "0.5704067", "0.57021254", "0.569237", "0.56909347", "0.5683719", "0.5677876", "0.5674841", "0.56657827", "0.56653", "0.5654901", "0.5654071", "0.56524956", "0.56524956", "0.5648301" ]
0.7662946
0
An HTTP POST request that operates through the router. ==== Parameters path:: The path that should go to the router as the request uri. params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see fake_request). &blk:: The controller is yielded to the block provided for actions prior to the action being dispatched.
def post(path, params = {}, env = {}, &block) env[:request_method] = "POST" mock_request(path, params, env, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(path, params)\n request(:post, path, params)\n end", "def post(path, params = {})\n\t\trequest(path, :post, params)\n\tend", "def post(path:, params: {})\n request(method: :post, path: path, params: params)\n end", "def post(path, params={})\n request(:post, path, params)\n end", "def post(path, params={})\n request(:post, path, params)\n end", "def post(path, params={})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params)\n with_monitoring do\n connection.post(path) do |req|\n req.body = Oj.dump(params)\n end\n end\n end", "def post(path, params)\n connection.post(path) { |req| req.body = params }\n end", "def post(path, params = {}, &success_block)\n cache_call(path, success_block) do\n res = conn.post(path) do |req|\n add_cookie_if_needed(req)\n req.body = params.to_json\n end\n handle_response(res) { |body| yield(body, res) }\n end\n end", "def post(path, &block)\n route 'POST', path, &block\n end", "def post_request(path, params={}, options={})\n request(:post, path, params, options)\n end", "def post(path, params={})\n RestClient.post request_base+path, params\n end", "def post(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'post'}.merge(authentication))\n end", "def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path, real_params = {}, 'rack.input' => rack_input\nend", "def post(path, params = nil)\n response = @connection.post do |req|\n req.headers = generate_headers\n req.url path\n req.body = params.to_json\n end\n Arke::Log.fatal(build_error(response)) if response.env.status != 201\n response\n end", "def post(path, params)\n parse_response @client[path].post(params)\n end", "def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path, real_params = {}, {\"rack.input\" => rack_input}\nend", "def make_post_request(route:, headers: nil, body: nil)\n post route, params: body, headers: headers\nend", "def post(path, params = {})\n resource(path).post(params)\n end", "def post(path, params = {})\n signature_params = params.values.any? { |value| value.respond_to?(:to_io) } ? {} : params\n request(:post, path, params, signature_params)\n end", "def post(path, params)\n time(\"POST #{path}\") { Cloudflarer.new.post(path, params) }\n end", "def post(path, params={}) # :nodoc:\n handle_response(@session.post(path, MultiJson.dump(params)))\n end", "def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params, signature_params)\n end", "def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params, signature_params)\n end", "def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params, signature_params)\n end", "def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params, signature_params)\n end", "def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params, signature_params)\n end", "def post(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('post')\n end\n end", "def post(path, opts = {}, &block)\n request(:post, path, opts, &block)\n end", "def post(path, opts = {}, &block)\n request(:post, path, opts, &block)\n end", "def post(path, params = {})\n @connection.post(path, params)\n end", "def post(path, query_params={}, opts={})\n request(:post, path, query_params, opts)\n end", "def post(path, parameters = {})\n request(:post, path, parameters)\n end", "def post payload, path = \"\" \n make_request(path, \"post\", payload)\n end", "def post(path, *data, &block)\n map(path, R3::POST, *data, &block)\n end", "def make_post_request url, body, headers = []\n make_request url, method: ::Rack::POST, body: body, headers: headers\n end", "def post(params = nil)\n request.method = :post\n execute(params)\n end", "def post(path, form_data)\n req = Net::HTTP::Post.new(path)\n req.set_form_data(form_data)\n request(req){|res| yield res }\n end", "def create_post(params)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.post(new_post_endpoint, { 'router.params' => params, format: :json })\n end", "def post(request)\n if request.params.is_a?(Hash)\n @connection.post request.path, request.params\n else\n @connection.post request.path do |req|\n req.body = request.params\n end\n end\n end", "def post(path, headers = {})\n process :post, path, headers\n end", "def post(path, to: nil, as: nil, **constraints, &blk)\n add_route(::Rack::POST, path, to, as, constraints, &blk)\n end", "def post(path, params={})\n params[:apikey] = self.api_key\n RestClient::Request.execute(\n :method => :post,\n :url => \"#{self.uri}#{path}\",\n :headers=> {},\n :payload=> params,\n :verify_ssl=> @ssl_verify )\n end", "def post(path, data, params = {}, request_options = {})\n request(:post, path, data, params)\n end", "def post(path, payload)\n req = Net::HTTP::Post.new(path)\n action(req, payload)\n end", "def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params.to_xml, signature_params)\n end", "def post(path, **args); end", "def post(path, payload={})\n request(:post, path, payload)\n end", "def post(path, body = '', headers = {})\n with_auth { request(:post, path, body.to_s, build_request_headers(headers, :post, build_uri(path))) }\n end", "def make_request(action, params = {})\n path = params[:path] || \"/\"\n method = params[:method] || \"post\"\n env = Rack::MockRequest.env_for(path, params: params.except(:path).except(:method), method: method)\n status, headers, body = described_class.action(action).call(env)\n @response = ActionDispatch::TestResponse.new(status, headers, body)\n @controller = body.instance_variable_get(:@response).request.env['action_controller.instance']\nend", "def post(path, params={}, options={})\n request(:post, api_path(path), params, options)\n end", "def post(path, data={})\n request(:post, path, data)\n end", "def post(path, body_params = {})\n debug_log \"POST #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :post, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def post(uri, request_headers, body)\n request('post', uri, request_headers, body) do |response_status_code, response_headers, response_body|\n yield response_status_code, response_headers, response_body\n end\n end", "def post(path, options = {}, &block)\n map(path, options, :post, &block)\n end", "def post(path, params = {})\n response = access_token.post(path, params.stringify_keys, header)\n parse_response(response)\n end", "def post(path = '/files/', params = {})\n request :post, path, params\n end", "def post(path, data=nil)\n request(:post, path, data)\n end", "def post_async(path, params = {})\n resource(path).post_async(params)\n end", "def post(path, body: {}, headers: nil)\n response = conn.post do |req|\n build_request(req, path: path, body: body, headers: headers)\n end\n puts response.body\n response.body unless response.blank?\n end", "def post(path, opts = {})\n request(:post, path, opts).body\n end", "def post path_and_params, post_body\n start if not @pid\n @lock.synchronize do\n @last_use = Time.new.to_f\n\n # Make request to xtractr\n Net::HTTP.start('localhost', @port) do |http|\n http.request_post \"/#{path_and_params}\", post_body do |response|\n headers = {}\n response.each_header {|name,val| headers[name] = val}\n return response.code.to_i, headers, response.body\n end\n end\n end\n end", "def post(path, body: nil, **params)\n return sync_post(path, params: params, body: body) unless Async::Task.current?\n\n async_post(path, params: params, body: body)\n end", "def post(path, options={})\n request :post, path, options\n end", "def post(uri, params = {})\n send_request(uri, :post, params)\n end", "def call(env)\n @request = Rack::Request.new(env)\n @params = @path_params.merge(@request.params.symbolize_keys)\n process_response(instance_exec(self, params, request, &@block))\n end", "def post(path, headers, body, &callback)\n request('POST', path, headers, body, &callback)\n end", "def post_route(payload)\n with_rescue do\n payload = payload.to_json if payload.is_a?(Hash)\n connection.post do |request|\n request.url routes_path\n request.body = payload\n request.headers['Content-Type'] = 'application/json'\n end\n end\n end", "def post(path, data, headers = {})\n request(:post, path, data, headers).body\n end", "def create(path)\n output { post(path, params) }\n end", "def posts_to(path,params,opts={},&block) #:nodoc: \n crud_to(:post,path,params,opts,&block)\n end", "def post(path, params = {}, auth=nil)\n request(:post, path, :body => params, :basic_auth => @auth)\n end", "def http_post(path, request)\n @http.post(\n :body => JSON(:request => request.to_hash),\n :headers => headers,\n :path => \"/api/v2/#{path}\",\n :expects => [200, 201, 202]\n )\n end", "def post(path, body = '', headers = {})\n headers = { 'Content-Type' => 'application/json' }.merge(headers)\n request(:post, path, body, merge_default_headers(headers))\n end", "def post(path, body, args = {})\n client = new(path, args)\n response = client.send(:request) do |uri|\n req = Net::HTTP::Post.new(uri)\n req.body = body\n req\n end\n response\n end", "def post()\n return @http.request(@req)\n end", "def post(path, body, headers: nil)\n request_url = request_url_for_path(path)\n\n Rails.logger.info(\"Url: #{request_url}, body: #{body.to_json}, headers: #{headers}\")\n return HTTParty.post(request_url, body: body.to_json, headers: headers.merge({ 'Content-Type': 'application/json' }).stringify_keys)\n end", "def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end", "def multipart_post(path, params = {}, env = {}, &block)\n env[:request_method] = \"POST\"\n env[:test_with_multipart] = true\n mock_request(path, params, env, &block)\n end", "def post(path, data = {})\n # Allow format override\n format = data.delete(:format) || @format\n # Clear cache\n expire_matching \"#{raw_path(path)}.*\"\n # Extract return unit params\n query_params = {}\n query_params[:returnUnit] = data.delete(:returnUnit) if data[:returnUnit]\n query_params[:returnPerUnit] = data.delete(:returnPerUnit) if data[:returnPerUnit]\n # Create POST request\n post_params = {\n :verbose => DEBUG,\n :method => \"post\",\n :body => form_encode(data)\n }\n post_params[:params] = query_params unless query_params.empty?\n post = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", post_params)\n # Send request\n do_request(post, format) \n end", "def post\n resource.post(request, response)\n end", "def post(path, options={})\n send_request 'post', path, options\n end", "def post\n RestClient.post(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def post(uri, request_headers, body)\n request('post', uri, request_headers, body)\n end", "def post method, params={}\n Request.new(self, :post, method, params)\n end", "def post(request)\n request.method = :post\n request.call\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post(*args)\n request :post, *args\n end", "def build_request(params = {}, env = {})\n params = Merb::Parse.params_to_query_string(params)\n\n query_string = env[:query_string] || env['QUERY_STRING']\n env[:query_string] = query_string ? \"#{query_string}&#{params}\" : params\n \n post_body = env[:post_body] || env['POST_BODY']\n fake_request(env, { :post_body => post_body, :req => env[:req] })\n end", "def post(uri, query = {}, &block)\n request(:post, uri, query, &block)\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post(path, options = {})\n request(:post, path, options)\n end" ]
[ "0.7268376", "0.717251", "0.7144611", "0.7091272", "0.7091272", "0.7091272", "0.7076556", "0.7053185", "0.7053185", "0.7053185", "0.7053185", "0.7053185", "0.69848996", "0.68877596", "0.68677187", "0.6861362", "0.68173164", "0.67491925", "0.6692912", "0.6691374", "0.6682392", "0.6666448", "0.6629078", "0.65932524", "0.65779537", "0.65660685", "0.6545122", "0.6532531", "0.65313464", "0.6508402", "0.6508402", "0.6508402", "0.6508402", "0.64758295", "0.644721", "0.644721", "0.64452547", "0.64142907", "0.6392913", "0.6371827", "0.63122183", "0.62893176", "0.62865853", "0.62168777", "0.6206739", "0.6187216", "0.6177948", "0.61508256", "0.61451846", "0.6139901", "0.61153233", "0.60923254", "0.60729074", "0.60693043", "0.60349643", "0.6034471", "0.60153127", "0.59681183", "0.5940022", "0.59383816", "0.5922528", "0.5910065", "0.5909203", "0.59086025", "0.59005547", "0.58846605", "0.58727133", "0.58605176", "0.58538955", "0.5848335", "0.5836035", "0.58185375", "0.58113927", "0.58100647", "0.5802823", "0.58023006", "0.57798487", "0.57717466", "0.57476413", "0.5735194", "0.57109565", "0.57084525", "0.57025176", "0.57011133", "0.5694062", "0.56852", "0.5684756", "0.5676955", "0.567652", "0.56743133", "0.5646288", "0.5646122", "0.56296515", "0.56296515", "0.56296515", "0.56244123", "0.56146526", "0.5607778", "0.560546", "0.560546" ]
0.7627235
0
An HTTP PUT request that operates through the router. ==== Parameters path:: The path that should go to the router as the request uri. params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see fake_request). &blk:: The controller is yielded to the block provided for actions prior to the action being dispatched.
def put(path, params = {}, env = {}, &block) env[:request_method] = "PUT" mock_request(path, params, env, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(path, params)\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put_request(path, params={}, options={})\n request(:put, path, params, options)\n end", "def put(path, params={})\n RestClient.put request_base+path, params\n end", "def put(path, &block)\n route 'PUT', path, &block\n end", "def put(path, params)\n parse_response @client[path].put(params)\n end", "def put(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('put')\n end\n end", "def put(path, params={}) # :nodoc:\n handle_response(@session.put(path, MultiJson.dump(params)))\n end", "def put(path, opts = {}, &block)\n request(:put, path, opts, &block)\n end", "def put(path, opts = {}, &block)\n request(:put, path, opts, &block)\n end", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "def put(path, parameters = {})\n request(:put, path, parameters)\n end", "def put(path, to: nil, as: nil, **constraints, &blk)\n add_route(::Rack::PUT, path, to, as, constraints, &blk)\n end", "def put(path, body = '', headers = {})\n with_auth { request(:put, path, body.to_s, build_request_headers(headers, :put, build_uri(path))) }\n end", "def put(path, headers = {})\n process :put, path, headers\n end", "def put(path = '/files/', params = {})\n request :put, path, params\n end", "def put(path, params={}, options={})\n request(:put, api_path(path), params, options)\n end", "def put(path, payload)\n req = Net::HTTP::Put.new(path)\n action(req, payload)\n end", "def put(path, headers: {}, query: {}, payload: {})\n (headers, query, payload) = preprocess(headers, query, payload)\n respond_with super(path, headers: headers, query: query, payload: payload)\n end", "def put(path, opts = {})\n request(:put, path, opts).body\n end", "def put(path, body_params = {})\n debug_log \"PUT #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def put(path, data, params = {}, request_options = {})\n request(:put, path, data, params)\n end", "def put(path, options={})\n request :put, path, options\n end", "def multipart_put(path, params = {}, env = {}, &block)\n env[:request_method] = \"PUT\"\n env[:test_with_multipart] = true\n mock_request(path, params, env, &block)\n end", "def put(path, *data, &block)\n map(path, R3::PUT, *data, &block)\n end", "def update(params = {})\n raise \"Can't update a resource without a REST Client\" unless @client\n yield params if block_given?\n set_up_properties_from(@client.put(@path, params))\n self\n end", "def put(uri, request_headers, body)\n request('put', uri, request_headers, body) do |response_status_code, response_headers, response_body|\n yield response_status_code, response_headers, response_body\n end\n end", "def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end", "def put(uri, params = {})\n send_request(uri, :put, params)\n end", "def put(path, body: {}, headers: nil)\n response = conn.put do |req|\n build_request(req, path: path, body: body, headers: headers)\n end\n puts response.body\n response.body unless response.blank?\n end", "def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def put(*args)\n request :put, *args\n end", "def put(path_part, payload, additional_headers = {}, &block)\n api_request { @rest.put('/REST/' + path_part, payload.to_json, additional_headers, &block) }\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def put(path: nil, payload:, headers: {}, query: {}, auth_method: nil)\n execute(\n method: :put,\n path: path,\n headers: headers,\n query: query,\n payload: payload,\n auth_method: auth_method\n )\n end", "def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def put(path, data={})\n request(:put, path, data)\n end", "def put(path, options = {})\n request(:put, parse_query_and_convenience_headers(path, options))\n end", "def put(uri, request_headers, body)\n request('put', uri, request_headers, body)\n end", "def put(path, data=nil)\n request(:put, path, data)\n end", "def put(resource_path, body:, headers: {}, prefix: API_PREFIX)\n request(method: :put, resource_path: resource_path, headers: headers, body: body, prefix: prefix)\n end", "def put!\n request! :put\n end", "def put(*args)\n request(:put, *args)\n end", "def put(request)\n request.method = :put\n request.call\n end", "def raw_put(path, body, options = {})\n # Allow format override\n format = options.delete(:format) || @format\n # Clear cache\n expire_matching \"#{parent_path(path)}.*\"\n # Create PUT request\n put = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", \n :verbose => DEBUG,\n :method => \"put\",\n :body => body,\n :headers => { :'Content-type' => options[:content_type] || content_type(format) }\n )\n # Send request\n do_request(put, format)\n end", "def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end", "def put(path, options={})\n send_request 'put', path, options\n end", "def put(path, options = {}, raw = false)\n request(:put, path, options, raw)\n end", "def put(body = nil, headers = {}, path = '')\n uri = URI.parse(\"#{@url}#{path}\")\n request = Net::HTTP::Put.new(uri.request_uri)\n request.body = body\n send_request(uri, request, headers)\n end", "def perform_put(path, options = {})\n perform_request(:put, path, options)\n end", "def update(path)\n output { patch(path, params) }\n end", "def put(path, options={}, raw=false)\n request(:put, path, options, raw)\n end", "def put(path, data = {})\n # Allow format override\n format = data.delete(:format) || @format\n # Clear cache\n expire_matching \"#{parent_path(path)}.*\"\n # Extract return unit params\n query_params = {}\n query_params[:returnUnit] = data.delete(:returnUnit) if data[:returnUnit]\n query_params[:returnPerUnit] = data.delete(:returnPerUnit) if data[:returnPerUnit]\n # Create PUT request\n put_params = {\n :verbose => DEBUG,\n :method => \"put\",\n :body => form_encode(data)\n }\n put_params[:params] = query_params unless query_params.empty?\n put = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", put_params)\n # Send request\n do_request(put, format)\n end", "def request_put(path)\n\ttimestamp = Time.now.utc.iso8601\n\tauth = create_hmac_auth(\"PUT\", path, timestamp)\n\t\n\turi = URI($baseUrl + path)\n\n\trequest = Net::HTTP::Put.new(uri)\n\trequest.add_field(\"x-hp-hmac-authentication\", auth)\n\trequest.add_field(\"x-hp-hmac-date\", timestamp)\n\n\tresponse = Net::HTTP.start(uri.host, uri.port,\n\t\t:use_ssl => uri.scheme == 'https',\n\t\t:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n\t\thttp.request(request)\n\tend\n\n\treturn response\nend", "def put method, params={}\n Request.new(self, :put, method, params)\n end", "def put(params)\n self.class.put(url, body: params)\n end", "def put(params)\n bucket = params[:bucket]\n object = params[:object]\n value = params[:value]\n content_type = params[:content_type]\n cb = params[:cb]\n date = generate_date\n sign_string = generate_signed_string('PUT', 'private', bucket, object, content_type)\n signature = generate_signature(sign_string)\n auth = generate_auth(signature)\n headers = generate_put_headers(date, auth, 'private', content_type, value.size)\n path = \"/\" << object\n\n @req_options = {:method => :put, :head => headers, :path => path, :body => value}\n @cb = cb if cb\n @bucket = bucket\n try_request\n self\n end", "def do_put(uri = '', body = '')\n build_request(:put, uri, body)\n end", "def puts_to(path,params,opts={},&block) #:nodoc: \n crud_to(:put,path,params,opts,&block)\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def put(path, options = {}, &block)\n map(path, options, :put, &block)\n end", "def put(path, request_options = {}, resource_options = {})\n response(:put, resource(resource_options)[path], request_options)\n end", "def http_put(url, params, &request_modifier)\n uri = URI.parse url\n req = Net::HTTP::Put.new uri.path\n req.set_form_data(params)\n request_modifier && (request_modifier.call req)\n\n session = (Net::HTTP.new uri.host, uri.port)\n case res = session.start { |http| http.request req }\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n else\n res.error!\n end\n end", "def put(path, options={}, format=format)\n request(:put, path, options, format)\n end", "def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end", "def put(path, args={})\n inject_token_auth_headers!(args)\n response = self.class.put(request_url(path), args)\n update_token_auth_headers(response)\n return response\n end", "def put(url, body = {})\n call(url: url, action: :put, body: body)\n end", "def put(uri, request_headers, body)\n raise NotImplementedError\n end", "def put(*args)\n request, adapter = request_and_adapter_from(args)\n\n with_adapter :put, request, adapter do |adapter|\n yield adapter.client if block_given?\n adapter.put request\n end\n end", "def put url, body, headers = {}\n http_request(url, Net::HTTP::Put, body, headers)\n end", "def put(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.put(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "def put(*args)\n request, adapter = request_and_adapter_from(args)\n \n with request, adapter do |adapter|\n yield adapter.client if block_given?\n adapter.put request\n end\n end", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def put(resource, body = \"\", headers = {})\n prepare_request(:put, resource, body, headers)\n end", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def put(body = '', headers = {}, parameters = {}, &block)\n build_put(body, headers, parameters, &block).invoke\n end", "def put(url, vars={})\n send_request url, vars, 'PUT'\n end", "def put(action, params={}, options={})\n request(:put, action, params, options)\n end", "def put(request)\n _request(request) { |client, options| client.put options }\n end", "def put(path, **args); end", "def put url, object = nil\n request url, HTTP::Put, object\n end", "def put(path, data = {})\n self.class.put path, :body => data.merge(:u => access_token)\n end", "def assert_puts(api_path, payload = nil, type = nil, &block)\n headers = DEFAULT_HEADERS.merge(extra_headers(payload, type))\n payload = 'null' if payload.nil?\n stub_request(:put, uri(api_path))\n .with(body: payload, headers: headers)\n .to_return(body: dummy_response, status: 200)\n yield block\n assert_requested(:put, uri(api_path), headers: headers)\n WebMock.reset!\n end", "def put(request)\n do_request(request) { |client| client.http_put request.body }\n end" ]
[ "0.7292966", "0.720389", "0.720389", "0.71866405", "0.7182192", "0.7182192", "0.7182192", "0.71755654", "0.71755654", "0.71755654", "0.71755654", "0.71755654", "0.71755654", "0.71755654", "0.71755654", "0.70728683", "0.70458686", "0.70229304", "0.6838001", "0.6824489", "0.6657714", "0.65832144", "0.65832144", "0.6554027", "0.65461856", "0.65177983", "0.6509304", "0.6486904", "0.64859265", "0.6480288", "0.63957286", "0.63444906", "0.63173544", "0.63112384", "0.6296739", "0.6277708", "0.6268287", "0.6264498", "0.62556237", "0.62465256", "0.62330115", "0.6225953", "0.6192318", "0.6179578", "0.6148714", "0.6148714", "0.613151", "0.611088", "0.6108096", "0.6108096", "0.61071783", "0.6081615", "0.60749215", "0.6067069", "0.6059134", "0.60536647", "0.60467553", "0.6042107", "0.60221195", "0.6012536", "0.6008129", "0.599082", "0.5975955", "0.59639895", "0.5943162", "0.59324414", "0.5922146", "0.5904702", "0.59030026", "0.5900847", "0.5899425", "0.58935606", "0.5879081", "0.5877941", "0.5868953", "0.5866137", "0.58433", "0.5838107", "0.58328766", "0.581044", "0.5809263", "0.5789748", "0.57783484", "0.5774502", "0.5709159", "0.57025987", "0.5700183", "0.5677347", "0.5668839", "0.56687766", "0.5668561", "0.56640863", "0.56515825", "0.56484634", "0.5641339", "0.56290925", "0.56239027", "0.5601606", "0.5595126", "0.55922526" ]
0.78555846
0
An HTTP DELETE request that operates through the router ==== Parameters path:: The path that should go to the router as the request uri. params:: An optional hash that will end up as params in the controller instance. env:: An optional hash that is passed to the fake request. Any request options should go here (see fake_request). &blk:: The controller is yielded to the block provided for actions prior to the action being dispatched.
def delete(path, params = {}, env = {}, &block) env[:request_method] = "DELETE" mock_request(path, params, env, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(path, params)\n request(:delete, path, {})\n end", "def delete(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('delete')\n end\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end", "def delete(path, params = {}, request_options = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def delete(url = nil, params = nil, headers = nil)\n run_request(:delete, url, nil, headers) { |request|\n # Original line from Faraday::Connection#delete method\n # request.params.update(params) if params\n\n # Monkey patch\n request.body = params if params\n\n yield(request) if block_given?\n }\n end", "def delete(path, params={}) # :nodoc:\n handle_response(@session.delete(path, MultiJson.dump(params)))\n end", "def delete(path, params={}, args={})\n inject_token_auth_headers!(args)\n response = self.class.delete(request_url(path, params), args)\n update_token_auth_headers(response)\n return response\n end", "def delete(uri, params = {})\n send_request(uri, :delete, params)\n end", "def delete(path)\n request(:delete, path)\n end", "def delete(path)\n request 'DELETE', path\n end", "def delete(params = {})\n Client.current.delete(resource_url, params)\n end", "def delete(path, opts = {}, &block)\n request(:delete, path, opts, &block)\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def do_delete(uri = '')\n build_request(:delete, uri)\n end", "def delete(path)\n request(:delete, path)\n end", "def delete(path, params={}, options={})\n request(:delete, api_path(path), params, options)\n end", "def delete(headers = {}, path = '', parameters = {})\n full_path = [path, URI.encode_www_form(parameters)].join(PARAM_STARTER)\n uri = URI.parse(\"#{@url}#{full_path}\")\n request = Net::HTTP::Delete.new(uri.request_uri)\n request.body = nil\n send_request(uri, request, headers)\n end", "def delete(uri, request_headers)\n request('delete', uri, request_headers) do |response_status_code, response_headers, response_body|\n yield response_status_code, response_headers, response_body\n end\n end", "def delete(path, payload = nil)\n req = Net::HTTP::Delete.new(path)\n action(req, payload)\n end", "def delete(path = '/files/', params = {})\n request :delete, path, params\n end", "def delete\n request(:delete)\n end", "def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end", "def delete(request)\n @connection.delete request.path do |req|\n req.body = request.params\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def rest_delete(path, options={}, &blk)\n delete path do |*args|\n @object = yield(*args) or pass\n @object.destroy\n rest_respond :result => :success\n end\n end", "def rest_delete(path, options={}, &blk)\n delete path do |*args|\n @object = yield(*args) or pass\n @object.destroy\n rest_respond :result => :success\n end\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete!\n request! :delete\n end", "def delete(path, headers = {})\n process :delete, path, headers\n end", "def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def delete(path, to: nil, as: nil, **constraints, &blk)\n add_route(::Rack::DELETE, path, to, as, constraints, &blk)\n end", "def delete(uri, request_headers)\n request('delete', uri, request_headers)\n end", "def delete(uri = nil)\n requestor(Net::HTTP::Delete.new(build_uri(uri)))\n end", "def delete(path, headers = {})\n request(:delete, path, nil, merge_default_headers(headers))\n end", "def delete(path, data={})\n request(:delete, path, data)\n end", "def delete(path, headers: {}, query: {})\n (headers, query) = preprocess(headers, query)\n respond_with super(path, headers: headers, query: query)\n end", "def delete(parameters = {}, headers = {}, &block)\n build_delete(parameters, headers, &block).invoke\n end", "def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end", "def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end", "def delete(path, opts = {})\n request(:delete, path, opts).body\n end", "def delete(path, headers = {})\n with_auth { request(:delete, path, nil, build_request_headers(headers, :delete, build_uri(path))) }\n end", "def delete(relative_path, request_headers, request_parameters, response_type, context)\n connection = @session.connection\n request_parameter_list = request_parameters &&\n request_parameters.to_request_parameters\n uri = to_absolute_uri(relative_path, request_parameter_list)\n request_headers = [] if request_headers.nil?\n add_generic_headers('DELETE', uri, request_headers, context)\n\n response_status_code, response_headers, response_body = nil\n connection.delete(uri, request_headers) do |status_code, headers, content|\n response_status_code = status_code\n response_headers = headers\n response_body = content.read.force_encoding('UTF-8')\n end\n process_response(response_body, response_status_code, response_headers, response_type, relative_path, context)\n end", "def send_delete_request(path)\n response = self.class.delete(path)\n # need auth\n case (response.code)\n when 200\n # just continue\n when 401\n authenticate(response)\n response = self.class.delete(path)\n else\n end\n if response.code != 200 && response.code != 202\n throw \"Could not finish request, status #{response.code}\"\n end\n response\n end", "def delete(*args)\n request(:delete, *args)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def delete(request)\n request.method = :delete\n request.call\n end", "def delete(endpoint, params = {})\n\n path = build_connect_url(endpoint)\n headers = build_headers(endpoint, 'DELETE', params)\n\n log \"DELETE \" + path + \" \" + params.to_s\n log headers.to_s\n\n begin\n response = RestClient::Request.execute(method: :delete, url: path, payload: params.to_json, headers: headers, timeout: 15)\n rescue RestClient::ExceptionWithResponse => e\n log e.http_code.to_s + \" \" + e.response.to_s\n return e.response\n end\n\n log response.code.to_s + \" \" + response.to_s\n\n response\n\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 delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def delete(path: nil, payload: nil, headers: {}, query: {}, auth_method: nil)\n execute(\n method: :delete,\n path: path,\n headers: headers,\n query: query,\n payload: payload,\n auth_method: auth_method\n )\n end", "def delete(path)\n uri = build_uri(path)\n\n request = Net::HTTP::Delete.new(uri.request_uri)\n set_authorisation_header(request)\n\n response = https_client(uri).request(request)\n end", "def fire_delete(url_or_path, options = {}, &block)\n params = options.fetch(:params, {})\n params.merge!(mapped_params(options))\n\n url = absolute_url(url_or_path, params: params)\n headers = {:Accept => MEDIA_TYPE_JSON}.merge(options.fetch(:headers, {}))\n headers = merge_log_weasel_header(headers)\n timeout = options.fetch(:timeout, Ladon.default_request_timeout)\n response = Typhoeus::Request.delete(url, headers: headers, timeout: timeout)\n handle_response(response, method: :delete, default_data: options[:default_data], url: url,\n raise_on_error: options[:raise_on_error], &block)\n end", "def delete(request_opts = {})\n store_result(http(request_opts).delete(resolved_path))\n end", "def delete(path_part, additional_headers = {}, &block)\n api_request { @rest.delete('/REST/' + path_part, \"\", additional_headers, &block) }\n end", "def delete(uri, request_headers)\n raise NotImplementedError\n end", "def destroy(params = {})\n client.delete(\"#{endpoint(params)}/#{attributes[:id]}\")\n end", "def delete(path, accept, content = {})\n execute HttpConnect::HttpDelete.new(path, nil, accept, content)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete(uri, parameters)\n response = Unirest.delete uri, parameters: parameters\n response.body\n end", "def delete(payload = {})\n request! do\n options = {payload: to_payload(payload)}\n api(options)[url.path].delete(API_HEADERS)\n end\n end", "def delete(uri)\r\n request(Net::HTTP::Delete.new(uri)) \r\n end", "def http_delete(path, headers = {})\n clear_response\n path = process_path(path)\n @success_code = 204\n @response = http.delete(path, headers)\n parse_response? ? parsed_response : response.body\n end", "def delete(payload)\n post_like payload, Net::HTTP::Delete.new(@uri.path)\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n head :no_content\n end", "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "def delete(request)\n do_request(request) { |client| client.http_delete }\n end", "def delete(path, headers: {}, query: {})\n headers = @default_headers.merge(headers)\n\n response = @http.delete(full_path(path, query: query), headers)\n ensure_success!(response)\n parse_response(response)\n end", "def delete_via_redirect(path, parameters = {}, headers = {})\n delete path, parameters, headers\n follow_redirect! while redirect?\n status\n end", "def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end" ]
[ "0.74507517", "0.7417788", "0.73641765", "0.73641765", "0.73448855", "0.7332574", "0.7332574", "0.7332574", "0.73173976", "0.73173976", "0.73173976", "0.73173976", "0.73173976", "0.73173976", "0.73173976", "0.7291985", "0.72366655", "0.720572", "0.719558", "0.7047115", "0.6992058", "0.69606376", "0.6874287", "0.6859151", "0.68156797", "0.68133545", "0.67791283", "0.6777974", "0.672887", "0.6708381", "0.6677902", "0.6669884", "0.66436976", "0.66384387", "0.66305405", "0.6626145", "0.65388495", "0.65330154", "0.6522049", "0.6510201", "0.65016836", "0.6498355", "0.6497133", "0.64969516", "0.6469932", "0.6454718", "0.6438585", "0.6378334", "0.6367108", "0.63618267", "0.6353548", "0.63489187", "0.6345336", "0.63132364", "0.6310167", "0.63068455", "0.6286916", "0.6278108", "0.62733305", "0.6269384", "0.6269384", "0.6268332", "0.6256053", "0.62426823", "0.62387913", "0.62302923", "0.6225126", "0.6225126", "0.6214363", "0.6214363", "0.6214363", "0.6214363", "0.6204166", "0.6203753", "0.620068", "0.6196121", "0.61743724", "0.61706144", "0.6170149", "0.61693835", "0.6164459", "0.61615896", "0.61415255", "0.61360663", "0.6124967", "0.6112302", "0.6109589", "0.6109589", "0.610881", "0.6107852", "0.61008257", "0.60806847", "0.6074505", "0.6071537", "0.6065339", "0.6064561", "0.60645163", "0.60401464", "0.6035079", "0.60255235" ]
0.7987581
0
The workhorse for the dispatchto helpers. ==== Parameters request:: A request object that has been setup for testing. controller_klass:: The class object off the controller to dispatch the action to. action:: The action to dispatch the request to. &blk:: The controller is yielded to the block provided for actions prior to the action being dispatched. ==== Returns An instance of +controller_klass+ based on the parameters. ==== Notes Does not use routes.
def dispatch_request(request, controller_klass, action, &blk) controller = controller_klass.new(request) yield controller if block_given? controller._dispatch(action) Merb.logger.info controller._benchmarks.inspect Merb.logger.flush controller end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch_to(controller_klass, action, params = {}, env = {}, &blk)\n params = merge_controller_and_action(controller_klass, action, params)\n dispatch_request(build_request(params, env), controller_klass, action.to_s, &blk)\n end", "def dispatch_action(klass, action, request, response, status=200)\n # build controller\n controller = klass.build(request, response, status)\n # complete setup benchmarking\n #controller._benchmarks[:setup_time] = Time.now - start\n if @@use_mutex\n @@mutex.synchronize { controller.dispatch(action) }\n else\n controller.dispatch(action)\n end\n [controller, action]\n end", "def call(controller, action)\n lambda {\n controller = Object.const_get(controller)\n action ||= Configuration::Base.app.default_action\n\n instance = controller.new\n request.controller = instance\n request.action = action\n\n instance.send(action)\n }\n end", "def dispatch_action(req)\n controller = ROUTE_TO_CONTROLLER[req.path_info]\n raise Heartcheck::Errors::RoutingError if controller.nil?\n\n Logger.info \"Start [#{controller}] from #{req.ip} at #{Time.now}\"\n\n controller.new.index.tap do |_|\n Logger.info \"End [#{controller}]\\n\"\n end\n end", "def create_controller(ctrl_action)\n ctrl_name, action_name = ctrl_action.split('#')\n klass = Object.const_get \"#{ctrl_name.capitalize}Controller\"\n klass.new(name: ctrl_name, action: action_name.to_sym, request: request)\n end", "def requestAction(controller,action,params={})\n controller.class_eval{\n def params=(params); @params = params end\n def params; @params end\n }\n c = controller.new\n c.request = @_request\n c.response = @_response\n c.params = params\n c.send(action)\n c.response.body\n end", "def route(controller, action, **args)\n klass = Object.const_get(klass_for(controller)).new(**args)\n klass.send(action)\n end", "def route(controller, action, **args)\n klass = Object.const_get(klass_for(controller)).new(**args)\n klass.send(action)\n end", "def route(controller, action, **args)\n klass = Object.const_get(klass_for(controller)).new(**args)\n klass.send(action)\n end", "def dispatch_multipart_to(controller_klass, action, params = {}, env = {}, &blk)\n request = multipart_fake_request(env, params)\n dispatch_request(request, controller_klass, action, &blk)\n end", "def _dispatch(action)\n _run_filters(:before, action)\n response = send(action)\n _run_filters(:after, action)\n response\n end", "def touch_controller(klass)\n klass.controller_class\n end", "def dispatch(request)\n # {{{\n benchmark_start_time = Time.now \n\n params = Aurita::Attributes.new(request)\n params[:_request] = request\n params[:_session] = Aurita::Session.new(request)\n params[:_logger] = @logger\n params[:_application] = @application\n status = 200\n response_body = ''\n response_header = {}\n\n controller = params[:controller]\n action = params[:action]\n mode = params[:mode]\n controller ||= 'App_Main'\n action ||= 'start'\n mode ||= 'default'\n\n Thread.current['request'] = params\n\n Lore::Connection.reset_query_count()\n Lore::Connection.reset_result_row_count()\n\n begin\n raise ::Exception.new('No controller given') if(controller.nil? || controller == '') \n\n model_klass = @application.get_model_klass(controller)\n controller_klass = @application.get_controller_klass(controller)\n\n raise ::Exception.new('Unknown controller: ' << controller.inspect) unless controller_klass\n \n controller_instance = controller_klass.new(params, model_klass)\n\n response = false\n @logger.debug(\"Calling model interface method #{controller}.#{action}\")\n\n element = controller_instance.call_guarded(action)\n response = controller_instance.response\n if response[:html] == '' then\n if element.is_a?(Aurita::GUI::XML::Document) then\n # Don't use default decorator for XML documents: \n response[:mode] = :none if (!response[:mode] || response[:mode] == :default)\n response[:html] = element.string \n elsif element.respond_to?(:string) then\n # Response is an instance of Aurita::GUI::Element\n response[:html] = element.string \n response[:script] << element.script if element.respond_to?(:script) && element.script\n elsif element.is_a?(Array) then\n element.each { |e|\n response[:html] << e.to_s\n }\n end\n end\n\n response_header.update(response[:http_header]) if response[:http_header]\n if response_header['status_code'] then\n status = response_header['status_code'].to_i \n response_header.delete('status_code')\n end\n\n mode = response[:mode].to_sym if response && response[:mode]\n mode ||= :default \n response[:mode] = mode\n params[:_controller] = controller_instance\n\n response_body = @decorator.render(model_klass, response, params)\n\n @num_dispatches += 1\n\n @benchmark_time = Time.now-benchmark_start_time\n @num_queries = Lore::Connection.query_count\n @num_tuples = Lore::Connection.result_row_count\n Aurita::Plugin_Register.call(Hook.dispatcher.request_finished, \n controller_instance, \n :dispatcher => self, \n :controller => controller_instance, \n :action => action, \n :time => @benchmark_time, \n :num_queries => @num_queries, \n :num_tuples => @num_tuples)\n @logger.debug(\"Num queries: #{@num_queries}\")\n rescue Exception => excep\n @logger.error(excep.message)\n @logger.error(excep.backtrace.join(\"\\n\"))\n response_body = GUI::Error_Page.new(excep).string\n response_body = ''\n end\n\n return [ status, response_header, response_body ]\n end", "def dispatch action\n @action = action\n\n invoke do\n filter(*before_filters_for(action))\n args = action_arguments action\n __send__(action, *args)\n end\n\n rescue => err\n invoke{ handle_error err }\n ensure\n filter(*after_filters_for(action))\n end", "def klass_from_controller(c = controller_name)\n c.singularize.camelize.constantize\n end", "def controller(&block)\n @config.controller.class_exec(&block) if block_given?\n @config.controller\n end", "def call_action action=nil\n action ||= @action\n invoke{ dispatch action }\n invoke{ handle_status(@response.status) }\n content_type self.class.content_type unless @response[CNT_TYPE]\n @response.finish\n end", "def make_controller(klass)\n @controller = eval(\"#{klass.to_s.camelize}Controller\").new\n end", "def controller(path)\n controller_name.constantize.new(controller_name, action_name,\n get_params(path))\n end", "def dispatch_action(request)\n method = request_method(request)\n path = request.path.sub(/\\.\\w+$/, '')\n route = @routing.detect { |r| r[0] == method && r[1] == path }\n route[2] if route\n end", "def route_to(klass_or_name, action)\n RouteToMatcher.new(klass_or_name, action)\n end", "def controller_action\n @controller_action ||= [controller.controller_name, controller.action_name].join('/')\n end", "def handle(action, request)\n request.error(404) unless only.include?(action)\n protect!(request) if protect.include?(action)\n \n log_with_benchmark(request, action) do\n instance_exec(request, &self.class.actions[action][:fn])\n end\n end", "def use_custom_controller(controller, &block)\n old_controller = self.class.controller_class\n begin\n self.class.controller_class = controller\n yield\n ensure\n self.class.controller_class = old_controller\n end\n end", "def controller_class\n @controller_class ||= @controller&.class || self.class.class_for(@key)\n end", "def getKlass #:doc:\n @Klass = self.controller_name.classify.constantize\n @Klass\n end", "def service(request, response)\n params = @router.resolve_uri(request.request_uri)\n controller = Acoustic::Controller.from_symbol(params[:controller])\n action = params[:action]\n controller.process(action, params, request, response)\n rescue Acoustic::UnresolvableUri, Acoustic::ControllerNameError\n raise Acoustic::NotFound.new(request.request_uri)\n end", "def renderActionInOtherController(controller,action,params)\n # controller.class_eval{\n # def params=(params); @params = params end\n # def params; @params end\n # }\n c = controller.new\n c.request = @_request\n c.response = @_response\n c.params = params\n c.send(action)\n c.response.body\n end", "def controller\n @controller ||= controller_name.constantize\n end", "def run(req, res)\n if matches?(req)\n controller = @controller_class.new(req, res)\n controller.send(@action_name)\n end\n end", "def call_action(handler, params, query_params)\n controller_name, action_name = handler.split('#')\n controller_class = lookup_controller(controller_name)\n controller = controller_class.new(self, params, query_params)\n controller.execute_action(action_name)\n end", "def make_request(action, params = {})\n path = params[:path] || \"/\"\n method = params[:method] || \"post\"\n env = Rack::MockRequest.env_for(path, params: params.except(:path).except(:method), method: method)\n status, headers, body = described_class.action(action).call(env)\n @response = ActionDispatch::TestResponse.new(status, headers, body)\n @controller = body.instance_variable_get(:@response).request.env['action_controller.instance']\nend", "def controller(controller); end", "def action(name, &blk)\n name = name.to_s\n\n klass = Class.new do\n def initialize(action, name)\n @action, @name = action, name\n end\n\n def control_flow(sym, name, mods, options={})\n @action.control_flow(sym, name, mods, options.merge({action: @name}))\n end\n\n def data_flow(sym, name, mods, options={})\n @action.data_flow(sym, name, mods, options.merge({action: @name}))\n end\n\n def flyweight(sym, name, mods, options={})\n @action.flyweight(sym, name, mods, options.merge({action: @name}))\n end\n\n def action(name, &blk)\n @action.action(\"#{@name}:#{name}\", &blk)\n end\n end\n\n blk.call klass.new(self, name)\n end", "def with_controller(controller_class, &block)\n old_controller = @controller\n @controller = controller_class.new\n rc = yield(controller_class)\n @controller = old_controller\n rc\n end", "def action(klass)\n def_delegator :default, klass.action_name\n define_method klass.action_name do |*args, &block|\n new_action = klass.new self, action\n directives.values.each {|it| it.setup! new_action }\n new_action.setup! *args, &block\n new_action.new_flow\n end\n end", "def controller_class; end", "def controller_class; end", "def klass_for(controller)\n if registered?(controller) && klass_defined?(controller)\n storage[controller][:klass]\n\n else\n raise Vedeu::Error::MissingRequired,\n \"Cannot route to #{controller} as no class defined.\"\n\n end\n end", "def _rails_controller_instance\n controller = rails_controller.new\n rails_request = ActionDispatch::Request.new(scope.env)\n\n prepare_rails_controller(controller, rails_request)\n\n controller\n end", "def handle(http_request, response)\n start = Time.now\n request = Merb::Request.new(http_request)\n Merb.logger.info(\"Params: #{request.params.inspect}\")\n Merb.logger.info(\"Cookies: #{request.cookies.inspect}\")\n # user friendly error messages\n if request.route_params.empty?\n raise ControllerExceptions::BadRequest, \"No routes match the request\"\n elsif request.controller_name.nil?\n raise ControllerExceptions::BadRequest, \"Route matched, but route did not specify a controller\" \n end\n Merb.logger.debug(\"Routed to: #{request.route_params.inspect}\")\n # set controller class and the action to call\n klass = request.controller_class\n dispatch_action(klass, request.action, request, response)\n rescue => exception\n Merb.logger.error(Merb.exception(exception))\n exception = controller_exception(exception)\n dispatch_exception(request, response, exception)\n end", "def spiced_controller(route, path) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/LineLength\n Class.new(route.controller).tap do |klass| # rubocop:disable Metrics/BlockLength, Metrics/LineLength\n klass.include(Helpers::AppHelper.new(app))\n klass.include(Helpers::AssetsHelper)\n klass.include(Helpers::RenderHelper)\n klass.include(Helpers::TagHelper)\n\n # include global ApplicationHelper if possible\n begin\n klass.include(ApplicationHelper)\n rescue NameError # rubocop:disable Lint/HandleExceptions\n # we don't have a global ApplicationHelper... which is fine\n end\n\n # find a controller-specific helper class and include it if we can\n begin\n helper = Kernel.const_get(\"#{route.base_name}_helper\".camelize)\n klass.include(helper)\n rescue NameError # rubocop:disable Lint/HandleExceptions\n # same difference\n end\n\n klass.define_method(:params) do\n route.params\n end\n\n klass.define_method(:current_path) do\n path\n end\n\n klass.define_method(:current_controller_name) do\n route.base_name\n end\n\n klass.define_method(:inspect) do |*args|\n # report that we are actually the controller, not some random\n # anonymous class\n # append a + to it to indicate that it's different than an ordinary\n # class instance\n super(*args).sub(/#<Class:[^>]+>/, \"#{route.controller}+\")\n end\n\n klass.define_singleton_method(:inspect) do\n # for .ancestors to show up correctly\n \"#{route.controller}+\"\n end\n\n klass.define_method(:to_s) do |*args|\n # irb uses this method for displaying in the prompt\n super(*args).sub(/#<Class:[^>]+>/, \"#{route.controller}+\")\n end\n\n # inject filters\n route.controller.public_instance_methods(false).each do |method|\n klass.define_method(method) do |*args|\n # @__before_actions is set on the original class -- use it from\n # that one\n route.controller.instance_variable_get(:@__before_actions)&.each do |action| # rubocop:disable Metrics/LineLength\n send(action)\n end\n super(*args)\n end\n end\n end\n end", "def switch_to_controller\n unless ( name = (path_matcher.view_name || path_matcher.model_name) )\n return\n end\n\n action = nil\n \tif path_matcher.is_view?\n \t action = File.basename(file_path).split(\".\").first\n else\n \t name = name.pluralize\n end\n\n controller = \"/app/controllers/#{name}_controller.rb\"\n\n if action\n goto_definition controller, \"def #{action}\"\n else\n open_file controller\n end\n end", "def dispatch!\n if response.nil?\n raise Wirecard::Elastic::Error, \"The request failed.\"\n else\n Wirecard::Elastic::Response.const_get(action.capitalize).new(request, response)\n end\n end", "def get_action(obj, klass, name)\n\t\t# expects names as standard symbols, rather than in constant-symbol format\n\t\t# ex) expected - :move_over_there\n\t\t# rather than - :MoveOverThere\n\t\t\n\t\t# NOTE: I think this is a cleaner interface, but it requires a bunch of string manipulation. As this is something that needs to be called very often, it may become a major source of latency.\n\t\t# The weird part is really that you're using symbols in a not-very-symbol-like way\n\t\t# so the solution may actually be just to use Strings instead\n\t\t# as constant lookup can also be done using strings\n\t\t\n\t\t\n\t\tname_const = name.to_s.constantize\n\t\t# p [klass, name, name_const]\n\t\t\n\t\tbegin\n\t\t\treturn klass::Actions.const_get name_const\n\t\trescue NameError => e\n\t\t\t# Traverse the hierarchy to find a class that can yield the desired Action.\n\t\t\t# Mostly, you will traverse the class inheritance hierarchy,\n\t\t\t# but there are some exceptions.\n\t\t\t\n\t\t\tif BASE_CLASSES.include? klass\n\t\t\t\t# you have reached the bottom of the chain,\n\t\t\t\t# the root of the the tree.\n\t\t\t\t# The recursion stops here\n\t\t\t\t\n\t\t\t\t# end of the road:\n\t\t\t\t# this is the base of the entire Action search system.\n\t\t\t\t# If no action has been found by this point, the action is not defined.\n\t\t\t\twarn \"#{obj.class} does not define #{name || '<NIL>'}, nor does it's ancestors\"\n\t\t\t\treturn ThoughtTrace::Actions::NullAction\n\t\t\telse\n\t\t\t\t# trigger recursion to find the Action in question\n\t\t\t\tparent = get_parent(obj, klass)\n\t\t\t\t\n\t\t\t\treturn get_action(obj, parent, name)\n\t\t\tend\n\t\tend\n\tend", "def base_controller_class\n proc_or_string = (@base_controller_class ||= \"::ApplicationController\")\n proc_or_string.respond_to?(:call) ? proc_or_string.call : proc_or_string\n end", "def controller\n @controller ||= ApplicationController.new\n end", "def fill_controller_action_attributes\n return if controller_action.blank?\n route = controller_action.split('#')\n self.controller, self.action = route.first, route.last\n end", "def issue_action\n request.request_parameters['action']\n end", "def _dispatch(action=:index)\n start = Time.now\n if self.class.callable_actions.include?(action.to_s)\n super(action)\n else\n raise ActionNotFound, \"Action '#{action}' was not found in #{self.class}\"\n end\n @_benchmarks[:action_time] = Time.now - start\n end", "def _dispatch(action=:to_s)\n hook :before_dispatch\n self.action_name = action\n \n caught = catch(:halt) do\n start = Time.now\n result = _call_filters(_before_filters.reverse)\n @_benchmarks[:before_filters_time] = Time.now - start if _before_filters\n result\n end\n \n @body = case caught\n when :filter_chain_completed then _call_action(action_name)\n when String then caught\n when nil then _filters_halted\n when Symbol then send(caught)\n when Proc then caught.call(self)\n else\n raise MerbControllerError, \"The before filter chain is broken dude. wtf?\"\n end\n start = Time.now\n _call_filters(_after_filters) \n @_benchmarks[:after_filters_time] = Time.now - start if _after_filters\n hook :after_dispatch\n end", "def controller(name, &block)\n existing = @base.controllers.select { |a| a.name == name }.first\n if existing\n controller = existing\n else\n controller = Moonrope::Controller.new(@base, name)\n @base.controllers << controller\n end\n controller.dsl.instance_eval(&block) if block_given?\n controller\n end", "def request(action = :echo)\n @request = Rack::MockRequest.new(RocketPants::CacheMiddleware.new(controller_class.action(action)))\n end", "def controller_to_get(attribute_name, class_attribute_name = nil)\n class_attribute_name ||= attribute_name\n return ModuleUtils.try_to self.class, class_attribute_name if is_a? ::ActionController::Base # controller?\n\n ModuleUtils.try_to controller, attribute_name # view?\n end", "def perform(action)\n @action_name = action\n begin\n self.send(@action_name)\n rescue\n Skates.logger.error {\n \"#{$!}:\\n#{$!.backtrace.join(\"\\n\")}\"\n }\n end\n self.render\n end", "def controller(controller)\n scenario.controller = controller\n end", "def switch_to_controller\n return unless ( name = path_matcher.functional_name )\n \n controller = \"/app/controllers/#{name}.rb\"\n \n if (test = find_test_under_cursor) \n # remove words from the test name that indicate the test\n # then use the first word as the name of the function/action\n #\n test.sub!(/^should /i, '')\n if test =~ /^(get|post|put|delete) /i\n test.sub!(/^[^\\s]+ /, '')\n end\n \n function = test.split(/\\s/).first\n unless function.nil?\n return goto_definition(controller, function)\n end\n end\n \n open_file controller\n end", "def _call_action(action)\n send(action)\n end", "def controller_with_decorator(action, decorator_class)\n method = action == \"index\" ? :apply_collection_decorator : :apply_decorator\n\n controller_class = Class.new do\n include ActiveAdmin::ResourceController::Decorators\n\n public method\n end\n\n active_admin_config = double(decorator_class: decorator_class)\n\n if action != \"index\"\n form_presenter = double(options: { decorate: !decorator_class.nil? })\n\n allow(active_admin_config).to receive(:get_page_presenter).with(:form).and_return(form_presenter)\n end\n\n controller = controller_class.new\n\n allow(controller).to receive(:active_admin_config).and_return(active_admin_config)\n allow(controller).to receive(:action_name).and_return(action)\n\n controller\n end", "def dispatch_exception(request, response, exception)\n klass = Exceptions rescue Controller\n request.params[:original_params] = request.params.dup rescue {}\n request.params[:original_session] = request.session.dup rescue {}\n request.params[:original_cookies] = request.cookies.dup rescue {}\n request.params[:exception] = exception\n request.params[:action] = exception.name\n dispatch_action(klass, exception.name, request, response, exception.class::STATUS)\n rescue => dispatch_issue\n dispatch_issue = controller_exception(dispatch_issue) \n # when no action/template exist for an exception, or an\n # exception occurs on an InternalServerError the message is\n # rendered as simple text.\n # ControllerExceptions raised from exception actions are \n # dispatched back into the Exceptions controller\n if dispatch_issue.is_a?(ControllerExceptions::NotFound)\n dispatch_default_exception(klass, request, response, exception)\n elsif dispatch_issue.is_a?(ControllerExceptions::InternalServerError)\n dispatch_default_exception(klass, request, response, dispatch_issue)\n else\n exception = dispatch_issue\n retry\n end\n end", "def dispatch(msg)\n ActiveRecord::Base.establish_connection(Serv::Configuration::database_configuration)\n\n msg = JSON.parse(msg)\n \n controller = msg['controller']\n action = msg['action']\n params = msg['params']\n session_id = msg['session_id']\n \n log \"[REQUEST] - [controller: #{controller},\" + \" action: #{action}, \" + \" params: #{params}]\"\n \n if !params.nil?\n args = \"params\"\n else\n args = nil\n end\n \n # Metaprogramming code that will dyamically call the requested controller\n # and method\n result = nil\n eval %Q(\n session = get_session(session_id)\n \n if !session.nil?\n request = #{controller.camelize}Controller.new\n request.instance_variable_set(:@session, session)\n request.instance_variable_set(:@game_mq, @game_mq)\n request.extend(Broker::Commands)\n \n result = if args.nil?\n request.#{action}\n else\n request.#{action}(#{args})\n end\n else\n raise Interrupt\n end\n )\n respond_success(result)\n rescue ArgumentError\n respond_error(Errors::ERR_ARGUMENT_ERROR, $!)\n rescue Interrupt\n respond_error(Errors::ERR_INVALID_SESSION, $!)\n rescue\n respond_error(Errors::ERR_GENERIC, $!)\n ensure\n ActiveRecord::Base.connection.disconnect!\n #ActiveRecord::Base.verify_active_connections!\n end", "def provider(*args, &block)\n super || self.class.action_class\n end", "def run(req, res)\n @params = req.params\n controller_class.send(action_name)\n end", "def run(req, res)\n controller = controller_class.new(req, res, route_params(req))\n controller.invoke_action(action_name)\n end", "def get_controller_and_action env\n path_info = env.fetch \"PATH_INFO\"\n parts = path_info.split \"/\", 4\n\n _, name, action, = parts\n\n controller_name = \"#{name.capitalize}Controller\"\n\n begin\n controller_class = Object.const_get controller_name\n rescue NameError\n raise Rulers::NoSuchController.new name, controller_name, env\n end\n\n controller = controller_class.new env\n\n return controller, action\n end", "def find_object(klass)\n controller_object = controller_session[\"object\"]\n if controller_object.present?\n if controller_object.is_a? ApplicationModel\n return controller_object\n else\n return klass.new(controller_object)\n end\n end\n return nil\n end", "def invoke_action(action, args = {})\n raise ArgumentError, \"Browser.invoke_action expects an ActionController::Action as first parameter\"\\\n unless ::Waw::ActionController::Action===action\n location, response = fetch(relative_uri(action.uri), :post, args)\n apply_action_routing(action, JSON.parse(response.body))\n self.response\n end", "def db_to_controller(db, action = \"show\")\n action = \"x_show\" if @explorer\n case db\n when \"ActionSet\"\n controller = \"miq_action\"\n action = \"show_set\"\n when \"AutomationRequest\", \"MiqProvision\"\n controller = \"miq_request\"\n action = \"show\"\n when \"ConditionSet\"\n controller = \"condition\"\n when \"ManageIQ::Providers::EmbeddedAnsible::AutomationManager::ConfigurationScriptSource\"\n controller = \"ansible_repository\"\n when \"ScanItemSet\"\n controller = \"ops\"\n action = \"ap_show\"\n when \"User\", \"Group\", \"Patch\", \"GuestApplication\"\n controller = \"vm\"\n action = @lastaction\n when \"Host\" && action == 'x_show'\n controller = \"infra_networking\"\n action = @lastaction\n when \"MiqReportResult\"\n if params[:controller] == \"chargeback_report\"\n controller = \"chargeback_report\"\n action = \"show\"\n else\n controller = \"report\"\n action = \"show_saved\"\n end\n when \"MiqSchedule\"\n if request.parameters[\"controller\"] == \"report\"\n controller = \"report\"\n action = \"show_schedule\"\n else\n controller = \"ops\"\n action = \"schedule_show\"\n end\n when \"MiqAeClass\"\n controller = \"miq_ae_class\"\n action = \"show_instances\"\n when \"MiqAeInstance\"\n controller = \"miq_ae_class\"\n action = \"show_details\"\n when \"PlacementGroup\"\n controller = \"placement_group\"\n action = \"show\"\n when \"SecurityGroup\"\n controller = \"security_group\"\n action = \"show\"\n when \"ServiceResource\", \"ServiceTemplate\"\n controller = \"catalog\"\n when \"ManageIQ::Providers::EmbeddedAnsible::AutomationManager::Playbook\"\n controller = \"ansible_playbook\"\n when \"ManageIQ::Providers::EmbeddedAnsible::AutomationManager::Credential\"\n controller = \"ansible_credential\"\n when \"ManageIQ::Providers::Workflows::AutomationManager::Workflow\"\n controller = \"workflow\"\n when \"ManageIQ::Providers::Workflows::AutomationManager::ConfigurationScriptSource\"\n controller = \"workflow_repository\"\n when \"ManageIQ::Providers::Workflows::AutomationManager::Credential\"\n controller = \"workflow_credential\"\n when \"MiqWorker\"\n controller = request.parameters[:controller]\n when \"ManageIQ::Providers::ExternalAutomationManager\", \"OrchestrationStackOutput\", \"OrchestrationStackParameter\", \"OrchestrationStackResource\",\n \"ManageIQ::Providers::CloudManager::OrchestrationStack\",\n \"ManageIQ::Providers::CloudManager::CloudDatabase\",\n \"ManageIQ::Providers::ConfigurationManager\",\n \"ManageIQ::Providers::AnsibleTower::AutomationManager::ConfiguredSystem\",\n \"ManageIQ::Providers::AnsibleTower::AutomationManager::Job\", \"ConfigurationScript\"\n controller = request.parameters[:controller]\n when \"ContainerVolume\"\n controller = \"persistent_volume\"\n when /^ManageIQ::Providers::(\\w+)Manager$/\n controller = \"ems_#{$1.underscore}\"\n when /^ManageIQ::Providers::(\\w+)Manager::(\\w+)$/\n controller = \"#{$2.underscore}_#{$1.underscore}\"\n when \"EmsAutomation\"\n controller = \"ems_automation\"\n when \"GenericObject\" && request.parameters[:controller] == 'service'\n controller = request.parameters[:controller]\n action = 'generic_object'\n else\n controller = db.underscore\n end\n return controller, action\n end", "def run(req, res)\n route_params = self.make_match_hash(req)\n controller = @controller_class.new(req, res, route_params)\n controller.invoke_action(@action_name)\n end", "def to_class(item)\n return item if item.nil? || item.is_a?(Class)\n name = item.is_a?(Symbol) ? item.to_s : item\n name = name.class.to_s unless name.is_a?(String)\n name.underscore.delete_suffix('_controller').classify.safe_constantize or\n Log.warn { \"#{__method__}: invalid: #{item.inspect}\" }\n end", "def mock_action_view(base = MockActionView)\n controller = ActionView::TestCase::TestController.new\n\n base.new(view_paths, {}, controller)\n end", "def set_controller_and_action(to)\n if to\n controller_and_action = to.split \"#\"\n @controller_name = controller_and_action.shift\n @action_name = controller_and_action.shift || \"index\"\n end\n end", "def controller(controller)\n @scope = @scope.new(controller: controller)\n yield\n ensure\n @scope = @scope.parent\n end", "def Controller(matcher)\n make(matcher)\n end", "def perform( action, workitem )\n @action, @workitem = action, workitem\n\n begin\n send( action )\n run_callbacks\n rescue => e\n handle_exception( e )\n end\n end", "def rails_controller_eval(&block)\n rails_controller_instance.instance_exec(&block)\n end", "def thing\n controller_name.classify.constantize\n end", "def with_fixtured_action( action=nil, *args, &block )\n\t\t@action = action\n\t\ttxn, req, vargs, *args = setup_fixtured_request( action, *args )\n\t\t\n\t\tif block.arity == 3\n\t\t\tblock.call( txn, req, vargs )\n\t\telse\n\t\t\tblock.call( txn, req )\n\t\tend\n\t\t\n\t\treturn @applet.run( txn, action.to_s, *args )\n\tensure\n\t\t@action = nil\n\tend", "def controller_for(resource)\n return resource if resource.is_a?(Class) && resource.ancestors.include?(ActionController::Base)\n \"#{resource.to_s.underscore}_controller\".classify.constantize\n rescue NameError\n raise ResourceFull::ResourceNotFound, \"not found: #{resource}\"\n end", "def instantiate_controller_and_action_names\n @current_action = action_name\n @current_controller = controller_name\n end", "def instantiate_controller_and_action_names\n @current_action = action_name\n @current_controller = controller_name\n end", "def instantiate_controller_and_action_names\n @current_action = action_name\n @current_controller = controller_name\n end", "def instantiate_controller_and_action_names\n @current_action = action_name\n @current_controller = controller_name\n end", "def controller\n @params['controller'] || @params[:controller]\n end", "def controller(controller)\n self.class.new(routes: @routes.select { |rt| rt.url_details[:controller] == controller.to_s })\n end", "def controller_instance(controller_class)\n # ensure protocol compliance\n unless controller_class.method_defined?(:call) \\\n && controller_class.instance_method(:call).arity == 2\n return\n end\n controller = controller_class.new\n controller.kenji = self if controller.respond_to?(:kenji=)\n return controller if controller\n nil # default return value\n end", "def perform_action\n action_name = params[:action_name].to_sym\n action = resource.member_actions[action_name]\n if action.is_method_action?\n @record.send(action.method_name)\n end\n if action.is_block_action?\n action.block.call(@record)\n end\n return redirect_to([app_kit, @record])\n end", "def get_controller_for_url_generation(opts)\n controller = opts[:controller] || @web_controller.params[:controller]\n raise \"No Controller Specified for url()\" unless controller\n controller\n end", "def run(request, response)\n\n match_data = @pattern.match(request.path)\n\n route_params = Hash[match_data.names.zip(match_data.captures)]\n\n @controller_class\n .new(request, response, route_params)\n .invoke_action(action_name)\n end", "def get_controller_for_url_generation(opts)\n controller = opts[:controller] || ( @base_controller.params[:controller] if @base_controller)\n raise \"No Controller Specified for url()\" unless controller\n controller\n end", "def make_request(request)\n puts \"\\n\\n\"\n puts \"==> Request, action='#{request.path}', params = #{request.query}...\"\n\n action = request.path.to_s.split(\"/\")[-1]\n\n if action && @app.valid?(action) then\n response = @app.send(action.to_sym, request.query)\n\n return response\n end\n\n return \"Error: Unrecognised action: #{action}\"\n rescue Exception => e\n $stderr.puts \"*** [E]: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n return \"Error: #{e}\"\n end", "def initialize(controller)\n @controller = controller\n @actions = []\n end", "def controller_action_defined?(controller, action)\n controller_obj = \"#{controller}_controller\".camelize.constantize.new\n controller_obj.respond_to? action.to_s\n end", "def controller_action_defined?(controller, action)\n controller_obj = \"#{controller}_controller\".camelize.constantize.new\n controller_obj.respond_to? action.to_s\n end", "def run(req, res)\n if matches?(req)\n controller_instance = controller_class.new(req, res, route_params(req))\n controller_instance.invoke_action(action_name)\n else\n # extra precaution! won't be hit if `Router#run` is used\n res.status = 404\n res.write(\"No route matches for #{http_method} on #{controller_class}\")\n end\n end", "def get_controller_for_url_generation(opts)\n controller = opts[:controller] || @web_controller.params[:controller]\n raise \"No Controller Specified for url()\" unless controller\n controller\n end", "def perform(action)\n case action\n when :index, :new then get action\n when :show, :edit then get action, id: 1\n when :update then put :update, id: 1\n when :create then post :create\n when :destroy then delete :destroy, id: 1\n end\n end", "def render_action(attrs)\n controller_name = attrs[:controller] || self.controller_class.controller_name\n action_name = attrs[:action]\n @controller.action_name = action_name\n prepare_data\n self.instance_variables.collect{|v| @assigns[v[1..-1]] = self.instance_eval(\"#{v}\")}\n render_opts = {:file => \"#{controller_name}/#{action_name}\"}\n render_opts[:layout] = \"layouts/\" + (attrs[:layout] || 'application')\n\n view_html = @view.render(render_opts)\n set_response_text(view_html)\n end", "def cms_path_for( object_or_model, action = :index, params = {} )\n\n # first, cast whatever we get to a class + check it’s useful to us\n klass = object_or_model.is_a?( Class ) ? object_or_model : object_or_model.class\n raise TypeError.new( 'object_or_model must be either an instance of-, or a class extending ActiveRecord::Base' ) unless klass < ActiveRecord::Base\n\n # now get a class name for pathing purposes\n klass_name = klass.to_s.underscore.pluralize.downcase\n\n # load some routes if we’ve not already done so\n load_routes if routes.nil?\n\n # work out the context we’re currently in + append what we think we’re after\n context_stack = Rails.application.routes.recognize_path( request.path, method: request.env['REQUEST_METHOD'] )[:controller].split( '/' )\n context_stack = context_stack.map.with_index{ |seg, idx| context_stack.slice( 0, idx + 1 ).join( '/' ) + \"/#{klass_name}\" }\n\n # search for matching routes\n matched = routes.select{ |r| context_stack.include?( r[:controller] ) and r[:action] == action }\n\n # if that didn’t work, look for anything that matches the wider pattern\n if matched.empty?\n\n # remove our class name from the stack\n context_stack.map!{ |c| c.gsub( \"/#{klass_name}\", '' )}\n\n # perform a wider search, grab the longest match\n matched = routes.select{ |r|\n r[:action] == action and\n r[:controller].ends_with?( klass_name ) and\n context_stack.select{ |c| r[:controller].starts_with?( c ) }.any?\n }.sort{ |b, a| a[:name].length <=> b[:name].length }\n\n end\n\n # if we’re still a failure\n raise \"Cannot find action #{action} for model #{klass.to_s}\" if matched.empty?\n\n # construct our parameters (we’ll use the form context for this, as it should contain everything we have)\n context = ( @form_context[1..-1] << object_or_model ).slice( 0, matched.first[:params].length )\n\n # call the appropriate route\n send( \"#{matched.first[:name]}_path\", *context, params )\n\n end", "def receive_action(action)\n self.define_singleton_method(:perform_action, &action)\n end" ]
[ "0.7685033", "0.6669442", "0.6500708", "0.6006697", "0.58645815", "0.5860242", "0.57698756", "0.57698756", "0.57417244", "0.56490266", "0.56320757", "0.5626222", "0.54789835", "0.547776", "0.54732305", "0.53960145", "0.5360265", "0.53585404", "0.5329015", "0.5314386", "0.52956694", "0.5283285", "0.5265548", "0.52292955", "0.5183185", "0.51767236", "0.5151617", "0.51473784", "0.5122845", "0.51070696", "0.51026267", "0.5101646", "0.5080983", "0.5067252", "0.50637764", "0.5063373", "0.50037783", "0.50037783", "0.4985576", "0.49588656", "0.4953013", "0.49482507", "0.49476802", "0.49415365", "0.4924644", "0.48851058", "0.4883527", "0.4863258", "0.4859652", "0.48578948", "0.4856419", "0.48549947", "0.48453996", "0.48397297", "0.48331493", "0.48206162", "0.48156804", "0.48140857", "0.48121643", "0.4798206", "0.4786527", "0.47803834", "0.47744966", "0.47743028", "0.4773203", "0.47572342", "0.4741438", "0.47321874", "0.4712186", "0.47118118", "0.46992567", "0.4698236", "0.46907312", "0.4685948", "0.4657358", "0.46533912", "0.46397787", "0.4637901", "0.4637883", "0.46350825", "0.46346444", "0.46346444", "0.46346444", "0.46237716", "0.4602521", "0.45937112", "0.45883003", "0.45873675", "0.45835885", "0.45831874", "0.45825258", "0.4580254", "0.45794612", "0.45794612", "0.45684463", "0.45501924", "0.45408973", "0.45178166", "0.45165756", "0.45035446" ]
0.7396057
1
Checks to see that a request is routable. ==== Parameters request:: The request object to inspect. ==== Raises Merb::ControllerExceptions::BadRequest:: No matching route was found. ==== Returns Hash:: The parameters built based on the matching route.
def check_request_for_route(request) match = ::Merb::Router.match(request) if match[0].nil? && match[1].empty? raise ::Merb::ControllerExceptions::BadRequest, "No routes match the request. Request uri: #{request.uri}" else match[1] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(request)\n @constraints.all? { |key, val| request.send(key).include? val }\n end", "def call(request)\n compile! unless compiled?\n pattern, verb, params = *parse_request(request)\n pattern = pattern.encode(Encoding.default_external)\n candidacies = match_with(pattern)\n raise_exception(404) if candidacies.empty?\n candidacies, allows = *candidacies.partition{ |route| route.verb == verb }\n raise_exception(405, :verbs => allows.map(&:verb)) if candidacies.empty?\n candidacies.map{ |route| [route, route.params_for(pattern, params)] }\n end", "def call(request)\n @constraints.all? {|key, val|\n request.send(key).include? val\n }\n end", "def validate_request(request)\n raise Errors::InvalidRequestError.new(\"Improperly formatted Request (expected `Hash', got `#{request.class}')\") unless request && request.is_a?(Hash)\n raise Errors::InvalidRequestError.new(\"Missing `method' Request object member\") unless request['method']\n end", "def request_params\n @request.params\n rescue\n {}\n end", "def routable_request?(env)\n return true unless defined?(Rails) # If not running on a Rails app, we can't verify if it is invalid\n Rails.application.routes.recognize_path(env['PATH_INFO'])\n true\n rescue ActionController::RoutingError\n false\n end", "def ===(request)\n request.match?(@method, @path, @params)\n end", "def route_for(request)\n index, params = if @around_match\n send(@around_match, request) { match(request) }\n else\n match(request)\n end\n route = routes[index] if index\n if !route\n raise ControllerExceptions::NotFound, \n \"No routes match the request: #{request.uri}\"\n end\n [route, params]\n end", "def handle_request( request, &block )\n\t\tself.log.debug \"[:parameters] Wrapping request with parameter validation.\"\n\n\t\tvalidator = self.class.paramvalidator.dup\n\t\tvalidator.validate( request.params )\n\t\trequest.params = validator\n\n\t\tsuper\n\tend", "def route!(request)\n @@request = request\n @@routes.each do |route|\n if route.first == request.path\n return route.last.call\n break\n end\n end\n end", "def can_safely_access_request_parameters?\n @request.request_parameters\n end", "def validate_request(env)\n parameters = extract_request_parameters\n\n validate_flow_presence!(parameters)\n validate_msisdn!(parameters)\n validate_session_id!(parameters)\n\n parameters\n end", "def route_for(request) #:nodoc:\n index, params = match(request)\n route = routes[index] if index\n if !route\n raise ControllerExceptions::NotFound, \n \"No routes match the request: #{request.uri}\"\n end\n [route, params]\n end", "def call_by_request(request)\n rotation do |offset|\n pattern = decode_pattern(request.path_info)\n if route = match?(offset, pattern)\n params = route.params_for(pattern, request.params)\n yield(route, params) if route.verb == request.request_method\n route\n end\n end\n end", "def validate_request(request, request_resource_prefix)\n method = (request_resource_prefix + '_request').to_sym\n return send(method, request[0])\nend", "def route_request\n env.logger.debug \"#{self.class} ROUTING - #{env[Goliath::Request::PATH_INFO]}\"\n if has_path = ( env[Goliath::Request::PATH_INFO] =~ /^\\/(\\w+)(\\/\\w+)*/ )\n env.logger.debug \"#{self.class} route_request:\\t pathinfo = #{$1} extended = #{$2}\"\n path_info = $1\n extended_path_info = $2\n has_path = true #it will be a number or nil - let's just make it a bool\n elsif params[:id]\n has_path = true\n end\n \n method = env[Goliath::Request::REQUEST_METHOD]\n action = case method\n when 'GET'\n has_path ? 'show' : 'index'\n when 'POST'\n has_path ? ( raise BadRequestError, \"can't post to this resource\" ) : 'create'\n when 'PUT'\n !has_path ? ( raise BadRequestError, \"no resource to PUT to\" ) : 'update'\n when 'DELETE'\n !has_path ? ( raise BadRequestError, \"no resource to DELETE\" ) : 'delete'\n else\n raise MethodNotAllowedError, \"unknown request method\"\n end\n env.logger.info \"#{self.class} route_request:\\t attempting to call #{action} action\"\n if self.respond_to?(action, true) #second param includes private methods\n env['params']['id'] = params[:id] || (path_info if has_path)\n self.send(action)\n else\n error_on MethodNotAllowedError, \"#{action} not supported for this resource\"\n end\n end", "def request_params\n params.require(:request).permit(:id, :ride_id, :notes, :phone, :accept)\n end", "def allowed?(request)\n name = request.call.intern\n namespace = request.handler.intern\n method = request.method.intern\n\n read\n\n if @rights.include?(name)\n return @rights[name].allowed?(request.name, request.ip)\n elsif @rights.include?(namespace)\n return @rights[namespace].allowed?(request.name, request.ip)\n end\n false\n end", "def match(request)\n path = String.normalize_path(request.path)\n method = request.method\n\n match, data = nil\n @sets.each { |set|\n match, data = set[1].match(path, method)\n break if match\n }\n\n fns = []\n if match\n fns = match[3]\n\n # handle route params\n #TODO where to do this?\n request.params.merge!(Hash.strhash(self.data_from_path(path, data, match[1])))\n\n #TODO where to do this?\n request.route_path = match[4]\n end\n\n fns\n end", "def request_params\n to_hash.select do |key, value|\n !REQUEST_PARAMS.include?(key.to_sym)\n end\n end", "def valid_params_request?; end", "def sanitize!(request)\n [ :path, :query, :body ].each do |name|\n send(\"#{name}_parameters\").sanitize_object!(request.params)\n end\n end", "def request_params\n params.require(:request).permit(:name, :age, :nickname, :minecraftUUID, :foundUs, :requestReason, :email, :status, :ip)\n end", "def check_route_params\n request_para = params[:check_route].nil? ? params : params[:check_route]\n request_para.select{|key,value| key.in?(CheckRoute.column_names())}.symbolize_keys\n end", "def valid_params_request?\n true\n end", "def valid_params_request?\n true\n end", "def request_params_all(request)\n request_params = HashWithIndifferentAccess.new\n request_params.merge!(request.params || {})\n\n # read post or put params. this will erase params\n # {code: 123, mode: 123}\n # \"code=123&mode=123\"\n request_body = request.body.read\n if request_body.present?\n body_params = begin\n JSON.parse(request_body) # {code: 123, mode: 123}\n rescue JSON::ParserError\n Rack::Utils.parse_nested_query(request_body) # \"code=123&mode=123\"\n end\n else\n body_params = {}\n end\n\n request_params.merge(body_params)\n end", "def parse_request(request)\n if request.is_a?(Hash)\n [request['PATH_INFO'], request['REQUEST_METHOD'].downcase.to_sym, {}]\n else\n [request.path_info, request.request_method.downcase.to_sym, request.params]\n end\n end", "def hold_request_params\n params.fetch(:hold_request, {})\n end", "def hold_request_params\n params.fetch(:hold_request, {})\n end", "def request_params\n params.require(:request).permit(:requestee_id)\n end", "def request_allowed?(request)\n true\n end", "def params\n @params ||= Hashie::Mash.new.deep_merge(request.params).deep_merge(env['rack.routing_args'] || {})\n end", "def request_params\n params.require(:request).permit!.except(:reference, :updated_at, :created_at)\n end", "def prepare_params\n request_parameters = params[:request]\n return unless request_parameters\n\n request_parameters[:name] &&= replace_whitespaces(request_parameters[:name])\n request_parameters[:sudo_user_ids] &&= request_parameters[:sudo_user_ids][1..-1]\n\n # the user_ids must contain the ids of ALL users, sudo or not\n request_parameters[:user_ids] ||= []\n request_parameters[:user_ids] += request_parameters[:sudo_user_ids] if request_parameters[:sudo_user_ids]\n end", "def check_requirements(request)\n valid = true\n keys = @event[\"required\"].keys\n keys.each { |k| valid = equal_pair(k, request) if valid != false }\n valid\n end", "def request_infos\n req = request\n return {} unless req\n # FIXME: Use frozen string keys\n {\n :rid => request_id,\n :user_agent => client_user_agent,\n :scheme => req.scheme,\n :verb => req.env['REQUEST_METHOD'],\n :host => hostname,\n :port => req.env['SERVER_PORT'],\n :referer => req.env['HTTP_REFERER'],\n :path => request_path,\n :remote_port => req.env['REMOTE_PORT'],\n :remote_ip => remote_addr,\n :client_ip => client_ip,\n }\n end", "def request_params\n params.require(:request).permit(:start_city, :start_street_address, :start_zip, :end_city, :end_street_address, :end_zip, :trip_time, :distance, :highest_price_to_pay, :matched_availability_id, :request_status)\n end", "def match?(_request)\n true\n end", "def allowed?(request)\n case\n when allow_path?(request) then true\n when allow_agent?(request) then true\n when whitelisted?(request) then true\n when blacklisted?(request) then false\n else nil # override in subclasses\n end\n end", "def handle(request, env)\n params = @params.dup\n path_info, script_name = env[\"PATH_INFO\"], env[\"SCRIPT_NAME\"]\n \n return unless request_conditions.all? do |method_name, condition|\n # TODO: Refactor this... it lacks awesome\n next true unless request.respond_to?(method_name)\n matched, captures = condition.match(request)\n if matched\n params.merge!(captures)\n if method_name == :path_info\n new_path_info = @path_info.dup if @path_info\n new_path_info ||= env[\"PATH_INFO\"].sub(/^#{Regexp.escape(matched)}/, '')\n new_path_info.gsub!(SEGMENT_REGEXP) { |s| params[$2.to_sym] }\n env[\"SCRIPT_NAME\"] = Utils.normalize(request.env[\"SCRIPT_NAME\"] + matched)\n env[\"PATH_INFO\"] = Utils.normalize(new_path_info)\n end\n true\n end\n end\n \n env[\"rack_router.route\"] = self\n env[\"rack_router.params\"].merge! params\n \n @app.call(env)\n ensure\n env[\"PATH_INFO\"], env[\"SCRIPT_NAME\"] = path_info, script_name\n end", "def params\n @params ||= HashWithIndifferentAccess.new(request.params.merge(env[\"rack.routing_args\"]))\n end", "def make_request(request)\n puts \"\\n\\n\"\n puts \"==> Request, action='#{request.path}', params = #{request.query}...\"\n\n action = request.path.to_s.split(\"/\")[-1]\n\n if action && @app.valid?(action) then\n response = @app.send(action.to_sym, request.query)\n\n return response\n end\n\n return \"Error: Unrecognised action: #{action}\"\n rescue Exception => e\n $stderr.puts \"*** [E]: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n return \"Error: #{e}\"\n end", "def request_params\n params.require(:request).permit(:user_id, :search_term)\n end", "def check_route_params\n params.select{|key,value| key.in?(CheckRoute.column_names())}\n end", "def test(request)\n constraints.all? {|key, val|\n if val.nil? or val == true\n true\n else\n if val.respond_to? :call\n val.call( request )\n else\n val == request.send( key ) or val === request.send( key ) or request.send( key ) === val\n end\n end\n }\n end", "def request_params\n params.require(:request).permit(:name, :email, :phone, :other_phone, :description, :subject, :status, :assigned_to_user)\n end", "def eql?(request)\n return false unless Request === request\n\n READER_VARS.inject(true) do |memo, name|\n memo && (self.send(name) == request.send(name))\n end\n end", "def show\n @request = Request.find(params[:id])\n\n if current_user.admin?\n @available_rooms = get_available_rooms @request\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end", "def request_params\n params.require(:request).permit(:carga, :documento, :urgente, :motivo, :tipo, :portaria, :data_partida, :data_volta, :hora_partida, \n :hora_volta, :status, :user_id,\n :data_aguardando_cad, :user_aguardando_cad_id,\n :data_aguardando_useget, :user_aguardando_useget_id,\n :data_aprovada, :user_aprovada_id,\n :data_em_andamento, :user_em_andamento_id,\n :data_finalizada, :user_finalizada_id,\n :data_cancelada, :user_cancelada_id,\n :motivo_cancelamento,\n request_passengers_attributes: [:id, :passenger_id, :request_id, :passenger_nome])\n \n end", "def validate_rpc_request(request)\n # validate request is an object\n return false unless request.is_a?(Hash)\n\n # validate request contains required members\n JSON_RPC_REQUIRED_MEMBERS.each { |member| return false unless request.key?(member) }\n\n return false if request[:jsonrpc] != JSON_RPC_VERSION\n\n # validate request members are correct types\n request.each do |member, value|\n return false if JSON_RPC_MEMBER_TYPES.key?(member) &&\n !JSON_RPC_MEMBER_TYPES[member].one? { |type| value.is_a?(type) }\n end\n\n true\n end", "def test( request )\n constraints.all? do | key, val |\n if val.nil? or val == true\n true\n else\n if val.respond_to? :call\n val.call( request )\n else\n val == request.send( key ) or val === request.send( key ) or request.send( key ) === val\n end\n end\n end\n end", "def recognize(request)\n prepare! unless prepared?\n pattern, verb, params = parse_request(request)\n fetch(pattern, verb){|route| [route, params_for(route, pattern, params)] }\n end", "def verify_request(request)\n verify_signature(\n # url without query string\n request.protocol + request.host_with_port + request.path,\n # raw parameters\n request.get? ? request.query_string : request.raw_post\n )\n end", "def find_route(request)\n @routes.find {|r| r.match?(request) }\n end", "def parse_request(env, path_params)\n validate_request!(env, path_params)\n parse_message_hash(env, path_params)\n end", "def parse_request(env, path_params)\n validate_request!(env, path_params)\n parse_message_hash(env, path_params)\n end", "def parse_request(request)\n projects = load_config\n project = projects.select { |proj| proj.name == request[\"project\"][\"name\"] }\n if project.length < 1\n log_message \"Project '#{request[\"project\"][\"name\"]}' not found in configuration.\"\n return\n end\n project = project[0]\n begin\n event = Event.new project.data[\"events\"].detect { |e| e[\"event\"] == request[\"object_kind\"] }\n if !event.exist?\n log_message \"Event '#{request[\"object_kind\"]}' not configured for #{project.name}.\"\n elsif event.check_requirements request # returns true if valid\n log_message \"Request valid!\"\n log_message request\n event.handle_action project\n else\n log_message \"The Current Request does not match all requirements. - skipping\"\n end\n rescue StandardError => e\n log_message \"An error occured: #{e}\"\n log_message e.backtrace\n end\nend", "def validate\n raise \"Can only validate request messages\" unless type == :request\n\n raise(NotTargettedAtUs, \"Received message is not targetted to us\") unless PluginManager[\"security_plugin\"].validate_filter?(payload[:filter])\n end", "def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n 'method' => method.to_s,\n 'url' => url,\n }).map { |k, v| [k.to_s, v] }]\n end", "def body_params(request)\n body = request.body.read\n return {} if body.empty?\n\n JSON\n .parse(body)\n .each_with_object({}) { |(key, value), res| res[key] = filtered_value(key, value) }\n end", "def unpack_request_params(request)\n # if Content-Type is empty or JSON, and there was a request body, try to\n # interpret it as JSON\n params = if !request.media_type || request.media_type =~ %r{application/(?:.*\\+)?json}\n parse_json(request)\n elsif @optimistic_json\n begin\n parse_json(request)\n rescue JSON::ParserError\n nil\n end\n end\n\n return [params, false] if params\n\n if @allow_form_params && %w[application/x-www-form-urlencoded multipart/form-data].include?(request.media_type)\n # Actually, POST means anything in the request body, could be from\n # PUT or PATCH too. Silly Rack.\n return [request.POST, true] if request.POST\n end\n\n [{}, false]\n end", "def validate_source_of_request\n LogWrapper.log('DEBUG', {\n 'message' => \"Request sent to #{params['controller']}Controller#validate_source_of_request\",\n 'method' => 'validate_source_of_request',\n 'status' => \"start, Rails.env=#{Rails.env}, (Rails.env.test? || Rails.env.local?)=#{Rails.env.test? || Rails.env.local?}\",\n 'dataSent' => \"request.headers['X-API-Key']:#{request.headers['X-API-Key']}\"\n })\n\n redirect_to '/api/unauthorized' unless Rails.env.test? || Rails.env.local? || request.headers['X-API-Key'] == ENV['API_GATEWAY_HEADER_KEY']\n end", "def validate_request(call)\n call.validate_request\n end", "def verify_request_components options = {}\n if options[:request]\n if options[:request].is_a?(Faraday::Request) || options[:request].is_a?(Array)\n request = options[:request]\n elsif options[:adapter]\n request = options[:adapter].adapt_request options[:request]\n end\n method = request.method\n uri = request.path\n headers = request.headers\n body = request.body\n else\n method = options[:method] || :get\n uri = options[:uri]\n headers = options[:headers] || []\n body = options[:body] || \"\"\n end\n\n headers = headers.to_a if headers.is_a? Hash\n method = method.to_s.upcase\n\n request_components = {\n method: method,\n uri: uri,\n headers: headers\n }\n\n # Verify that we have all the pieces required to validate the HTTP request\n request_components.each do |(key, value)|\n raise ArgumentError, \"Missing :#{key} parameter.\" unless value\n end\n request_components[:body] = body\n request_components\n end", "def request_params\n params.fetch(:request, {}).permit(:title, :description, :status, :type_of_request, :latitude, :longitude, :republished)\n end", "def validateRequestParam(requestParams = {})\r\n\t \r\n\t \tif requestParams[:pReqType].blank? || isBlankOrNull(requestParams[:pReqType])\r\n\t \t\treturn BLANK_REQUEST_TYPE\r\n\t \telsif !(@@requestTypes.include? requestParams[:pReqType])\r\n\t \t\treturn INVALID_REQUEST_TYPE \t\r\n\t \tend\r\n\t \t\r\n\t \tif requestParams[:pMerCode].blank? || isBlankOrNull(requestParams[:pMerCode])\r\n\t \t\treturn BLANK_MER_CODE\r\n\t \tend\r\n\t \t\r\n\t \tif requestParams[:pEncKey].blank? || isBlankOrNull(requestParams[:pEncKey])\r\n\t \t\treturn INVALID_KEY\r\n\t \tend\r\n\t \t\r\n\t \tif requestParams[:pEncIv].blank? || isBlankOrNull(requestParams[:pEncIv]) || requestParams[:pEncIv].length < 16\r\n\t \t\treturn INVALID_IV\r\n\t \tend \r\n\t \t\r\n\t \treturn false \t\r\n\t \t\r\n\t end", "def request_params\n params.require(:request).permit(:listing_id, :user_id, :start_date, :end_date, :approved, :message_id)\n end", "def params\n @request.params\n end", "def set_request\n @request = Request.accessible_by(current_ability).find(params[:id])\n end", "def request_params\n params.require(:request).permit(:requestType, :created, :expires, :longtitude, :latitude, :user_id)\n end", "def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n \"method\" => method.to_s,\n \"url\" => url,\n }).map {|k,v| [k.to_s,v] }]\n end", "def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n \"method\" => method.to_s,\n \"url\" => url,\n }).map {|k,v| [k.to_s,v] }]\n end", "def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n \"method\" => method.to_s,\n \"url\" => url,\n }).map {|k,v| [k.to_s,v] }]\n end", "def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n \"method\" => method.to_s,\n \"url\" => url,\n }).map {|k,v| [k.to_s,v] }]\n end", "def params\n request.params\n end", "def params\n request.params\n end", "def acceptable_request!(env)\n case Halcyon.config[:allow_from].to_sym\n when :all\n # allow every request to go through\n when :halcyon_clients\n # only allow Halcyon clients\n raise Exception::Forbidden.new unless env['USER_AGENT'] =~ /JSON\\/1\\.1\\.\\d+ Compatible \\(en-US\\) Halcyon::Client\\(\\d+\\.\\d+\\.\\d+\\)/\n when :local\n # do not allow for requests from an outside host\n raise Exceptions::Forbidden.new unless ['localhost', '127.0.0.1', '0.0.0.0'].member? env[\"REMOTE_ADDR\"]\n else\n logger.warn \"Unrecognized allow_from configuration value (#{Halcyon.config[:allow_from].to_s}); use all, halcyon_clients, or local. Allowing all requests.\"\n end\n end", "def params() request.params end", "def create\n @request = Request.new(request_params)\n respond_to do |format|\n if @request.save\n user = User.find(current_user.id)\n make = Make.create!(user_id: current_user.id, request_id: @request.id)\n user.makes << make\n @request.makes << make\n @make_id = make.id\n # get the matched availability_id\n @matched_id = match_availability(@request)\n format.html { redirect_to user_request_path(current_user, @request), notice: 'Request was successfully created.' }\n format.json { render :show, status: :created, location: @request }\n # format.html { redirect_to @request, :status => 200, notice: 'Request was successfully created.' }\n # format.json { render :show, status: :created, location: @request }\n else\n format.html { render :new }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "def route_request_with(event_data, hold_request, timestamp)\n owner = \"\"\n\n if event_data == nil || event_data.count == 0 || event_data[\"owningInstitutionId\"] == nil\n $logger.error \"Request data missing key information. Cannot proceed. Malformed request. #{event_data}\"\n else\n owner = event_data[\"owningInstitutionId\"].downcase\n end\n\n if owner.scan('nypl').empty?\n $logger.info \"Processing partner hold\"\n\n response = SierraRequest.process_partner_item(event_data)\n\n RequestResult.process_response(response, 'AcceptItemRequest', event_data, hold_request, timestamp)\n\n elsif owner != \"\"\n $logger.info \"Processing NYPL hold\"\n\n response = SierraRequest.process_nypl_item(event_data)\n\n RequestResult.process_response(response, 'SierraRequest', event_data, hold_request, timestamp)\n end\n end", "def request_params\n params.require(:request).permit(:space_id, :booked_date).merge(user_id: current_user.id)\n end", "def validate_request\n binding.pry if $debug\n rejected_error = validate_method || validate_arguments\n if rejected_error\n reject\n #if public mode\n #kill\n #else\n respond_with_rejected_error(rejected_error)\n #end\n return false\n end\n accept\n true\n end", "def matching_throttle(request)\n self.class.throttles.find { |t| t.match?(normalized_request_path(request), request.request_method) }\n end", "def validate(params)\n Request.new(params).validate(params)\n end", "def parse_request request\n\n request_uuid = request.shift\n request_method = request.shift\n\n begin\n request_response = @notifier_engine.process_input request_method.to_sym, request\n rescue => exc\n request_response = \"#{exc.class}: #{exc.message}\"\n end\n\n send_response request_uuid, request_response\n\n end", "def request_params; end", "def index\n @request = Request.find(params[:request_id])\n if current_user.requisitante_transporte?\n if @request.status != \"EM ABERTO\"\n flash[:info] = \"Você não pode adicionar passageiros a requisição atual.\"\n redirect_to requests_url\n end\n end\n\n @request_passengers = @request.request_passengers\n @request_passenger = @request.request_passengers.new\n \n end", "def request_params\n params.require(:request).permit(:item, :cost, :availability, :business, :benefit, :why, :recommentdation, :applicant_id)\n end", "def request_denied(request)\n if !request.nil?\n @request = request\n @email = @request.clid + '@louisiana.edu'\n mail to: @email, subject: \"Room Change Request Denied\"\n end\n end", "def request_parameters\n {:email => @email, :receiverid => @receiverid, :amt => @amt,\n :uniqueid => @unique, :note => @note}.reject{|k,v| v.nil? }\n end", "def can_fulfill_request?(request)\r\n matching_items= self.overlay.active_items_by_name_and_user(request.name, self)\r\n matching_items.size > 0\r\n end", "def request_params\n params.require(:request).permit(:name, :description, :budget, :proposalDeadline, :eventDate, :address, :city, :province, :category, :status, :user_id)\n end", "def params(request)\n request.query\n end", "def request_matches_criteria( request, pattern )\n\t\tself.log.debug \"Testing request '%s %s' against pattern: %p\" %\n\t\t\t[ request.verb, request.app_path, pattern ]\n\n\t\tcase pattern\n\t\twhen nil\n\t\t\tself.log.debug \" no pattern; calling the block\"\n\t\t\treturn yield( request )\n\n\t\twhen Regexp\n\t\t\tself.log.debug \" checking app_path with regexp: %p\" % [ pattern ]\n\t\t\tmatchdata = pattern.match( request.app_path ) or return false\n\t\t\tself.log.debug \" matched: calling the block\"\n\t\t\treturn yield( request, matchdata )\n\n\t\twhen String\n\t\t\tself.log.debug \" checking app_path: %p\" % [ pattern ]\n\t\t\trequest.app_path.gsub( %r{^/+|/+$}, '' ) == pattern or return false\n\t\t\tself.log.debug \" matched: calling the block\"\n\t\t\treturn yield( request )\n\n\t\telse\n\t\t\traise ScriptError, \"don't know how to match a request with a %p\" % [ pattern.class ]\n\t\tend\n\tend", "def request_params\n params.fetch(:request, {}).permit(:title, :description, :value)\n end", "def params\n @request.params\n end", "def matches?(request)\n !!@rule.call(request) # rubocop:disable Style/DoubleNegation\n end", "def call( request )\n if @pattern.is_a? Array\n path = extract_path( request ).reverse\n return {} if @pattern.empty? && path.empty?\n capture = {}\n match = @pattern.all? do | want |\n case want\n when true # same as a Range of 1..-1\n path = [] unless path.empty?\n when Range\n if want.end == -1\n path = [] if path.length >= want.begin\n else\n path = [] if want.include? path.length\n end\n when String then want == path.pop\n when Symbol then capture[ want ] = path.pop\n when Regexp then want === path.pop\n when Hash\n key, value = want.to_a.first\n case value\n when true\n ( capture[ key ], path = path.reverse, [] ) unless path.empty?\n when Range\n if value.end == -1\n ( capture[ key ], path = path.reverse, [] ) if path.length >= value.begin\n else\n ( capture[ key ], path = path.reverse, [] ) if value.include? path.length\n end\n when String, Symbol\n got = path.pop\n capture[ key ] = got ? got : value.to_s\n when Regexp then\n got = path.pop\n capture[ key ] = got if value === got\n end\n end\n end\n capture if match && path.empty?\n elsif @pattern == true or @pattern == false or @pattern == nil\n {}\n end\n end", "def access(request, _unused_call)\n user_id = request.accessing_user_id\n owner_id = request.resource_owner_id\n mrids = request.medical_records.to_a\n\n record_ids = ResourceMapping.where(\n accessing_user_id: user_id,\n resource_owner_id: owner_id,\n status: to_enum(:GRANTED)).pluck(:medical_record_ids)\n\n if record_ids.include?(mrids)\n access_response(:GRANTED, I18n.t('resources.access_already_granted'))\n else\n Event.notify(owner_id, user_id, mrids)\n create_mapping(user_id, owner_id, mrids, :AWAITING_RESPONSE)\n access_response(:AWAITING_RESPONSE, I18n.t('resources.request_sent_to_user'))\n end\n rescue => ex\n # access_response()\n puts \"#{ex.message} - #{ex.backtrace}\"\n end" ]
[ "0.6007185", "0.5976569", "0.59397715", "0.5760299", "0.5580053", "0.5485739", "0.546998", "0.5440643", "0.541358", "0.537255", "0.53686225", "0.5368136", "0.53625286", "0.53019357", "0.52885294", "0.52464867", "0.521794", "0.52103597", "0.5199129", "0.5196158", "0.51958007", "0.51834005", "0.5178962", "0.5176871", "0.5168105", "0.5168105", "0.5153125", "0.5149042", "0.51293916", "0.51293916", "0.5126705", "0.5122684", "0.51098853", "0.5105588", "0.5100801", "0.50719005", "0.5022219", "0.50216246", "0.50204885", "0.5015309", "0.4999294", "0.4985102", "0.49749547", "0.4963947", "0.4959806", "0.49560812", "0.4953854", "0.4947503", "0.4940266", "0.49386224", "0.49306557", "0.49283117", "0.49230507", "0.49062544", "0.4898702", "0.4888948", "0.4888948", "0.48756894", "0.4871448", "0.48599756", "0.48460624", "0.4845863", "0.48373854", "0.48350736", "0.48325637", "0.483228", "0.48319352", "0.48289216", "0.48275495", "0.48163235", "0.4810913", "0.4809063", "0.4809063", "0.4809063", "0.4809063", "0.48019177", "0.48019177", "0.4791191", "0.47900882", "0.47832868", "0.47816744", "0.47790125", "0.477359", "0.4765586", "0.47599185", "0.47524494", "0.47503492", "0.4749186", "0.47445577", "0.47434738", "0.47414008", "0.4741153", "0.47405225", "0.47391984", "0.47254562", "0.47146925", "0.47130865", "0.47100443", "0.47091085", "0.47090626" ]
0.69358224
0
print out all between 1100, if mult 3 fizz, if mult 5 buzz, if mult 10 fizzbuzz
def fizzbuzz y = (1..100) y.each { |x| if x % 3 == 0 && x % 5 == 0 puts "fizzbuzz" elsif x % 3 == 0 puts "fizz" elsif x % 5 == 0 puts "buzz" else puts x end } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fizzbuzz\n\t(1..100).each do |num|\n\t if num % 3 == 0 && num % 5 == 0\n\t\tputs \"Fizzbuzz\"\n\t elsif num % 3 == 0\n\t\tputs \"Fizz\"\n\t elsif num % 5 == 0 \n\t\tputs \"Buzz\"\n\t else\n\t\tputs num\n\t end\n\tend\nend", "def fizzbuzz()\n numbers = Array(1..100)\n numbers.each do |num|\n if num % 15 == 0\n puts \"FizzBuzz\" \n elsif num % 3 == 0\n puts \"Fizz\"\n elsif num % 5 == 0\n puts \"Buzz\"\n else\n puts num\n end\n end\nend", "def fizzBuzz\n array = [*1..100]\n array.each { |num|\n if ((num % 3) == 0) && ((num % 5) == 0)\n puts \"FizBuzz\"\n elsif num % 5 == 0\n puts \"Buzz\"\n elsif num % 3 == 0\n puts \"Fizz\"\n else \n puts num\n end\n }\nend", "def fizzbuzz(number)\n (1..number).each do |num|\n if (num % 15).zero?\n puts 'FizzBuzz'\n elsif (num % 3).zero?\n puts 'Fizz'\n elsif (num % 5).zero?\n puts 'Buzz'\n else\n puts num\n end\n end\nend", "def fizzbuzz(num)\n collection = (1..num).to_a\n collection.each do |num|\n if (num % 3 == 0) && (num % 5 != 0)\n puts \"Fizz #{num}\"\n elsif (num % 5 == 0) && (num % 3 != 0)\n puts \"Buzz #{num}\"\n elsif (num % 3 == 0) && (num % 5 == 0)\n puts \"FizzBuzz #{num}\"\n end\n end\nend", "def fizzBuzz (number)\n for i in 1..number\n if (i % 15 == 0)\n puts \"fizzbuzz\"\n elsif (i % 3 ==0)\n puts \"fizz\"\n elsif (i % 5 ==0)\n puts \"buzz\"\n else\n puts i\n end\n end\nend", "def fizzbuzz\n\n\tfor i in (1..100) do\n\t\tif i % 3 == 0 and i % 5 == 0\n\t\t\tputs 'FizzBuzz'\n\t\telsif i % 5 == 0\n\t\t\tputs 'Buzz'\n\t\telsif i % 3 == 0\n\t\t\tputs 'Fizz'\n\t\telse puts i\n\n\t\tend\n\tend\n\nend", "def fizz_buzz \n\ti=1\n\t while i < 100 do\n\t \tif i%3 == 0 && i%5 == 0\n\t \t\tprint \"FizzBuzz\\n\"\n\t \telsif i%3 == 0\n\t \tprint \"fizz\\n\"\n\t \telsif i%5 == 0\n\t \t\tprint \"Buzz\\n\"\n\t \telse\n\t \tprint \"#{i}\\n\"\n\t \tend\n\t\ti += 1\n\t end\nend", "def fizzbuzz(a,b)\n numbers = (a..b).to_a\n\n numbers.each do |number|\n if number % 15 == 0\n puts \"FizzBuzz\"\n elsif number % 3 == 0\n puts \"Fizz\"\n elsif number % 5 == 0\n puts \"Buzz\"\n else\n puts number\n end\n end\nend", "def run\n (-100..100).each do |number|\n fizz = @fizz_buzz.fizz?(number)\n buzz = @fizz_buzz.buzz?(number)\n if fizz && buzz then puts \"fizzBuzz (#{number})\"\n elsif fizz then puts \"fizz (#{number})\"\n elsif buzz then puts \"buzz (#{number})\"\n else puts number\n end\n end\n end", "def fizzbuzz\n\t 1.upto(100) do |i|\n\tif i % 5 == 0 and i % 3 == 0\n\t puts \"FizzBuzz\"\n\telsif i % 5 == 0\n\t puts \"Buzz\"\n\telsif i % 3 == 0\n\t puts \"Fizz\"\n\telse\n\t puts i\n\tend\n\tend\nend", "def super_fizz(number)\n(0..1000).each do |number|\ndivisible_by_3 = number % 3\ndivisible_by_5 = number % 5\ndivisible_by_7 = number % 7\nif divisible_by_3 == 0\n if divisible_by_5 == 0\n if divisible_by_7 == 0\n puts \"SuperFizzBuzz\"\n else\n puts \"FizzBuzz\"\n end\n elsif divisible_by_7 == 0\n puts \"SuperFizz\"\n else\n puts \"Fizz\"\n end\nelsif divisible_by_5 == 0\n if divisible_by_7 == 0\n puts \"SuperBuzz\"\n else\n puts \"Buzz\"\n end\nelsif divisible_by_7 == 0\n puts \"Super\"\nelse\n puts number\nend\nend\nend", "def fizzbuzz(num)\n num.times do |i|\n \n if i % 15 == 0\n puts \"fizzbuzz\"\n elsif i % 3 == 0 \n puts \"fizz\"\n elsif i % 5 == 0\n puts \"buzz\"\n else\n puts \"num\"\n end\n end\nend", "def reprint(number)\n\t(1..100).each do |i|\n\t\tif i % 3 == 0 and i % 5 == 0\n\t\t\tputs 'FizzBuzz'\n\t\telsif i % 5 == 0\n\t\t\tputs 'Buzz'\n\t\telsif i % 3 == 0 \n\t\t\tputs 'Fizz'\t\t\n\t\telse\n\t\t\tputs i\t\t\n\t\tend\n\tend\nend", "def fizzbuzz(starting, ending)\n (starting..ending).each do |num|\n if (num % 15).zero?\n p \"FizzBuzz\"\n elsif (num % 3).zero?\n p \"Fizz\"\n elsif (num % 5).zero?\n p \"Buzz\"\n else\n p num\n end\n end\nend", "def fizz_buzz()\n for i in 1..100\n if i % 3 == 0 && i % 5 == 0\n puts 'FizzBuzz'\n elsif i % 3 == 0\n puts 'Fizz'\n elsif i % 5 == 0\n puts 'Buzz'\n else\n puts i\n end\n end\nend", "def fizzbuzz(start_number, end_number)\n (start_number..end_number).each do |number|\n if number % 15 == 0 \n puts \"FizzBuzz\"\n elsif number % 5 == 0\n puts \"Buzz\"\n elsif number % 3 == 0\n puts \"Fizz\"\n else\n puts number\n end \n end\nend", "def fizz_buzz num\n puts \"FizzBuzz\" if num % 15 == 0\n puts \"Fizz\" if num % 3 == 0\n puts \"Buzz\" if num % 5 == 0\n puts num\nend", "def fizzbuzz(num1,num2)\n for i in num1..num2 do\n if i%15 == 0\n puts \"FizzBuzz\"\n elsif i%3 == 0\n puts \"Fizz\"\n elsif i%5 == 0\n puts \"Buzz\"\n else\n puts i\n end\n end\nend", "def fizz_buzz (i)\n 1.upto 100 do |i|\n if i % 5 == 0 && i % 3 == 0 \n puts \"FizzBuzz\"\n elsif i % 5 == 0\n puts \"Buzz\" \n elsif\n puts i % 3 == 0\n else \"Fizz\"\n puts i\n end\nend\nend", "def fizz_buzz_woof(max)\n 1.upto(max).each do |x|\n if (x % 3 == 0) && (x % 5 == 0) && (x % 7 == 0)\n puts \"FizzBuzzWoof\"\n elsif (x % 3 == 0) && (x % 5 == 0)\n puts \"FizzBuzz\"\n elsif (x % 3 == 0) && (x % 7 == 0)\n puts \"FizzWoof\"\n elsif (x % 5 == 0) && (x % 7 == 0)\n puts \"BuzzWoof\"\n elsif x % 3 == 0\n puts \"Fizz\"\n elsif x % 5 == 0\n puts \"Buzz\"\n elsif x % 7 == 0\n puts \"Woof\"\n else\n puts x\n end\n end\nend", "def fizz_buzz_check\n @numbers.collect do |x|\n if multiple_of(15, x)\n 'FizzBuzz'\n elsif multiple_of(3, x)\n 'Fizz'\n elsif multiple_of(5, x)\n 'Buzz'\n else\n x\n end\n end\n end", "def FizzBuzz\n\t\n1.upto(100) {|i| \n\tputs \"Fizz\" if i%3 == 0 && i%5 != 0\n\tputs \"Buzz\" if i%3 != 0 && i%5 == 0\n\tputs \"FizzBuzz\" if i%3 == 0 && i%5 == 0\n\tputs i if i%3 != 0 && i%5 != 0\n}\t\n\nend", "def fizzbuzz(maxNumber)\n\n\tfor count in 1..maxNumber\n\t\tif count % 15 == 0 then\n\t\t\tprint \"fizzbuzz\"\n\t\telsif count % 3 == 0 then\n\t\t\tprint \"fizz\"\n\t\telsif count % 5 == 0 then\n\t\t\tprint \"buzz\"\n\t\telse\n\t\t\tprint count\n\t\tend\n\t\tprint \"\\n\"\n\tend\nend", "def fizzbuzz\n\t1.upto(100) do |i|\n\t\tprint \"Fizz \" if a = (i % 3).zero?\n\t\tprint \"Buzz \" if b = (i % 5).zero?\n\t\tprint \"FizzBuzz \" if c = (i % 15).zero?\n\t\tprint i.to_s + \" \" unless (a || b || c)\n\tend\nend", "def fizz_buzz\n num = 0\n 100.times do\n num +=1\n if num % 5 == 0 && num % 3 == 0\n puts 'FizzBuzz'\n elsif num % 5 == 0\n puts 'Buzz'\n elsif num % 3 == 0\n puts 'Fizz'\n else\n puts num\n end\n end\nend", "def fizzbuzz(num)\n if num%3 == 0\n print \"Fizz\"\n elsif num%5 == 0\n print \"Buzz\"\n else\n puts num\nend", "def super_fizzbuzz(array)\n\tarray = [1..100]\n\tarray.each do |num|\n\t\tif num % 3 == 0 \n\t\t\tprint \"Fizz\"\n\t\tend \n\t\tif num % 5 == 0 \n\t\t\tprint \"Buzz\"\n\t\tend \n\t\tif num % 15 == 0 \n\t\t\tprint \"FizzBuzz\"\n\t\tend \n\tend \nend", "def fizz(number)\t\t\t\t# creates fizz function had number argument\n\tfor\ti in 1..number\t\t\t# for loop i is the current value runs from 1 to 100 the agrument\n if i % 5 == 0 and i % 3 == 0 # if the current number is both divisible by 3\n puts \"FizzBuzz\"\t\t\t# prints FizzBuzz\n elsif i % 5 == 0\t\t\t# else if the current number is divisible by 5\n puts \"Buzz\"\t\t\t\t# prints Buzz\n elsif i % 3 == 0\t\t\t# esle if the current number is divisible by 3\n puts \"Fizz\"\t\t\t\t# prints Fizz\n else\t\t\t\t\t\t# else if none of the above conditions exist\n puts i\t\t\t\t\t# print the current number\n end\t\t\t\t\t\t# ends if\n end\t\t\t\t\t\t# ends \n end", "def FizzBuzz()\n x=0\n while x < 100\n x += 1\n if x % 3 == 0 && x % 5 !=0\n puts \"Fizz\"\n elsif x % 5 == 0 && x% 3 !=0\n puts \"Buzz\"\n elsif x % 15 == 0\n puts \"FizzBuzz\"\n else puts x\n end\n end\nend", "def fizz_buzz number \n # for i in number\n # \tif i%3 == 0 \n # \t\treturn \"fiz\"\n # \telsif i%5 == 0\n # \t\treturn \"buzz\"\n # \tend \n # end\n\n if ((number % 3 == 0) && (number % 5 == 0))\n \treturn \"FizzBuzz\"\n elsif (number % 3 == 0)\n \treturn \"Fizz\"\n elsif (number % 5 == 0)\n \treturn \"Buzz\"\n else \n \treturn number\n end\nend", "def fizzbuzz(start_num, end_num)\n start_num.upto(end_num) do |num|\n if num % 15 == 0\n print \"FizzBuzz \"\n elsif num % 5 == 0\n print \"Buzz \"\n elsif num % 3 == 0\n print \"Fizz \"\n else\n print \"#{num.to_i} \"\n end\n end\nend", "def fizz_buzz\n (1..100).each do |n|\n if is_div(n, 15)\n puts \"FIZZBUZZ\"\n elsif is_div(n, 3)\n puts \"FIZZ\"\n elsif is_div(n, 5)\n puts \"BUZZ\"\n else\n puts n\n end\n end\nend", "def fizz_buzz\n [*1..100].map do |num|\n if num % 5 == 0 && num % 3 == 0\n 'FizzBuzz'\n elsif num % 5 == 0\n 'Buzz'\n elsif num % 3 == 0\n 'Fizz'\n else\n num\n end\n end\nend", "def fizz_buzz number \n#prints numbers from 1 to 200\n #Modulo\n if number % 3 == 0 && number % 5 == 0\n 'FizzBuzz'\n elsif number % 3 == 0\n 'Fizz'\n elsif number % 5 == 0\n 'Buzz'\n else\n return number\n end\n\nend", "def fizzbuzz(max_val)\n\tcurrent_number = 1\n\twhile current_number <= max_val\n\n\t\tif current_number % 3 == 0\n\t\t\tputs \"fizz\"\n\t\tend\n\t\tif current_number % 5 == 0\n\t\t\tputs \"buzz\"\n\t\tend\n\t\tif current_number % 3 != 0 && current_number % 5 != 0\n\t\t\tputs current_number\n\t\tend\n\t\tcurrent_number += 1\n\tend\nend", "def fizzbuzz(start_num, end_num)\n for curr_num in (start_num..end_num)\n if curr_num % 15 == 0\n print \"FizzBuzz\"\n elsif curr_num % 5 == 0\n print \"Buzz\"\n elsif curr_num % 3 == 0\n print \"Fizz\"\n else\n print curr_num\n end\n print \", \" if curr_num < end_num\n end\n puts \"\"\nend", "def fizzbuzz(num)\n\tif num % 15 == 0\n\t\"FizzBuzz\"\n\telsif num % 3 == 0\n\t\"Fizz\"\n\telsif num % 5 == 0\n\t\"Buzz\"\n\t\n\telse num % 15 != 0\n\tputs\n\nend\nend", "def supafizbuz(max_num)\n range = (0..max_num).to_a\n range.each do |num|\n if num % 3 == 0\n if num % 7 == 0\n if num % 5 == 0\n puts(\"SuperFizzBuzz\")\n next\n end\n puts(\"SuperFizz\")\n next\n end\n puts(\"Fizz\")\n next\n elsif num % 7 == 0\n if num % 5 == 0\n puts(\"SuperBuzz\")\n next\n end\n puts(\"Super\")\n next\n elsif num % 5 == 0\n puts(\"Buzz\")\n next\n end\n puts(num)\n end\n return nil\n\n range = (0..max_num).to_a\n range.each do |num|\n a = num % 7 == 0 ? \"Super\" : \"\"\n b = num % 3 == 0 ? \"Fizz\" : \"\"\n c = num % 5 == 0 ? \"Buzz\" : \"\"\n puts (a + b + c) == \"\" ? num : (a + b + c)\n end\n return nil\n\nend", "def fizzbuzz(start, finish)\n start.upto(finish) do |num|\n if div_by_3?(num) && div_by_5?(num)\n puts \"FizzBuzz\"\n elsif div_by_5?(num)\n puts \"Buzz\"\n elsif div_by_3?(num)\n puts \"Fizz\"\n else\n puts num\n end\n end\nend", "def fizzbuzz\n\ti = 1\n\twhile i < 101\n\t\tif i % 15 == 0\n\t\t\tputs \"fizzbuzz\"\n\t\telsif i % 5 == 0\n\t\t\tputs \"buzz\"\n\t\telsif i % 3 == 0\n\t\t\tputs \"fizz\"\n\t\telse\n\t\t\tputs \"#{i}\"\n\t\tend\n\t\ti = i + 1\n\tend\nend", "def fizzbuzz(num1,num2)\n num1.upto(num2).each do |n|\n case\n when n % 3 == 0\n 'fizz'\n when n % 5 == 0\n 'buzz'\n when n % 3 == 0 && n % 5 == 0\n 'fizzbuzz'\n else\n p n\n end\n end\nend", "def fizzbuzz(number)\n\t\tif number % 15 == 0\n\t\t\t\"fizzbuzz\"\n\t\telsif number % 3 == 0 \n\t\t\t\"fizz\"\n\t\telsif number % 5 == 0\n\t\t\t\"buzz\"\n\t\telse\n\t\t\tnumber\n\t\tend\nend", "def fizzbuzz(start_num, end_num)\n start_num.upto(end_num) do |num|\n if num % 5 == 0 && num % 3 == 0\n puts \"FizzBuzz\"\n elsif num % 3 == 0 then puts \"Fizz\"\n elsif num % 5 == 0 then puts \"Buzz\"\n else puts num\n end\n end\nend", "def fizzbang(limit)\r\n\t1.upto(limit) do |number|\r\n\t\tif number % 3 == 0 and number % 5 == 0\r\n\t\t\tputs \"fizzbang\"\r\n\t\telsif number % 3 == 0\r\n\t\t\tputs \"fizz\"\r\n\t\telsif number % 5 == 0\r\n\t\t\tputs \"bang\"\r\n\t\telse\r\n\t\t\tputs number\r\n\t\tend\r\n\tend\r\nend", "def fizzbuzz(num)\n i = 1\n while i < num\n \n if i % 3 == 0 && i % 5 == 0\n p \"Fizzbuzz! nums is #{i}\"\n elsif i % 3 == 0\n p \"Fizz! num is #{i}\"\n elsif i % 5 == 0\n p \"Buzz! num is #{i}\"\n end\n i+= 1\n end\n\nend", "def determine_fizz_buzz (num)\n if num % 3 == 0 and num % 5 == 0 and num != 0\n puts \"#{num} is FIZZ BUZZ\"\n elsif num % 5 == 0 and num != 0\n puts \"#{num} is BUZZ\"\n elsif num % 3 == 0 and num != 0\n puts \"#{num} is FIZZ\"\n else\n puts \"#{num} is boring...\"\n end\nend", "def fizzbuzz(num_1, num_2, range)\n #set range of numbers for fizzbuzz\n (1..range).each do |i|\n #set initial condition\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n #set alternate condition\n elsif i % num_1 === 0\n puts 'fizz'\n #set alternate condition\n elsif i % num_2 === 0\n puts 'buzz'\n #set else condition\n else\n puts i\n #close if-statement\n end\n #close .each method\n end\n#close fizzbuzz\nend", "def fizzbuzz(number)\n\t\n\tif number % 3 == 0 && number % 5 == 0\n\t\tputs \"FizzBuzz\"\n\n\telsif number % 3 == 0\n\t\tputs \"Fizz\"\n\t\n\telsif number % 5 == 0\n\t\tputs \"Buzz\"\n\n\telse \n\t\tputs number\n\tend\n\nend", "def fizzbuzz(number)\n\n if number % 3 == 0 && number % 5 == 0\n puts \"Fizzbuzz\"\n\n elsif number % 3 == 0 \n puts \"Fizz\"\n \n elsif number % 5 == 0\n puts \"Buzz\"\n \n end\n\nend", "def fizzbuzz(array)\n\tfor num in array\n\t\tif num % 15 == 0\n\t\t\tputs \"fizzbuzz\"\n\t\telsif num % 3 == 0\n\t\t\tputs \"fizz\"\n\t\telsif num % 5 == 0\n\t\t\tputs \"buzz\"\n\t\telse \n\t\t\tputs num.to_s\n\t\tend\n\tend\nend", "def fizzbuzz (int)\n if int % 15 == 0 \n \"FizzBuzz\"\n\n elsif int % 5 == 0 \n \"Buzz\"\n \n \nelsif int % 3 == 0\n \"Fizz\"\n else \n \n end \n end", "def print_list(limit)\n\n 1.upto(limit) do |number|\n\n if divisible_by?(15, number)\n puts \"Fizzbuzz\"\n\n elsif divisible_by?(3, number)\n puts \"Fizz\"\n\n elsif divisible_by?(5, number)\n puts \"Buzz\"\n\n else\n puts number\n\n end\n end\nend", "def fizz_buzz number\n if number % 15 == 0\n \"FizzBuzz\"\n elsif number % 5 == 0\n \"Buzz\"\n elsif number%3 == 0\n \"Fizz\"\n else\n number\n end\nend", "def fizzbuzz(num_1, num_2, range)\n (1..range).each do |i|\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n elsif i % num_1 === 0\n puts 'fizz'\n elsif i % num_2 === 0\n puts 'buzz'\n else\n puts i\n end\n end\nend", "def fizzbuzz(num_1, num_2, range)\n #calls alll numbers in range to each do variable |i|\n (1..range).each do |i|\n # begins if else statement if i can be divided by num_1 and if i divided by num_2\n if i % num_1 === 0 && i % num_2 === 0\n # 'fizzbuzz' is printed to terminal\n puts 'fizzbuzz'\n #if the above is not true i will be checked if divisble by num_1\n elsif i % num_1 === 0\n # if true 'fizz' will be printed to the terminal\n puts 'fizz'\n # checks if i can be divided by num_2\n elsif i % num_2 === 0\n # if true 'buzz' is printed to the terminal\n puts 'buzz'\n #if none of the above is true\n else\n # the variable i is printed to the terminal\n puts i\n #ends if else statement\n end\n #ends range.each do\n end\n #ends method\nend", "def fizzbuzz(number)\n if number % 3 == 0 && number % 5 == 0\n \"FizzBuzz\"\n elsif number % 3 == 0\n \"Fizz\"\n elsif number % 5 == 0\n \"Buzz\"\n end\nend", "def fizz_buzz\n x=1\n until x > 100 do\n if x%3 == 0 && x%5 !=0\n puts \"Fizz\"\n elsif x%5==0 && x%3 !=0\n puts \"Buzz\"\n elsif x%3 ==0 && x%5==0\n puts \"FizzBuzz\"\n else\n puts x\n end\n x+=1\n end\nend", "def fizzbuzz(number)\n\n if number % 5 == 0 && number % 3 == 0\n \t\"FizzBuzz\"\n elsif number % 5 == 0\n \t\"Buzz\"\n elsif number % 3 == 0\n \t\"Fizz\"\n else\n \tnumber\n end\nend", "def fizz_buzz number\n if number%3 == 0 && number%5 == 0\n return \"FizzBuzz\"\n elsif number%3 == 0\n return \"Fizz\"\n elsif number%5 == 0\n return \"Buzz\"\n else\n return number\n end\nend", "def fizzbuzz(num)\n if num % 3 == 0\n return \"fizz\"\n elsif num % 5 == 0\n return \"buzz\"\n elsif num % 3 ==0 && num % 5 == 0\n return \"fizzbuzz\"\n else\n end\nend", "def fizzbuzz(num_1, num_2, range)\n#iterate throughout the number set\n (1..range).each do |i|\n #boolean, === is exact equals, % is the remainder from division (modulo), && is AND both conditions are met\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n #otherwise, if this exact number is met, put this phrase\n elsif i % num_1 === 0\n puts 'fizz'\n #otherwise, if this exact number is met, put this phrase\n elsif i % num_2 === 0\n puts 'buzz'\n #if all else fails, put i\n else\n puts i\n end\n end\nend", "def fizz_buzz(min, max)\n (min..max).each do |number|\n puts fizz_buzz_calculator(number)\n end\nend", "def fizzbuzz(start, finish)\n (start..finish).each do |x|\n output = case \n when x % 3 == 0 && x % 5 == 0\n 'FizzBuzz'\n when x % 3 == 0\n 'Fizz'\n when x % 5 == 0\n \"Buzz\"\n else x\n end\n \n \n puts output\n end\nend", "def fizzbuzz(num_1, num_2, range)\n # create a for-loop that begins at 1 and runs until the range value is met\n (1..range).each do |i|\n # if the next value in the range is divided by num_1 and is mod 0 (no remainder)\n # and if the next value in the range is divided by num_2 and is mod 0\n if i % num_1 === 0 && i % num_2 === 0\n # display string\n puts 'fizzbuzz'\n # if the next value in the range is divided by num_1 and is mod 0\n elsif i % num_1 === 0\n # display string\n puts 'fizz'\n # if the next value in the range is divided by num_2 and is mod 0\n elsif i % num_2 === 0\n # display string\n puts 'buzz'\n else\n # if none of the previous statements are met, display the next value in the range\n puts i\n # end the if/else statement\n end\n # end the for-loop\n end\n# end the method\nend", "def fizzbuzz(max_val)\n\tcounter = 1\n\twhile (counter <=max_val)\n\t\t\n\t\tif (counter %3 ==0)\n\t\t\tputs \"fizz\"\n\t\tend \n\n\t\tif (counter %5 ==0)\n\t\t\tputs \"buzz\"\n\t\tend\n\t\tif (counter %5 !=0 && counter %3 !=0)\n\t\t\tputs counter \n\t\tend\n\n\t\t# else \n\t\t# \tputs counter \n\t\t# end\n\t\tcounter +=1\n\tend\n\nend", "def fizzbuzz(number)\n if number % 5 == 0 && number % 3 == 0\n return \"FizzBuzz\"\n end\n if number % 3 == 0\n return \"Fizz\"\n end\n if number % 5 == 0\n return \"Buzz\"\n end\nend", "def fizzbuzz(num)\n if(num%15==0)\n return \"fizzbuzz\"\n end\n if(num%3==0)\n return \"fizz\"\n end\n if (num%5==0)\n return \"buzz\"\n end\n return num.to_s\nend", "def fizzbuzz(int)\n if int % 3 == 0 && int % 5 == 0 \n \"FizzBuzz\"\n \n elsif int % 5 == 0 # if the number int is divisible by 5\n \"Buzz\"\n \n # if number is divisible by 3 and 5 print \"FizzBuzz\"\n \n elsif int % 3 == 0 # if the number int is divisible by 3\n \"Fizz\"\n \n end\n end", "def multiples(num)\n# \"each\" loop for each integer\n (1..num).each do |num|\n # numbers that are mulitples of 3 and 5\n if num % 3 == 0 && num % 5 == 0\n puts \"FizzBuzz\"\n # multiples of 5\n elsif num % 5 == 0\n puts \"Buzz\"\n # multiples of 3\n elsif num % 3 == 0\n puts \"Fizz\"\n # if not divisible by 5 or 3, just print number\n else\n puts num\n end\n end\nend", "def fizzbuzz(num)\n if num % 3 == 0 && num % 5 == 0\n \"FizzBuzz\"\n elsif num % 3 == 0\n \"Fizz\"\n elsif num % 5 == 0\n \"Buzz\"\n else\n num\n end\nend", "def fizzbuzz(num)\n if num % 3 == 0 && num % 5 == 0\n \"FizzBuzz\"\n elsif num % 3 == 0\n \"Fizz\"\n elsif num % 5 == 0\n \"Buzz\"\n else\n num\n end\nend", "def fizzbuzz(num)\n if num % 3 == 0 && num % 5 == 0\n \"FizzBuzz\"\n elsif num % 3 == 0\n \"Fizz\"\n elsif num % 5 == 0\n \"Buzz\"\n else\n num\n end\nend", "def fizzbuzz(num)\n if num % 3 == 0 && num % 5 == 0\n \"FizzBuzz\"\n elsif num % 3 == 0\n \"Fizz\"\n elsif num % 5 == 0\n \"Buzz\"\n else\n num\n end\nend", "def fizzbuzz(num)\n if num % 3 == 0 && num % 5 == 0\n \"FizzBuzz\"\n elsif num % 3 == 0\n \"Fizz\"\n elsif num % 5 == 0\n \"Buzz\"\n else\n num\n end\nend", "def fizzbuzz(num)\n if num % 3 == 0 && num % 5 == 0\n \"FizzBuzz\"\n elsif num % 3 == 0\n \"Fizz\"\n elsif num % 5 == 0\n \"Buzz\"\n else\n num\n end\nend", "def fizzbuzz(num_1, num_2, range)\n # starts a counter from 1 to range value\n # for each in that range, print the specified output on\n # these next conditions:\n (1..range).each do |i|\n\n # if the next number in the counter is divisible\n # by both num1 and num2 (with 0 remainder)\n if i % num_1 === 0 && i % num_2 === 0\n # print this specified output\n puts 'fizzbuzz'\n\n # if the next number in the counter is divisible by num1 (with 0 remainder)\n elsif i % num_1 === 0\n # print this specified output\n puts 'fizz'\n\n # if the next number in the counter is divisible by num2 (with 0 remainder)\n elsif i % num_2 === 0\n # print this specified output\n puts 'buzz'\n # if none of these conditions are met,\n else\n # print the next number in the range counter.\n puts i\n # end of conditionals\n end\n # end of each.do loop\n end\n # end of method\nend", "def fizzbuzz(num_1, num_2, range)\n # sets 1 to range (last number) where each number will do the following\n (1..range).each do |i|\n # if the remainder of each number i divided by the first number num_1 should have a zero AND\n # the remainder of each number i divided by the second number num_2 should have a zero\n if i % num_1 === 0 && i % num_2 === 0\n # then print 'fizzbuzz'\n puts 'fizzbuzz'\n # otherwise, if the remainder of number i divdied by num_1 should have a zero\n elsif i % num_1 === 0\n # then print 'fizz'\n puts 'fizz'\n # otherwise, if the remainder of number i divided by num_2 should have a zero\n elsif i % num_2 === 0\n # then print 'buzz'\n puts 'buzz'\n else\n # if all the conditions above are not met, then print the number i\n puts i\n end\n end\nend", "def fizzbuzz(num)\n test_3 = num % 3\n test_5 = num % 5\n \n if test_3 == 0 && test_5 == 0\n \"FizzBuzz\"\n elsif test_3 == 0 && test_5 != 0\n \"Fizz\"\n elsif test_3 != 0 && test_5 == 0\n \"Buzz\"\n end\nend", "def fizzbuzz(int)\n if int % 15 == 0\n return \"FizzBuzz\"\nend\n if int % 3 == 0 # if the number int is divisible by 3\n return \"Fizz\" # Go fizz\nend\n if int % 5 == 0\n return \"Buzz\"\n end\nend", "def Fizz2\r\n\t\t(1..100).each do |x|\r\n\t\t\tstr = [(\"Fizz\" if x % 3 == 0),(\"Buzz\" if x % 5 == 0)].compact.join\r\n\t\t\tif str == \"\" then str << x.to_s end\r\n\t\t\tputs str\t\t\r\n\t\tend\r\n\tend", "def fizzbuzz(num_1, num_2, range)\n#Repeats the following code for the duration of the range argument.\n (1..range).each do |i|\n#If i is divisible by both num_1 and num_2, it displays string fizzbuzz\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#If i is divisible by num_1, it displays string fizz\n elsif i % num_1 === 0\n puts 'fizz'\n#If i is divisible by num_2, it displays string buzz\n elsif i % num_2 === 0\n puts 'buzz'\n#If i isn't divisible by either num_1 or num_2, it displays integer i\n else\n puts i\n#Ends the if, elsif, elsif, else check\n end\n#ends our loop\n end\n#ends our method\nend", "def fizzbuzz(num_1, num_2, range)\n#create a loop that iterates from 1 up to the value of the argument range\n# variable i gets assigned another value after each loop\n (1..range).each do |i|\n# in each iteration, if i is divided by num_1 and has 0 remainder (modulo)\n# AND if i is divided by num_2 and has 0 remainders, 'fizzbuzz' will print out\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n# if condition is not met from above, then if only i divided by num_1 has 0\n#remainder, then only print out 'fizz'\n elsif i % num_1 === 0\n puts 'fizz'\n# Or if only i divided by num_2 has 0 remainder, then only print out 'buzz'\n elsif i % num_2 === 0\n puts 'buzz'\n# if the three conditions above are not true then just print out value of i\n else\n puts i\n end\n #iterate the loop to the next value in the range\n end\n # when all values within the range are finished, end the loop\nend", "def fizzbuzz(start, finish)\n (start..finish).each do |n|\n output = ''\n output << 'Fizz' if (n % 3).zero?\n output << 'Buzz' if (n % 5).zero?\n puts output == '' ? n : output\n end\nend", "def fizzbuzz(number)\n i = 1\n until i > number\n if i % 15 == 0\n puts \"Fizzbuzz for #{i}\"\n elsif i % 3 == 0\n puts \"Fizz for #{i}\"\n elsif i % 5 == 0\n puts \"Bizz for #{i}\"\n end\n i+=1\n end\nend", "def fizzbuzz\n (1..100).map do |i|\n\tif (i % 15).zero?\n\t 'FizzBuzz'\n\telsif (i % 3).zero?\n\t 'Fizz'\n\telsif (i % 5).zero?\n\t 'Buzz'\n\telse\n\t i\n\tend\n end\nend", "def fizzbuzz(x)\n if x % 3== 0 && x % 5== 0\n \"FizzBuzz\"\n \n elsif x % 3 == 0 \n \"Fizz\"\n elsif x % 5 == 0\n \"Buzz\"\n else\n end\nend", "def counter()\n number = gets.chomp\n number = number.to_i\nfor num in 1..number.to_i\n # if num % 15 == 0\n if num % 5 == 0 && num % 3 == 0\n p \"FizzBuzz\"\n elsif num % 5 == 0\n p \"Buzz\"\n elsif num % 3 == 0\n p \"Fizz\"\n else\n p num\n end\nend\nend", "def fizz_buzz(i)\nif i % 3 == 0 && i % 5 == 0\n\t\"fizzbuzz\"\nelsif i % 3 == 0 \n\t \"fizz\"\nelsif i % 5 == 0\n \"buzz\"\nelse\n\t i \n end\nend", "def fizzbuzz(num_1, num_2, range)\n # Declare a function that does the following for each argument (i) beginning at 1 and ending at\n # the range:\n (1..range).each do |i|\n # If the value of i divided by num_1 is an integer AND the value of i divided\n # by num_2 is also an integer, print the value 'fizzbizz' on the next line\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n # If the value of i divided by num_1 is an integer, print 'fizz' on the next line\n elsif i % num_1 === 0\n puts 'fizz'\n # If the value of i divided by num_2 is an integer, print 'buzz' on the next line\n elsif i % num_2 === 0\n puts 'buzz'\n # If none of the above conditions are met, print the value of i on the next line.\n else\n puts i\n end\n end\nend", "def fizzbuzz(n)\n result = []\n (1..n).each do |num|\n if num % 3 == 0 && num % 5 == 0\n result << \"fizzbuzz\"\n elsif num % 3 == 0\n result << \"fizz\"\n elsif num % 5 == 0\n result << \"buzz\"\n else\n result << num\n end\n end\n result\nend", "def fizz_buzz()\n for i in 0..100\n# nested if for multiple of 3 and 5\n if i%3 ==0\n if i%5 ==0\n puts \"FizzBuzz\"\n else \n puts \"Fizz\"\n end\n elsif i%5 ==0\n puts \"Buzz\"\n else\n puts i\n end\n end\nend", "def fizzbuzz(starting, ending)\n result = []\n (starting..ending).each do |num|\n if num % 3 == 0 && num % 5 == 0\n result << \"FizzBuzz\"\n elsif num % 3 == 0\n result << \"Fizz\"\n elsif num % 5 == 0\n result << \"Buzz\"\n else\n result << num\n end\n end\n puts result.join(\", \")\nend", "def multiples\n \tfor n in 1..100\n \t\tif n%3==0 && n%5==0\n \t\t\tputs \"FizzBuzz\"\n \t elsif n%3==0\n \t \tputs \"Buzz\"\n \t else\n \t \tputs n\n \t end\n \tend\nend", "def fizz_buzz num \n counter = 1\n until counter > num \n if (counter % 3) == 0 && (counter % 5) == 0 \n puts \"FizzBuzz #{counter}\"\n elsif (counter % 3) == 0 \n puts \"Fizz #{counter}\"\n elsif (counter % 5) == 0\n puts \"Buzz #{counter}\"\n end\n counter += 1\n end\nend", "def fizzbuzz(num1 , num2)\n result = []\n arr = (num1..num2).to_a\n arr.each do |n|\n if n % 3 == 0 && n % 5 == 0\n result << 'FizzBuzz'\n elsif n % 3 == 0\n result << 'Fizz'\n elsif n % 5 == 0\n result << 'Buzz'\n else\n result << n\n end\n end\n puts result.join(', ')\nend", "def fizzbuzz(num_1, num_2, range)\n#Iterate the process begining at the value \"1\" up to the range argument's value.\n#A new variable i is established, i starts as \"1\" and goes up by 1 up until the range value is hit.\n (1..range).each do |i|\n#Establish a conditional: If i's value can be divided by num1's value with a remainder\n#of 0 AND i's value can also be divided by num2's value with a remainder of 0, print the string 'fizzbuzz' to the terminal\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#If both prongs of the above conditional are not met, but i's value can be divided by num1's value with a remainder 0 then...\n elsif i % num_1 === 0\n#...print the string 'fizz' to the terminal\n puts 'fizz'\n#If neither of the two previous conditionals are met, but i's value can be divided by num2's value with a remainder 0 then...\n elsif i % num_2 === 0\n#...print the string 'fizz' to the terminal\n puts 'buzz'\n#If none of those conditionals were satisfied then...\n else\n#...print the value of i to the terminal\n puts i\n#end the conditional\n end\n#end the iteration\n end\n#end the method\nend", "def fizzbuzz(number)\nif (number%3==0) && (number%5==0)\n \"FizzBuzz\"\nelsif (number%3)==0\n \"Fizz\"\nelsif (number%5)==0\n \"Buzz\"\nelse\n nil\nend\nend", "def fizzbuzz(num)\n i = 0;\n num.times do\n i += 1\n # Check to see if num is a multiple of 3 but not 5\n if (i % 3 == 0 && i % 5 != 0)\n p \"Fizz\"\n # Check to see if num is a multiple of 5 but not 3\n elsif (i % 5 == 0 && i % 3 != 0)\n p \"Buzz\"\n # Check to see if num is a multiple of 3 and 5\n elsif (i % 5 == 0 && i % 3 == 0)\n p \"FizzBuzz\"\n else\n p i\n end\n end\nend", "def fizzbuzz(integer)\n if integer %3 ==0 && integer %5==0\n return \"FizzBuzz\"\nelsif integer % 3 == 0\n return \"Fizz\"\n elsif integer % 5 ==0 \n return \"Buzz\"\n \n end\n end" ]
[ "0.8394218", "0.81584203", "0.8128392", "0.8122503", "0.81006026", "0.8041958", "0.8038834", "0.80252004", "0.8019587", "0.7988418", "0.7980908", "0.7962792", "0.79569644", "0.79488856", "0.7929194", "0.79289824", "0.7915785", "0.7900978", "0.78860044", "0.7875394", "0.7874615", "0.78744006", "0.7867673", "0.7839353", "0.7822701", "0.78226393", "0.778947", "0.77678996", "0.77652884", "0.7764561", "0.7754884", "0.77532953", "0.77505624", "0.7749112", "0.77190983", "0.77160776", "0.7709768", "0.7698066", "0.7687324", "0.76706004", "0.76672524", "0.7661842", "0.76434934", "0.7641838", "0.7641173", "0.7637225", "0.7630465", "0.7624981", "0.7623776", "0.7623024", "0.76028204", "0.7596131", "0.75951785", "0.7585954", "0.7582816", "0.7570317", "0.75695455", "0.7568499", "0.75613934", "0.75503075", "0.7546941", "0.7546115", "0.7545115", "0.75426817", "0.7542323", "0.75418115", "0.7540863", "0.7538073", "0.75356287", "0.75310665", "0.7529519", "0.7529519", "0.7529519", "0.7529519", "0.7529519", "0.7529519", "0.75291085", "0.75244325", "0.7523583", "0.7499194", "0.74830514", "0.74758875", "0.74735445", "0.7468968", "0.74687195", "0.7464251", "0.7460223", "0.74593776", "0.7457742", "0.7453958", "0.74533343", "0.74501395", "0.7448144", "0.7447547", "0.7446983", "0.74455684", "0.7444421", "0.7440955", "0.74385166", "0.7436903" ]
0.803089
7
calcit calculator that can add, subtract, multiply, divide advanced exponents and square roots
def add(x,y) x+y end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc(expr, verbose=false)\n # hash of str: func for operations\n ops_hash = {'+': method(:add), '-': method(:subt),\n '*': method(:mult), '/': method(:div),\n '**': method(:pow), '^': method(:pow)}\n\n # parse expr\n expr.strip!\n expr_arr = expr.split\n\n # check expression validity\n unless check_expr(expr_arr, false)\n return nil\n end\n\n j = 0 # used to track index while handling parens\n\n # find matching parens, then replace parens and contents with result of contents\n while j < (expr_arr.length - 1) do\n # check parens and get nest info. needs to be done inside this loop\n # if not, info fails to match as expression changes\n nest = check_parens(expr_arr)\n unless nest\n return nil\n end\n\n match_j = nil # Initialize match_j so later code can find it\n # find open paren\n if PAIRS.key?(expr_arr[j])\n # find matching close paren\n nest.each do |info_arr|\n if info_arr[2] == j\n match_j = info_arr[3]\n end\n end\n\n # join contents and send to calc\n temp_expr = expr_arr[j+1...match_j].join(' ')\n temp_result = calc(temp_expr, verbose)\n\n # return if internal expression was invalid\n unless temp_result\n return nil\n end\n\n # replace parens and contents with temp result\n expr_arr[j..match_j] = temp_result\n j = 0 # indices got moved and removed, so start from beginning\n else\n j += 1\n end\n end\n\n # If, after dealing with parens, there is only one element, return it\n if expr_arr.length == 1\n return expr_arr[0].to_f\n end\n\n result = 0 # initialize result variable so the return statement can find it\n\n # search for operations in order\n OPS.each do |op_set|\n i = 0\n\n # search expression for current operations\n # if found: calculate, replace, and search from begining of expression\n # else: move to next element in expression\n while i < (expr_arr.length - 1) do\n if op_set.include?(expr_arr[i])\n # find and assign operation and values\n op = expr_arr[i]\n x = expr_arr[i-1]\n y = expr_arr[i+1]\n\n # call appropriate op function\n result = ops_hash[op.to_sym].(x.to_f, y.to_f)\n\n # replace the 3 used elements with the result\n expr_arr[i-1..i+1] = result\n i = 0 # indices got moved and removed, so start from beginning\n\n # print verbose output\n if verbose and not expr_arr.length == 1\n puts expr_arr.join(\" \")\n end\n else\n i += 1\n end\n end\n end\n return result\nend", "def advanced_calc\n puts \"You chose advanced calculator, which operator would you like to use? type 'P' for power or 'S' for square-root? \"\n operator = gets.chomp()\n\n case operator\n when \"P\"\n puts \"Choose your base number? \"\n num1 = gets.chomp()\n puts \"Choose your exponential number? \"\n num2 = gets.chomp()\n sum = (num1.to_f) ** num2.to_f\n puts \"Your answer is #{sum}\"\n display_calculator\n\n when \"S\"\n puts \"Choose your number? \"\n x = gets.chomp().to_f\n if (x < 0)\n puts \"Error, you cannot divide by a negative number\"\n display_calculator\n elsif (x >= 0)\n sum = Math.sqrt(x)\n puts \"Your answer is #{sum}\"\n display_calculator\n end\n end\nend", "def calc\n# print \"Please select (a)dd, (s)ubtract, (m)ultiply, (d)ivide, (p)ower, or (s)quare root: \"\n# operation = gets.chomp.downcase\n case response\n when \"a\"\n \tputs \"You have selected addition. Please enter the first number: \"\n \tnum1 = gets.chomp.to_f\n \tputs \"Please enter the second number: \"\n \tnum2 = gets.chomp.to_f\n \tans = num1 + num2\n \tputs \"#{num1} plus #{num2} equals #{ans}.\"\n when \"s\"\n \tputs \"You have selected subtraction. Please enter the first number: \"\n \tnum1 = gets.chomp.to_f\n \tputs \"Please enter the second number: \"\n \tnum2 = gets.chomp.to_f\n \tans = num1 - num2\n \tputs \"#{num1} minus #{num2} equals #{ans}.\"\n when \"m\"\n \tputs \"You have selected multiplication. Please enter the first number: \"\n \tnum1 = gets.chomp.to_f\n \tputs \"Please enter the second number: \"\n \tnum2 = gets.chomp.to_f\n \tans = num1 * num2\n \tputs \"#{num1} multiplied by #{num2} equals #{ans}.\"\n when \"d\"\n \tputs \"You have selected division. Please enter the first number: \"\n \tnum1 = gets.chomp.to_f\n \tputs \"Please enter the second number: \"\n \tnum2 = gets.chomp.to_f\n \tans = num1 / num2\n \tputs \"#{num1} divided by #{num2} equals #{ans}.\"\n when \"p\"\n \tputs \"You have selected power. Please enter the first number: \"\n \tnum1 = gets.chomp.to_f\n \tputs \"Please enter the power which you would like that to be raised: \"\n \tnum2 = gets.chomp.to_f\n \tans = num1**num2\n \tputs \"#{num1} to the power of #{num2} equals #{ans}.\"\n when \"s\"\n \tputs \"You have selected square root. Please enter the number you would like to know the square root of: \"\n \tnum1 = gets.chomp.to_f\n \tans = Math.sqrt(num1)\n \tputs \"The square root of #{num1} equals #{ans}.\"\n else\n \tputs \"Please try again.\"\n \tcalc\n end\nend", "def test_addition\n test = Calculator.new\n assert_equal(4.0 , test.solve_equation(\"2 2 +\"))\n assert_equal(2.0 , test.solve_equation(\"-2 +\"))\n assert_equal(-18.0 , test.solve_equation(\"-20 +\"))\n end", "def calculate( a, operator, c )\n\tif operator == \"+\"\n\t\ta + c\n\telsif operator == \"-\"\n\t\ta - c\n\telsif operator == \"*\"\n\t\ta * c\n\telsif operator == \"/\"\n\t\ta/c\n\t\t\n\tend\n\t\nend", "def main\n # determine whether to use verbose outpuut\n verbose = false\n if ARGV[0] != nil and ARGV[0].downcase == \"-v\"\n verbose = true\n end\n\n # get input\n puts \"Instructions: enter a mathematical expression using +, -, *, /, **, or (q)uit\"\n puts \"Calculator follows order of operations\"\n puts \"All elements must be separated by spaces\"\n puts \"e.g. ( 4 + 5 ) * 6\"\n print \"Enter an expression: \"\n expr = STDIN.gets.strip\n\n # continue calculating expressions until user quits\n until expr.downcase.start_with?(\"q\")\n # send to calc() and print result\n result = calc(expr, verbose)\n\n if result == nil\n puts \"Please enter a valid expression\"\n puts \"Common error: all elements should be separated by spaces\"\n elsif result % 1 == 0 # print int if result is integer\n puts result.to_i\n else\n puts result\n end\n\n print \"enter another expression, or (q)uit: \"\n expr = STDIN.gets.strip\n end\nend", "def calc()\n\tputs \"Calculator:\"\n\tcalculate = true\n\twhile calculate == true\n\t\tfirst_num = input_num()\n\t\tputs \"> #{first_num}\"\n\t\toperator = input_operator()\n\t\tputs \"> #{first_num} #{operator}\"\n\t\tsecond_num = input_num()\n\t\tputs \"> #{first_num} #{operator} #{second_num}\"\n\t\t\n\t\tif operator == \"+\"\n\t\t\tadd(first_num, second_num)\n\t\telsif operator == \"-\"\n\t\t\tsubtract(first_num, second_num)\n\t\telsif operator == \"*\"\n\t\t\tmultiply(first_num, second_num)\n\t\telsif operator == \"/\" && second_num == 0\n\t\t\tputs \"Division by zero is undefined\"\n\t\telsif operator == \"/\"\n\t\t\tdivide(first_num, second_num)\n\t\telse\n\t\t\tputs \"Error\"\n\t\tend\n\t\tcalculate = leave?()\n\tend\nend", "def advanced_calc\n print \"(p)ower, (s)qrt: \"\n advanced_menu_choice = gets.chomp.downcase\n\n if advanced_menu_choice == 'p'\n \tputs \"Enter the base number:\"\n \tx = gets.chomp.to_i\n \tputs \"Enter the exponent:\"\n \ty = gets.chomp.to_i\n \tputs \"#{x} ^#{y} = #{x ** y}\"\n\n elsif advanced_menu_choice == 's'\n \tputs \"Enter the number you would like the square root of:\"\n \tx = gets.chomp.to_i\n \tputs \"The square root of #{x} is: #{Math.sqrt(x)}\"\n\n else\n \tputs \"Invalid selection\"\n end\nend", "def sum (operator, a, b)\n if operator == \"exponents\"\n a ** b\n elsif operator == \"square root\"\n Math.sqrt(a)\n end\nend", "def calculate(starting_value, operations)\n sum = starting_value\n operations.each do |ops|\n operator = ops[0]\n operand = ops[1]\n \n case operator\n when '+'\n sum += operand \n when '-'\n sum -= operand\n when '*'\n sum *= operand\n when '/'\n sum /=operand\n else \n end\n end \n sum \nend", "def calc(num1, mathop, num2)\n if mathop == \"+\"\n return num1 + num2\n elsif mathop == \"-\"\n return num1 - num2\n elsif mathop == \"*\"\n return num1 * num2\n elsif mathop == \"/\"\n return num1 / num2\n else\n return \"I did not recognize your input, please try again.\"\n end\nend", "def calculate_expressions(expr)\n res = 0\n if expr.count(\"a-zA-Z\") > 0\n res = \"Incorrect expression or Number\"\n else\n while(has_operators?(expr))\n @logger.info \"Expression=#{expr}\"\n part_expr = \"\"\n operator = next_operator(expr)\n @logger.info \"Operator=#{operator}\"\n idx = expr.index(operator)\n val1 = find_prv_operand(expr, idx)\n val2 = find_next_operand(expr, idx)\n res = perform_calc(operator, val1, val2)\n part_expr = \"#{val1}#{operator}#{val2}\"\n @logger.info \"#{part_expr}=#{res}\"\n expr.gsub!(part_expr, res.to_s)\n end\n res = res.round(2)\n end\n res\n end", "def advanced_calc\n print \"(p)ower, (s)qrt: \"\n option_3 = gets.chomp.downcase\n\n if option_3 == \"p\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n print \"Please enter an exponent: \"\n number_2 = gets.chomp.to_i\n puts \"Result: #{number_1} ** #{number_2} = #{number_1 ** number_2}\"\n elsif option_3 == \"s\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n puts \"The square root of #{number_1} is #{Math.sqrt(number_1)}\"\n else\n puts \"That is not a valid option. Please try again.\"\n end\n\nend", "def calculator(operator_active, num1, num2)\n case operator_active\n when \"+\"\n return num1 + num2\n when \"-\"\n return num1 - num2\n when \"*\"\n return num1 * num2\n when \"/\"\n return num1 / num2\n end\nend", "def evalRPN(exp)\n begin\n expr = parseString(exp) # Parse expression into array\n\n stack = Stack.new # stack to keep track of operands\n\n # convert string to int or float\n case expr[0]\n when /\\.{1}/\n stack.push(atof(expr[0]))\n else\n stack.push(atoi(expr[0]))\n end\n\n for i in 1..expr.length\n\n # Addition - perform addition on previous two operands\n if expr[i] == '+' \n stack.push(calc stack.pop, stack.pop, &:+)\n\n # Subtraction - perform subtraction on previous two operands\n elsif expr[i] == '-'\n stack.push(calc stack.pop, stack.pop, &:-) \n\n # Division - perform division on previous two operands\n elsif expr[i] == '/'\n stack.push(calc (stack.pop/1.0), stack.pop, &:/)\n\n # Multiplication - perform mult on previous two operands\n elsif expr[i] == '*'\n stack.push(calc stack.pop, stack.pop, &:*)\n\n # Just a number -- add to stack\n else\n next if expr[i] == nil # dont add nil to stack\n\n case expr[i]\n when /\\.{1}/\n stack.push(atof(expr[i]))\n else\n stack.push(atoi(expr[i]))\n end\n end\n end\n\n # No operator provided\n raise NotEnoughException if stack.size != 1\n \n return stack.pop # Return answer\n\n rescue NotEnoughException => e\n abort(e.mes) # inform user of error\n end\n\nend", "def calculate(starting_value, operations)\n for i in 0...operations.length\n # just in case an unexpected operator is given:\n if '*/+-'.include?(operations[i][0]) == false\n puts 'unexpected operator!'\n break\n end\n \n if operations[i][0] == \"*\"\n starting_value *= operations[i][1]\n elsif operations[i][0] == \"+\"\n starting_value += operations[i][1]\n elsif operations[i][0] == \"-\"\n starting_value -= operations[i][1]\n else\n starting_value /= operations[i][1]\n end\n end\n starting_value\nend", "def basic_calc\n puts Rainbow(\"(a)dd, (s)ubtract, (m)ultiply, (d)ivide\").yellow.inverse\n arithmetic_type = gets.chomp.downcase\n\n case arithmetic_type\n \n when 'a' \n puts \"whats your first number?\"\n response_1 = gets.strip.to_f \n puts \"whats your second number?\"\n response_2 = gets.strip.to_f\n result = response_1 + response_2\n puts \"#{response_1}+#{response_2} = #{result}\"\n\n when 's' \n puts \"whats your first number?\"\n response_1 = gets.strip.to_f \n puts \"whats your second number?\"\n response_2 = gets.strip.to_f\n result = response_1 - response_2\n puts \"#{response_1}-#{response_2} = #{result}\"\n when 'm' \n puts \"whats your first number?\"\n response_1 = gets.strip.to_f \n puts \"whats your second number?\"\n response_2 = gets.strip.to_f\n result = response_1 * response_2\n puts \"#{response_1}*#{response_2} = #{result}\"\n when 'd' \n puts \"whats your first number?\"\n response_1 = gets.strip.to_f \n puts \"whats your second number?\"\n response_2 = gets.strip.to_f\n result = response_1 / response_2\n puts \"#{response_1}/#{response_2} = #{result}\"\n\nend\nend", "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n operation = gets.chomp.downcase\n print \"first number: \"\n a = gets.to_f\n print \"second number: \"\n b = gets.to_f\n \n case operation\n when 'a'\n puts \"#{a + b}\"\n when 's'\n puts \"#{a - b}\"\n when 'm'\n puts \"#{a * b}\"\n when 'd'\n puts \"#{a / b}\"\n else\n puts \"WRONG!!!!!\"\n basic_calc\n end\n\n gets\nend", "def calculate(integer, operator, integer1)\n\tif operator == \"+\"\n\t\tp integer + integer1\n\telsif operator == \"-\"\n\t\tp integer - integer1\n\telsif operator == \"*\"\n\t\tp integer * integer1\n\telsif operator == \"/\"\n\t\tp integer / integer1\n\telse\n\t\tp \"I'm sorry that's not a valid equation!\"\n\t\t\n\tend\nend", "def math_eval(str)\n # iterate over string values\n # perhaps utilize a queue till you hit a symbol?\n # left operand and right operand (do we care about order of operations?)\n copy = str\n total = 0\n tokens = []\n\n copy.chars.each_with_index do |ch, idx|\n if ch == '*' || ch == '/' || ch == '+' || ch == '-'\n divided = str.split(ch)\n tokens << divided.shift.to_i\n tokens << ch\n copy = divided\n end\n if idx == copy.length - 1\n tokens << copy\n end\n # break if ch.match(/()+\\-*/) && operator != ''\n # operator = ch.match(/()+\\-*/)\n # left_operand = ch if ch.match(/0-9/) && operator == ''\n # right_operand += ch if ch.match(/0-9/) && operator != ''\n end\n return tokens\n\n p \"operator: #{operator}, left_operand: #{left_operand}, right_operand: #{right_operand}\"\n return left_operand.to_i if operator == ''\n return left_operand.to_i + right_operand.to_i if operator == '+'\n return left_operand.to_i - right_operand.to_i if operator == '-'\n return left_operand.to_i / right_operand.to_i if operator == '/'\n return left_operand.to_i * right_operand.to_i if operator == '*'\nend", "def calculator(num1, num2)\n\treturn num1 + num2, num1 - num2, num1 * num2, num1 / num2\nend", "def operation(x)\n Math.sqrt(x.abs) + 5 * x ** 3\nend", "def calculate(op, x, y)\n case op\n when 'plus'\n x.to_f + y.to_f\n when 'minus'\n x.to_f - y.to_f\n when 'divide'\n x.to_f / y.to_f\n when 'multiple'\n x.to_f * y.to_f\n end\nend", "def calculator\n #ask user method\n puts \"What calculation would you like to do? (add, sub, mult, div)\"\n calc_type = gets.chomp\n\n #ask for first number\n puts \"What is number 1? where result = num_1 operator num_2\"\n num_1 = gets.chomp\n num_1 = num_1.to_f\n\n #ask for second number\n puts \"What is number 2?\"\n num_2 = gets.chomp\n num_2 = num_2.to_f\n\n # do calculation using num_1, num_2, calc_type\n if calc_type == \"add\"\n result = num_1 + num_2\n elsif calc_type == \"sub\" \n result = num_1 - num_2\n elsif calc_type == \"mult\" \n result = num_1 * num_2\n else\n result = num_1.to_f / num_2.to_f\n end\n #return result\n puts \"#{result}\"\n return result\n\nend", "def my_calculate(*params)\n\n puts \"\\nStarting....\"\n\n operations = {}\n operands = []\n\n \n params.reverse.each do |p|\n\n puts \"param p is #{p.inspect}. Its class is #{p.class}\"\n\n #determine what p is\n operations = p if p.is_a?(Hash)\n operands << p if p.is_a?(Fixnum)\n\n end\n\n # perform operations\n\n #check the default operation\n if operations.size == 0\n\n puts \"\\n Performing add... for default operation\"\n result = my_add(operands)\n puts \"Result is #{result}.\"\n\n else\n\n operations.each do | key, val|\n \n if val == true \n if key == :add\n puts \"\\n Performing add...\"\n result = my_add(operands)\n puts \"Result is #{result}.\"\n \n elsif key == :subtract\n puts \"\\n Performing subtract...\"\n result = my_subtract(operands)\n puts \"Result is #{result}.\"\n \n elsif key == :multiply\n puts \"\\n Performing multiply...\"\n result = my_multiply(operands)\n puts \"Result is #{result}.\"\n \n elsif key == :divide\n puts \"\\n Performing divide...\"\n result = my_divide(operands)\n puts \"Result is #{result}.\"\n \n else\n puts \"Unknow operation #{key}. It is ignored.\"\n \n \n end\n end\n \n \n end\n end\n \nend", "def perform_calc(opr, val1, val2)\n result = 0\n case opr\n when '*'\n result = val1.to_f * val2.to_f\n when \"/\"\n result = val1.to_f / val2.to_f\n when \"+\"\n result = val1.to_f + val2.to_f\n when \"-\"\n result = val1.to_f - val2.to_f\n end\n result.round(2)\n end", "def display_advanced_operators\n puts \"Please select an Advanced operation type: \\n (E)xponent \\n (S)quare root\"\n print \"> \"\n advanced_operation = gets.chomp.downcase\n case advanced_operation\n when 'e'\n puts \"Exponent selected\"\n print \"Please enter the base value that needs to be multiplied: \"\n base = gets.chomp.to_i\n if base > 0\n print \"Please enter the exponent value that needs to be applied to the base: \"\n power = gets.chomp.to_i\n puts \"Total #{base**power}\"\n else\n \"Please enter a value greater than zero for the calculation.\"\n end\n when 's'\n puts \"Square root selected\"\n print \"Please enter a value to determine the square root: \"\n sq_value = gets.chomp.to_f\n puts \"Total #{Math.sqrt(sq_value)}\"\n else\n puts \"I didn't recognise your selection. Please only pick an Advanced operation type: \\n (E)xponent \\n (S)quare root \\n > \"\n end\nend", "def calculator \n valid_operations = [\"add\",\"+\",\"subtract\",\"-\",\"multiply\",\"*\",\"divide\",\"/\"]\n \n # ask user for math operations \n # check if operation is valid and if not ask for a new input \n puts \"What is the math operation?\"\n operation = gets.chomp.strip.downcase \n until valid_operations.include?(operation)\n puts \"Please enter a valid operation\"\n operation = gets.chomp\n end \n \n \n # ask user for numbers and input validation \n puts \"What is the first number for the math operation?\"\n number_one = gets.chomp.strip\n number_one = check_number(number_one)\n puts \"What is the seccond number for the math operation?\"\n number_two = gets.chomp.strip\n number_two = check_number(number_two)\n \n # use user input to do math operations \n if operation == \"add\" || operation == \"+\"\n result = number_one + number_two \n operation = \"+\"\n elsif operation == \"subtract\" || operation == \"subtract\"\n result = number_one - number_two \n operation = \"-\"\n elsif operation == \"multiply\" || operation == \"*\"\n result = number_one * number_two \n operation = \"*\"\n elsif operation == \"divide\" || operation == \"/\"\n result = number_one / number_two \n operation = \"/\"\n \n end \n \n \n # display result of calculation to user \n puts \" #{number_one} #{operation} #{number_two} = #{result}\"\nend", "def basic_calc\n print Rainbow(\"\\n(a)\").white+Rainbow(\"dd \").green+Rainbow(\"(s)\").white+Rainbow(\"ubtract \").green+Rainbow(\"(m)\").white+Rainbow(\"ultiply \").green+Rainbow(\"(d)\").white+Rainbow(\"ivide \").green\n choice = gets.chomp.to_s\n print Rainbow(\"\\nfirst number: \").blue\n first = gets.chomp.to_f\n print Rainbow(\"second number: \").blue\n second = gets.chomp.to_f\n case choice[0].downcase\n when \"a\"\n print Rainbow(\"\\n#{first} + #{second} = \").blue + Rainbow(\"#{first + second}\\n\\n\").white\n when \"s\"\n print Rainbow(\"\\n#{first} - #{second} = \").blue + Rainbow(\"#{first - second}\\n\\n\").white\n when \"m\"\n print Rainbow(\"\\n#{first} 8 #{second} = \").blue + Rainbow(\"#{first * second}\\n\\n\").white\n when \"d\"\n print Rainbow(\"\\n#{first} / #{second} = \").blue + Rainbow(\"#{(first / second).rounf(5)}\\n\\n\").white\n when \"q\"\n menu\n else \n print Rainbow(\"\\nYou are doing it \").green + Rainbow(\"WRONG\\n\").red\n basic_calc\n end\nend", "def arithmetic_ops\n puts \"Enter first number:\"\n num1 = gets.to_i\n puts \"Enter the second number:\"\n num2 = gets.to_i\n\n puts \"#{num1} + #{num2} = #{num1 + num2}\" \n puts \"#{num1} - #{num2} = #{num1 - num2}\" \n puts \"#{num1} * #{num2} = #{num1 * num2}\" \n puts \"#{num1} / #{num2} = #{num1 / num2}\" \n puts \"#{num1} % #{num2} = #{num1 % num2}\" \n puts \"#{num1} ** #{num2} = #{num1 ** num2}\"\n \nend", "def math(operator, first_num, second_num)\n if operator ==\"*\"\n first_num*second_num\n elsif operator == \"/\"\n first_num/second_num\n elsif operator == \"+\"\n first_num+second_num\n else\n first_num-second_num\n end\nend", "def postfix_evaluator(equation)\n stack = []\n for i in equation do\n if str_to_num(i)\n stack.push(str_to_num(i))\n puts stack\n elsif (\"+-*/\").include?(i)\n second_num = stack.pop\n if stack != []\n first_num = stack.pop\n result = math(i, first_num, second_num)\n stack.push(result)\n else\n raise \"Not enough arguments\"\n end\n else\n raise \"Invalid number\"\n end\n end\n stack.pop()\nend", "def calculator_method(number_one, operator, number_two)\n if operator == \"+\"\n return result = number_one + number_two\n elsif operator == \"-\"\n return result = number_one - number_two\n elsif operator == \"*\"\n return result = number_one * number_two\n else operator == \"/\"\n return result = number_one / number_two\n end\nend", "def calc(expr)\n expr.split.each_with_object([]) { |e, a|\n if e.match(/\\d+/)\n a << e.to_f\n else\n y, x = a.pop, a.pop\n a << x.send(e, y)\n end\n }.last || 0\nend", "def single_input_calc\n puts \"What would you like to calculate? - enter first number then operator then second number.\"\n to_calc = gets.strip\n arr = to_calc.split\n first_num = arr[0].to_i\n op = arr[1].to_s\n second_num = arr[2].to_i\n string_result = first_num.public_send(op, second_num)\n puts \"The result is: #{string_result}\"\n @arr_results << {first_number: first_num, modifier: op, second_number: second_num, result: string_result}\n end", "def basic_calculator\n print \"Do you wish to add, subtract, multiply or divide?: \"\n operation = gets.chomp.downcase\n\n if operation == \"add\"\n formula\n puts (@first_num + @second_num)\n elsif operation == \"subtract\"\n formula\n puts (@first_num - @second_num)\n elsif operation == \"multiply\"\n formula\n puts (@first_num * @second_num)\n elsif operation == \"divide\"\n formula\n puts (@first_num / @second_num)\n else\n puts \"Invalid selection.\"\n end\n end", "def calculator(op, num1, num2)\n if op == \"add\" || op == \"+\" || op == \"addition\"\n return num1 + \" + \" + num2 + \" = #{add(num1.to_i, num2.to_i)}\"\n elsif op == \"subtract\" || op == \"-\" || op == \"subtraction\"\n return num1 + \" - \" + num2 + \" = #{sub(num1.to_i, num2.to_i)}\"\n elsif op == \"multiply\" || op == \"*\" || op == \"multiplication\"\n return num1 + \" * \" + num2 + \" = #{mult(num1.to_i, num2.to_i)}\"\n elsif op == \"divide\" || op == \"/\" || op == \"division\"\n return num1 + \" / \" + num2 + \" = #{div(num1.to_i, num2.to_i)}\"\n elsif op == \"modulo\" || op == \"remainder\" || op == \"%\"\n return num1 + \" % \" + num2 + \" = #{mod(num1.to_i, num2.to_i)}\"\n else op == \"exponent\" || op == \"^\"\n return num1 + \"^\" + num2 + \" = #{exponent(num1.to_i, num2.to_i)}\"\n end\nend", "def eval_math(string)\n number_stack = []\n operator_stack = []\n tokens = string.split(\" \")\n tokens.each_with_index do |n, i|\n if n == \"*\" \n number_stack << number_stack.pop.to_i * tokens[i+1].to_i\n tokens.delete_at(i+1)\n elsif n == \"/\" \n number_stack << number_stack.pop.to_i / tokens[i+1].to_i\n tokens.delete_at(i+1)\n elsif ['+','-'].include? n\n operator_stack << n\n else\n number_stack << n\n end\n puts \"evaling n: #{n}, number_stack #{number_stack} operator_stack #{operator_stack}\"\n end\n result = 0\n operator_stack.each do |o|\n if o == '+'\n number_stack[0] = number_stack.first.to_i + number_stack.delete_at(1).to_i\n end\n if o == '-'\n number_stack[0] = number_stack.first.to_i - number_stack.delete_at(1).to_i\n end\n end\n\n return number_stack[0]\n\nend", "def calc(*args)\n calculate = args.join().gsub(/[^\\d()+\\-*\\/.]/, '')\n # eval() rescue nil will NOT work, because it only catches subclasses\n # of the StandardError class\n begin\n eval(calculate)\n rescue Exception => exc\n nil\n end\n end", "def calculation(choice, num1, num2)\n\n if choice == \"add\"\n return num1 + num2\n\n elsif choice == \"subtract\"\n return num1 - num2\n\n elsif choice == \"multiply\"\n return num1 * num2\n\n elsif choice == \"divide\"\n return num1 / num2\n\n elsif choice == \"exponent\"\n return num1 ** num2\n\n elsif choice == \"square\"\n return Math.sqrt(num1)\n end\nend", "def calculate(x, operator, y)\n\t# lots of ways to do the below part ...\n\t# if/elsif would have worked,\n\t# as would a case statement\n\treturn x + y if operator == '+'\n\treturn x - y if operator == '-'\n\treturn x * y if operator == '*'\n\treturn x / y if operator == '/'\nend", "def basic_calc\n puts \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: enter a, s, m, or d; quit to quit\"\n basic_functions = gets.chomp\n while basic_functions != \"quit\"\n if basic_functions == \"a\"\n puts \"Enter first number\"\n add1_int = gets.chomp\n puts \"Enter second number\"\n add2_int = gets.chomp\n puts \"Equals\"\n puts add1_int + add2_int\n puts \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: enter a, s, m, or d; quit to quit\"\n puts basic_functions = gets.chomp\n end\n if basic_functions == \"s\"\n puts \"Enter first integer\"\n sub1_int = gets.chomp.to_i\n puts \"Enter second integer\"\n sub2_int = gets.chomp.to_i\n puts \"Equals\"\n puts sub1_int - sub2_int\n puts \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: enter a, s, m, or d; quit to quit\"\n puts basic_functions = gets.chomp\n end\n if basic_functions == \"m\"\n puts \"Enter first integer\"\n mult1_int = gets.chomp.to_i\n puts \"Enter second integer\"\n mult2_int = gets.chomp.to_i\n puts \"Equals\"\n puts mult1_int * mult2_int\n puts \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: enter a, s, m, or d; quit to quit\"\n puts basic_functions = gets.chomp\n\n end\n if basic_functions == \"d\"\n puts \"Enter first integer\"\n div1_int = gets.chomp.to_i\n puts \"Enter second integer\"\n div2_int = gets.chomp.to_i\n puts \"Equals\"\n puts div1_int / div2_int\n puts \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: enter a, s, m, or d; quit to quit\"\n puts basic_functions = gets.chomp\n\n end\n end\nend", "def do_math(operand, val1, val2)\n case operand\n when \"+\"\n val1 + val2\n when \"-\"\n val1 - val2\n when \"*\"\n val1 * val2\n when \"/\"\n val1 / val2\n end\nend", "def calculate(input)\n\tUTIL::Log.debug(\"processing: #{input}\")\n expr = @scanner.tokenize(input)\n\tUTIL::Log.debug(\"tokenized expression: #{expr}\")\n postfix_expr = @translate.to_postfix(expr)\n\tUTIL::Log.debug(\"postfix expression: #{postfix_expr}\")\n result = @calc.eval(postfix_expr)\n UTIL::Log.debug(\"result: #{result}\")\n\tresult\n end", "def exponent_plus(num1, num2)\n total = (num1 ** 2) + num2\n return total\nend", "def evaluate(expression)\n \texpr = tokens(expression)\n \tret = 0\n values = [] #Values stores the results from each operation\n \texpr.each do |element|\n \t\tif(element.is_a?(Fixnum))\n \t\t\tpush(element)\n \t\telse\n \t\t\tcase element\n \t\t\twhen :+\n #If numbers is empty, use the last two numbers in values \n #as the operands.\n #Implemented this in order for the \"1 2 3 * + 4 5 - /\" example\n #to pass. Kept getting the error that @numbers was empty\n if(@numbers.empty?)\n num1 = values.pop\n num2 = values.pop\n ret = num2 / num1\n break \n else \n \t\t\t\t ret = plus\n values << ret\n end\n \t\t\twhen :-\n if(@numbers.empty?)\n num1 = values.pop\n num2 = values.pop\n ret = num2 / num1\n break \n else\n \t\t\t\t ret = minus\n values << ret\n end\n \t\t\twhen :*\n if(@numbers.empty?)\n num1 = values.pop\n num2 = values.pop\n ret = num2 / num1\n break \n else\n ret = times\n values << ret\n end\n \t\t\twhen :/\n if(@numbers.empty?)\n num1 = values.pop\n num2 = values.pop\n ret = num2 / num1\n break\n else\n ret = divide\n values << ret\n end\n \t\t\tend\n \t\tend\n \tend\n\tret\n end", "def calculate(f, a, b)\n if [\"addition\", \"+\"].include?(f)\n add(a, b)\n elsif [\"subtraction\", \"-\"].include?(f)\n subtract(a, b)\n elsif [\"multiplication\", \"*\"].include?(f)\n multiply(a, b)\n elsif [\"division\", \"÷\", \"/\"].include?(f)\n divide(a, b)\n elsif [\"exponent\", \"^\"].include?(f)\n exponent(a, b)\n elsif [\"square root\", \"√\"].include?(f)\n sqr_root(a)\n end\nend", "def evaluate(exp)\n\twhile x = exp =~ /[\\*\\/]/\n\t\tres = 0\n\t\tcase exp[x]\n\t\twhen '*'\n\t\t\tk, p = x-1, \"\"\n\t\t\tnum1, num2 = 0, 0\n\t\t\twhile k >= 0\n\t\t\t\tif exp[k] != '*' && exp[k] != '/' && exp[k] != '+' && exp[k] != '-'\n\t\t\t\t\tp += exp[k]\n\t\t\t\t\tk -= 1\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tnum1 = p.reverse.to_i\n\t\t\tk, p = x+1, \"\"\n\t\t\twhile k < exp.length\n\t\t\t\tif exp[k] != '*' && exp[k] != '/' && exp[k] != '+' && exp[k] != '-'\n\t\t\t\t\tp += exp[k]\n\t\t\t\t\tk += 1\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tnum2 = p.to_i\n\t\t\tres = num1 * num2\n\t\t\tres = res.to_s\n\t\t\texp = exp.sub(/\\d*\\*\\d*/, res)\n\t\twhen '/'\n\t\t\tk, p = x-1, \"\"\n\t\t\tnum1, num2 = 0, 0\n\t\t\twhile k >= 0\n\t\t\t\tif exp[k] != '*' && exp[k] != '/' && exp[k] != '+' && exp[k] != '-'\n\t\t\t\t\tp += exp[k]\n\t\t\t\t\tk -= 1\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tnum1 = p.reverse.to_i\n\t\t\tk, p = x+1, \"\"\n\t\t\twhile k < exp.length\n\t\t\t\tif exp[k] != '*' && exp[k] != '/' && exp[k] != '+' && exp[k] != '-'\n\t\t\t\t\tp += exp[k]\n\t\t\t\t\tk += 1\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tnum2 = p.to_i\n\t\t\tres = num1 / num2\n\t\t\tres = res.to_s\n\t\t\texp = exp.sub(/\\d*\\/\\d*/, res)\n\t\tend\n\tend\n\twhile x = exp =~ /[\\+\\-]/\n\t\tres = 0\n\t\tcase exp[x]\n\t\twhen '+'\n\t\t\tk, p = x-1, \"\"\n\t\t\tnum1, num2 = 0, 0\n\t\t\twhile k >= 0\n\t\t\t\tif exp[k] != '*' && exp[k] != '/' && exp[k] != '+' && exp[k] != '-'\n\t\t\t\t\tp += exp[k]\n\t\t\t\t\tk -= 1\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tnum1 = p.reverse.to_i\n\t\t\tk, p = x+1, \"\"\n\t\t\twhile k < exp.length\n\t\t\t\tif exp[k] != '*' && exp[k] != '/' && exp[k] != '+' && exp[k] != '-'\n\t\t\t\t\tp += exp[k]\n\t\t\t\t\tk += 1\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tnum2 = p.to_i\n\t\t\tres = num1 + num2\n\t\t\tres = res.to_s\n\t\t\texp = exp.sub(/\\d*\\+\\d*/, res)\n\t\twhen '-'\n\t\t\tk, p = x-1, \"\"\n\t\t\tnum1, num2 = 0, 0\n\t\t\twhile k >= 0\n\t\t\t\tif exp[k] != '*' && exp[k] != '/' && exp[k] != '+' && exp[k] != '-'\n\t\t\t\t\tp += exp[k]\n\t\t\t\t\tk -= 1\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tnum1 = p.reverse.to_i\n\t\t\tk, p = x+1, \"\"\n\t\t\twhile k < exp.length\n\t\t\t\tif exp[k] != '*' && exp[k] != '/' && exp[k] != '+' && exp[k] != '-'\n\t\t\t\t\tp += exp[k]\n\t\t\t\t\tk += 1\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tnum2 = p.to_i\n\t\t\tres = num1 - num2\n\t\t\tres = res.to_s\n\t\t\texp = exp.sub(/\\d*\\-\\d*/, res)\n\t\tend\n\tend\n\texp\nend", "def calculator\n puts \"RPN Calculator\"\n calc = []\n input = 0\n while input != 'q'\n operand = ['+','-','*','/']\n print '> '\n input = gets.chomp\n if validate?(input) || operand.include?(input)\n if operand.include?(input)\n operand2 = calc.pop.to_f\n operand1 = calc.pop.to_f\n calc << operate(operand1, operand2, input)\n else\n calc << input\n end\n puts calc.last\n end\n end\nend", "def calculator(x, operator, y)\r\n\r\n\tif ['+', '-', '*', '/'].include? operator\r\n\t\tcalculation = x.send(operator.to_sym, y) #send x to object (operator which has been converted to a symbol) and y. calculation will now = x (operator) y\r\n\telse\r\n\t\tputs \"ERROR! Invalid input. Please try again.\"\r\n\tend\r\n\treturn calculation #previously had this set to 'print' instead of 'return' which was causing issues when needing to print a history of values returned\r\nend", "def calculate_answer(operator, a, b)\n if operator == \"add\"\n a + b \n elsif operator == \"subtract\"\n a - b\n elsif operator == \"multiply\"\n a * b\n elsif operator == \"divide\"\n a / b\n elsif operator == \"exponent\"\n a ** b\n elsif operator == \"modulus\"\n a % b\n end\nend", "def Calculator(leftParam, rightParam, operator)\n\n case operator\n\n when \"+\"\n return leftParam + rightParam;\n when \"*\"\n\n i = 0\n result = 0\n while i < leftParam #2\n result = result + rightParam #@\n i= i + 1\n end\n\n return result\n end\nend", "def calculator(operation, num1, num2)\n \n if [\"+\", \"-\", \"*\" , \"/\"].include?(operation)\n num1.method(operation).(num2)\n else\n puts \"Invalid operation!\"\n nil\n end\nend", "def calc(input)\n LexicalCalculator.calculate(input)\nend", "def do_math(num1, num2, operation)\n case operation\n when '+'\n num1.to_i + num2.to_i\n when '-'\n num1.to_i - num2.to_i\n when '*'\n num1.to_i * num2.to_i\n when '/'\n num1.to_f / num2.to_f\n end\nend", "def calculate(key)\n while key =~ /\\(/ && key =~ /\\)/\n key.gsub!(/\\(([^\\(\\)]+)\\)/) do |calculation|\n calculate(calculation.gsub(/[\\(\\)]/, ''))\n end\n end\n\n (left, op, right) = key.split(/\\s/)\n\n left = (\n left =~ /[^\\d.]/ ? self.fetch(left) : BigDecimal.new(left)\n ) || zero()\n\n right = (\n right =~ /[^\\d.]/ ? self.fetch(right) : BigDecimal.new(right)\n ) || zero()\n\n op = op == \":\" ? \"/\" : op\n op = op == \"x\" ? \"*\" : op\n\n # make sure at least 1 hand is a float\n left *= 1.0 if [left.class, right.class].include?(Fixnum)\n\n value = ( left.send(op, right) ) rescue zero()\n return checked(value)\n end", "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n option_2 = gets.chomp.downcase\n\n if option_2 == \"a\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n print \"Please enter a second number to add: \"\n number_2 = gets.chomp.to_i\n puts \"Result: #{number_1} + #{number_2} = #{number_1 + number_2}\"\n elsif option_2 == \"s\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n print \"Please enter a second number to subtract: \"\n number_2 = gets.chomp.to_i\n puts \"Result: #{number_1} - #{number_2} = #{number_1 - number_2}\"\n elsif option_2 == \"m\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n print \"Please enter a second number to multiply: \"\n number_2 = gets.chomp.to_i\n puts \"Result: #{number_1} x #{number_2} = #{number_1 * number_2}\"\n elsif option_2 == \"d\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n print \"Please enter a second number to divide: \"\n number_2 = gets.chomp.to_i\n puts \"Result: #{number_1} ÷ #{number_2} = #{number_1 / number_2}\"\n else\n puts \"That is not a valid option. Please try again.\"\n end\n\nend", "def calculate\n @equations = self.class.permutate(@inputs, @operators)\n @results = {}\n @equations.each do |eq|\n @results[eq] = eval(eq)\n end\n end", "def advanced_calc\n print \"(p)ower, (s)qrt: \"\n\nend", "def check_operation x, num1, num2\n case x\n when \"+\" then num1 + num2\n when \"-\" then num1 - num2\n when \"*\" then num1 * num2\n when \"/\" then num1 / num2\n when \"exp\" then num1 ** num2\n when \"sqrt\" then Math.sqrt num1\n else \"Invalid operation choosen\"\n end\nend", "def evaluate(ops)\n \t\tops = tokens(ops)\n \t\tmethods = {:+ => Proc.new{plus()}, :- => Proc.new{minus()}, :* => Proc.new{times()}, :/ => Proc.new{divide()}}\n \t\tops.each do |op|\n \t\t\tif methods.has_key?(op)\n \t\t\t\tmethods[op].call\n \t\t\telse\n \t\t\t\tpush(op)\n \t\t\tend\n \t\tend\n \t\tvalue()\n end", "def elegant_calc(expr)\n expr.split.each_with_object([]) { |e, a|\n if e.match(/\\d+/)\n a << e.to_f\n else\n y, x = a.pop, a.pop\n a << x.send(e, y)\n end\n }.last || 0\nend", "def calculator(a,b)\n puts \"The sub of #{a} and #{b} is #{a + b}\"\n puts \"The difference of #{a} and #{b} is #{a - b}\"\n puts \"The multiplication of #{a} and #{b} is #{a * b}\"\n end", "def calculator_method(operator, number_1, number_2)\n case operator\n when \"add\"\n total = number_1 + number_2\n when \"+\"\n total = number_1 + number_2\n when \"subtract\"\n total = number_1 - number_2\n when \"-\"\n total = number_1 - number_2\n when \"multiply\"\n total = number_1 * number_2\n when \"x\"\n total = number_1 * number_2\n when \"*\"\n total = number_1 * number_2\n when \"divide\"\n total = number_1.to_f / number_2.to_f\n when \"/\"\n total = number_1.to_f / number_2.to_f\n end\n return total\nend", "def test_simple_equations\t\t\n \tassert_equal 3\t,Equation.new('2+1').resolve\t\n \tassert_equal 3\t,Equation.new('(2+1)').resolve\t\n \tassert_equal 5\t,Equation.new(' 4 + 1').resolve\n \tassert_equal 21\t,Equation.new(' 4*5 + 1').resolve\n \tassert_equal 21\t,Equation.new(' 4 *5 + 1').resolve\n \tassert_equal 19\t,Equation.new(' 4 *5 + -1 ').resolve\n end", "def calculate(input)\n raise error(\"length is zero!\") unless input.length > 0\n # break input string on whitespace for tokens.\n tokens = input.strip.gsub(/\\(|\\)/,'').split(/\\s+/m)\n tokens.each_with_index do |token, index|\n raise error(\"syntax error at token ##{index + 1} '#{token}'\") unless token =~ /\\d+|[*-\\/+^%]/\n # if this is an operand, add it to the stack\n if token =~ /\\d/\n @stack << token.to_f\n else\n raise error(\"not enough operands at token ##{index + 1} '#{token}'\") if (@stack.length < MIN_TOKENS && @strict)\n # if it is an operator, take the operands off the stack and apply the operator to them\n while @stack.length > 1\n first, second = @stack.pop(MIN_TOKENS)\n @stack << first.send(token, second)\n end\n end\n end\n raise error(\"invalid syntax\") unless @stack.length == 1\n @stack.pop\n end", "def expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n\n\n value = nil\n\n\n a = nil\n b = nil\n\n\n begin\n # at line 9:28: a= mul ( ADD b= mul | SUB b= mul )*\n @state.following.push( TOKENS_FOLLOWING_mul_IN_expression_44 )\n a = mul\n @state.following.pop\n # at line 9:33: ( ADD b= mul | SUB b= mul )*\n while true # decision 1\n alt_1 = 3\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0 == ADD )\n alt_1 = 1\n elsif ( look_1_0 == SUB )\n alt_1 = 2\n\n end\n case alt_1\n when 1\n # at line 10:5: ADD b= mul\n match( ADD, TOKENS_FOLLOWING_ADD_IN_expression_51 )\n @state.following.push( TOKENS_FOLLOWING_mul_IN_expression_55 )\n b = mul\n @state.following.pop\n\n # --> action\n a += b \n # <-- action\n\n\n when 2\n # at line 11:5: SUB b= mul\n match( SUB, TOKENS_FOLLOWING_SUB_IN_expression_63 )\n @state.following.push( TOKENS_FOLLOWING_mul_IN_expression_67 )\n b = mul\n @state.following.pop\n\n # --> action\n a -= b \n # <-- action\n\n\n else\n break # out of loop for decision 1\n end\n end # loop for decision 1\n\n\n # --> action\n value = a \n # <-- action\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n\n end\n\n return value\n end", "def basic_calc\n print Rainbow(\"\\n(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \\n\").yellow\n basic_choice = gets.chomp.downcase\n\n print \"\\nEnter your first number: \" \n first_number = gets.to_f\n print \"\\nEnter your second number: \"\n second_number = gets.to_f\n\n\n case basic_choice[0]\n when \"a\"\n print \"\\n\\t#{first_number} + #{second_number} = \", first_number + second_number, \"\\n\"\n when \"s\"\n print \"\\n\\t#{first_number} - #{second_number} = \", first_number - second_number, \"\\n\"\n when \"m\"\n print \"\\n\\t#{first_number} * #{second_number} = \", first_number * second_number, \"\\n\"\n when \"d\"\n print \"\\n\\t#{first_number} / #{second_number} = \", first_number / second_number, \"\\n\"\n else Rainbow(\"\\nYou're doing it wrong!\".upcase).red\n end\n gets\nend", "def basic_calc\n\tprint \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide:\" \n\tuser_input = gets.chomp\nif user_input == \"a\"\n\tadd\nelsif user_input == \"s\"\n\tsubtract\nelsif user_input == \"m\"\n\tmultiply\nelsif user_input == \"d\"\n\tdivide\n\tend\nend", "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n\nend", "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n\nend", "def calculator\n\tputs \"Hello and welcome to the calculator. If you do not want to use this application, type exit and click the return key\"\n\tputs \"Would you like to add, subtract, multiply, divide, or use exponents?\"\n\tanswer = gets.chomp\n\tif answer == \"multiply\"\n\t\tmultiplication\n\telsif answer == \"add\"\n\t\taddition\n\telsif answer == \"divide\"\n\t\tdivision\n\telsif answer == \"subtract\"\n\t\tsubtraction\n\telsif answer == \"exponents\"\n\t\texponents\n\telse\n\t\tputs \"I am sorry, that is not a computation. Try re-wording what you said and try again.\"\n\tend\nend", "def test_multi\n aval = AvalExpMath.new(\"5 * 2\")\n assert_equal(aval.solve_exp, 10) \n end", "def read_and_calculate\n puts 'Insert the equation'\n entry = gets.chomp\n result = calculate(entry)\n puts result\n end", "def plus \n\t\tif @calculator.empty?\n\t\t\traise \"calculator is empty\"\n\t\telse\n\t\t\tsum = 0\n\t\t\tif @calculator.length == 2\n\t\t\t\twhile @calculator.length != 0 do\n\t\t\t\t\t\tsum += @calculator.last.to_f\n\t\t\t\t\t\t@calculator.pop\n\t\t\t\tend\n\t\t\telse\n\t\t\t\twhile @calculator.length != 1 do\n\t\t\t\t\t\tsum += @calculator.last.to_f\n\t\t\t\t\t\t@calculator.pop\n\t\t\t\tend\n\t\t\tend\n\t\t\t@calculator.push(sum)\n\t\tend\n\tend", "def derive(coefficient, exponent)\n result1 = coefficient * exponent\n result2 = result1.to_s\n result2\n result3 = result2 + 'x'\n result3\n result4 = result3 + \"^\"\n result4\n new_exponent = exponent - 1\n exponent_converted = new_exponent.to_s\n result5 = result4 + exponent_converted\n end", "def _arith(sym, sexp)\n self.eval(car(sexp)) + self.eval(cadr(sexp)) + [sym]\n end", "def calculate(operation, n1, n2)\n if operation == \"add\" || operation == \"+\"\n return \"#{n1} + #{n2} = #{n1+n2}\"\n elsif operation == \"subtract\" || operation == \"-\"\n return \"#{n1} - #{n2} = #{n1-n2}\"\n elsif operation == \"multiply\" || operation == \"*\"\n return \"#{n1} * #{n2} = #{n1*n2}\"\n elsif operation == \"divide\" || operation == \"/\"\n if n2 == 0\n return \"undefined\"\n else\n return \"#{n1} / #{n2} = #{n1/n2}\"\n end\n elsif operation == \"exponent\" || operation == \"^\"\n return \"#{n1} ^ #{n2} = #{n1**n2}\"\n elsif operation == \"modulo\" || operation == \"%\"\n return \"#{n1} % #{n2} = #{n1%n2}\"\n end\nend", "def calc(expression)\n value = 0\n #check that its just numbers and + - * / and () -> no XSS xD\n return {'response'=>'error'} if expr.match(/[^0123456789\\+\\-\\*\\/\\(\\)]/) != nil\n #calculate\n value = eval(expression)\n #return JSON response\n return {'response'=>value}\nend", "def calculator_1(operator, num1, num2)\n # See exercise 36\nend", "def advanced_calc\n puts \"Do you want to raise your first number to a [power] or find it's [sqrt] \"\n print \">\"\n $advanced = gets.chomp\n\n puts \"Alright, now give me some numbers!\"\n print \"> first: \"\n first = gets.chomp.to_i\n\n case $advanced\n when \"power\"\n print \"> second:\"\n second = gets.chomp.to_i\n puts \"\\nanswer: #{first} to the #{second} power is #{first**second}\"\n when \"sqrt\"\n puts \"\\nanswer: The square root is #{Math.sqrt(first)}\"\n else\n puts \"\\nOh crap...how'd that happen...\"\n puts \"I guess you never told me what maths to do...EMBARRASSING\\n\\n\"\n end\nend", "def basic_calc\n\n\n print Rainbow(\"(a)\").green + \"dd, \" + Rainbow(\"(s)\").yellow + \"ubtract, \" + Rainbow(\"(m)\").red + \"ultiply, \" + Rainbow(\"(d)\").cyan + \"ivide: \"\n basic_function = gets.chomp.downcase\n print \"Enter first number: \"\n first_number = gets.chomp.to_f\n print \"Enter second number: \"\n second_number = gets.chomp.to_f\n case basic_function\n when \"a\"\n answer = first_number + second_number\n puts \"Your answer is #{answer}\"\n when \"s\"\n answer = first_number - second_number\n puts \"Your answer is #{answer}\"\n when \"m\"\n answer = first_number * second_number\n puts \"Your answer is #{answer}\"\n when \"d\"\n answer = first_number / second_number\n puts \"Your answer is #{answer}\"\n \n else\n puts \"incorrect\"\n end \ngets\nend", "def operation(operator, num1, num2)\n case operator \n when 1 \n puts \"The operational result is: #{num1.to_f + num2.to_f}\"\n puts \"==> #{num1.to_s} + #{num2.to_s} = #{num1.to_f + num2.to_f}\"\n when 2 \n puts \"The operational result is: #{num1.to_f - num2.to_f}\"\n puts \"==> #{num1.to_s} - #{num2.to_s} = #{num1.to_f - num2.to_f}\"\n when 3\n puts \"The operational result is: #{num1.to_f * num2.to_f}\"\n puts \"==> #{num1.to_s} * #{num2.to_s} = #{num1.to_f * num2.to_f}\"\n else\n puts \"The operational result is: #{num1.to_f / num2.to_f}\"\n puts \"==> #{num1.to_s} / #{num2.to_s} = #{num1.to_f / num2.to_f}\"\n end\nend", "def calculate(s)\n stack = []\n num = 0\n res = 0 # For the on-going result\n sign = 1 # 1 means positive, -1 means negative\n\n s.each_char do |char|\n if char =~ /\\d/\n num = num * 10 + char.to_i\n elsif [\"+\", \"-\"].include?(char)\n res += sign * num\n num = 0\n sign = char == \"+\" ? 1 : -1\n elsif char == \"(\"\n stack << res\n stack << sign\n sign = 1\n res = 0\n elsif char == \")\"\n res += num * sign\n res *= stack.pop\n res += stack.pop\n num = 0\n end\n end\n\n res + num * sign\nend", "def mathy\n print \"what is the first number?\"\n first = gets.chomp.to_i\n\n print \"what is the second number\"\n second = gets.chomp.to_i\n\n puts \"\\n #{first} + #{second} = #{first + second}\\n\n #{first} - #{second} = #{first - second} \\n\n #{first} * #{second} = #{first * second} \\n\n #{first} / #{second} = #{first / second}\"\nend", "def calculate( op, a1, a2 = nil )\n case op\n when :abs; a2\n when :rel; a2\n when :mul; a1 * a2\n when :add; a1 + a2\n when :sub; a1 - a2\n when :inv; a1 * -1\n else 0\n end\n end", "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n basic_menu_choice = gets.chomp.downcase\n\n if basic_menu_choice == 'a'\n \tputs \"Enter the first number you want to add:\"\n \tx = gets.chomp.to_i\n \tputs \"Enter the second number you want to add:\"\n \ty = gets.chomp.to_i\n \tputs \"#{x} + #{y} = #{x + y}\"\n\n elsif basic_menu_choice== 's'\n \tputs \"Enter the first number you want to subtract:\"\n \tx = gets.chomp.to_i\n \tputs \"Enter the second number you want to subtract:\"\n \ty = gets.chomp.to_i\n \tputs \"#{x} - #{y} = #{x - y}\"\n\n elsif basic_menu_choice == 'm'\n \tputs \"Enter the first number you want to multiply:\"\n \tx = gets.chomp.to_i\n \tputs \"Enter the second number you want to multiply:\"\n \ty = gets.chomp.to_i\n \tputs \"#{x} x #{y} = #{x * y}\"\n\n elsif basic_menu_choice == 'd'5\n \tputs \"Enter the first number you want to divide:\"\n \tx = gets.chomp.to_i\n \tputs \"Enter the second number you want to divide by:\"\n \ty = gets.chomp.to_i\n \tputs \"#{x} / #{y} = #{x / y}\"\n\n else\n \tputs \"Invalid selection\"\n end\nend", "def expression\n lterm = term\n loop do\n if accept(:T_PLUS)\n lterm = Addition.new(lterm, term)\n elsif accept(:T_MINUS)\n lterm = Subtraction.new(lterm, term)\n else\n break\n end\n end\n lterm\n end", "def cal_sol(str)\n par1=0\n par2=0\n array = str.split('')\n return str if array.none?(%r{[/*/+-/(/)]})\n while array.any?('(')\n i=1\n while i<array.length\n if array[i]=='(' || array[i]==')'\n par1=par2\n par2=i\n end\n if array[par1]=='(' && array[par2]==')'\n array = (par1!=0 ? array[0..par1-1] : []).concat([cal_sol(array[par1+1..par2-1].join(''))]).concat(array[par2+1..array.length])\n i=par1\n par2=par1-1\n par1=par1-1\n end\n i+=1\n end\n end\n new_string = array.join('')\n numbers= new_string.split(%r{[/*/+-]})\n signs= new_string.split(%r{[^/*/+-]}).join('').split('')\n elements = []\n (numbers.length+signs.length).times do |i|\n if i%2==0\n elements.push(numbers[0])\n numbers.delete_at(0)\n else \n elements.push(signs[0])\n signs.delete_at(0)\n end\n end\n operations = ['/','*','-','+']\n operations.each do |ops|\n i=1\n while i<elements.length-1\n if elements[i]==ops\n new_value= [elements[i-1].to_f, elements[i+1].to_f].inject(ops.to_sym)\n puts new_value\n elements = (i>=2 ? elements[0..i-2] : []).concat([new_value]).concat(elements[i+2..elements.length])\n i-=1\n end\n i+=1\n end\n end\n elements[0].to_s\nend", "def input_equation()\n\tputs \"Hello I'm a calculator\"\n\twhile true\n\t\tputs \"Please input a math equation that has + - * or / (ex. 3 * 5)\"\n\t\tuser_input = gets.strip\n\t\t# remove all spaces from input\n\t\tuser_input = user_input.gsub(/\\s+/, \"\")\n\t\t# Find any characters not 0-9 + - / or *\n\t\tif /[^+\\-\\*\\/0-9]/.match(user_input)\n\t\t\tputs \"Please enter an equation with only numbers seperated by + - / or *\"\n\t\t\t# Make sure equation has only one operator\n\t\telsif /\\A-?\\d+\\D-?\\d+\\z/.match(user_input)\n\t\t\texpression = /\\A-?\\d+\\D-?\\d+\\z/.match(user_input)[0]\n\t\t\treturn expression\n\t\telse\n\t\t\tputs \"Please enter a simple math equation such as \\\"7 / 5\\\"\"\n\t\tend\n\tend\nend", "def advanced_calculator_type\n print \"What would you like to do? Type 1 to find exponents or 2 to find the square root of a number: \"\n selection = gets.to_i\n # puts \"You chose #{selection}\"\n if selection == 1\n \"exponents\"\n elsif selection == 2\n \"square root\"\n else\n \"error\"\n end\nend", "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n command = gets.chomp.downcase\n case command\n when \"a\"\n puts \"Adding, please provide numbers\"\n first_num = inputs\n answer = inputs + first_num\n when \"s\"\n puts \"Subtracting\"\n first_num = inputs\n answer = first - inputs\n when \"m\"\n puts \"Multiplication\"\n first_num = inputs\n answer = first_num * inputs\n when \"d\"\n puts \"Division\"\n first_num = inputs\n answer = first_num/inputs\n else\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n command = gets.chomp.downcase\n end\n return answer\nend", "def calculator\n end_op = \"addition\"\n end_product = 0\n puts \"What is your first number?\"\n numb1 = gets.chomp.to_f\n puts \"What is your operation?\"\n op = gets.chomp\n puts \"What is your second number?\"\n numb2 = gets.chomp.to_f\n puts \"Would you like to add an operation?\"\n add_second = gets.chomp.capitalize\n if add_second.upcase == \"YES\"\n puts \"What is your operation?\"\n op2 = gets.chomp\n puts \"What is your third number?\"\n numb3 = gets.chomp.to_f\n# calculator\n else\n end\n\n # This is normalizing the input, so that the operation is only the lowercase word of the op\n if op == \"+\" || op == \"addition\"\n end_op = \"addition\"\n elsif op == \"-\" || op == \"subtraction\"\n end_op = \"subtraction\"\n elsif op == \"*\" || op == \"multiplication\"\n end_op = \"multiplication\"\n elsif op == \"/\" || op == \"division\"\n end_op = \"division\"\n end\n\n # This does the same as the above section, for the 2nd op\n if op2 == \"+\" || op == \"addition\" || op == \"ADDITION\"\n end_op2 = \"addition\"\n elsif op2 == \"-\" || op == \"subtraction\" || op == \"SUBTRACTION\"\n end_op2 = \"subtraction\"\n elsif op2 == \"*\" || op == \"multiplication\" || op == \"MULTIPLICATION\"\n end_op2 = \"multiplication\"\n elsif op2 == \"/\" || op == \"division\" || op == \"DIVISION\"\n end_op2 = \"division\"\n end\n\n # This operates the first 2 numbers\nif end_op == \"addition\"\n end_product = numb1 + numb2\n elsif end_op == \"subtraction\"\n end_product = numb1 - numb2\n elsif end_op == \"multiplication\"\n end_product = numb1 * numb2\n elsif end_op == \"division\"\n end_product = numb1 / numb2\nend\n\n # This calculates for the 2nd operation and 3rd number\n if add_second.upcase == \"YES\"\n if end_op2 == \"addition\"\n end_product = end_product + numb3\n elsif end_op2 == \"subtraction\"\n end_product = end_product - numb3\n elsif end_op2 == \"multiplication\"\n end_product = end_product * numb3\n elsif end_op2 == \"division\"\n end_product = end_product / numb3\n else\nend\nend\n puts \"Your final answer is #{end_product}.\"\nend", "def exponent(input_number1)\n\texponent = input_number1 ** input_number2\n\tputs \"The exponent of #{input_number1} to the power of #{input_number2} is #{exponent}.\"\n\tputs \"Thank you for using the calculator. Goodbye!\"\nend", "def exponent!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 3)\n\n \n # - - - - main rule block - - - -\n # at line 17:5: ( 'e' | 'E' ) ( '-' )? DECIMAL\n if @input.peek(1) == ?E || @input.peek(1) == ?e\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n # at line 17:15: ( '-' )?\n alt_6 = 2\n look_6_0 = @input.peek(1)\n\n if (look_6_0 == ?-) \n alt_6 = 1\n end\n case alt_6\n when 1\n # at line 17:15: '-'\n match(?-)\n\n end\n decimal!\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 3)\n\n end", "def calculate_answer(operator, a, b)\r\n\r\n if operator == \"add\"\r\n return result= a + b\r\n elsif operator == \"subtract\"\r\n return result = a - b\r\n elsif operator == \"multiply\"\r\n return result = a * b\r\n elsif operator == \"divide\"\r\n return result = a / b\r\n\r\n end\r\n\r\nend", "def calculate_answer(operator, a, b)\n\n if operator == \"add\"\n return result= a + b\n elsif operator == \"subtract\"\n return result = a - b\n elsif operator == \"multiply\"\n return result = a * b\n elsif operator == \"divide\"\n return result = a / b\n\nend", "def exponent!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 37 )\n\n \n # - - - - main rule block - - - -\n # at line 361:12: ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+\n if @input.peek(1) == 0x45 || @input.peek(1) == 0x65\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n # at line 361:22: ( '+' | '-' )?\n alt_14 = 2\n look_14_0 = @input.peek( 1 )\n\n if ( look_14_0 == 0x2b || look_14_0 == 0x2d )\n alt_14 = 1\n end\n case alt_14\n when 1\n # at line \n if @input.peek(1) == 0x2b || @input.peek(1) == 0x2d\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n end\n # at file 361:33: ( '0' .. '9' )+\n match_count_15 = 0\n while true\n alt_15 = 2\n look_15_0 = @input.peek( 1 )\n\n if ( look_15_0.between?( 0x30, 0x39 ) )\n alt_15 = 1\n\n end\n case alt_15\n when 1\n # at line 361:34: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n else\n match_count_15 > 0 and break\n eee = EarlyExit(15)\n\n\n raise eee\n end\n match_count_15 += 1\n end\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 37 )\n\n end", "def expr()\n\n\n begin\n @ruleStack.push('expr')\n # dice.g:52:7: ( mult ( '+' mult | '-' mult )* )\n # dice.g:52:7: mult ( '+' mult | '-' mult )*\n\n #@following.push(FOLLOW_mult_in_expr65)\n mult()\n #@following.pop\n\n\n # dice.g:52:12: ( '+' mult | '-' mult )*\n #catch (:loop1) do\n \twhile true\n \t\talt1 = 3\n \t\tlook_ahead1_0 = input.look_ahead(1).token_type\n \t\tif look_ahead1_0 == 6 \n \t\t alt1 = 1\n \t\telsif look_ahead1_0 == 7 \n \t\t alt1 = 2\n\n \t\tend\n\n \t\tcase alt1\n \t\t\twhen 1\n \t\t\t # dice.g:53:5: '+' mult\n\n \t\t\t match(6, nil) # FOLLOW_6_in_expr73\n\n\n \t\t\t #@following.push(FOLLOW_mult_in_expr75)\n \t\t\t mult()\n \t\t\t #@following.pop\n\n\n\n \t\t\t a, b = @stack.pop, @stack.pop\n \t\t\t dbg \"\\nAdd: #{b} + #{a}\"\n \t\t\t @stack.push(b + a)\n \t\t\t \n\n\n\n \t\t\twhen 2\n \t\t\t # dice.g:58:5: '-' mult\n\n \t\t\t match(7, nil) # FOLLOW_7_in_expr83\n\n\n \t\t\t #@following.push(FOLLOW_mult_in_expr85)\n \t\t\t mult()\n \t\t\t #@following.pop\n\n\n\n \t\t\t a, b = @stack.pop, @stack.pop\n \t\t\t dbg \"\\nSubtract: #{b} - #{a}\"\n \t\t\t @stack.push(b - a)\n \t\t\t \n\n\n\n\n \t\t\telse\n \t\t\t\tbreak\n \t\t\t\t#throw :loop1\n \t\tend\n \tend\n #end\n\n\n\n\n rescue ANTLR::RecognitionException => e\n report_error(e)\n #raise e\n ensure\n @ruleStack.pop\n end\n\n end", "def calculator(operator, *numbers)\n result = 0\n if operator == \"*\"\n result = 1\n else\n result = numbers[0]\n numbers.shift\n end\n\n numbers.each do |arg|\n #result = arg operator.send result\n result = result.send(operator,arg)\n end\n return result\nend", "def doMath(num1, num2, operator)\n # puts \"#{num1} #{operator} #{num2} \"\n case operator\n when \"+\"\n answer = num1 + num2\n when \"-\"\n answer = num1 - num2\n when \"*\"\n answer = num1 * num2\n when \"/\"\n answer = num1 / num2\n else\n answer = nil\n end\n # puts answer\n return answer\nend" ]
[ "0.71008295", "0.685444", "0.6852172", "0.68473864", "0.6801921", "0.6724995", "0.6724113", "0.6704965", "0.6680994", "0.65600675", "0.6534326", "0.6516459", "0.65036166", "0.63788366", "0.6355087", "0.634722", "0.6328821", "0.6307278", "0.62797296", "0.62679684", "0.62663305", "0.62651175", "0.6255354", "0.62508446", "0.6232523", "0.6227191", "0.6226929", "0.6198907", "0.61893046", "0.6175378", "0.61667496", "0.6166096", "0.6160972", "0.61561257", "0.6154566", "0.6145373", "0.6129537", "0.61258775", "0.6121015", "0.6119161", "0.6109127", "0.6105817", "0.6102117", "0.609109", "0.6087956", "0.60855496", "0.60849154", "0.608057", "0.6079399", "0.6076308", "0.6068995", "0.60651606", "0.6055857", "0.6052198", "0.6051947", "0.60519344", "0.60469127", "0.6035998", "0.6033788", "0.6030937", "0.60299665", "0.60284644", "0.60169077", "0.6003806", "0.5996084", "0.5995423", "0.59764117", "0.59758085", "0.5973577", "0.59734434", "0.59734434", "0.5972523", "0.59698063", "0.5968429", "0.5968323", "0.5966917", "0.59596574", "0.59587723", "0.5948292", "0.5944508", "0.59319687", "0.5918928", "0.59129936", "0.59025437", "0.5878082", "0.5876233", "0.5871015", "0.58686256", "0.5862541", "0.5853217", "0.5850927", "0.5848962", "0.5846109", "0.58372295", "0.5822653", "0.58035266", "0.5799668", "0.5797943", "0.5791343", "0.5790889", "0.57892394" ]
0.0
-1
Fetch Wallet list with client's permissions
def get_wallet_permission_all_using_get(opts = {}) data, _status_code, _headers = get_wallet_permission_all_using_get_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wallet_transactions_listing(wallet_id, type)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'application/json',\n 'signature' => signature('', 'get', \"/v1/user/#{wallet_id}/transactions?type=#{type}\"), 'salt' => salt, 'timestamp' => timestamp, 'access_key' => access_key }\n response, msg = rest_client.getCall(\"/v1/user/#{wallet_id}/transactions?type=#{type}\", headers)\n JSON.parse(response)['data'] if response.present?\n rescue StandardError => e\n Rails.logger.error e\n nil\n end", "def get_list_acc\n JSON.parse(curl_get(\"accounts\").body_str)\n end", "def fetch_wallets(funds_type = nil)\n MangoPay.request(:get, url() + \"/wallets/#{funds_type}\")\n end", "def index\n @accounts = current_user.accounts\n @wallet = current_user.wallet\n authorize @accounts\n end", "def wallets\n @wallets ||= ArkEcosystem::Client::API::Wallets.new(@client)\n end", "def index\n @merchant_account_permissions = MerchantAccountPermission.all\n end", "def wallet_payment_sources\n user.wallet_payment_sources.to_a\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n return @account_permissions.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n return @account_grants.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "def list_payment_method\n authorize current_employer\n @payment_methods = current_employer.customers\n end", "def getwalletinfo\n @api.request 'getwalletinfo'\n end", "def index\n @transactions = current_user.wallet.transactions\n\n end", "def index\n @users_wallets = Users::Wallet.all\n end", "def get_wallet_permission_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WalletPermissionApi.get_wallet_permission_all_using_get ...'\n end\n # resource path\n local_var_path = '/wallet_permission'\n\n # query parameters\n query_params = {}\n query_params[:'nucleus_client_id'] = opts[:'nucleus_client_id'] if !opts[:'nucleus_client_id'].nil?\n query_params[:'is_active'] = opts[:'is_active'] if !opts[:'is_active'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'get_latest'] = opts[:'get_latest'] if !opts[:'get_latest'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageWalletPermissionResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WalletPermissionApi#get_wallet_permission_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_accounts(client, options)\n accounts = get_accounts(client, options)\n if accounts.nil?\n return\n end\n\n accounts.each do |acc|\n print_account(acc)\n end\nend", "def listaccounts(minconf = 1)\n @api.request 'listaccounts', minconf\n end", "def listaccounts(minconf = 1)\n coind.listaccounts minconf\n end", "def list_keychains(params: {})\n call :get, '/keychain', params\n end", "def index\n @wallets = Wallet.all\n end", "def index\n @wallets = Wallet.all\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::AccountGrantListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"AccountGrants.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.account_grants.each do |plumbing_item|\n g.yield Plumbing::convert_account_grant_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "def index\n @client_profiles = ClientProfile.all\n\n authorize ClientProfile\n end", "def listaccounts\n return {} unless node.wallet\n accounts = {}\n node.wallet.accounts.each do |a|\n accounts[a.name] = node.wallet.get_balance(a)\n end\n accounts\n end", "def access_list\n\t\tif(MARKETPLACE_MODE_ONLINE_SHOP)\n\t\t\treturn {}\n\t\telse\n\t\t\tacl = self.acl\n\t\t\tacl = {} if(acl.blank?)\n\t\t\tacl[:creator_user_id] = self.user_id\n\t\t\treturn self.acl\n\t\tend\n\tend", "def list_coins\n endpoint = \"#{HOST}/v1/cryptocurrency/map\"\n get(endpoint)\n end", "def wallet\n get 'wallet'\n end", "def index\n @accounts = policy_scope(Account)\n\n render json: @accounts, include: [:user]\n end", "def listreceivedbyaccount(minconf = 1, includeemepty = false)\n request :listreceivedbyaccount, minconf, includeemepty\n end", "def account_trade_list(options)\n sleep 0.25 # rate limit weight of 5, 20 requests/second limit\n request :account, :get, 'myTrades', options\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n return @accounts.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "def list\n response = Tiptaplab.api.make_call(\"users/authorizations\")\n response.keys\n end", "def get_character_list account\n end", "def index\n @cryptotables = Cryptotable.all\n retrieve_data\n end", "def customer_list\n perform_get_request('/customer/list')\n end", "def get_permission_list\n db = open_rds_db();\n result = db.query(\"SELECT * FROM autoretouch.Permission_List\");\n result.each do |row|\n puts row\n end\n db.close();\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n return @account_resources.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "def listings\n authorize! :read, @user\n end", "def fetch_wallets_transactions(filters = {})\n MangoPay.request(:get, url() + \"/transactions\", {}, filters)\n end", "def index\n @wallet_actions = WalletAction.all\n end", "def wallet_history\n get 'walletHistory'\n end", "def guild_perks\r\n BnetApi::make_request('/wow/data/guild/perks')\r\n end", "def index\n @grants =\n if @company\n @company.grants(params[:filter_by], params[:sort_by], params[:desc])\n else\n Grant.kept.order(name: :asc)\n end\n\n headers[\"Total\"] = @grants.count\n headers[\"Per-Page\"] = params[:per_page]\n\n render json: (params[:page] == 'all' ? @grants : paginator(@grants)), has_type: false\n end", "def show_all_loan_entries\n @loans = Loan.disbursed_loans.paginate(page: params[:page], per_page: 2)\n\n authorize AccountingEntry\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::AccountPermissionListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"AccountPermissions.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.permissions.each do |plumbing_item|\n g.yield Plumbing::convert_account_permission_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "def fetch_wallet(funds_type, currency_iso_code)\n MangoPay.request(:get, url() + \"/wallets/#{funds_type}/#{currency_iso_code}\")\n end", "def get_accounts()\n http_get(accounts_url)\n end", "def list\n @keychain.keys\n end", "def listreceivedbyaccount(minconf = 1, includeempty = false)\n coind.listreceivedbyaccount minconf, includeempty\n end", "def index\n @customer = Customer.all\n authorize! :list, @customer\n end", "def apps_permissions_users_list\n return {} unless !skip_info? && is_app_token? && is_not_excluded?\n semaphore.synchronize {\n @apps_permissions_users_list_raw ||= access_token.get('/api/apps.permissions.users.list')\n @apps_permissions_users_list ||= @apps_permissions_users_list_raw.parsed['resources'].inject({}){|h,i| h[i['id']] = i; h}\n }\n end", "def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\t# A filter used to exclude specific types of permissions\n\t\t\tclient.add_param(kparams, 'filter', filter);\n\t\t\t# A limit for the number of records to display on a page\n\t\t\tclient.add_param(kparams, 'pager', pager);\n\t\t\tclient.queue_service_action_call('permission', 'list', 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 show_coins_list\n coins_list(coins)\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 index\n @wallet_transactions = WalletTransaction.all\n end", "def index\n lists = policy_scope(List).includes(:admin).page(page).per(per)\n authorize lists\n json_response(PageDecorator.decorate(lists).as_json(admin: true), :ok)\n end", "def index\n @wallets = Wallet.all\n @user_life = current_seller.user_life\n end", "def index\n @batches = Batch.all\n @batches.each do |batch|\n authorize! :read, batch\n end\n render json: @batches\n end", "def all(params = {})\n @client.make_request(:get, 'carrier_accounts', MODEL_CLASS, params)\n end", "def index\n @authorized_clients = AuthorizedClient.all\n end", "def index\n @permissions = ApiKeyPermission.where(api_key_id: @key.id).order(id: :desc).page params[:page]\n end", "def index\n @ledger_accounts = current_user.ledger_accounts.all\n respond_with @ledger_accounts\n end", "def index\n @ledger_accounts = current_user.ledger_accounts.all\n respond_with @ledger_accounts\n end", "def index\n authorize! :manage, PaymentTier\n @payment_tiers = PaymentTier.all\n end", "def wallet_info\n client.make_request('/wallet-info', 'post', params: {})\n end", "def list\n token = SocialService::Facebook.renew_token(token_params)\n\n accounts =\n SocialService::Facebook\n .accounts(token)\n .reject { |a| a[:id].in?(facebook_account_ids) }\n\n render json: { accounts: accounts }\n end", "def list_items( args={} )\n @session.base_url = \"http://my.cl.ly\"\n \n url = \"/items\"\n args.each do |k, v|\n # probably a nicer way to do this\n if url == \"/items\"\n url << \"?#{k.to_s}=#{v.to_s}\"\n else\n url << \"&#{k.to_s}=#{v.to_s}\"\n end\n end\n resp = @session.get( url )\n \n raise AuthorizationError if resp.status == 401\n Crack::JSON.parse(resp.body)\n end", "def list_licenses\n check_scope!\n licenses = License.\n editable_by(@context).\n eager_load(user: :org).\n includes(:taggings).\n order(:title)\n\n licenses = licenses.where(scope: params[:scopes]) if params[:scopes].present?\n\n render json: licenses, root: \"licenses\", adapter: :json\n end", "def index\n users = policy_scope(User)\n render json: { users: users }\n end", "def index\n @grants = policy_scope(Grant.all)\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('accesscontrol', 'list', 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 merchant_list\n @merchant_list ||= @api.associations\n end", "def list_accounts\n HTTP.headers(:accept => @@accept).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\"#{@@base_url}/users/#{self.guid}/accounts\").parse[\"accounts\"]\n end", "def list(merchant_access_token)\n Requests::ListOrders.new(merchant_access_token: merchant_access_token).\n send_to_api(:get, endpoint_path(:v14))\n end", "def index\n @account_balance_distributions = current_user.get_all('account_balance_distributions')\n end", "def index\n @clienttransactions = current_user.clienttransactions.order(\"id DESC\")\n end", "def get_authorization_list(local_id=nil)\n soap_response = client.request :get_authorization_list do\n soap.header = soap_header\n soap.body = {\"localID\" => local_id} if local_id\n end\n\n @last_request = client.http\n @last_response = soap_response\n end", "def walletlock\n @api.request 'walletlock'\n end", "def customerList(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :from, :count)\n execute(:customerList, options)\n end", "def user_get_wallet_history(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: UserApi#user_get_wallet_history ...\"\n end\n\n # resource path\n path = \"/user/walletHistory\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\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 => 'Array<Transaction>')\n if Configuration.debugging\n Configuration.logger.debug \"API called: UserApi#user_get_wallet_history. Result: #{result.inspect}\"\n end\n return result\n end", "def list_accounts\n\ttp Account.all\nend", "def show\n authorize @accounts\n render json: @account\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 index\n @lcb_access_items = LcbAccessItem.all\n end", "def all_merchant_configs\n profile.merchant_configs\n end", "def index\n @loan_manager_profiles = LoanManagerProfile.all\n authorize LoanManagerProfile\n end", "def index\n @client_policies = ClientPolicy.all\n end", "def retrieve_plan_list\n options = { limit: 100 }\n options[:offset] = @offset if @offset.present?\n ChargeBee::Plan.list(options)\n end", "def index\n @twallets_cs = TwalletsC.all\n end", "def keys\n ::M2X::Client::Key.list(@client, params.merge(device: self[\"id\"]))\n end", "def fetch_syncables\n gh_client.repos.list.select{|repo| repo.permissions.admin}.map(&:full_name)\n end", "def get_merchants\n uri = build_uri_for(@provider)\n p uri\n http = initialize_http(uri)\n\n request = Net::HTTP::Get.new(uri.request_uri)\n JSON( http.request(request).body )\n end", "def index\n @clients = policy_scope(Client)\n end", "def account_list(user)\n (user.account_lists & account_lists).first\n end", "def index\n @accountant_profiles = AccountantProfile.all\n\n authorize AccountantProfile\n end", "def fetch_wallet_name(public_key)\n result = rpc.call('wallet_by_key_api.get_key_references', { 'keys' => [keys['recovery_public']] })\n result&.fetch('wallets', [])&.first&.first\nend", "def get_permission_menu\n @client.raw('get', '/helpers/menu')\n end", "def index\n @utilized_bitcoin_wallets = UtilizedBitcoinWallet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @utilized_bitcoin_wallets }\n end\n end", "def list(q=nil)\n _params = {:q => q}\n return @master.call 'subaccounts/list', _params\n end", "def getacl\n url = prefix + \"getacl\"\n return response(url)\n end", "def listreceivedbyaccount(minconf = 1, includeempty = false)\n @api.request 'listreceivedbyaccount', minconf, includeempty\n end" ]
[ "0.6541657", "0.63796103", "0.63207394", "0.6275381", "0.6209335", "0.6205977", "0.6145387", "0.6141835", "0.6134418", "0.6079305", "0.60259145", "0.6017778", "0.6011842", "0.59754145", "0.5915374", "0.5905679", "0.58748984", "0.5851173", "0.5849543", "0.5849543", "0.5834174", "0.58194894", "0.5809113", "0.5800691", "0.5748796", "0.571259", "0.5693236", "0.5675431", "0.56650275", "0.5659623", "0.5586413", "0.55841273", "0.55835557", "0.5583001", "0.55809516", "0.5573636", "0.5560636", "0.55490524", "0.5548299", "0.5543302", "0.55424803", "0.5542165", "0.55398196", "0.5533786", "0.5521184", "0.5519", "0.5497501", "0.54922354", "0.548944", "0.5472549", "0.5468606", "0.5452608", "0.54501814", "0.54473865", "0.54455477", "0.5443514", "0.5442185", "0.54351044", "0.5433339", "0.5429345", "0.54288477", "0.54288477", "0.5426855", "0.5426823", "0.54185086", "0.5417156", "0.54095507", "0.5397148", "0.5392747", "0.53898036", "0.53873056", "0.53860587", "0.5385718", "0.53843117", "0.5381233", "0.5379339", "0.5373734", "0.53456503", "0.534525", "0.53446966", "0.53383416", "0.5337062", "0.533472", "0.53344387", "0.53338695", "0.5332742", "0.531608", "0.5316056", "0.53114384", "0.5308994", "0.5299797", "0.5292154", "0.5282814", "0.5282733", "0.5279915", "0.52730227", "0.5258892", "0.52555746", "0.52530706", "0.5252635" ]
0.5863406
17
Fetch Wallet list with client&39;s permissions
def get_wallet_permission_all_using_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WalletPermissionApi.get_wallet_permission_all_using_get ...' end # resource path local_var_path = '/wallet_permission' # query parameters query_params = {} query_params[:'nucleus_client_id'] = opts[:'nucleus_client_id'] if !opts[:'nucleus_client_id'].nil? query_params[:'is_active'] = opts[:'is_active'] if !opts[:'is_active'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil? query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil? query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil? query_params[:'get_latest'] = opts[:'get_latest'] if !opts[:'get_latest'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'PageWalletPermissionResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: WalletPermissionApi#get_wallet_permission_all_using_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wallet_transactions_listing(wallet_id, type)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'application/json',\n 'signature' => signature('', 'get', \"/v1/user/#{wallet_id}/transactions?type=#{type}\"), 'salt' => salt, 'timestamp' => timestamp, 'access_key' => access_key }\n response, msg = rest_client.getCall(\"/v1/user/#{wallet_id}/transactions?type=#{type}\", headers)\n JSON.parse(response)['data'] if response.present?\n rescue StandardError => e\n Rails.logger.error e\n nil\n end", "def get_list_acc\n JSON.parse(curl_get(\"accounts\").body_str)\n end", "def fetch_wallets(funds_type = nil)\n MangoPay.request(:get, url() + \"/wallets/#{funds_type}\")\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n return @account_grants.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n return @account_permissions.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "def wallet_payment_sources\n user.wallet_payment_sources.to_a\n end", "def wallets\n @wallets ||= ArkEcosystem::Client::API::Wallets.new(@client)\n end", "def index\n @accounts = current_user.accounts\n @wallet = current_user.wallet\n authorize @accounts\n end", "def getwalletinfo\n @api.request 'getwalletinfo'\n end", "def listaccounts(minconf = 1)\n coind.listaccounts minconf\n end", "def listaccounts(minconf = 1)\n @api.request 'listaccounts', minconf\n end", "def list_keychains(params: {})\n call :get, '/keychain', params\n end", "def list_accounts(client, options)\n accounts = get_accounts(client, options)\n if accounts.nil?\n return\n end\n\n accounts.each do |acc|\n print_account(acc)\n end\nend", "def index\n @merchant_account_permissions = MerchantAccountPermission.all\n end", "def list_payment_method\n authorize current_employer\n @payment_methods = current_employer.customers\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::AccountGrantListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"AccountGrants.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.account_grants.each do |plumbing_item|\n g.yield Plumbing::convert_account_grant_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "def listaccounts\n return {} unless node.wallet\n accounts = {}\n node.wallet.accounts.each do |a|\n accounts[a.name] = node.wallet.get_balance(a)\n end\n accounts\n end", "def list_coins\n endpoint = \"#{HOST}/v1/cryptocurrency/map\"\n get(endpoint)\n end", "def index\n @users_wallets = Users::Wallet.all\n end", "def index\n @transactions = current_user.wallet.transactions\n\n end", "def listreceivedbyaccount(minconf = 1, includeemepty = false)\n request :listreceivedbyaccount, minconf, includeemepty\n end", "def get_wallet_permission_all_using_get(opts = {})\n data, _status_code, _headers = get_wallet_permission_all_using_get_with_http_info(opts)\n data\n end", "def wallet\n get 'wallet'\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n return @accounts.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "def get_character_list account\n end", "def index\n @wallets = Wallet.all\n end", "def index\n @wallets = Wallet.all\n end", "def account_trade_list(options)\n sleep 0.25 # rate limit weight of 5, 20 requests/second limit\n request :account, :get, 'myTrades', options\n end", "def fetch_wallet(funds_type, currency_iso_code)\n MangoPay.request(:get, url() + \"/wallets/#{funds_type}/#{currency_iso_code}\")\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n return @account_resources.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "def index\n @client_profiles = ClientProfile.all\n\n authorize ClientProfile\n end", "def access_list\n\t\tif(MARKETPLACE_MODE_ONLINE_SHOP)\n\t\t\treturn {}\n\t\telse\n\t\t\tacl = self.acl\n\t\t\tacl = {} if(acl.blank?)\n\t\t\tacl[:creator_user_id] = self.user_id\n\t\t\treturn self.acl\n\t\tend\n\tend", "def listreceivedbyaccount(minconf = 1, includeempty = false)\n coind.listreceivedbyaccount minconf, includeempty\n end", "def list_items( args={} )\n @session.base_url = \"http://my.cl.ly\"\n \n url = \"/items\"\n args.each do |k, v|\n # probably a nicer way to do this\n if url == \"/items\"\n url << \"?#{k.to_s}=#{v.to_s}\"\n else\n url << \"&#{k.to_s}=#{v.to_s}\"\n end\n end\n resp = @session.get( url )\n \n raise AuthorizationError if resp.status == 401\n Crack::JSON.parse(resp.body)\n end", "def get_permission_list\n db = open_rds_db();\n result = db.query(\"SELECT * FROM autoretouch.Permission_List\");\n result.each do |row|\n puts row\n end\n db.close();\n end", "def get_accounts()\n http_get(accounts_url)\n end", "def wallet_history\n get 'walletHistory'\n end", "def show_coins_list\n coins_list(coins)\n end", "def show_all_loan_entries\n @loans = Loan.disbursed_loans.paginate(page: params[:page], per_page: 2)\n\n authorize AccountingEntry\n end", "def guild_perks\r\n BnetApi::make_request('/wow/data/guild/perks')\r\n end", "def list\n response = Tiptaplab.api.make_call(\"users/authorizations\")\n response.keys\n end", "def customer_list\n perform_get_request('/customer/list')\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::AccountPermissionListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"AccountPermissions.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.permissions.each do |plumbing_item|\n g.yield Plumbing::convert_account_permission_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "def fetch_wallets_transactions(filters = {})\n MangoPay.request(:get, url() + \"/transactions\", {}, filters)\n end", "def list\n @keychain.keys\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 index\n @accounts = policy_scope(Account)\n\n render json: @accounts, include: [:user]\n end", "def wallet_info\n client.make_request('/wallet-info', 'post', params: {})\n end", "def list\n token = SocialService::Facebook.renew_token(token_params)\n\n accounts =\n SocialService::Facebook\n .accounts(token)\n .reject { |a| a[:id].in?(facebook_account_ids) }\n\n render json: { accounts: accounts }\n end", "def list_accounts\n HTTP.headers(:accept => @@accept).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\"#{@@base_url}/users/#{self.guid}/accounts\").parse[\"accounts\"]\n end", "def fetch_wallet_name(public_key)\n result = rpc.call('wallet_by_key_api.get_key_references', { 'keys' => [keys['recovery_public']] })\n result&.fetch('wallets', [])&.first&.first\nend", "def listings\n authorize! :read, @user\n end", "def index\n @grants =\n if @company\n @company.grants(params[:filter_by], params[:sort_by], params[:desc])\n else\n Grant.kept.order(name: :asc)\n end\n\n headers[\"Total\"] = @grants.count\n headers[\"Per-Page\"] = params[:per_page]\n\n render json: (params[:page] == 'all' ? @grants : paginator(@grants)), has_type: false\n end", "def index\n @cryptotables = Cryptotable.all\n retrieve_data\n end", "def all(params = {})\n @client.make_request(:get, 'carrier_accounts', MODEL_CLASS, params)\n end", "def walletlock\n @api.request 'walletlock'\n end", "def index\n @wallet_actions = WalletAction.all\n end", "def get_authorization_list(local_id=nil)\n soap_response = client.request :get_authorization_list do\n soap.header = soap_header\n soap.body = {\"localID\" => local_id} if local_id\n end\n\n @last_request = client.http\n @last_response = soap_response\n end", "def list(q=nil)\n _params = {:q => q}\n return @master.call 'subaccounts/list', _params\n end", "def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\t# A filter used to exclude specific types of permissions\n\t\t\tclient.add_param(kparams, 'filter', filter);\n\t\t\t# A limit for the number of records to display on a page\n\t\t\tclient.add_param(kparams, 'pager', pager);\n\t\t\tclient.queue_service_action_call('permission', 'list', 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 listreceivedbyaccount(minconf = 1, includeempty = false)\n @api.request 'listreceivedbyaccount', minconf, includeempty\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n return @secret_stores.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "def user_get_wallet_history(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: UserApi#user_get_wallet_history ...\"\n end\n\n # resource path\n path = \"/user/walletHistory\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\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 => 'Array<Transaction>')\n if Configuration.debugging\n Configuration.logger.debug \"API called: UserApi#user_get_wallet_history. Result: #{result.inspect}\"\n end\n return result\n end", "def customerList(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :from, :count)\n execute(:customerList, options)\n end", "def index\n @wallets = Wallet.all\n @user_life = current_seller.user_life\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('accesscontrol', 'list', 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 index\n @customer = Customer.all\n authorize! :list, @customer\n end", "def list(merchant_access_token)\n Requests::ListOrders.new(merchant_access_token: merchant_access_token).\n send_to_api(:get, endpoint_path(:v14))\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 list_ability(pk)\n puts \"\"\n puts \"Abilities:\"\n puts \"\"\n puts pk.abilities\n puts \"\"\n end", "def keys\n ::M2X::Client::Key.list(@client, params.merge(device: self[\"id\"]))\n end", "def get_wallet_key_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WalletKeyApi.get_wallet_key_all_using_get ...'\n end\n # resource path\n local_var_path = '/wallet_key'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'get_latest'] = opts[:'get_latest'] if !opts[:'get_latest'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageWalletKeyResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WalletKeyApi#get_wallet_key_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @lcb_access_items = LcbAccessItem.all\n end", "def index\n @wallet_transactions = WalletTransaction.all\n end", "def list_licenses\n check_scope!\n licenses = License.\n editable_by(@context).\n eager_load(user: :org).\n includes(:taggings).\n order(:title)\n\n licenses = licenses.where(scope: params[:scopes]) if params[:scopes].present?\n\n render json: licenses, root: \"licenses\", adapter: :json\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::AccountListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"Accounts.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.accounts.each do |plumbing_item|\n g.yield Plumbing::convert_account_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::SecretStoreListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"SecretStores.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.secret_stores.each do |plumbing_item|\n g.yield Plumbing::convert_secret_store_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "def list(struct)\n struct.remapkeys!\n if struct.has_key? :user and struct.has_key? :pass\n rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])\n struct.delete(:user)\n struct.delete(:pass)\n else\n rt = RT_Client.new\n end\n val = rt.list(struct)\n rt = nil\n val\n end", "def listMerchants (merchants)\n\tmerchants.each do |merchant|\n\t\tputs \"#{merchant[\"name\"]}\"\n\tend\nend", "def apps_permissions_users_list\n return {} unless !skip_info? && is_app_token? && is_not_excluded?\n semaphore.synchronize {\n @apps_permissions_users_list_raw ||= access_token.get('/api/apps.permissions.users.list')\n @apps_permissions_users_list ||= @apps_permissions_users_list_raw.parsed['resources'].inject({}){|h,i| h[i['id']] = i; h}\n }\n end", "def retrieve_plan_list\n options = { limit: 100 }\n options[:offset] = @offset if @offset.present?\n ChargeBee::Plan.list(options)\n end", "def wallet_summary\n get 'walletSummary'\n end", "def list_accounts\n\ttp Account.all\nend", "def account_list(user)\n (user.account_lists & account_lists).first\n end", "def get_merchants\n uri = build_uri_for(@provider)\n p uri\n http = initialize_http(uri)\n\n request = Net::HTTP::Get.new(uri.request_uri)\n JSON( http.request(request).body )\n end", "def index\n @ledger_accounts = current_user.ledger_accounts.all\n respond_with @ledger_accounts\n end", "def index\n @ledger_accounts = current_user.ledger_accounts.all\n respond_with @ledger_accounts\n end", "def index\n @utilized_bitcoin_wallets = UtilizedBitcoinWallet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @utilized_bitcoin_wallets }\n end\n end", "def show\n authorize @accounts\n render json: @account\n end", "def list_of_accounts_online\n Stripe.api_key = Rails.application.credentials.stripe[Rails.env.to_sym][:secret_key]\n return Stripe::Account.list\n end", "def get_permission_menu\n @client.raw('get', '/helpers/menu')\n end", "def index\n @permissions = ApiKeyPermission.where(api_key_id: @key.id).order(id: :desc).page params[:page]\n end", "def list_api_keys(opts = {})\n @transporter.read(:GET, '/1/keys', {}, opts)\n end", "def merchant_list\n @merchant_list ||= @api.associations\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('accesscontrolprofile', 'list', 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 index\n @account_balance_distributions = current_user.get_all('account_balance_distributions')\n end", "def all_merchant_configs\n profile.merchant_configs\n end", "def fetch(wallet)\n query = { wallet: wallet, balance: { '$gt' => 1e-8 } }\n order = { balance: :desc }\n addresses = find_order_limit(query, order, 50)\n .map { |doc| Entities::Address.create_from(doc) }\n Entities::Wallet.create_from 'id' => wallet, 'name' => name(wallet),\n 'balance' => balance(wallet),\n 'size' => count(wallet),\n 'addresses' => addresses\n end", "def index\n lists = policy_scope(List).includes(:admin).page(page).per(per)\n authorize lists\n json_response(PageDecorator.decorate(lists).as_json(admin: true), :ok)\n end", "def cdb_list(inflate=false)\n rs = Chef::CouchDB.new.list(\"users\", inflate)\n rs[\"rows\"].collect { |r| r[inflate ? \"value\" : \"key\" ]}\n end" ]
[ "0.65433025", "0.6492362", "0.63008475", "0.61963177", "0.61601347", "0.6080165", "0.6070637", "0.6062939", "0.60466075", "0.60067785", "0.5993547", "0.5992091", "0.59845245", "0.5951983", "0.58824986", "0.5865882", "0.58523196", "0.5838608", "0.5821371", "0.58146477", "0.5789353", "0.5772646", "0.57365656", "0.57353204", "0.5711521", "0.569755", "0.569755", "0.56343234", "0.5620343", "0.5616884", "0.561031", "0.5605898", "0.5591793", "0.5578863", "0.5571322", "0.5570721", "0.55658054", "0.55485344", "0.5533265", "0.5532151", "0.55188745", "0.551354", "0.54968435", "0.54941005", "0.5485359", "0.54693013", "0.5468977", "0.5468355", "0.54682595", "0.5462941", "0.5444284", "0.543462", "0.54065096", "0.54011416", "0.5378024", "0.53687185", "0.5360583", "0.5357862", "0.5342939", "0.53429055", "0.53364736", "0.53332114", "0.5329965", "0.5327901", "0.53221", "0.53115255", "0.5311037", "0.5305484", "0.5302169", "0.5292185", "0.5280162", "0.5277078", "0.52731526", "0.52696145", "0.5268537", "0.52683496", "0.52650213", "0.52614206", "0.52535075", "0.5249597", "0.52485025", "0.5246443", "0.5244525", "0.5243433", "0.5242649", "0.5239162", "0.5239162", "0.52298194", "0.52290386", "0.5228727", "0.52255535", "0.5224856", "0.5219668", "0.521666", "0.5216002", "0.5215299", "0.52141184", "0.52126485", "0.51999545", "0.5199599" ]
0.58896345
14
Fetch Wallet's client permissions details
def get_wallet_permission_using_get(wallet_id, opts = {}) data, _status_code, _headers = get_wallet_permission_using_get_with_http_info(wallet_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_permissions_facebook(api_client)\n api_request = 'me?fields=permissions'\n logger.debug2 \"api_request = #{api_request}\"\n begin\n api_response = api_client.get_object(api_request)\n rescue Koala::Facebook::ClientError => e\n e.logger = logger\n e.puts_exception(\"#{__method__}: \")\n raise\n end # rescue\n logger.debug2 \"api_response = #{api_response}\"\n self.permissions = api_response['permissions']['data']\n save!\n self\n end", "def show\n authorize @client_profile\n end", "def index\n @client_profiles = ClientProfile.all\n\n authorize ClientProfile\n end", "def get_permissions\n permissions.keys\n end", "def get_permissions\n permissions.keys\n end", "def get_permission_menu\n @client.raw('get', '/helpers/menu')\n end", "def access_list\n\t\tif(MARKETPLACE_MODE_ONLINE_SHOP)\n\t\t\treturn {}\n\t\telse\n\t\t\tacl = self.acl\n\t\t\tacl = {} if(acl.blank?)\n\t\t\tacl[:creator_user_id] = self.user_id\n\t\t\treturn self.acl\n\t\tend\n\tend", "def get_permission_menu\n return @client.raw(\"get\", \"/helpers/menu\")\n end", "def permission_level(repo, collaborator, options={})\n get \"#{Repository.path repo}/collaborators/#{collaborator}/permission\", options\n end", "def permission_grants\n return @permission_grants\n end", "def getacl\n url = prefix + \"getacl\"\n return response(url)\n end", "def getacl\n url = prefix + \"getacl\"\n return response(url)\n end", "def permissions_info(sco_id, filter = nil)\n res = query(\"permissions-info\", \"acl-id\" => sco_id, \"filter\" => filter)\n\n return res.body\n data = XmlSimple.xml_in(res.body)\n if data['permissions'][0]\n return data['permissions'][0]\n end\n #puts YAML::dump(data)\n# if data[\"sco\"][0]\n# return data[\"sco\"][0]\n# end\n end", "def permissions\n User.do_find_permissions session_id: kb_session_id\n end", "def get_fb_permissions\n if fb_access_token\n @graph = Koala::Facebook::API.new(fb_access_token)\n @graph.get_connections('me', 'permissions') rescue []\n else\n []\n end\n end", "def get_active_permissions\n set_access_token\n if @access_token && !@permissions && set_uid\n # if we don't have permissions set but have an access token\n # grab the user's info\n @rest = Facebook::RestAPI.new(@access_token) \n result = @rest.fql_query(\"select #{all_permissions.join(\",\")} from permissions where uid = #{@uid.to_s}\")\n result.first\n end \n end", "def get_current_privs\n query = @db_connection.query(\"SHOW GRANTS FOR current_user();\")\n query.each { |x| print_line(\"#{x[0]}\") }\n end", "def index\n @merchant_account_permissions = MerchantAccountPermission.all\n end", "def index\n @accounts = current_user.accounts\n @wallet = current_user.wallet\n authorize @accounts\n end", "def get_authorization_permissions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuthorizationApi.get_authorization_permissions ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/authorization/permissions\".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 => 'PermissionCollectionEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuthorizationApi#get_authorization_permissions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def grant_controls\n return @grant_controls\n end", "def permissions\n objects_from_response(Code42::Permission, :get, 'permission')\n end", "def show\r\n authorize! :read, @pb_areainfo\r\n end", "def cap_ids\n CAP_CLIENT.profile_ids\nend", "def list_payment_method\n authorize current_employer\n @payment_methods = current_employer.customers\n end", "def get_wallet_permission_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WalletPermissionApi.get_wallet_permission_all_using_get ...'\n end\n # resource path\n local_var_path = '/wallet_permission'\n\n # query parameters\n query_params = {}\n query_params[:'nucleus_client_id'] = opts[:'nucleus_client_id'] if !opts[:'nucleus_client_id'].nil?\n query_params[:'is_active'] = opts[:'is_active'] if !opts[:'is_active'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'get_latest'] = opts[:'get_latest'] if !opts[:'get_latest'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageWalletPermissionResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WalletPermissionApi#get_wallet_permission_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def permissions(api_key=KillBillClient.api_key, api_secret=KillBillClient.api_secret)\n User.do_find_permissions :session_id => kb_session_id,\n :api_key => api_key,\n :api_secret => api_secret\n end", "def grant_permission\n @attributes[:grant_permission]\n end", "def get_permission_list\n db = open_rds_db();\n result = db.query(\"SELECT * FROM autoretouch.Permission_List\");\n result.each do |row|\n puts row\n end\n db.close();\n end", "def list_authorized?\n authorized_for?(:crud_type => :read)\n end", "def list_authorized?\n authorized_for?(:crud_type => :read)\n end", "def permissions_policy(&block); end", "def retrieve_permissions(file_id)\n\t\t@client ||= api_client()\n\n\t api_result = @client.execute(\n\t :api_method => @drive.permissions.list,\n\t :parameters => { 'fileId' => file_id })\n\t if api_result.status == 200\n\t permissions = api_result.data\n\t permissions.items.each do |perm|\n\t \tif perm['role'] == 'owner'\n\t \t\tRails.logger.info \"Found Permission #{perm['id']}\"\n\t \t\treturn perm['id']\n\t \tend\n\t end\n\t else\n\t Rails.logger.info \"An error occurred: #{api_result.data['error']['message']}\"\n\t end\n\n\t return false\n\tend", "def calendar_permissions\n return @calendar_permissions\n end", "def getAccessInfo()\n @accessInfo\n end", "def getwalletinfo\n @api.request 'getwalletinfo'\n end", "def fetch_granted_permissions(action:, user:, type:, target:, token:)\n permissions = granted_permissions_for_user(user: user, type: type, target: target, token: token)\n @read = permissions.include?('read')\n @create = permissions.include?('create')\n @update = permissions.include?('update')\n @delete = permissions.include?('delete')\n instance_variable_get(\"@#{action}\")\n end", "def permissions_for(game)\n self.permissions.where(\"user_roles.game_id = ?\", game.id)\n end", "def get_permissions_for_user(user)\n get_filtered_policy(0, user)\n end", "def admin_grant_permissions\n @user = User.includes(:perms).find(params[:id])\n authorize @user\n user_perms = current_user.perms\n @perms = user_perms & [Perm.grant_permissions, Perm.modify_templates, Perm.modify_guidance, Perm.use_api, Perm.change_org_details]\n end", "def get_current_permissions()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('permission', 'getCurrentPermissions', 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_merchants\n uri = build_uri_for(@provider)\n p uri\n http = initialize_http(uri)\n\n request = Net::HTTP::Get.new(uri.request_uri)\n JSON( http.request(request).body )\n end", "def getPermissions\n perms = []\n perms.push :disseminate if params[:disseminate_perm] == \"on\"\n perms.push :withdraw if params[:withdraw_perm] == \"on\"\n perms.push :peek if params[:peek_perm] == \"on\"\n perms.push :submit if params[:submit_perm] == \"on\"\n perms.push :report if params[:report_perm] == \"on\" \n perms \n end", "def get_permissions (user, store_name)\n s = \"\"\n [ :read, :write, :delegate ].each do |action|\n s << action.to_s[0, 1] \\\n if @auth_system.authorized?(user, store_name, action)\n end\n s\n end", "def show\n @client = Client.find(params[:id])\n authorize! :read, @client\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end", "def retrieve_policies( resource_name, access_token, realm_uuid, resource_server )\n if resource_name && access_token\n request_policies(\n resource_name,\n access_token,\n realm_uuid,\n resource_server\n )\n else\n nil\n end\n end", "def permissions = {}", "def requester_acls\n RBAC::ACLS.new.create(nil, OWNER_PERMISSIONS)\n end", "def requester_acls\n RBAC::ACLS.new.create(nil, OWNER_PERMISSIONS)\n end", "def permission_grants()\n return MicrosoftGraph::PermissionGrants::PermissionGrantsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def list\n response = Tiptaplab.api.make_call(\"users/authorizations\")\n response.keys\n end", "def get_permissions(poll_path, polls = read_polls_data)\n if signed_in?\n @user.permissions(poll_path, polls)\n else\n []\n end\n end", "def show\n authorize @contract\n end", "def get_withdrawal_info\n # body = {\n # cmd: \"get_withdrawal_info\"\n # }\n\n end", "def get_role_info()\n make_call(NO_TIMEOUT, ABORT_ON_FAIL) { \n @conn.get_role_info(@secret) \n }\n end", "def get_acc_info\n JSON.parse(curl_get(\"/api2/account/info/\").body_str)\n end", "def wallet_payment_sources\n user.wallet_payment_sources.to_a\n end", "def get_permissions\n permissions = Hash.new\n permissions[:CanEditAllTeams] = 1\n permissions[:CanEditAllPlayers] = 2\n permissions[:CanEditAllSeasons] = 3\n permissions[:CanEditAllDivisions] = 4\n permissions[:CanEditAllRatings] = 5\n permissions[:CanEditAllRoles] = 6\n permissions[:CanEditAllPermissions] = 7\n permissions[:CanImport] = 8\n permissions[:CanApproveRatings] = 10\n @permissions = permissions\n end", "def discovery_permissions\n @discovery_permissions ||= [\"edit\",\"discover\",\"read\"]\n end", "def show\n authorize @loan_manager_profile\n end", "def client_info\n self.class.client_info\n end", "def your_project_access_type policy = nil, resource = nil\n unless policy.nil? or resource.nil? or !(policy.sharing_scope == Policy::ALL_SYSMO_USERS)\n unless policy.permissions.empty?\n my_project_ids = if resource.class == Project then [resource.id] else resource.project_ids end\n my_project_perms = policy.permissions.select {|p| p.contributor_type == 'Project' and my_project_ids.include? p.contributor_id}\n access_types = my_project_perms.map(&:access_type)\n return access_types.first if access_types.all?{|acc| acc == access_types.first}\n else\n policy.access_type\n end\n end\n end", "def clients\n if self.is_admin?\n User.where(client_id: self.id)\n else\n raise Unauthorized.new(self)\n end\n end", "def discovery_permissions\n @discovery_permissions ||= %w[edit read]\n end", "def get_access_level request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_access_level_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Identity::AccessContextManager::V1::AccessLevel.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def details\n response = CreateSend.get \"/clients/#{client_id}.json\", {}\n Hashie::Mash.new(response)\n end", "def permission_resources\n %w{roles sites employees classrooms students gapps_org_units}\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n return @account_permissions.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "def permissions\n @resource_permissions\n end", "def index\n @authorized_clients = AuthorizedClient.all\n end", "def permissions\n [\"read_permissions\", \"update_permissions\", \"delete_permissions\"].each do |p|\n perms = self.send(p)\n perm_string = []\n AssetPermission::GROUP.each do |g, v|\n if perms & AssetPermission::GROUP[g] > 0\n perm_string << g\n end\n end\n puts \"#{self.name}: #{p}: #{perm_string.join(',')}\"\n end\n end", "def get_list_acc\n JSON.parse(curl_get(\"accounts\").body_str)\n end", "def index\n @clients = policy_scope(Client)\n end", "def list_permissions\n BrickFTP::API::Permission.all\n end", "def list_permissions\n BrickFTP::API::Permission.all\n end", "def get_authorization_list(local_id=nil)\n soap_response = client.request :get_authorization_list do\n soap.header = soap_header\n soap.body = {\"localID\" => local_id} if local_id\n end\n\n @last_request = client.http\n @last_response = soap_response\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 apps_permissions_scopes_list\n return {} unless is_app_token?\n semaphore.synchronize {\n @apps_permissions_scopes_list ||= (\n r = get('/api/apps.permissions.scopes.list').parsed\n r['scopes'] || {}\n )\n }\n end", "def index\n @client_policies = ClientPolicy.all\n end", "def local_acl\n acl = {\n \"#{self.user.email}\" => (Rails.env.production? && FireCloudClient::COMPUTE_DENYLIST.include?(self.firecloud_project)) ? 'Edit' : 'Owner'\n }\n self.study_shares.each do |share|\n acl[\"#{share.email}\"] = share.permission\n end\n acl\n end", "def show\n authorize RoleCutoff\n end", "def permissions\n return @permissions\n end", "def permissions\n @attributes[:permissions]\n end", "def permissions\n @attributes[:permissions]\n end", "def client_mechanisms\n mechanisms :client\n end", "def show\n set_client_profile(@case)\n\n set_models_permissions\n end", "def authorization\n get_privacy_setting.privacy_level\n end", "def oauth2_permission_scopes\n return @oauth2_permission_scopes\n end", "def all_chanperms\n Ricer::Irc::Chanperm.where(:user_id => self.id)\n end", "def show\n @permissions = @role.permissions\n end", "def fb_permissions\n fb_user = FbGraph::User.new('me', :access_token => self.access_token)\n fb_user.permissions\n end", "def permissions\n attribute_prop(5)\n end", "def get_accounts(client, options)\n # TODO: Add exception handling \n if !options[:application].nil?\n application = client.applications.get options[:application]\n return application.accounts\n elsif !options[:directory].nil?\n directory = client.directories.get options[:directory]\n return directory.accounts\n elsif !options[:group].nil?\n group = client.groups.get options[:group]\n return group.accounts\n else\n puts \"Missing arguments\"\n return nil\n end \nend", "def chargeable_profiles\n acl_entries.where(role: [:charge, :edit]).map(&:subject)\n end", "def policy\n self.permissions['policy'].to_sym\n end", "def permissions(ob, user, query)\n\n policy = ob.is_a?(Policy) ? ob : ob.contribution.policy\n\n def permission_node(view, download, edit, category, id = nil, layout = false)\n node = LibXML::XML::Node.new('permission')\n category_node = LibXML::XML::Node.new('category')\n category_node << category\n node << category_node\n if id\n id_node = LibXML::XML::Node.new('id')\n id_node << id\n node << id_node\n end\n if view\n privilege = LibXML::XML::Node.new('privilege')\n privilege['type'] = \"view\"\n node << privilege\n end\n if download\n privilege = LibXML::XML::Node.new('privilege')\n privilege['type'] = \"download\"\n node << privilege\n end\n if edit\n privilege = LibXML::XML::Node.new('privilege')\n privilege['type'] = \"edit\"\n node << privilege\n end\n if layout\n use_layout_node = LibXML::XML::Node.new('use-layout')\n use_layout_node << 'true'\n node << use_layout_node\n end\n\n if view || edit || download\n node\n else\n nil\n end\n end\n\n permissions = LibXML::XML::Node.new('permissions')\n permissions << permission_node([0,1,2].include?(policy.share_mode),\n policy.share_mode == 0,\n false,\n 'public')\n\n unless ob.is_a?(Policy)\n permissions['uri'] = rest_access_uri(policy)\n permissions['resource'] = rest_resource_uri(policy)\n permissions['id'] = policy.id.to_s\n permissions['policy-type'] = policy.group_policy? ? 'group' : 'user-specified'\n end\n\n policy.permissions.select {|p| p.contributor_type == \"Network\"}.each do |perm|\n permissions << permission_node(perm.view, perm.download, perm.edit, 'group', perm.contributor_id,\n policy.layout == perm.contributor.layout_name)\n end\n\n permissions\nend", "def show\n authorize @accounts\n render json: @account\n end", "def fetch_syncables\n gh_client.repos.list.select{|repo| repo.permissions.admin}.map(&:full_name)\n end", "def show\n @all_permissions = Permission.all\n end", "def show\n authorize! :read, @admin_system_admin\n end", "def grantor\n @data['grantor']\n end" ]
[ "0.61460376", "0.6098816", "0.600442", "0.5946339", "0.5946339", "0.5912879", "0.58784074", "0.58379537", "0.5813389", "0.5790581", "0.5675754", "0.567379", "0.5617735", "0.55895376", "0.5583609", "0.5565665", "0.55527884", "0.554511", "0.5540676", "0.55083966", "0.55058956", "0.5495577", "0.5483487", "0.5456666", "0.5437302", "0.54336166", "0.54270273", "0.54121685", "0.5404247", "0.5396175", "0.5396175", "0.5392259", "0.5389286", "0.53726596", "0.53691757", "0.5366947", "0.5360606", "0.53523207", "0.53516734", "0.53501654", "0.5348703", "0.5346198", "0.534542", "0.5344604", "0.5337177", "0.5333067", "0.5325535", "0.5322181", "0.5322181", "0.53148276", "0.53030694", "0.52959275", "0.5295891", "0.5293274", "0.52889955", "0.5279389", "0.52785325", "0.5273662", "0.5273429", "0.52728254", "0.5270579", "0.5270463", "0.52685714", "0.5263434", "0.5262297", "0.5254852", "0.52540773", "0.5253941", "0.5253197", "0.5252322", "0.5248878", "0.5240398", "0.5239807", "0.52329683", "0.52329683", "0.52312356", "0.52282476", "0.5226738", "0.5224012", "0.52182496", "0.52106166", "0.5206721", "0.51927334", "0.51927334", "0.51925445", "0.51828235", "0.5180121", "0.5177247", "0.517015", "0.5162815", "0.51595384", "0.5157033", "0.5156746", "0.515533", "0.51532924", "0.5150039", "0.51436967", "0.51433337", "0.513957", "0.5132943", "0.5128355" ]
0.0
-1
Fetch Wallet&39;s client permissions details
def get_wallet_permission_using_get_with_http_info(wallet_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WalletPermissionApi.get_wallet_permission_using_get ...' end # verify the required parameter 'wallet_id' is set if @api_client.config.client_side_validation && wallet_id.nil? fail ArgumentError, "Missing the required parameter 'wallet_id' when calling WalletPermissionApi.get_wallet_permission_using_get" end # resource path local_var_path = '/wallet_permission/{wallet_id}'.sub('{' + 'wallet_id' + '}', wallet_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'WalletPermissionResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: WalletPermissionApi#get_wallet_permission_using_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n authorize @client_profile\n end", "def get_permission_menu\n @client.raw('get', '/helpers/menu')\n end", "def index\n @client_profiles = ClientProfile.all\n\n authorize ClientProfile\n end", "def get_permission_menu\n return @client.raw(\"get\", \"/helpers/menu\")\n end", "def getwalletinfo\n @api.request 'getwalletinfo'\n end", "def get_permissions_facebook(api_client)\n api_request = 'me?fields=permissions'\n logger.debug2 \"api_request = #{api_request}\"\n begin\n api_response = api_client.get_object(api_request)\n rescue Koala::Facebook::ClientError => e\n e.logger = logger\n e.puts_exception(\"#{__method__}: \")\n raise\n end # rescue\n logger.debug2 \"api_response = #{api_response}\"\n self.permissions = api_response['permissions']['data']\n save!\n self\n end", "def permission_level(repo, collaborator, options={})\n get \"#{Repository.path repo}/collaborators/#{collaborator}/permission\", options\n end", "def get_withdrawal_info\n # body = {\n # cmd: \"get_withdrawal_info\"\n # }\n\n end", "def permissions_info(sco_id, filter = nil)\n res = query(\"permissions-info\", \"acl-id\" => sco_id, \"filter\" => filter)\n\n return res.body\n data = XmlSimple.xml_in(res.body)\n if data['permissions'][0]\n return data['permissions'][0]\n end\n #puts YAML::dump(data)\n# if data[\"sco\"][0]\n# return data[\"sco\"][0]\n# end\n end", "def getacl\n url = prefix + \"getacl\"\n return response(url)\n end", "def get_acc_info\n JSON.parse(curl_get(\"/api2/account/info/\").body_str)\n end", "def getacl\n url = prefix + \"getacl\"\n return response(url)\n end", "def access_list\n\t\tif(MARKETPLACE_MODE_ONLINE_SHOP)\n\t\t\treturn {}\n\t\telse\n\t\t\tacl = self.acl\n\t\t\tacl = {} if(acl.blank?)\n\t\t\tacl[:creator_user_id] = self.user_id\n\t\t\treturn self.acl\n\t\tend\n\tend", "def get_wallet_permission_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WalletPermissionApi.get_wallet_permission_all_using_get ...'\n end\n # resource path\n local_var_path = '/wallet_permission'\n\n # query parameters\n query_params = {}\n query_params[:'nucleus_client_id'] = opts[:'nucleus_client_id'] if !opts[:'nucleus_client_id'].nil?\n query_params[:'is_active'] = opts[:'is_active'] if !opts[:'is_active'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'get_latest'] = opts[:'get_latest'] if !opts[:'get_latest'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageWalletPermissionResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WalletPermissionApi#get_wallet_permission_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_current_privs\n query = @db_connection.query(\"SHOW GRANTS FOR current_user();\")\n query.each { |x| print_line(\"#{x[0]}\") }\n end", "def get_permissions\n permissions.keys\n end", "def get_permissions\n permissions.keys\n end", "def show\r\n authorize! :read, @pb_areainfo\r\n end", "def index\n @accounts = current_user.accounts\n @wallet = current_user.wallet\n authorize @accounts\n end", "def get_list_acc\n JSON.parse(curl_get(\"accounts\").body_str)\n end", "def permission_grants\n return @permission_grants\n end", "def index\n @merchant_account_permissions = MerchantAccountPermission.all\n end", "def list_payment_method\n authorize current_employer\n @payment_methods = current_employer.customers\n end", "def get_merchants\n uri = build_uri_for(@provider)\n p uri\n http = initialize_http(uri)\n\n request = Net::HTTP::Get.new(uri.request_uri)\n JSON( http.request(request).body )\n end", "def get_active_permissions\n set_access_token\n if @access_token && !@permissions && set_uid\n # if we don't have permissions set but have an access token\n # grab the user's info\n @rest = Facebook::RestAPI.new(@access_token) \n result = @rest.fql_query(\"select #{all_permissions.join(\",\")} from permissions where uid = #{@uid.to_s}\")\n result.first\n end \n end", "def get_authorization_permissions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuthorizationApi.get_authorization_permissions ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/authorization/permissions\".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 => 'PermissionCollectionEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuthorizationApi#get_authorization_permissions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def cap_ids\n CAP_CLIENT.profile_ids\nend", "def get_permission_list\n db = open_rds_db();\n result = db.query(\"SELECT * FROM autoretouch.Permission_List\");\n result.each do |row|\n puts row\n end\n db.close();\n end", "def wallet_info\n client.make_request('/wallet-info', 'post', params: {})\n end", "def show\n @client = Client.find(params[:id])\n authorize! :read, @client\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end", "def show\n authorize @contract\n end", "def show\n authorize @loan_manager_profile\n end", "def grantor\n @data['grantor']\n end", "def grant_controls\n return @grant_controls\n end", "def get_access_level request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_access_level_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Identity::AccessContextManager::V1::AccessLevel.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def wallet_payment_sources\n user.wallet_payment_sources.to_a\n end", "def get_authorization_list(local_id=nil)\n soap_response = client.request :get_authorization_list do\n soap.header = soap_header\n soap.body = {\"localID\" => local_id} if local_id\n end\n\n @last_request = client.http\n @last_response = soap_response\n end", "def show\n authorize AccountingEntry\n end", "def list\n response = Tiptaplab.api.make_call(\"users/authorizations\")\n response.keys\n end", "def fetch_wallet_name(public_key)\n result = rpc.call('wallet_by_key_api.get_key_references', { 'keys' => [keys['recovery_public']] })\n result&.fetch('wallets', [])&.first&.first\nend", "def get_role_info()\n make_call(NO_TIMEOUT, ABORT_ON_FAIL) { \n @conn.get_role_info(@secret) \n }\n end", "def retrieve_permissions(file_id)\n\t\t@client ||= api_client()\n\n\t api_result = @client.execute(\n\t :api_method => @drive.permissions.list,\n\t :parameters => { 'fileId' => file_id })\n\t if api_result.status == 200\n\t permissions = api_result.data\n\t permissions.items.each do |perm|\n\t \tif perm['role'] == 'owner'\n\t \t\tRails.logger.info \"Found Permission #{perm['id']}\"\n\t \t\treturn perm['id']\n\t \tend\n\t end\n\t else\n\t Rails.logger.info \"An error occurred: #{api_result.data['error']['message']}\"\n\t end\n\n\t return false\n\tend", "def list(\n filter,\n *args,\n deadline: nil\n )\n return @account_permissions.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "def permissions(api_key=KillBillClient.api_key, api_secret=KillBillClient.api_secret)\n User.do_find_permissions :session_id => kb_session_id,\n :api_key => api_key,\n :api_secret => api_secret\n end", "def details\n response = CreateSend.get \"/clients/#{client_id}.json\", {}\n Hashie::Mash.new(response)\n end", "def grant_permission\n @attributes[:grant_permission]\n end", "def get_fb_permissions\n if fb_access_token\n @graph = Koala::Facebook::API.new(fb_access_token)\n @graph.get_connections('me', 'permissions') rescue []\n else\n []\n end\n end", "def guild_perks\r\n BnetApi::make_request('/wow/data/guild/perks')\r\n end", "def denied_client_code(crosswalk_record)\n rcc_log.debug \"Obtaining Denied CLIENT CODE for zero payment.\"\n if crosswalk_record && crosswalk_record.crosswalk_record_id.present?\n crosswalk_record = ReasonCodesClientsFacilitiesSetName.find(crosswalk_record.crosswalk_record_id)\n if crosswalk_record.present?\n client_code_association_records = crosswalk_record.reason_codes_clients_facilities_set_names_client_codes.\n select{|rcfsc| rcfsc.category == 'DENIED'}\n client_code_record = client_code_association_records.first.client_code if client_code_association_records.present?\n if client_code_record.present?\n denied_client_code = client_code_record.adjustment_code\n rcc_log.debug \"Denied CLIENT CODE : #{denied_client_code}, having ID : #{client_code_record.id}\"\n end\n end\n end\n denied_client_code.to_s.upcase\n end", "def show\n authorize @accounts\n render json: @account\n end", "def permissions\n User.do_find_permissions session_id: kb_session_id\n end", "def list_ability(pk)\n puts \"\"\n puts \"Abilities:\"\n puts \"\"\n puts pk.abilities\n puts \"\"\n end", "def get_access\n path = '/v3/oauth/authorize'\n data = \"consumer_key=#{Consumer_key}&code=#{Token}\"\n return pocket_api(path,data)\nend", "def show\n authorize @account, :index?\n show_password_hash = show_password_hash?\n @show_password_hash_if_allowed =\n show_password_hash &&\n Pundit.policy(current_client, @account).show_password_hash? #for HTML view\n respond_to do |format|\n format.html { render :show }\n format.json do\n render json: @account, show_password_hash: show_password_hash\n end\n end\n end", "def get_accounts(client, options)\n # TODO: Add exception handling \n if !options[:application].nil?\n application = client.applications.get options[:application]\n return application.accounts\n elsif !options[:directory].nil?\n directory = client.directories.get options[:directory]\n return directory.accounts\n elsif !options[:group].nil?\n group = client.groups.get options[:group]\n return group.accounts\n else\n puts \"Missing arguments\"\n return nil\n end \nend", "def get_permissions (user, store_name)\n s = \"\"\n [ :read, :write, :delegate ].each do |action|\n s << action.to_s[0, 1] \\\n if @auth_system.authorized?(user, store_name, action)\n end\n s\n end", "def get_customer_profile\n authenticate_request!\n json_response(current_customer)\n end", "def get_account_and_display(client, options)\n account = get_account(client, options)\n if !account.nil?\n print_account(account)\n else\n puts \"Account not found.\"\n return\n end\nend", "def base_credential_type; end", "def list_authorized?\n authorized_for?(:crud_type => :read)\n end", "def list_authorized?\n authorized_for?(:crud_type => :read)\n end", "def show\n authorize RoleCutoff\n end", "def getPermissions\n perms = []\n perms.push :disseminate if params[:disseminate_perm] == \"on\"\n perms.push :withdraw if params[:withdraw_perm] == \"on\"\n perms.push :peek if params[:peek_perm] == \"on\"\n perms.push :submit if params[:submit_perm] == \"on\"\n perms.push :report if params[:report_perm] == \"on\" \n perms \n end", "def show\n authorize @accountant_profile\n end", "def GetProfileData()\n uri = URI(API_URL + 'me')\n\n return PerformRestrictedGet(uri)\n end", "def getAccessInfo()\n @accessInfo\n end", "def get_account_data(type)\n client.api.get_room_account_data(client.mxid, id, type)\n end", "def listaccounts(minconf = 1)\n coind.listaccounts minconf\n end", "def get_attribs_all( )\n url = \"#{self.url}/cid?auth=#{self.authtoken}\"\n status, response = rest_get( url )\n return status, response['results'] if ok?( status ) && response['results']\n return status, ''\n end", "def client_code(crosswalk_record)\n rcc_log.debug \"Obtaining CLIENT CODE.\"\n if crosswalk_record && crosswalk_record.crosswalk_record_id.present?\n crosswalk_record = ReasonCodesClientsFacilitiesSetName.find(crosswalk_record.crosswalk_record_id)\n if crosswalk_record.present?\n client_code_association_records = crosswalk_record.reason_codes_clients_facilities_set_names_client_codes.\n select{|rcfsc| rcfsc.category != 'DENIED' or rcfsc.category == nil}\n client_code_record = client_code_association_records.first.client_code if client_code_association_records.present?\n if client_code_record.present?\n client_code = client_code_record.adjustment_code\n rcc_log.debug \"CLIENT CODE : #{client_code}, having ID : #{client_code_record.id}\"\n end\n end\n end\n client_code.to_s.upcase\n end", "def policy\n self.permissions['policy'].to_sym\n end", "def client_info\n self.class.client_info\n end", "def wallet_information(wallet_id)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'application/json', 'signature' => signature('', 'get', \"/v1/user/#{wallet_id}\"),\n 'salt' => salt, 'timestamp' => timestamp, 'access_key' => access_key }\n response, msg = rest_client.getCall(\"/v1/user/#{wallet_id}\", headers)\n if response.present? && response.body.present? && JSON.parse(response.body)['status']['status'] == 'SUCCESS'\n JSON.parse(response.body)\n else\n msg\n end\n rescue StandardError => e\n Rails.logger.error e\n nil\n end", "def account_info language_code: \"en\"\n params = init_params\n params[:languageCode] = language_code\n request_url = UrlGenerator.url_for(\"account\")\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end", "def permissions\n objects_from_response(Code42::Permission, :get, 'permission')\n end", "def list_accounts(client, options)\n accounts = get_accounts(client, options)\n if accounts.nil?\n return\n end\n\n accounts.each do |acc|\n print_account(acc)\n end\nend", "def lookup_permissions(token)\n url = create_url('GetPermissions')\n data = call(url, { 'token' => token })\n\n paypal_scopes = parse_scopes(data)\n raise ::Paypal::Permissions::FaultMessage.new(data) if paypal_scopes.empty?\n\n { :scopes => paypal_scopes }\n end", "def authorization\n get_privacy_setting.privacy_level\n end", "def permissions_policy(&block); end", "def show\n set_client_profile(@case)\n\n set_models_permissions\n end", "def admin_grant_permissions\n @user = User.includes(:perms).find(params[:id])\n authorize @user\n user_perms = current_user.perms\n @perms = user_perms & [Perm.grant_permissions, Perm.modify_templates, Perm.modify_guidance, Perm.use_api, Perm.change_org_details]\n end", "def retrieve_policies( resource_name, access_token, realm_uuid, resource_server )\n if resource_name && access_token\n request_policies(\n resource_name,\n access_token,\n realm_uuid,\n resource_server\n )\n else\n nil\n end\n end", "def wallet\n get 'wallet'\n end", "def index\n @permissions = ApiKeyPermission.where(api_key_id: @key.id).order(id: :desc).page params[:page]\n end", "def your_project_access_type policy = nil, resource = nil\n unless policy.nil? or resource.nil? or !(policy.sharing_scope == Policy::ALL_SYSMO_USERS)\n unless policy.permissions.empty?\n my_project_ids = if resource.class == Project then [resource.id] else resource.project_ids end\n my_project_perms = policy.permissions.select {|p| p.contributor_type == 'Project' and my_project_ids.include? p.contributor_id}\n access_types = my_project_perms.map(&:access_type)\n return access_types.first if access_types.all?{|acc| acc == access_types.first}\n else\n policy.access_type\n end\n end\n end", "def show\n authorize! :show, @characteristic\n end", "def fetch_wallets(funds_type = nil)\n MangoPay.request(:get, url() + \"/wallets/#{funds_type}\")\n end", "def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end", "def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end", "def permissions_for(game)\n self.permissions.where(\"user_roles.game_id = ?\", game.id)\n end", "def getMaintainer(maintainer)\n data = CLIENT.user(maintainer)\n return data\nend", "def get_accounts()\n http_get(accounts_url)\n end", "def permission_grants()\n return MicrosoftGraph::PermissionGrants::PermissionGrantsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def permissions(ob, user, query)\n\n policy = ob.is_a?(Policy) ? ob : ob.contribution.policy\n\n def permission_node(view, download, edit, category, id = nil, layout = false)\n node = LibXML::XML::Node.new('permission')\n category_node = LibXML::XML::Node.new('category')\n category_node << category\n node << category_node\n if id\n id_node = LibXML::XML::Node.new('id')\n id_node << id\n node << id_node\n end\n if view\n privilege = LibXML::XML::Node.new('privilege')\n privilege['type'] = \"view\"\n node << privilege\n end\n if download\n privilege = LibXML::XML::Node.new('privilege')\n privilege['type'] = \"download\"\n node << privilege\n end\n if edit\n privilege = LibXML::XML::Node.new('privilege')\n privilege['type'] = \"edit\"\n node << privilege\n end\n if layout\n use_layout_node = LibXML::XML::Node.new('use-layout')\n use_layout_node << 'true'\n node << use_layout_node\n end\n\n if view || edit || download\n node\n else\n nil\n end\n end\n\n permissions = LibXML::XML::Node.new('permissions')\n permissions << permission_node([0,1,2].include?(policy.share_mode),\n policy.share_mode == 0,\n false,\n 'public')\n\n unless ob.is_a?(Policy)\n permissions['uri'] = rest_access_uri(policy)\n permissions['resource'] = rest_resource_uri(policy)\n permissions['id'] = policy.id.to_s\n permissions['policy-type'] = policy.group_policy? ? 'group' : 'user-specified'\n end\n\n policy.permissions.select {|p| p.contributor_type == \"Network\"}.each do |perm|\n permissions << permission_node(perm.view, perm.download, perm.edit, 'group', perm.contributor_id,\n policy.layout == perm.contributor.layout_name)\n end\n\n permissions\nend", "def fetch_granted_permissions(action:, user:, type:, target:, token:)\n permissions = granted_permissions_for_user(user: user, type: type, target: target, token: token)\n @read = permissions.include?('read')\n @create = permissions.include?('create')\n @update = permissions.include?('update')\n @delete = permissions.include?('delete')\n instance_variable_get(\"@#{action}\")\n end", "def index\n @authorized_clients = AuthorizedClient.all\n end", "def get_grant_info\n # See https://help.nla.gov.au/trove/becoming-partner/for-content-partners/adding-NHMRC-ARC\n # - Funder: Upper case for consistency (in both Funder & PURL)\n # - Grant Num: Upper case for consistency (in both Grant Num & PURL)\n grant_info = []\t\t\t# Ordered list of unique funders & grant numbers\n gwarnings = []\t\t\t# List of warnings\n\n grant_info_rel = {}\t\t\t# Hash for dc.relation\n @dc[:relation].each{|s|\t\t# Format: URL_PREFIX/funder/grant_num\n s.strip.match(PURL_REGEX)\n if [$1, $2, $3].all?{|o| !o.to_s.empty?}\n funder, grant_num = $2.upcase, $3.upcase\n next unless process_grant(funder, grant_num, grant_info, gwarnings, \"dc.relation\", grant_info_rel)\n\n else\n gwarnings << \"dc.relation purl format\"\n end\n }\n\n grant_info_gn = {}\t\t\t# Hash for dc.relation.grantnumber\n @dc[:grantnumber].each{|s|\t\t# Format: funder/grant_num\n s.strip.match(FUNDER_GRANTNUM_REGEX)\n if [$1, $2].all?{|o| !o.to_s.empty?}\n funder, grant_num = $1.upcase, $2.upcase\n next unless process_grant(funder, grant_num, grant_info, gwarnings, \"dc.relation.grantnumber\", grant_info_gn, grant_info_rel)\n\n else\n gwarnings << \"dc.relation.grantnumber format\"\n end\n }\n\n gwarnings << \"dc.relation/dc.relation.grantnumber grants differ\" unless grant_info_rel == grant_info_gn\n [gwarnings, grant_info]\n end", "def listaccounts(minconf = 1)\n @api.request 'listaccounts', minconf\n end", "def wallet_transactions_listing(wallet_id, type)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'application/json',\n 'signature' => signature('', 'get', \"/v1/user/#{wallet_id}/transactions?type=#{type}\"), 'salt' => salt, 'timestamp' => timestamp, 'access_key' => access_key }\n response, msg = rest_client.getCall(\"/v1/user/#{wallet_id}/transactions?type=#{type}\", headers)\n JSON.parse(response)['data'] if response.present?\n rescue StandardError => e\n Rails.logger.error e\n nil\n end", "def permissions\n [\"read_permissions\", \"update_permissions\", \"delete_permissions\"].each do |p|\n perms = self.send(p)\n perm_string = []\n AssetPermission::GROUP.each do |g, v|\n if perms & AssetPermission::GROUP[g] > 0\n perm_string << g\n end\n end\n puts \"#{self.name}: #{p}: #{perm_string.join(',')}\"\n end\n end", "def for_client(client_id, offset = 0, limit = 100)\n if client = Client.find_by_id(client_id)\n client.access_tokens.offset(offset).limit(limit)\n else\n []\n end\n end" ]
[ "0.59261596", "0.5862964", "0.58017594", "0.5761688", "0.57591146", "0.5758449", "0.5630297", "0.56248444", "0.5608936", "0.55960566", "0.55872184", "0.55742043", "0.5569646", "0.5552916", "0.55364853", "0.55228555", "0.55228555", "0.5507539", "0.5506231", "0.54422176", "0.54368025", "0.5405663", "0.53881645", "0.5382039", "0.5380974", "0.5364771", "0.5354212", "0.53395605", "0.5310132", "0.5291768", "0.5287153", "0.5279692", "0.52789366", "0.52780247", "0.5274825", "0.5270278", "0.5249842", "0.5242932", "0.5235728", "0.5227344", "0.5225674", "0.52184904", "0.5216011", "0.5206573", "0.5190652", "0.5189757", "0.5188193", "0.5187923", "0.5176538", "0.5165801", "0.51492524", "0.5139758", "0.51316", "0.5125342", "0.5124613", "0.5117629", "0.5109006", "0.5107894", "0.5107725", "0.50994515", "0.50994515", "0.509898", "0.5097876", "0.5097681", "0.5097404", "0.50926125", "0.50879675", "0.50789213", "0.50789064", "0.5072474", "0.50696695", "0.5068922", "0.5067571", "0.50668544", "0.50654656", "0.5063367", "0.5056423", "0.50524867", "0.50505054", "0.50494146", "0.5047947", "0.5047897", "0.5045049", "0.5043879", "0.5041627", "0.50371385", "0.50364876", "0.50316715", "0.50316715", "0.5029643", "0.5024577", "0.5022251", "0.5019461", "0.50174814", "0.50109017", "0.5009133", "0.50087816", "0.5007493", "0.5006604", "0.50052637", "0.5001468" ]
0.0
-1
Update client's permission for provided Wallet
def update_wallet_permission_using_put(wallet_id, client_permissions, opts = {}) data, _status_code, _headers = update_wallet_permission_using_put_with_http_info(wallet_id, client_permissions, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_wallet_permission_using_put_with_http_info(wallet_id, client_permissions, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WalletPermissionApi.update_wallet_permission_using_put ...'\n end\n # verify the required parameter 'wallet_id' is set\n if @api_client.config.client_side_validation && wallet_id.nil?\n fail ArgumentError, \"Missing the required parameter 'wallet_id' when calling WalletPermissionApi.update_wallet_permission_using_put\"\n end\n # verify the required parameter 'client_permissions' is set\n if @api_client.config.client_side_validation && client_permissions.nil?\n fail ArgumentError, \"Missing the required parameter 'client_permissions' when calling WalletPermissionApi.update_wallet_permission_using_put\"\n end\n # resource path\n local_var_path = '/wallet_permission/{wallet_id}'.sub('{' + 'wallet_id' + '}', wallet_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(client_permissions)\n auth_names = ['oauth2']\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 => 'WalletPermissionResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WalletPermissionApi#update_wallet_permission_using_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update?\n @current_user.permission('Bid', :clerk)\n end", "def setAsAdmin\n self.clientType = CLIENT_TYPES[:administrator]\n end", "def update\n authorize! :update, Client\n load_client\n build_client\n save_client or render :edit\n end", "def enable_on_behalf_requestors_to_update_access=(value)\n @enable_on_behalf_requestors_to_update_access = value\n end", "def update!(**args)\n @trust_settings_for_client = args[:trust_settings_for_client] if args.key?(:trust_settings_for_client)\n end", "def admin_update_permissions\n @user = User.find(params[:id])\n authorize @user\n\n perms_ids = permission_params[:perm_ids].blank? ? [] : permission_params[:perm_ids].map(&:to_i)\n perms = Perm.where(id: perms_ids)\n privileges_changed = false\n current_user.perms.each do |perm|\n if @user.perms.include? perm\n unless perms.include? perm\n @user.perms.delete(perm)\n @user.remove_token! if perm.id == Perm.use_api.id\n privileges_changed = true\n end\n elsif perms.include? perm\n @user.perms << perm\n if perm.id == Perm.use_api.id\n @user.keep_or_generate_token!\n privileges_changed = true\n end\n end\n end\n\n if @user.save\n if privileges_changed\n deliver_if(recipients: @user, key: 'users.admin_privileges') do |r|\n UserMailer.admin_privileges(r).deliver_now\n end\n end\n render(json: {\n code: 1,\n msg: success_message(perms.first_or_initialize, _('saved')),\n current_privileges: render_to_string(partial: 'users/current_privileges',\n locals: { user: @user }, formats: [:html])\n })\n else\n render(json: { code: 0, msg: failure_message(@user, _('updated')) })\n end\n end", "def update\n begin\n ## Can't review an already reviewed request.\n if @permission_request.reviewed\n respond_with_error 'This request has already been reviewed.', \n permission_request_path(@permission_request)\n else\n granted = (params.require(:permission_request).require(:action) == 'grant')\n \n ## Update the request with the review.\n @permission_request.update!({\n reviewed: true,\n granted: granted,\n reviewed_by: current_user,\n reviewed_on: Time.now\n })\n \n ## Update the user's permission level.\n if granted\n @permission_request.user.update!({\n permission_level: @permission_request.level_requested,\n permission_level_granted_on: @permission_request.reviewed_on,\n permission_level_granted_by: current_user\n })\n @user = @permission_request.user\n @user.send_permissions_changed_email\n end\n \n respond_to do |format|\n format.json { render json: {\n success: true, \n permission_request: {\n granted: @permission_request.granted,\n reviewed_by_username: current_user.username,\n reviewed_on: @permission_request.reviewed_on\n }\n } }\n format.html { redirect_to path }\n end\n end\n rescue => e \n respond_with_error 'There was a problem saving changes to this request.', \n permission_request_path(@permission_request)\n end\n end", "def authorize\n render json: { status: 200, msg: 'You are not allowed to do this update' } unless current_user && current_user.can_modify_user?(params[:id])\n end", "def update\n respond_to do |format|\n if @merchant_account_permission.update(merchant_account_permission_params)\n format.html { redirect_to @merchant_account_permission, notice: 'Merchant account permission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @merchant_account_permission.errors, status: :unprocessable_entity }\n end\n end\n end", "def update?\n @current_user.permission('Donor', :clerk)\n end", "def grant\n self.status = 'granted'\n save\n end", "def update\n authorize! :update, @gf_travel_request\n respond_to do |format|\n if @gf_travel_request.update(grant_funded_travel_request_params)\n format.html { redirect_to @gf_travel_request, notice: 'Grant funded travel request was successfully updated.' }\n format.json { render :show, status: :ok, location: @gf_travel_request }\n else\n format.html { render :edit }\n format.json { render json: @gf_travel_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @permission = args[:permission] if args.key?(:permission)\n end", "def update!(**args)\n @permission = args[:permission] if args.key?(:permission)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update?\n @current_user.permission('Ration', :clerk)\n end", "def update_user_overrides(token, channel_id, user_id, allow, deny)\n request(\n __method__,\n :put,\n \"#{api_base}/channels/#{channel_id}/permissions/#{user_id}\",\n { type: 'member', id: user_id, allow: allow, deny: deny }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def update\n respond_to do |format|\n if @wallet.update(wallet_params)\n format.html { redirect_to @wallet, notice: 'User wallet was successfully updated.' }\n format.json { render :show, status: :ok, location: @wallet }\n else\n format.html { render :edit }\n format.json { render json: @wallet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n authorize! :update, @client\n\n respond_to do |format|\n if @client.update_attributes(client_params)\n format.html { redirect_to @client, :notice => 'Client was successfully updated.' }\n format.json { head :ok }\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 authorize @client_profile\n respond_to do |format|\n if @client_profile.update(client_profile_params)\n format.html { redirect_to @client_profile, notice: 'Client profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_profile }\n else\n format.html { render :edit }\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def admin_grant_permissions\n @user = User.includes(:perms).find(params[:id])\n authorize @user\n user_perms = current_user.perms\n @perms = user_perms & [Perm.grant_permissions, Perm.modify_templates, Perm.modify_guidance, Perm.use_api, Perm.change_org_details]\n end", "def update?\n @current_user.permission('Currency', :clerk)\n end", "def update_permissions\n self.admin_permission.update_attribute(:name, name + \" dept admin\")\n end", "def update?\n @current_user.permission('Fdp', :clerk)\n end", "def enable_on_behalf_requestors_to_update_access\n return @enable_on_behalf_requestors_to_update_access\n end", "def update\n @role = Role.find(params[:id])\n authorize @role\n\n if @role.update(access: role_params[:access])\n deliver_if(recipients: @role.user, key: 'users.added_as_coowner') do |_r|\n UserMailer.permissions_change_notification(@role, current_user).deliver_now\n end\n render json: {\n code: 1,\n msg: format(_('Successfully changed the permissions for %{email}. They have been\n notified via email.'), email: @role.user.email)\n }\n else\n render json: { code: 0, msg: flash[:alert] }\n end\n end", "def update\n authorize! :update, @customer\n update_customer_params = ( current_user.role == 'kanari_admin' ? admin_customer_params : customer_params)\n if @customer.update(update_customer_params)\n render json: nil, status: 200\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = current_user\n @user.role = 'client'\n \n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, flash[:success] => \"User was successfully updated\" }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @client.valid?\n old_password = @client.password\n @client.password = SecureRandom.hex(6)\n status = ApiClient.update(@client)\n\n user = User.find_by(client_id: @client.code)\n\n if user\n user.name = @client.name\n user.email = @client.email\n user.password = old_password\n user.password_salt = @client.password\n user.client_id = @client.code\n user.save\n end\n end\n\n respond_to do |format|\n if @client.valid?\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_admin\n update admin_client\n end", "def update!(**args)\n @permissions = args[:permissions] unless args[:permissions].nil?\n end", "def update!(**args)\n @permissions = args[:permissions] unless args[:permissions].nil?\n end", "def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end", "def update\n authorize @client\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_back_or_default clients_url, t('Record has been saved') }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def walletlock\n @api.request 'walletlock'\n end", "def update\n\tif signed_in?\n\t\tif params[:client][:encrypted_password_confirmation].blank?\n\t\t\tparams[:client].delete(\"encrypted_password\")\n\t\t\tparams[:client].delete(\"encrypted_password_confirmation\")\n\t\tend\n\t\t@current_client = current_user.username\n\t\tif current_user.username == 'admin'\n\t\t\t@client = Client.find(params[:id])\n\t\telse\n\t\t\tredirect_to home_path\n\t\tend\n\telse\n\t\tredirect_to signin_path\n\tend\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to clients_path}\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 current_account.update(provider_params, without_protection: true)\n respond_with current_account\n end", "def update?\n @current_user.permission('Commodity', :clerk)\n end", "def admin_update_permissions\n @user = User.includes(:perms).find(params[:id])\n authorize @user\n perms_ids = params[:perm_ids].blank? ? [] : params[:perm_ids].map(&:to_i)\n perms = Perm.where( id: perms_ids)\n current_user.perms.each do |perm|\n if @user.perms.include? perm\n if ! perms.include? perm\n @user.perms.delete(perm)\n if perm.id == Perm.use_api.id\n @user.remove_token!\n end\n end\n else\n if perms.include? perm\n @user.perms << perm\n if perm.id == Perm.use_api.id\n @user.keep_or_generate_token!\n end\n end\n end\n end\n\n if @user.save!\n redirect_to({controller: 'users', action: 'admin_index'}, {notice: _('Information was successfully updated.')}) # helpers.success key does not exist, replaced with a generic string\n else\n flash[:notice] = failed_update_error(@user, _('user'))\n end\n end", "def update\n set_params\n @restaurant = Restaurant.find(params[:id])\n authorize! :update, @restaurant\n if (params[:restaurant][:status] == \"Exclusive\" &&\n @restaurant.owned_by != current_user.id)\n params[:restaurant][:status] = \"Pending Approval\"\n send_request\n @restaurant.mark_pending(current_user.id)\n end\n MenuItem.destroy_all(:restaurant_id => params[:id])\n set_menu_items_and_file\n super\n end", "def update_client\n\t\tif(request.method == \"OPTIONS\")\n\t\t\trespond({status: 0})\n\t\telsif request.method == \"POST\"\n\t\t\trespond(update_user_client(params))\n\t\tend\n\tend", "def update\n account = current_organization.accounts.find(params[:id])\n return forbidden unless account && current_account.allowed_to_edit_account?(account, current_organization)\n return json(account) unless account.update_attributes pick(params, :first_name, :last_name, :email,:language, :document_language)\n\n role = pick(params, :role)\n #account.update_attributes(role) if !role.empty? && current_account.admin?\n membership = current_organization.role_of(account)\n membership.update_attributes(role) if !role.empty? && current_account.admin?\n password = pick(params, :password)[:password]\n if (current_account.id == account.id) && password\n account.update(password: password)\n end\n json account.canonical(membership: membership)\n end", "def update\n respond_to do |format|\n if @client_policy.update(client_policy_params)\n format.html { redirect_to @client_policy, notice: 'Client policy was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_policy }\n else\n format.html { render :edit }\n format.json { render json: @client_policy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_client_manager\n to_update_manager_id = @to_update_client_manager[:manager_id]\n\n set_props_arr = []\n unset_props_arr = []\n attributes_hash = {}\n\n if Util::CommonValidator.is_true_boolean_string?(@is_super_admin)\n attributes_hash[GlobalConstant::PepoCampaigns.super_admin] = GlobalConstant::PepoCampaigns.attribute_set\n\n unset_props_arr.push(GlobalConstant::ClientManager.is_admin_privilege)\n set_props_arr.push(GlobalConstant::ClientManager.is_super_admin_privilege)\n else\n attributes_hash[GlobalConstant::PepoCampaigns.super_admin] = GlobalConstant::PepoCampaigns.attribute_unset\n\n unset_props_arr.push(GlobalConstant::ClientManager.is_super_admin_privilege)\n set_props_arr.push(GlobalConstant::ClientManager.is_admin_privilege)\n end\n\n ClientManager.atomic_update_bitwise_columns(@client_id, to_update_manager_id, set_props_arr, unset_props_arr)\n\n Email::HookCreator::UpdateContact.new(\n receiver_entity_id: to_update_manager_id,\n receiver_entity_kind: GlobalConstant::EmailServiceApiCallHook.manager_receiver_entity_kind,\n custom_attributes: attributes_hash, # Has to be done from here since this flow runs on mainnet\n user_settings: {}\n ).perform\n\n\n success\n\n end" ]
[ "0.59180945", "0.57920545", "0.578783", "0.5779451", "0.5759536", "0.56594276", "0.563222", "0.5625595", "0.55976665", "0.55800337", "0.55740416", "0.55707705", "0.5520361", "0.55114096", "0.55114096", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508724", "0.5508631", "0.55084854", "0.55077815", "0.5507005", "0.54618245", "0.5447935", "0.54408073", "0.5406817", "0.5400729", "0.5390181", "0.53857994", "0.5379144", "0.5356997", "0.5351673", "0.5329814", "0.5326", "0.53004676", "0.52925223", "0.5291172", "0.5289517", "0.5288761", "0.5280451", "0.5274118", "0.5266137", "0.5257207", "0.5255889", "0.5254161", "0.5247351", "0.5244166", "0.52424777", "0.52421886", "0.5240653" ]
0.53582567
80
Update client&39;s permission for provided Wallet
def update_wallet_permission_using_put_with_http_info(wallet_id, client_permissions, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WalletPermissionApi.update_wallet_permission_using_put ...' end # verify the required parameter 'wallet_id' is set if @api_client.config.client_side_validation && wallet_id.nil? fail ArgumentError, "Missing the required parameter 'wallet_id' when calling WalletPermissionApi.update_wallet_permission_using_put" end # verify the required parameter 'client_permissions' is set if @api_client.config.client_side_validation && client_permissions.nil? fail ArgumentError, "Missing the required parameter 'client_permissions' when calling WalletPermissionApi.update_wallet_permission_using_put" end # resource path local_var_path = '/wallet_permission/{wallet_id}'.sub('{' + 'wallet_id' + '}', wallet_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(client_permissions) auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'WalletPermissionResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: WalletPermissionApi#update_wallet_permission_using_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setAsAdmin\n self.clientType = CLIENT_TYPES[:administrator]\n end", "def update\n authorize! :update, Client\n load_client\n build_client\n save_client or render :edit\n end", "def update!(**args)\n @trust_settings_for_client = args[:trust_settings_for_client] if args.key?(:trust_settings_for_client)\n end", "def enable_on_behalf_requestors_to_update_access=(value)\n @enable_on_behalf_requestors_to_update_access = value\n end", "def update?\n @current_user.permission('Bid', :clerk)\n end", "def update\n begin\n ## Can't review an already reviewed request.\n if @permission_request.reviewed\n respond_with_error 'This request has already been reviewed.', \n permission_request_path(@permission_request)\n else\n granted = (params.require(:permission_request).require(:action) == 'grant')\n \n ## Update the request with the review.\n @permission_request.update!({\n reviewed: true,\n granted: granted,\n reviewed_by: current_user,\n reviewed_on: Time.now\n })\n \n ## Update the user's permission level.\n if granted\n @permission_request.user.update!({\n permission_level: @permission_request.level_requested,\n permission_level_granted_on: @permission_request.reviewed_on,\n permission_level_granted_by: current_user\n })\n @user = @permission_request.user\n @user.send_permissions_changed_email\n end\n \n respond_to do |format|\n format.json { render json: {\n success: true, \n permission_request: {\n granted: @permission_request.granted,\n reviewed_by_username: current_user.username,\n reviewed_on: @permission_request.reviewed_on\n }\n } }\n format.html { redirect_to path }\n end\n end\n rescue => e \n respond_with_error 'There was a problem saving changes to this request.', \n permission_request_path(@permission_request)\n end\n end", "def admin_update_permissions\n @user = User.find(params[:id])\n authorize @user\n\n perms_ids = permission_params[:perm_ids].blank? ? [] : permission_params[:perm_ids].map(&:to_i)\n perms = Perm.where(id: perms_ids)\n privileges_changed = false\n current_user.perms.each do |perm|\n if @user.perms.include? perm\n unless perms.include? perm\n @user.perms.delete(perm)\n @user.remove_token! if perm.id == Perm.use_api.id\n privileges_changed = true\n end\n elsif perms.include? perm\n @user.perms << perm\n if perm.id == Perm.use_api.id\n @user.keep_or_generate_token!\n privileges_changed = true\n end\n end\n end\n\n if @user.save\n if privileges_changed\n deliver_if(recipients: @user, key: 'users.admin_privileges') do |r|\n UserMailer.admin_privileges(r).deliver_now\n end\n end\n render(json: {\n code: 1,\n msg: success_message(perms.first_or_initialize, _('saved')),\n current_privileges: render_to_string(partial: 'users/current_privileges',\n locals: { user: @user }, formats: [:html])\n })\n else\n render(json: { code: 0, msg: failure_message(@user, _('updated')) })\n end\n end", "def update\n @client = Client.find(params[:id])\n authorize! :update, @client\n\n respond_to do |format|\n if @client.update_attributes(client_params)\n format.html { redirect_to @client, :notice => 'Client was successfully updated.' }\n format.json { head :ok }\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 respond_to do |format|\n if @merchant_account_permission.update(merchant_account_permission_params)\n format.html { redirect_to @merchant_account_permission, notice: 'Merchant account permission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @merchant_account_permission.errors, status: :unprocessable_entity }\n end\n end\n end", "def authorize\n render json: { status: 200, msg: 'You are not allowed to do this update' } unless current_user && current_user.can_modify_user?(params[:id])\n end", "def update?\n @current_user.permission('Donor', :clerk)\n end", "def grant\n self.status = 'granted'\n save\n end", "def update\n authorize @client_profile\n respond_to do |format|\n if @client_profile.update(client_profile_params)\n format.html { redirect_to @client_profile, notice: 'Client profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_profile }\n else\n format.html { render :edit }\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @client.valid?\n old_password = @client.password\n @client.password = SecureRandom.hex(6)\n status = ApiClient.update(@client)\n\n user = User.find_by(client_id: @client.code)\n\n if user\n user.name = @client.name\n user.email = @client.email\n user.password = old_password\n user.password_salt = @client.password\n user.client_id = @client.code\n user.save\n end\n end\n\n respond_to do |format|\n if @client.valid?\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 authorize! :update, @gf_travel_request\n respond_to do |format|\n if @gf_travel_request.update(grant_funded_travel_request_params)\n format.html { redirect_to @gf_travel_request, notice: 'Grant funded travel request was successfully updated.' }\n format.json { render :show, status: :ok, location: @gf_travel_request }\n else\n format.html { render :edit }\n format.json { render json: @gf_travel_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_client\n\t\tif(request.method == \"OPTIONS\")\n\t\t\trespond({status: 0})\n\t\telsif request.method == \"POST\"\n\t\t\trespond(update_user_client(params))\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @wallet.update(wallet_params)\n format.html { redirect_to @wallet, notice: 'User wallet was successfully updated.' }\n format.json { render :show, status: :ok, location: @wallet }\n else\n format.html { render :edit }\n format.json { render json: @wallet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_client_manager\n to_update_manager_id = @to_update_client_manager[:manager_id]\n\n set_props_arr = []\n unset_props_arr = []\n attributes_hash = {}\n\n if Util::CommonValidator.is_true_boolean_string?(@is_super_admin)\n attributes_hash[GlobalConstant::PepoCampaigns.super_admin] = GlobalConstant::PepoCampaigns.attribute_set\n\n unset_props_arr.push(GlobalConstant::ClientManager.is_admin_privilege)\n set_props_arr.push(GlobalConstant::ClientManager.is_super_admin_privilege)\n else\n attributes_hash[GlobalConstant::PepoCampaigns.super_admin] = GlobalConstant::PepoCampaigns.attribute_unset\n\n unset_props_arr.push(GlobalConstant::ClientManager.is_super_admin_privilege)\n set_props_arr.push(GlobalConstant::ClientManager.is_admin_privilege)\n end\n\n ClientManager.atomic_update_bitwise_columns(@client_id, to_update_manager_id, set_props_arr, unset_props_arr)\n\n Email::HookCreator::UpdateContact.new(\n receiver_entity_id: to_update_manager_id,\n receiver_entity_kind: GlobalConstant::EmailServiceApiCallHook.manager_receiver_entity_kind,\n custom_attributes: attributes_hash, # Has to be done from here since this flow runs on mainnet\n user_settings: {}\n ).perform\n\n\n success\n\n end", "def update\n\tif signed_in?\n\t\tif params[:client][:encrypted_password_confirmation].blank?\n\t\t\tparams[:client].delete(\"encrypted_password\")\n\t\t\tparams[:client].delete(\"encrypted_password_confirmation\")\n\t\tend\n\t\t@current_client = current_user.username\n\t\tif current_user.username == 'admin'\n\t\t\t@client = Client.find(params[:id])\n\t\telse\n\t\t\tredirect_to home_path\n\t\tend\n\telse\n\t\tredirect_to signin_path\n\tend\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to clients_path}\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 enable_on_behalf_requestors_to_update_access\n return @enable_on_behalf_requestors_to_update_access\n end", "def walletlock\n @api.request 'walletlock'\n end", "def update_admin\n update admin_client\n end", "def update?\n @current_user.permission('Ration', :clerk)\n end", "def update\n authorize @client\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_back_or_default clients_url, t('Record has been saved') }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update?\n @current_user.permission('Currency', :clerk)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n end", "def update_user_overrides(token, channel_id, user_id, allow, deny)\n request(\n __method__,\n :put,\n \"#{api_base}/channels/#{channel_id}/permissions/#{user_id}\",\n { type: 'member', id: user_id, allow: allow, deny: deny }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def update\n @user = current_user\n @user.role = 'client'\n \n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, flash[:success] => \"User was successfully updated\" }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client_policy.update(client_policy_params)\n format.html { redirect_to @client_policy, notice: 'Client policy was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_policy }\n else\n format.html { render :edit }\n format.json { render json: @client_policy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if current_user.id != @exchange_combination.user.id\n render_unauthorised 'Not yours to meddle with.'\n elsif @exchange_combination.update(exchange_combination_params)\n render_ok 'Exchange combination was successfully updated.'\n else\n render_unprocessable\n end\n end", "def update?\n @current_user.permission('Fdp', :clerk)\n end", "def update!(**args)\n @client_ids_allowed = args[:client_ids_allowed] if args.key?(:client_ids_allowed)\n @is_editorial = args[:is_editorial] if args.key?(:is_editorial)\n @modifications_allowed = args[:modifications_allowed] if args.key?(:modifications_allowed)\n @regions_allowed = args[:regions_allowed] if args.key?(:regions_allowed)\n @regions_disallowed = args[:regions_disallowed] if args.key?(:regions_disallowed)\n @requires_attribution = args[:requires_attribution] if args.key?(:requires_attribution)\n @requires_first_party_only = args[:requires_first_party_only] if args.key?(:requires_first_party_only)\n @requires_linkback = args[:requires_linkback] if args.key?(:requires_linkback)\n @requires_share_alike = args[:requires_share_alike] if args.key?(:requires_share_alike)\n end", "def admin_grant_permissions\n @user = User.includes(:perms).find(params[:id])\n authorize @user\n user_perms = current_user.perms\n @perms = user_perms & [Perm.grant_permissions, Perm.modify_templates, Perm.modify_guidance, Perm.use_api, Perm.change_org_details]\n end", "def update\n respond_to do |format|\n if @enabled_client.update(enabled_client_params)\n format.html { redirect_to @enabled_client, notice: 'Enabled client was successfully updated.' }\n format.json { render :show, status: :ok, location: @enabled_client }\n else\n format.html { render :edit }\n format.json { render json: @enabled_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n current_account.update(provider_params, without_protection: true)\n respond_with current_account\n end", "def update?\n @current_user.permission('Commodity', :clerk)\n end", "def update!(**args)\n @permission = args[:permission] if args.key?(:permission)\n end", "def update!(**args)\n @permission = args[:permission] if args.key?(:permission)\n end", "def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end", "def update\n @role = Role.find(params[:id])\n authorize @role\n\n if @role.update(access: role_params[:access])\n deliver_if(recipients: @role.user, key: 'users.added_as_coowner') do |_r|\n UserMailer.permissions_change_notification(@role, current_user).deliver_now\n end\n render json: {\n code: 1,\n msg: format(_('Successfully changed the permissions for %{email}. They have been\n notified via email.'), email: @role.user.email)\n }\n else\n render json: { code: 0, msg: flash[:alert] }\n end\n end", "def update\n authorize! :update, @customer\n update_customer_params = ( current_user.role == 'kanari_admin' ? admin_customer_params : customer_params)\n if @customer.update(update_customer_params)\n render json: nil, status: 200\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @wallet.update(wallet_params)\n format.html { redirect_to @wallet, notice: 'Wallet was successfully updated.' }\n format.json { render :show, status: :ok, location: @wallet }\n else\n format.html { render :edit }\n format.json { render json: @wallet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wallet.update(wallet_params)\n format.html { redirect_to @wallet, notice: 'Wallet was successfully updated.' }\n format.json { render :show, status: :ok, location: @wallet }\n else\n format.html { render :edit }\n format.json { render json: @wallet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n set_params\n @restaurant = Restaurant.find(params[:id])\n authorize! :update, @restaurant\n if (params[:restaurant][:status] == \"Exclusive\" &&\n @restaurant.owned_by != current_user.id)\n params[:restaurant][:status] = \"Pending Approval\"\n send_request\n @restaurant.mark_pending(current_user.id)\n end\n MenuItem.destroy_all(:restaurant_id => params[:id])\n set_menu_items_and_file\n super\n end", "def admin_update_permissions\n @user = User.includes(:perms).find(params[:id])\n authorize @user\n perms_ids = params[:perm_ids].blank? ? [] : params[:perm_ids].map(&:to_i)\n perms = Perm.where( id: perms_ids)\n current_user.perms.each do |perm|\n if @user.perms.include? perm\n if ! perms.include? perm\n @user.perms.delete(perm)\n if perm.id == Perm.use_api.id\n @user.remove_token!\n end\n end\n else\n if perms.include? perm\n @user.perms << perm\n if perm.id == Perm.use_api.id\n @user.keep_or_generate_token!\n end\n end\n end\n end\n\n if @user.save!\n redirect_to({controller: 'users', action: 'admin_index'}, {notice: _('Information was successfully updated.')}) # helpers.success key does not exist, replaced with a generic string\n else\n flash[:notice] = failed_update_error(@user, _('user'))\n end\n end" ]
[ "0.58043027", "0.57691044", "0.57562065", "0.56954324", "0.55856115", "0.55254626", "0.55041367", "0.54850465", "0.54640573", "0.5450176", "0.5440878", "0.5433542", "0.542459", "0.54207915", "0.54025215", "0.53998464", "0.53962314", "0.5392713", "0.5384155", "0.53773713", "0.53773004", "0.5361127", "0.53599304", "0.5338959", "0.5306208", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284782", "0.5284721", "0.52845687", "0.5283976", "0.5271661", "0.5263641", "0.5239446", "0.52345407", "0.5233452", "0.5232435", "0.5231243", "0.52177095", "0.52129287", "0.52121013", "0.520482", "0.520482", "0.51973456", "0.51836777", "0.5154053", "0.5147402", "0.5147402", "0.51403993", "0.5140348" ]
0.5662649
4
custom validation for uniqueness
def four_unique_answers array = [answer, distractor1, distractor2, distractor3] array.each_with_index do |v, k| a = array.delete_at(k) if array.include? v errors.add(v, "Questions require 4 unique options") end array.insert(k, v) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preconditions\n validator.kind == :uniqueness\n end", "def validates_uniqueness_of(*args)\n validates_with(UniquenessValidator, _merge_attributes(args))\n end", "def allows_unique?\n true\n end", "def validates_uniqueness_of(*args)\n validates_with(UniquenessValidator, _merge_attributes(args))\n end", "def validates_unique(*atts)\n message = (atts.pop[:message] if atts.last.is_a?(Hash)) || 'is already taken'\n atts.each do |a|\n ds = model.filter(Array(a).map{|x| [x, send(x)]})\n errors.add(a, message) unless (new? ? ds : ds.exclude(pk_hash)).count == 0\n end\n end", "def validate_uniqueness_of_email\n if Person.exists?(:email=>self.email,:user_id => self.user_id)\n self.errors.add(:email, :taken)\n return false\n else\n return true\n end\n end", "def username_must_be_unique\n errors.add(:username, :taken) if username.present? && User.where(username: username).where.not(id: model.id).exists?\n end", "def validate_unique(record)\n return if provided(record).uniq.length == provided(record).length\n\n record.errors.add(\n options[:attribute],\n 'contains an option more than once'\n )\n end", "def email_must_be_unique\n if ((Organization.where(['email = ? AND id <> ?', self.email, self.id]).count > 0) or\n (Volunteer.where(['email = ?', self.email]).count > 0))\n\n errors.add(:email, \"is already taken\")\n end\n end", "def after_save\n validate_uniqueness_as_run(:name)\n end", "def slug_uniqueness\n if name? and slug? and Quotum.where(slug: slug).where.not(id: id).exists?\n errors.add(:name, \"is unavailable\")\n end\n end", "def validates_uniqueness?(attribute)\n validator_of_type_exists?(validators_for(attribute), :uniqueness, false)\n end", "def value_uniqueness_without_scheme\n # if scheme is nil, then just unique for identifiable\n return unless Identifier.where(identifiable: identifiable, value: value).any?\n\n errors.add(:value, _('must be unique'))\n end", "def validate_uniqueness(attribute_name, message = nil, &block)\n value = attributes[attribute_name]\n unless block.call(value)\n append_error(attribute_name, message || :is_duplicated)\n end\n end", "def validate_unique *colnames\n\t\t\tcolnames.each { |colname|\n\t\t\t\tds = self.class.where colname => send(colname)\n\t\t\t\tds.filter!(~{primary_key => send(primary_key)}) unless new?\n\t\t\t\tif ds.count > 0\n\t\t\t\t\terrors.add(colname, 'must be unique.')\n\t\t\t\tend\n\t\t\t}\n\t\tend", "def validate\n super\n validates_presence :account\n validates_unique :account\n end", "def uniqueness\n if Task.exists?(:name => name, :stage_id => stage_id, :factor_id => factor_id) || Task.exists?(:name => name, :parent_task_id => parent_task_id)\n errors[:base] << \"An identical task already exists\"\n end\n end", "def validates_email_uniqueness\n if validate_attributes == true\n if email and (Contact.find_by_email(email) or Lead.find(:first, :conditions => [\"email = ? and record_type_id = ?\",email,MOLTEN_REQUEST_RECORD_TYPE]))\n errors.add('email', \"A contact already exists with this email address.\")\n end\n end\n end", "def validate\n validate_resources_defined\n validates_unique(:resource_id, :message => \"ARK must point to a unique Resource\")\n validates_unique(:archival_object_id, :message => \"ARK must point to a unique Archival Object\")\n super\n end", "def slug_unique_in_clinic\n errors.add(:slug, \"Slug: #{slug} already in use\") unless\n slug_unique_in_clinic?\n end", "def check_unique\n bar = Bar.where(:name => self.name, :user_id => self.user_id)\n if bar != nil\n \treturn false\n end\n end", "def email_is_unique\n active_users = User.active.where(:email => self.email)\n active_users = active_users.exclude(self) unless self.new_record?\n errors.add :email, 'ya existe' if active_users.count(:id) > 0\n end", "def unique?(field)\n !multiple?(field)\n end", "def validate_unique_submission\n existing = Course::Assessment::Submission.find_by(assessment_id: assessment.id,\n creator_id: creator.id)\n return unless existing\n\n errors.clear\n errors[:base] << I18n.t('activerecord.errors.models.course/assessment/'\\\n 'submission.submission_already_exists')\n end", "def numero_fattura_must_be_unique_in_anno_and_data_fattura\n #return if field.blank?\n not_uniq = self.class.count(:conditions => [\"anno = ? AND numero_fattura = ? AND YEAR(data_fattura) = ?\", self.anno, self.numero_fattura, self.data_fattura.year])\n if not_uniq > 0\n #self.errors.add(:data_fattura, \"anno, numero_fattura e anno di data_fattura devono essere unici\")\n flash[:error] = \"anno, numero_fattura e anno di data_fattura devono essere unici\"\n end\n #not_uniq = self.class.where(:anno=>self.anno,:numero_fattura=>self.numero_fattura).where(\"YEAR(data_fattura) = ?\",data_fattura.year).first\n #self.errors.add(:data_fattura, \"anno, numero_fattura e anno di data_fattura devono essere unici\") if not_uniq\n end", "def uniqueness_by_votable\n errors.add(\"you already voted!\") if Vote.where(votable: self.votable, user_id: self.user_id).count > 0\n end", "def save_if_unique(column)\n save\n rescue ActiveRecord::RecordNotUnique => e\n self.errors.add(column, :taken)\n false\n end", "def is_unique?(str)\n\nend", "def validate_uniqueness_of_new_image_url\n self.errors[:\"image.url\"] = 'Image url has already been added to this collection' if self.dup_image?\n end", "def validate_unique_submission\n return unless existing_submission\n\n errors.clear\n errors[:base] << I18n.t('activerecord.errors.models.course/video/submission.'\\\n 'submission_already_exists')\n end", "def name_uniqueness\n other_sprint = Sprint.where(board_id: self.board_id, name: self.name).where.not(id: self.id).count\n if other_sprint > 0\n errors.add(:name, 'must be uniq.')\n end\n end", "def name_is_unique\n return if self.name.nil?\n errors.add(:name, 'has already been taken') if Institution.where(name: self.name).reject{|r| r == self}.any?\n end", "def test_uniqueness_of_email\n person_repeat = Person.new(:email => @valid_person.email.upcase)\n assert !person_repeat.valid?\n assert_equal @error_messages[:taken], person_repeat.errors[:email][0], \"Test must be case sensitive.\"\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def name_must_be_unique_if_organization\n unless type == \"Individual\"\n self.errors.add(:name, :is_already_taken) if Entity.where('lower(name) = ?', name.downcase).any?\n end\n end", "def should_validate_uniqueness_of(*attributes)\n message, scope, case_sensitive = get_options!(attributes, :message, :scoped_to, :case_sensitive)\n scope = [*scope].compact\n case_sensitive = true if case_sensitive.nil?\n\n attributes.each do |attribute|\n matcher = validate_uniqueness_of(attribute).\n with_message(message).scoped_to(scope)\n matcher = matcher.case_insensitive unless case_sensitive\n should matcher.description do\n assert_accepts(matcher, subject)\n end\n end\n end", "def unique_email_user\n if self.class.where(email: email).count > 0\n errors.add(:email, :taken)\n end\n end", "def has_unique_name\n invalid = false\n if template\n invalid ||= template.common_fields.any? {|field| field.name.downcase == self.name.downcase && field != self }\n invalid ||= template.default_fields.any? {|field| field.name.downcase == self.name.downcase && field != self }\n else\n scope = self.class.common.where(\"LOWER(name) = LOWER(?)\", self.name)\n scope = scope.where(\"id != ?\", self.id) if persisted?\n invalid ||= scope.exists?\n end\n\n errors.add(:name, \"has already been taken\") if invalid\n end", "def test_uniqueness_of_username\n person_repeat = Person.new(:username => @valid_person.username.upcase)\n assert !person_repeat.valid?\n assert_equal @error_messages[:taken], person_repeat.errors[:username][0], \"Test must be case sensitive.\"\n end", "def validate_business_uniqueness( column_name )\n cond_str = \"#{column_name.to_s} = ? AND business_id = ?\";\n if ! self.new_record?\n cond_str = \"id != #{self.id} AND \" + cond_str;\n end\n \n count = self.class.count(:conditions=>[cond_str, self.send(column_name), self.business_id]);\n return (count == 0);\n end", "def validate_unique_with_status\n psl = PersonSchoolLink.where(:person_id => self.person_id, :school_id => self.school_id).status_active\n if self.id\n psl = psl.where(\"id != #{self.id}\")\n end\n if psl.length > 0\n errors.add(:status, \"Username already associated with this school.\")\n end\n end", "def value_uniqueness_with_scheme\n if new_record? && Identifier.where(identifier_scheme: identifier_scheme,\n identifiable: identifiable).any?\n errors.add(:identifier_scheme, _('already assigned a value'))\n end\n end", "def unique?\n false\n end", "def validate_challonge_id_uniqueness\n if tournament.matches.where.not(id: id).where(challonge_id: challonge_id).any?\n errors.add(:challonge_id, \"is not unique\")\n end\n end", "def unique?\n @unique\n end", "def unique_mobile_user\n if self.class.where(mobile: mobile).count > 0\n errors.add(:mobile, :taken)\n end\n end", "def raises_uniqueness_violation?(&block)\n transaction(:savepoint=>:only, &block)\n false\n rescue unique_constraint_violation_class => e\n e\n end", "def register_uniqueness(field_sym)\n \n @__fields_to_validate_uniqueness ||= {}\n @__fields_to_validate_uniqueness[field_sym] = true\n \n # puts @__fields_to_validate_uniqueness.inspect\n end", "def company_account_name_unique\n errors.add(:name, 'already exists') if name && account_name_exists?\n end", "def uniqueness_generate\n self.uniqueness_options.each do |field, options|\n value = send(field)\n unless value.present?\n value = Uniqueness.generate(options)\n self.send(\"#{field}=\", value)\n end\n end\n end", "def validate\n self.code = generate_unique_code\n end", "def unique?\n self[:unique] ? true : false\n end", "def validate_username_is_unique(username)\n return false unless username != nil\n return !User.username_exists?(username)\n end", "def validate\n errors.add(:username, \"already exists.\") if Player.get_player(username) != nil\n end", "def video_is_unique\n if self.new_record? && self.external_id.present? && Video.where(:external_id => self.external_id, :type => self.class.to_s).count > 0\n self.errors.add(:external_id, 'is not unique')\n false\n else\n true\n end\n end", "def validate_unique(child, child_type)\n if child_id_of.has_key?(child_type[0]) and child_id_of[child_type[0]].has_key?(child[child_type[1]])\n raise TPX_2_2::DuplicateElementInsertError, \"Duplicate input object id #{child[child_type[1]]} provided to #{self.class}!\"\n end\n end", "def uniqueness_for_school_and_subject\n school = School.find(school_id)\n school.courses.where(subject_id: subject_id).each do |course|\n if (course.call_number == call_number)\n errors.add(:course, 'course call number already exists')\n return\n elsif (course.friendly_name == friendly_name)\n errors.add(:course, 'course friendly name already exists')\n return\n end\n end\n end", "def save(options = {})\n super\n rescue ActiveRecord::RecordNotUnique\n errors.add(:model_id, \"has already been taken\")\n false\n end", "def validate_date_uniqueness()\n self.subject_class.attendances.each do |at|\n if self.date_created == at.date_created\n errors.add(:date, \"already existed\")\n end\n end \n end", "def check_uniqueness \n has_visits = pat.visits.where(doc_id: OWNER_DOC_ID).order(entry_ts: :desc).first.entry_ts.today? rescue nil #where('date(entry_ts)=?', self.entry_ts.to_date)\n errors.add(:reason, \"Only 1 visit is allowed by OHIP per patient per day\") if has_visits\n end", "def ensure_uniqueness_when_replicating(replication)\n # if uniqueness property is set, make sure the specified field is unique\n if params = replicable_opts(:uniqueness)\n # setup the params for the call to the generate_unique_field_value method\n params = params.merge(:mission => replication.to_mission, :dest_obj => replication.dest_obj)\n\n # get a unique field value (e.g. name) for the dest_obj (may be the same as the source object's value)\n unique_field_val = generate_unique_field_value(params)\n\n # set the value on the dest_obj\n replication.dest_obj.send(\"#{params[:field]}=\", unique_field_val)\n end\n end", "def validate_on_create\n errors.add(:username, \"is already taken for store #{self.store.friendly_name}\") if User.find_by_username_and_store_id(self.username, self.store_id)\n end", "def validates_as_unique(options = {})\n validated_columns = self.dimension_columns.map { |c| c.to_sym }\n return if validated_columns.empty?\n validates_each(validated_columns.first, options) do |record, attr_name, value|\n where_parts = []\n validated_columns.each do |column|\n value = record.send(column)\n if value.nil?\n # ignore\n elsif column == :start_time || column == :end_time\n where_parts << \"#{connection.quote_table_name(column)} = #{quote_value(value.strftime(\"%Y-%m-%d %H:%M:%S\"))}\"\n else\n where_parts << \"#{connection.quote_table_name(column)} = #{quote_value(value)}\"\n end\n end\n\n if !where_parts.empty?\n # don't need this since we only validate as unique on create currently\n #unless record.new_record?\n #where_parts << \"#{connection.quote_table_name(primary_key)} <> #{quote_value(record.send(primary_key))}\"\n #end\n\n duplicates = self.find_by_sql(\"SELECT 1 FROM #{connection.quote_table_name(self.to_s.underscore.pluralize)} WHERE #{where_parts.join(\" AND \")}\")\n unless duplicates.empty?\n record.errors.add_to_base(\"Set of dimension columns is not unique\")\n end \n else\n record.errors.add_to_base('All columns in validates_as_unique constraint have nil values')\n end\n end\n end", "def unique_email\n\t\treturn if email.blank?\n\t\tif Email.where(email: email).count > 0\n\t\t\terrors.add(:email, 'has already been taken')\n\t\tend\n\tend", "def validate\n if User.find_by_email(new_email)\n errors.add(:new_email, \"has already been taken\")\n end\n end", "def test_uniqueness_name\n u = Unit.find(2)\n u2 = Unit.create( :name => 'horsemen')\n assert !u2.valid?\n end", "def must_be_unique\n errors.add(:failed, I18n.t('room_type_master_rate_mappings.create.message.already_exist')) if\n !RoomTypeMasterRateMapping.find_by_pool_id_and_room_type_id(self.pool_id, self.room_type_id).blank?\n end", "def before_create\n super\n self.check_unique_code\n end", "def should_be_wrong_duplicated_name(wrong_album = @wrong_album)\n validate_column_errors(wrong_album, :name, false, 'activerecord.errors.messages.taken')\n end", "def should_be_wrong_duplicated_name(wrong_artist = @wrong_artist)\n validate_column_errors(wrong_artist, :name, false, 'activerecord.errors.messages.taken')\n end", "def unique?\n @unique\n end", "def unique?\n @unique\n end", "def unique?\n @unique\n end", "def unique?\n @unique\n end", "def unique?\n @unique\n end", "def validate_unique_kit_per_group\n if self.class.exists?(:kit_id => kit_id, :group_id => group_id)\n errors.add :kit, 'already exists in this group'\n end\n end", "def unique_name\n return true unless company && name\n scope = company.time_periods.where('LOWER(name) = ?', self.name.downcase)\n scope = scope.where('id <> ?', self.id) if self.id\n\n errors.add(:name, \"with value #{name} has already been taken\") if scope.count > 0\n end", "def check_uniqueness\n data = {\"university\" => :name, \"university_team\" => :name, \"course\" => :title, \"group\" => :title, \"user\" => :email ,\"cms_page\"=>:seo_url, \"sport\" => :title, \"question\" => :title}\n modal_name = \"\"\n column_name = \"\"\n column_val = \"\"\n data.each do |key, val|\n if params[key].present? && params[key][val].present?\n modal_name = key\n column_name = val\n column_val = params[key][val].strip\n break\n end\n end\n if params[:existing_data].present? && params[:existing_data].strip == column_val\n response = \"true\"\n elsif modal_name.classify.constantize.unscoped.exists?(column_name => column_val)\n response = \"false\"\n else\n response = \"true\"\n end\n render :js => response\n\n end", "def validate_attendances_uniqueness\n attendances.each do |attendance|\n next if attendance.justification_ids.blank?\n errors.add(:attendance_ids, \"a falta de #{attendance.date.month}/#{attendance.date.year} já tem justificativo.\")\n end\n end", "def validate_unique_name(name)\n if @@events.reduce(true) {|outcome, event| outcome && (event.name != name)}\n # Event name is unique.\n return name\n else\n handle_validation_fail \"That event name already exists!\"\n return false\n end\n end", "def validate_email_is_unique(email)\n return false unless email != nil\n return !User.email_exists?(email)\n end", "def uniqueness_constraint\n base_role.all_role_ref.detect{|rr|\n rs = rr.role_sequence\n rs.all_role_ref.size == 1 and\n rs.all_presence_constraint.detect do |pc|\n return pc if pc.max_frequency == 1 and !pc.enforcement # Alethic uniqueness constraint\n end\n }\n nil\n end", "def validate_name_uniqueness\n existing_files = ProjectFile.where(directory_id: directory_id, \n project_id: project_id, name: name)\n unless existing_files.empty? or (existing_files.size == 1 and \n existing_files.first == self)\n errors.add(:name, \"must be unique within a folder; please \"+\n \"change #{project.name}:#{path} to something different.\")\n end\n end", "def test_uniqueness_of_name\n client = Client.new(:name => \"XXX\", :tat => 14,\n :partener_bank_group_code => 'KK', :internal_tat => 90, :group_code => 'JO',\n :max_jobs_per_user_payer_wise => 5, :max_jobs_per_user_client_wise => 5,\n :max_eobs_per_job => 5)\n assert_equal(false,client.save)\n end", "def retail_subdomain_uniqueness\n return if retail_subdomain.blank? || !retail_subdomain_changed?\n errors.add(:retail_subdomain, :taken) if given_subdomain_exists?(retail_subdomain)\n end", "def validates_unique_source\n source_name = source_params[:name]\n all_sources.each do |source|\n if source.name == source_name\n render json: {error: 'Cannot have two sources with same name, must delete one first'}, status: :unprocessable_entity\n end\n end\n end", "def is_unique\n return true if fact_type.is_a?(LinkFactType) or # Handle objectification roles\n fact_type.all_role.size == 1 # and unary roles\n\n uniqueness_constraint ? true : false\n end", "def validates_duplicity_of(attr_name, scope: nil)\n set_callback :save, :before, Callback.new(attr_name, scope)\n end", "def test_uniqueness(column, value)\n if committed?\n (self.class.where(column.to_sym, value) - self).empty?\n else\n list = self.class.where(column.to_sym, value)\n if list.size == 1\n list.first.id == id\n else\n true\n end\n end\n end", "def should_be_wrong_duplicated_name(wrong_song = @wrong_song)\n validate_column_errors(wrong_song, :name, false, 'activerecord.errors.messages.taken')\n end", "def validate_name_and_url\n # check name and url_safe_name first and set validation error\n if self.name.blank? || self.name.nil?\n errors.add(:name, \" cannot be blank - please provide a name for your study.\")\n end\n if Study.where(name: self.name).any?\n errors.add(:name, \": #{self.name} has already been taken. Please choose another name.\")\n end\n if Study.where(url_safe_name: self.url_safe_name).any?\n errors.add(:url_safe_name, \": The name you provided (#{self.name}) tried to create a public URL (#{self.url_safe_name}) that is already assigned. Please rename your study to a different value.\")\n end\n end", "def postgresql_not_unique_error_class\n /(PG::UniqueViolation)|(ActiveRecord::RecordNotUnique)|(ActiveRecord::JDBCError)/\n end", "def site_membership_uniqueness\n return unless site && user\n\n existing_membership =\n user.site_memberships.where(site_id: site.id).where.not(id: id).first\n\n errors.add(:user, \"already has a membership to #{ site.url }\") if existing_membership\n end", "def invalidate_duplicate_users\n difference = users.size - users.uniq.size\n errors.add(:users, 'Duplicate User entered') if difference != 0\n end", "def test_rule_name_uniquess_for_a_person\n owner = people(:valid_person)\n rule_1 = Rule.new(:person_id=>owner.id,\n :rule_name=>\"test\",\n :state=>\"active\",\n :logic=>\"and\")\n assert rule_1.save, \"Rule 1 cannot be saved.\"\n\n rule_2 = Rule.new(:person_id=>owner.id,\n :rule_name=>\"test\",\n :state=>\"active\",\n :logic=>\"or\")\n assert !rule_2.save, \"Allows duplicate rule names for a person.\"\n end", "def check_id_uniqueness\n check('object id uniqueness') do |messages|\n list = [\n check_network_id_uniqueness,\n check_node_id_uniqueness,\n check_link_id_uniqueness,\n check_tp_id_uniqueness\n ]\n messages.push(list)\n messages.flatten!\n end\n end", "def subdomain_is_unique\n if subdomain.present? && (League.all.count > 0)\n unless League.find_by_subdomain(subdomain).nil?\n errors.add(:subdomain, \"is already taken\")\n end\n if Apartment::Elevators::Subdomain.excluded_subdomains.include?(subdomain)\n errors.add(:subdomain, \"is not available\")\n end\n end\n end", "def validate\n return HESResponder(\"Field and value required.\", \"ERROR\") unless params[:field] && params[:value]\n fs = ['email','username', 'altid']\n f = params[:field]\n if !fs.include?(f)\n return HESResponder(\"Can't check this field.\", \"ERROR\")\n end\n f = f.to_sym\n v = params[:value]\n if @promotion.users.where(\"LOWER(#{f}) = ?\", v.downcase).count > 0\n return HESResponder(f.to_s.titleize + \" is not unique within promotion.\", \"ERROR\")\n else\n return HESResponder()\n end\n end", "def unique_sequence_number\n unless self.lifecycle.nil?\n if(lifecycle.lifecycle_phases.find_all_by_sequence_number(self.sequence_number).count > 0)\n errors.add(:sequence_number, \"must be unique for this lifecycle\")\n end\n end\n end", "def test_unique_book_isbn\n \n book = Book.new(:title => \"\",\n :isbn => \"978-0811827782\",\n :book_id => 1)\n \n assert !book.save\n assert_equal \"Please fill in!\", book.errors.on(:title)\n assert_equal \"Already in Database!\", book.errors.on(:isbn)\n end", "def check_username_uniqueness\n if self.type == 'MultiSchoolAdmin'\n h_user = self.higher_user\n if h_user.present? and h_user.type == 'MultiSchoolAdmin' #higher user is client admin only when msg is created for the first time\n user_detail = AdminUser.first(:joins=>[:school_group_user],\n :conditions=>[\"school_group_users.school_group_id=? and admin_users.username=?\",h_user.school_group_user.school_group_id,self.username])\n self.errors.add(:username,\"is already taken\") if user_detail.present?\n end\n else\n self.errors.add(:username,\"is already taken\") if AdminUser.exists?([\"admin_users.type NOT IN ('MultiSchoolAdmin') and admin_users.username=?\",self.username])\n end \n end" ]
[ "0.7855296", "0.7746909", "0.7605428", "0.7602301", "0.7372961", "0.7351098", "0.7237629", "0.7133063", "0.7131976", "0.70436853", "0.690079", "0.6899203", "0.6892068", "0.6869978", "0.68205255", "0.6786011", "0.6718982", "0.66834176", "0.66461587", "0.66362333", "0.6609155", "0.65835243", "0.6577903", "0.6576412", "0.65760595", "0.6565689", "0.6541111", "0.65390795", "0.6528378", "0.65234125", "0.64980626", "0.64875466", "0.6476941", "0.6469517", "0.6451616", "0.6425463", "0.64252067", "0.64244515", "0.641945", "0.6416556", "0.6411729", "0.64093876", "0.63640183", "0.6354894", "0.63450307", "0.6344217", "0.63296497", "0.63228804", "0.6310845", "0.6307711", "0.6296317", "0.62919474", "0.62840444", "0.6249278", "0.6234753", "0.62230116", "0.6212414", "0.6211099", "0.6207231", "0.62060106", "0.6201813", "0.6198981", "0.61953247", "0.6192192", "0.61772317", "0.6172706", "0.6160261", "0.61516386", "0.61493456", "0.6141971", "0.6129189", "0.6129189", "0.6129189", "0.6118606", "0.6118606", "0.61106473", "0.6101891", "0.6099577", "0.6093199", "0.60853714", "0.60680276", "0.60634345", "0.6061215", "0.6041188", "0.6033545", "0.6030035", "0.6020849", "0.6015206", "0.601482", "0.6011296", "0.6003896", "0.5995628", "0.5994334", "0.5993118", "0.59924", "0.5990009", "0.5980461", "0.5977023", "0.59695005", "0.59688777", "0.59633" ]
0.0
-1
require 'stopwords' def stopwords Terminology::STOPWORDS end def file File.read(Rails.root.join('public/2015/FY15_Tabular.xml')).to_s end def xml_doc Nokogiri::XML(file).to_s end
def get_text_node(node) text = nil if node and node.text text = node.text end text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_stop_words\n # Meta-level: caller & caller_locations (inspect.stack in python)\n # p caller\n # p caller_locations.last(5).inspect\n if caller_locations[-3].label != 'extract_words'\n p caller_locations.last(5).inspect # just for debug\n return nil\n end\n stop_words = File.open('/Users/ravil/experimental/exips/stop_words.txt').read.split(',')\n stop_words += 'abcdefghijklmnopqrstuvwxyz'.chars\n stop_words\nend", "def stopwords\n @stopwords ||= IO.readlines(@stopwords_file).map { |l| l.strip }\n end", "def stopwords\n @stopwords ||= IO.readlines(@stopwords_file).map { |l| l.strip }\n end", "def stopwords\n @stopwords ||= IO.readlines(@stopwords_file).map { |l| l.strip }\n end", "def to_terms\n\t\t\traise \"Document invalid.\" unless @doc\n\t\t\tterms = @doc.gsub(/[^a-z]+/u, ' ').strip.split(' ')\n\t\t\tterms.reject! do |term|\n\t\t\t\t#@@stop_words.include?(term) || term.length < 4 || term.length > 20\n ((term.length < 3 && !SHORT_WORDS.include?(term)) || term.length > 20)\n\t\t\tend\n terms.collect! {|term| term.stem}\n terms = terms.select {|term| term.length > 1}\n\t\t\tterms - STOP_WORDS\n\t\tend", "def read_stopwords_file(filename)\n stopwords = []\n CSV.foreach(filename) do |row|\n stopwords << row[0]\n end\n stopwords\n # puts \"loaded \" + stopwords.length.to_s + \" stopwords.\"\n end", "def load_stopwords_file(file) \n stop_words = {}\n\n # Looping through the file and adding each word to a hash table after chomping them\n File.open(file, \"r\").each_line do |line|\n stop_words[line.chomp] = 1\n end\n\n return stop_words\n\nend", "def load_stopwords_file(file)\n f = File.open(file, \"r\")\n stopwordH = {}\n f.each_line do |stopword|\n stopwordH[stopword] = 0\n end\n return stopwordH\nend", "def run\n\t\t\t\tif save_file\n\t\t\t\t\tdoc = Nokogiri::HTML(open(@file,\"r\"))\n\t\t\t\t\tparse_page(doc)\n\t\t\t\t\tflush_page\n\t\t\t save_words\n\t\t\t end\n\t\t\tend", "def stopwords\n @stopwords ||= @stopword_generator.to_set\n end", "def index_file(file, pages_dir, stopwords, file_data)\n # Removing the dir from the file name\n # begin\n actual_name = file.gsub(pages_dir, \"\")\n # rescue NoMethodError\n# actual_name = badpage.html\n \n\n # Resetting the file path\n file_path = \"\"\n file_path = File.expand_path(\".\") + \"/\" + file\n\n print \"Parsing HTML document: \" + actual_name + \" \\n\"\n\n # Finding all the tokens in the file\n tokens = find_tokens(file_path)\n\n # Getting the page title, word count, and page url\n page_title = get_title(file_path)\n word_count = tokens.length\n page_url = file_data[actual_name]\n\n # Updating the docindex hash\n $docindex[file.gsub(pages_dir, \"\")] = [word_count, page_title, page_url]\n\n # Removing the stop words and getting the stem words in the file\n tokens = remove_stop_tokens(tokens, stopwords)\n tokens = stem_tokens(tokens)\n\n # Creating the invindex hash table\n for token in tokens\n begin\n if $invindex.member?(token)\n if $invindex[token].member?(actual_name)\n $invindex[token][actual_name] += 1\n else\n $invindex[token][actual_name] = 1\n end\n else\n $invindex[token] = {actual_name => 1}\n end\n # end\n# rescue NoMethodError\n # puts \"NoMethodError\"\n end\n #puts file_name\n # title = nil\n end\n #end\nend", "def parse_kramdown(file)\n ::Kramdown::Document.new File.readlines(file).join, :input => 'QuickStartParser' \n end", "def yardoc_file; end", "def get_stopword_list\n list = []\n \n begin\n File.open(\"stopwords.txt\", \"r\") do |file|\n file.each_line { |line| list.push( line.chomp ) }\n end\n rescue\n puts \"The file 'stopwords.txt' was not found.\"\n exit\n end\n\n return list\nend", "def create\n #Load file\n \n if params[:xml_file].content_type =~ /xml/\n begin\n plain_string = XmlSimple.xml_in(params[:xml_file].read,{'ForceArray' => false, 'NoAttr' => true,'SuppressEmpty' => true })\n flash[:notice]=\"File parsed successfully.\"\n rescue\n flash[:notice]=\"Error in parsing file.\"\n end\n if plain_string[\"keyword\"].kind_of?(Array) && !plain_string[\"keyword\"].empty?\n plain_string[\"keyword\"].each do|kwd|\n next if kwd.blank?\n # Language will be updated later after identifying keyword language\n Keyword.create({:keyword=>kwd,:language=>\"english\"})\n end\n end\n\n AsyncRequest.execute\n\n end\n respond_to do |format|\n format.html{render :action=>:new}\n end\n end", "def documentation\n\troot = settings.root + '/doc'\n\tcontent = File.open(\"#{root}/#{@user.default_locale}.textile\", 'r').read()\n\tRedCloth.new(content).to_html\nend", "def load_words\n File.read(\"../scrabble word cheat/words.txt\").split(\"\\n\")\nend", "def custom_stopwords(stopwords)\n unless stopwords.is_a?(Enumerable)\n if stopwords.strip.empty?\n stopwords = []\n elsif File.exist?(stopwords)\n stopwords = File.read(stopwords).force_encoding(\"utf-8\").split\n else\n return # Do not overwrite the default\n end\n end\n Hasher::STOPWORDS[@language] = Set.new stopwords\n end", "def stop_words\n return {} if self.collection_yaml.nil?\n return self[:stop_words] unless self[:stop_words].nil?\n \n self[:stop_words] = Treat.languages[self.treat_collection.language].stop_words\n self.save!\n \n self[:stop_words]\n end", "def load_words\n File.readlines(\"#{WORD_DIR}/#{language}.txt\").map(&:strip)\n end", "def getStopWordsSet(path)\n unless caller[0].include? \"frequencies\"\n return\n end\n Set.new(open(path){|f| f.read}.split(\",\")).merge( Set.new( ('a' .. 'z').to_a ))\nend", "def getToolsStopwords( text)\n params = Hash.new\n params['text'] = text\n return doCurl(\"get\",\"/tools/stopwords\",params)\n end", "def gensecretword \n @wordtable.sample.gsub(/\\s+/, \"\") # revoving all whitespaces as wordfile has phrases as possible secret words\nend", "def process_input_file\n\t\t\tinput_file = File.open(@params[:input_file], 'r')\n\t\t\tfile_terms = convert_contents_to_search_string(input_file.read)\n\t\t\tadd_terms(file_terms)\n\t\tend", "def completed_text_extraction\n end", "def run\n load_the_file\n word_frequency\n match_the_word\n end", "def parse_to_kramdown_document\n # Initialize processing i_vars\n @data_output = {}\n @deleted_text_output = []\n @notes_output = []\n @warnings_output = []\n # Parse\n @ke_context = Folio::KeContext.new(\n { 'root' => Kramdown::ElementRt.new(:root, nil, nil, :encoding => 'UTF-8') },\n self\n )\n @xml_document = Nokogiri::XML(@folio_xml) # Can't do { |config| config.noblanks }, it breaks parsing\n\n # Transform the XML tree\n @xml_document.css('record').each do |record_xn|\n process_xml_node(record_xn)\n end\n kramdown_doc = Kramdown::Document.new('', @kramdown_options)\n kramdown_doc.root = @ke_context.get('root', nil)\n post_process_kramdown_tree!(kramdown_doc.root)\n kramdown_doc\n end", "def initialize(text_file_name)\n @dictionary = Hash.new 0 \n #read file text_file_name\n #extract words from string (file contents) using method 'words' below.\n #put in dictionary with their frequency (calling train! method)\n File.open(text_file_name) do |f|\n f.each_line do |line|\n words = line.split\n words.each do |word|\n \n train! words word\n\n end\n end\n end\n end", "def request_doc\n \n end", "def initialize(text_file_name)\n text = \"\"\n #read file text_file_name\n File.open(text_file_name, \"r\") do |f|\n f.each_line do |line|\n\ttext << line.chomp << \" \"\n end\n end\n\n #extract words from string (file contents) using method 'words' below.\n word_list = words(text)\n\n #put in dictionary with their frequency (calling train! method)\n train!(word_list)\n end", "def initialize(text_file_name)\n @dictionary = Hash.new(0)\n contents = IO.read(text_file_name)\n wordsInFile = words(contents)\n train!(wordsInFile)\n end", "def initialize(word_list_file_path)\n word_list = ::File.readlines(word_list_file_path).map(&:chomp)\n @words = word_list.map(&:downcase)\n end", "def get_xml_document(workflow_file)\n xml_file = File.new(workflow_file)\n document = Document.new(xml_file)\n end", "def generate_doc\n\n end", "def load_xml_doc( filename )\n File.open( filename, 'r') do |file|\n return Oga.parse_xml( file )\n end\n\n puts \"ERROR: loading #{filename}\"\n return nil\n end", "def prepare_words(filename)\n @words = []\n File.readlines(filename).each do |line|\n line.split.each {|word| @words << word}\n end\n end", "def initialize(stop_word_file = 'project1/src/resources/stop_words.yml')\n # load stop words\n # CLASS VARIABLE \n @@stopWords = YAML::load_file(stop_word_file)\n puts \"#{@@stopWords.length} stop words loaded...\" \n end", "def index\n @words = Word.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @words }\n format.csv { send_csv }\n end\n end", "def getPr2\n if !File.exists?(\"pr2_genus.txt\")\n `wget http://application.sb-roscoff.fr/redgenes//static/pr2_gb191_taxonomy.xls`\n # Problem -- need manual parsing of microsoft silliness as useful text file not provided\n STDERR << \"Please save genus tab as text to pr2_genus.txt\\n\"\n exit(1)\n end\nend", "def load_ingest_content( filename )\n xml_doc = TaskHelpers.load_xml_doc( filename )\n return xml_doc\n end", "def initialize(text: ,delimeter: TxtMine::Strategy::PunctuationDelimeter, stop_words: STOP_WORDS, downcase: true, doc_id: self.class.get_next_doc_id)\n @text, @delimeter, @stop_words, @downcase, @doc_id = text, delimeter, stop_words, downcase, doc_id\n @stop_words ||= []\n @delimited, @cased, @filtered = false, false, false\n self.class.next_doc_id = doc_id + 1 if doc_id != @@next_doc_id - 1\n\n end", "def analyse(file_path)\n fixed = 0\n words = []\n File.open(file_path, \"r:iso-8859-1\") do |f|\n words = f.readlines(sep=\" \")\n words.dup.each_with_index do |word, i|\n word.delete!(\" \")\n match, dist = @tree.best word.downcase\n if !match.nil? && dist != 0\n fixed+=1\n words[i] = capitalize_if_needed(word, match)\n # puts \"#{word} - #{match}\"\n end\n end\n end\n # print \"file: #{file_path}\\nwords: #{words.size}\\nfixed words:#{((fixed.to_f/(words.size).to_f)*100).round(2)}%\\n\"\n save words, file_path\n end", "def extract_all_words(html)\n doc = Nokogiri::HTML(html)\n keywords = []\n doc.css(\"meta[name='keywords']\").each do |node|\n keywords += node['content'].gsub(/\\s+/, \" \").gsub(/[^a-zA-Z\\- ',]/, '').squeeze(\" \").split(\",\")\n end\n text = String.new\n doc.css(\"meta[name='description']\").each do |node|\n text += node['content']\n end\n \n %w(script style link meta).each do |tag|\n doc.css(tag).each { |node| node.remove }\n end\n\n w = []\n doc.traverse do |node|\n if node.text? then\n w << node.content + \" \"\n end\n end\n text += w.join.gsub(/\\s+/, \" \").gsub(/[^a-zA-Z\\- ']/, '').squeeze(\" \")\n words = (text.downcase.split - STOPWORDS)\n \n final = (keywords + words)\n final.map do |w|\n w.stem\n end\n end", "def xml_parser(directory_name, filename)\n @doc = Document.new File.new(directory_name + filename)\n get_dataset_name(filename)\n set_topics\n set_dataset_rel_and_attr\n get_footnotes\n record_attributes\n @dataset.save\n end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def doc_xml(file)\n content = nil\n Zip::Archive.open(file) do |archive|\n archive.fopen('word/document.xml') do |f|\n content = f.read\n end\n end\n content\n end", "def stop_words\n # Words taken from Jonathan Feinberg's cue.language (via jasondavies.com), see lib/cue.language/license.txt.\n \"i|me|my|myself|we|us|our|ours|ourselves|you|your|yours|yourself|yourselves|he|him|his|himself|she|her|hers|herself|it|its|itself|they|them|their|theirs|themselves|what|which|who|whom|whose|this|that|these|those|am|is|are|was|were|be|been|being|have|has|had|having|do|does|did|doing|will|would|should|can|could|ought|im|youre|hes|shes|its|were|theyre|ive|youve|weve|theyve|id|youd|hed|shed|wed|theyd|ill|youll|hell|shell|well|theyll|isnt|arent|wasnt|werent|hasnt|havent|hadnt|doesnt|dont|didnt|wont|wouldnt|shant|shouldnt|cant|cannot|couldnt|mustnt|lets|thats|whos|whats|heres|theres|whens|wheres|whys|hows|a|an|the|and|but|if|or|because|as|until|while|of|at|by|for|with|about|against|between|into|through|during|before|after|above|below|to|from|up|upon|down|in|out|on|off|over|under|again|further|then|once|here|there|when|where|why|how|all|any|both|each|few|more|most|other|some|such|no|nor|not|only|own|same|so|than|too|very|say|says|said|shall\"\nend", "def file_process(file)\n\n stop_words = File.read('stop_words.txt').split(\"\\n\")\n\n lines = File.readlines(file)\n title = lines[0]\n speech = lines[1..-1]\n line_count = speech.size\n text = speech.join\n char_count = text.length\n char_count_nospaces = text.force_encoding('UTF-8').gsub(/\\s+/, '').length\n word_count = text.scan(/\\w+/).length\n sentence_count = text.split(/\\.|\\?|!/).length\n average_words_sentence = word_count / sentence_count\n paragraph_count = text.split(/\\n\\n/).length\n word_frequency_hash = {}\n word_frequency_top = []\n\n text.split().each do |word|\n unless stop_words.include?(word.downcase)\n if word_frequency_hash.has_key?(word.downcase)\n word_frequency_hash[word.downcase] += 1\n else\n word_frequency_hash[word.downcase] = 1\n end\n end\n end\n\n non_fluff_words = (word_frequency_hash.size.to_f / word_count.to_f * 100).to_i\n\n array_of_sentences = text.scan(/[^\\.!?]+[\\.!?]/).map(&:strip).sort_by { |sentence| sentence.length }\n ideal_sentences = array_of_sentences[array_of_sentences.length/3..array_of_sentences.length - array_of_sentences.length/3]\n\n word_frequency = word_frequency_hash.sort_by { |key, value| value}.reverse\n word_frequency.flatten.each_with_index { |word, index| word_frequency_top << word if index.even? }\n\n puts \"#{title}\"\n puts \"#{line_count} lines\"\n puts \"#{char_count} characters\"\n puts \"#{char_count_nospaces} characters excluding spaces\"\n puts \"#{word_count} words\"\n puts \"#{sentence_count} sentences\"\n puts \"#{paragraph_count} paragraphs\"\n puts \"#{average_words_sentence} words per sentence (average)\"\n puts \"#{word_frequency_hash.size} non-fluff words\"\n puts \"roughly #{non_fluff_words} percent non-fluff words.\"\n puts \"Top 10 non-fluff words: #{word_frequency_top.take(10)} top 10 non-fluff words.\"\n puts \"Ideal sentences array: #{ideal_sentences.take(7) }\"\n puts\n puts\n\nend", "def read_word_file\n File.open(\"5desk.txt\").each { |line| @text_file << line }\n end", "def load_xml(file_name = @file_name)\n\t\tputs \"loading xml...\"+file_name\n\t\ttweet_loader = TweetLoader.new(file_name)\n\t\ttweet_loader.load_tweets\n\t\t@tweets = tweet_loader.get_tweets\n\tend", "def read_word_file(file)\n\t\tFile.foreach(file) do |line|\n\t\t\tif(@@word.legal?(line.chomp)) # Check if current line/word is legal\n\t\t\t\tLEGAL_WORDS << line.chomp # Add line/word to array of legal words\n\t\t\tend\n end\n LEGAL_WORDS.freeze # Freeze LEGAL_WORDS to make it immutable\n\tend", "def extract\n # create hash of words with number of their instances in tokens excluding stopwords\n words_hash = Hash.new(0)\n @tokens.each { |w| \n unless w.empty? or stop_words_for(@language)[w]\n words_hash[w] += 1 \n end\n }\n\n idfs_hash = get_idfs(words_hash.keys)\n\n # calculate tf-idf for each word into keywords array\n keywords = []\n max_num = words_hash.values.max.to_f\n words_hash.each do |word, num|\n tf = num / max_num\n idf = idfs_hash[word]\n keywords << [word, (tf * idf).round(5), idf.round(5)]\n end\n\n # return keywords sorted by rank descending\n keywords.sort_by {|word, rank, idf| -rank}\n end", "def init\n f = File.open(@pref_file)\n @doc = Nokogiri::XML(f)\n f.close\n @doc.remove_namespaces! \n end", "def process_stopwords(txt = self.search_text)\n #Needs to be set so highlighting will work properly (can't match quotes)\n self.highlight_token_array(txt)\n #Now put humpty dumpty back together without the nasty stopwords, sort the tokens by length\n self.search_token_array(txt).join(\" \")\n end", "def analysis\n @str = params[:text] ||= '解析対象の文字列'\n @words = Tag.counter(Tag.generate(@str))\n end", "def initialize(file_content)\n # Open XML file\n self.fichero = file_content\n # Initialize XML Document\n @doc = Document.new self.fichero\n # Initialize attribute default values\n self.lista_devoluciones = []\n end", "def get_words(str)\n stopwords = stopwords()\n \n str = str.downcase\n str = strip_parenthesis(str)\n str.strip!\n str.gsub!(\"'\", ' ')\n str.gsub!('\"', ' ')\n str.gsub!('.', ' ')\n str.gsub!(',', ' ')\n str.gsub!(':', ' ')\n str.gsub!('/', ' ')\n str.gsub!('!', ' ')\n str.gsub!('?', ' ')\n str.gsub!(';', ' ')\n str.gsub!('<', ' ')\n str.gsub!('>', ' ')\n str.gsub!('-', ' ')\n str.gsub!('$', ' ')\n str.gsub!(/( )+/, ' ')\n str_arr = str.split(' ')\n out_arr = []\n \n for word in str_arr\n if(word.length > 3 and out_arr.index(word) == nil and stopwords.index(word) == nil)\n out_arr << word\n end\n end\n \n out = out_arr.join(' ')\n \n return out\n end", "def holidayreq\n send_file '/home/user/Programs/PescadoHRIS/public/HolidayRequestForm.docx', :type => \"application/octet-stream\"\n end", "def doc; end", "def doc; end", "def doc; end", "def doc; end", "def tokenize(s)\nterms = s.gsub(/(\\s|\\d|\\W)+/u,' ').rstrip.strip.downcase.split(' ')\nterms.reject!{|term| @@stop_words.include?(term) || term.length < 3}\nterms\nend", "def alvin_xslt\n Nokogiri::XSLT(File.open(Rails.root + \"app/models/processes/create_mets_package/assets/LibrisToAlvin.xsl\", \"rb\"))\n end", "def initialize\n @words_set = Set.new\n words_file = File.expand_path(File.dirname(__FILE__) + '/words.txt')\n File.readlines(words_file).each do |line|\n @words_set.add(line.to_s.strip)\n end\n end", "def load_xml file\n f = File.open file\n doc = Nokogiri::XML f\n f.close\n doc\n end", "def handle_controlled_vocabulary(data, import)\n print \"Handling CV \"\n if import.metadata['controlled_vocabulary']\n print \"from database.\\n\"\n ControlledVocabularyTerm.all.each do |cv|\n data.keywords.merge!(cv.name => cv)\n end\n else\n print \"as newly parsed.\\n\"\n # from collecting_events\n PREDICATES.each do |p|\n data.keywords.merge!(p => Predicate.create(name: \"CollectingEvents:#{p}\", definition: \"The verbatim value imported in for #{p}.\") )\n end\n\n # from handle taxa\n data.keywords.merge!( \n 'Taxa:Synonyms' => Predicate.create(name: 'Taxa:Synonyms', definition: 'The verbatim value on import from Taxa#Synonyms.'),\n 'Taxa:References' => Predicate.create(name: 'Taxa:References', definition: 'The verbatim value on import Taxa#References.')\n )\n\n # from handle specimens\n data.keywords.merge!( \n 'AdultMale' => BiocurationClass.create(name: 'AdultMale', definition: 'The collection object is comprised of adult male(s).'), \n 'AdultFemale' => BiocurationClass.create(name: 'AdultFemale', definition: 'The collection object is comprised of adult female(s).'), \n 'Immature' => BiocurationClass.create(name: 'Immature', definition: 'The collection object is comprised of immature(s).'), \n 'Pupa' => BiocurationClass.create(name: 'Pupa', definition: 'The collection object is comprised of pupa.'), \n 'Exuvium' => BiocurationClass.create(name: 'Exuvia', definition: 'The collection object is comprised of exuvia.'),\n 'AdultUnsexed' => BiocurationClass.create(name: 'AdultUnsexed', definition: 'The collection object is comprised of adults, with sex undetermined.'), \n 'AgeUnknown' => BiocurationClass.create(name: 'AgeUnknown', definition: 'The collection object is comprised of individuals of indtermined age.'), \n 'OtherSpecimens' => BiocurationClass.create(name: 'OtherSpecimens', definition: 'The collection object that is asserted to be unclassified in any manner.'), \n 'ZeroTotal' => Keyword.create(name: 'ZeroTotal', definition: 'On import there were 0 total specimens recorded in the FM database.'),\n 'IdentifiedBy' => Predicate.create(name: 'IdentifiedBy', definition: 'The verbatim value in the identified by field.'),\n 'YearIdentified' => Predicate.create(name: 'YearIdentified', definition: 'The verbatim value in the year identified field.'),\n 'OldIdentifiedBy' => Predicate.create(name: 'OriginalIdentifiedBy', definition: 'Imported value: Old identified by.'),\n 'LocalityCode' => Predicate.create(name: 'LocalityCode', definition: 'Imported value: Locality Code.'),\n 'Country' => Predicate.create(name: 'Country', definition: 'Imported value: Country.'),\n 'State' => Predicate.create(name: 'State', definition: 'Imported value: State.'),\n 'County' => Predicate.create(name: 'County', definition: 'Imported value: County.'),\n 'Locality' => Predicate.create(name: 'Locality', definition: 'Imported value: Locality.'),\n 'Park' => Predicate.create(name: 'Park', definition: 'Imported value: Park.'),\n 'BodyOfWater' => Predicate.create(name: 'BodyOfWater', definition: 'The verbatim value in the Body Of Water.'),\n 'DrainageBasinLesser' => Predicate.create(name: 'DrainageBasinLesser', definition: 'The verbatim value in the Drainage Basin Lesser.'),\n 'DrainageBasinGreater' => Predicate.create(name: 'DrainageBasinGreater', definition: 'The verbatim value in the Drainage Basin Greater.'),\n 'StreamSize' => Predicate.create(name: 'StreamSize', definition: 'The verbatim value in the StreamSize.'),\n 'INDrainage' => Predicate.create(name: 'INDrainage', definition: 'The verbatim value in the INDrainage.'),\n 'WisconsinGlaciated' => Predicate.create(name: 'WisconsinGlaciated', definition: 'The verbatim value in the Wisconsin Glaciated.'),\n 'OldLocalityCode' => Predicate.create(name: 'OldLocalityCode', definition: 'Imported value: Old Locality Code.'),\n 'Host' => Predicate.create(name: 'Host', definition: 'The verbatim value in the Host.'),\n )\n\n import.metadata['controlled_vocabulary'] = true\n end\n end", "def to_s\n\n\t \"Words running in pure mode using wordnet files found at #{wordnet_path}\"\n\n\tend", "def index\n @ms_words = MsWord.all\n end", "def initialize\r\n load_word_catalog\r\n end", "def DataLoadFromFile(filename)\n file = File.new(filename)\n \n @xml_data = file\n self.ScrapAnalyse()\n end", "def initialize(ead_file)\n @xml = Nokogiri::XML(open(ead_file))\n @doc = {}\n self.getID\n self.getFormatFacet\n self.getTitle\n self.getSubjects\n self.getGeographicSubjects\n self.getPublisherFacet\n self.getGenreFormatFacet\n self.getLanguageFacet\n self.getAbstract\n self.getBiogHist\n #self.getEAD\n end", "def scanner\n @sentences ||= File.open(@path) do |file|\n file.each_line.each_with_object([]) do |line, acc|\n stripped_line = line.strip\n\n unless stripped_line.nil? || stripped_line.empty?\n acc << line.split(' ').map do |word|\n word.split('/').first\n end.join(' ')\n end\n end\n end\n\n end", "def create_sax_document\n sax_document = SaxDocumentExamineMets.new\n Nokogiri::XML::SAX::Parser.new(sax_document).parse(@text)\n\n # sax parser errors may not be fatal, so store them to warnings.\n\n if sax_document.warnings?\n warning \"The SAX parser produced the following warnings for '#{short_filename}':\"\n warning sax_document.warnings\n end\n\n # SAX errors just treated as warnings (for now).\n\n if sax_document.errors?\n warning \"The SAX parser produced the following errors for '#{short_filename}':\"\n warning sax_document.errors\n end\n\n return sax_document\n end", "def index\n positive = YAML::load_file(\"/home/ubuntu/scrap/app/controllers/rt-polarity-pos.yml\")\n negative = YAML::load_file(\"/home/ubuntu/scrap/app/controllers/rt-polarity-neg.yml\")\n #classifier = Classifier::Bayes.new('Positive','Negative')\n Tweet.each do |tt|\n puts tt.content\n end \n end", "def properties_word_ml; end", "def xfrm_remove_stop_words(str)\n stop_words = ['Variant','variant', 'Erhua', 'Counter', 'Has', 'I', 'me', 'a', 'an', 'am', 'are', 'as', 'at', 'be', 'by','how', 'in', 'is', 'it', 'of', 'on', 'or', 'that', 'than', 'the', 'this', 'to', 'was', 'what', 'when', 'where', 'who', 'will', 'with', 'the']\n results = []\n str.gsub!($regexes[:inlined_tags], \"\") ## remove tag blocks\n str.split(' ').each do |sstr|\n # remove non word characters from string\n results << sstr unless stop_words.index(sstr.gsub(/[^a-zA-Z|\\s]/, '').strip)\n end\n return results.flatten.compact.join(' ')\n end", "def read_file\n\t\t\treturn 'wordlists/reverse_ip.txt'\n\t\tend", "def documents; end", "def documents; end", "def parse_file(file)\n comment_symbol = \"//\"\n comment_matcher = Regexp.new('^\\\\s*' + comment_symbol + '\\\\s?')\n comment_filter = Regexp.new('(^#![/]|^\\\\s*#\\\\{)')\n\n docs_text = code_text = '';\n has_code = false\n \n if @filename\n #puts \"FILE: #{@filename}\" #debugging\n #get file as one string for class detecting\n f = File.new(@filename)\n text = f.read\n f.close\n \n code = IO.readlines(@filename)\n code.each_with_index do |line, index|\n if comment_matcher.match(line) and !comment_filter.match(line) \n if has_code\n save_section(docs_text, code_text)\n \n #reset docs and code\n docs_text = code_text = ''\n has_code = false\n end\n\n #docs_text += line.sub(comment_matcher, '') + \"\\n\"\n docs_text += line.sub(comment_matcher, '')\n else\n #remove tabs\n #line.gsub!(\"\\t\", \"\")\n line.gsub!(\"\\t\", \" \")\n\n #remove newlines\n line.gsub!(/\\n+/, \"\")\n\n #remove whitespace\n line.gsub!(/$\\s+/, \"\")\n line.gsub!(/^\\s+/, \"\")\n\n line = line.gsub('\\t', \"\").gsub('\\n',\"\").gsub(/\\s+1/,\"\")\n\n has_code = true\n code_text += line + \"\\n\"\n #code_text += line\n \n if line.match(/(class|public|private)\\s+((?!boost)\\w+\\s*)(\\s+|;|:|\\{)?/)\n keyword = $2\n thirdComponent = $3\n #remove all beginning and trailling whitespace\n keyword = keyword.gsub(/^\\s+/, \"\").gsub(/\\s+$/, \"\")\n\n pKeyword = PotionKeyword.new(keyword)\n pKeyword.origin = @filename.split('/').last\n #puts \"\\tChecking #{pKeyword.word}...\" #debugging\n if @master_list_ref.contains_keyword(keyword) == false && thirdComponent != \";\" && keyword.length > 1\n @master_list_ref.keywords << pKeyword \n #puts \"\\tMatched Line: #{line}\" #debugging\n #puts \"\\tAdded #{keyword} to the master list\\n\\n\" #debugging\n end\n end\n end\n end\n\n save_section(docs_text, code_text)\n end\n end" ]
[ "0.6351007", "0.63177717", "0.62417823", "0.6241443", "0.5916587", "0.5877575", "0.5827767", "0.58040446", "0.56540775", "0.561389", "0.5593043", "0.5586844", "0.5540508", "0.549342", "0.5450978", "0.5449171", "0.54457766", "0.5399563", "0.5332813", "0.5329607", "0.53207", "0.5292792", "0.526788", "0.52557236", "0.5251306", "0.52465826", "0.5239924", "0.51943356", "0.5175543", "0.51701194", "0.51682687", "0.51648706", "0.5162156", "0.5151417", "0.5144332", "0.51268554", "0.510875", "0.5108583", "0.51027876", "0.5088684", "0.5087138", "0.5083119", "0.50813395", "0.5065943", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.5063591", "0.50432616", "0.50403035", "0.5025165", "0.50249517", "0.5018302", "0.5016493", "0.5007477", "0.5005778", "0.5004245", "0.50025654", "0.49975258", "0.4994502", "0.4993336", "0.49913254", "0.49913254", "0.49913254", "0.49913254", "0.49825895", "0.4980151", "0.4978951", "0.49722475", "0.49699897", "0.49667487", "0.49652863", "0.4963652", "0.49617314", "0.49407294", "0.4939091", "0.49370322", "0.49333814", "0.49329844", "0.49326462", "0.49321437", "0.49306756", "0.49306756", "0.49295482" ]
0.0
-1
Configures the adapter to use for telemetry
def set_adapter(adapter) @instance = adapter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adapter\n @adapter ||= adapter_class.new configuration\n end", "def initialize_adapter\n # if no adapter has been initialized, use memory adapter\n config[:adapter] ||= Adapters::Memory\n\n extend config[:adapter]\n after_initialize if respond_to? :after_initialize\n end", "def initialize(analytics_config, opts = {})\n @config = analytics_config\n adapter = opts[:adapter] || Defaults::ADAPTER\n logger = opts[:logger] || LoggerHelper.create\n requester = opts[:http_requester] || Defaults::REQUESTER_CLASS.new(adapter, logger)\n @transporter = Transport::Transport.new(@config, requester)\n end", "def default_adapter_options; end", "def default_adapter_options; end", "def adapter=(adapter)\n Adapter.use = adapter\n end", "def do_adapter_specific_setup; end", "def default_adapter=(adapter); end", "def default_adapter=(adapter); end", "def default_adapter=(adapter); end", "def adapter=(v)\n cfg_set(:adapter, v)\n end", "def init_adapter\n self.adapter = adapter_string.constantize.new\n end", "def adapter=(v)\n cfg_set(:adapter, v)\n end", "def adapter\n configatron.blabber_mouth.adapter\n end", "def initialize(adapter)\n @adapter = adapter\n end", "def adapter_options\n []\n end", "def adapter_initialize\n end", "def initialize(adapter)\n @adapter = adapter\n end", "def initialize(adapter)\n self.adapter = adapter\n end", "def initialized_adapter\n adapter.new(adapter_options)\n end", "def default_adapter_options=(_arg0); end", "def default_adapter_options=(_arg0); end", "def adapter\n @adapter ||= load_adapter\n end", "def adapter\n @adapter\n end", "def register_adapter(type, adapter); end", "def configure(options = {})\n enabled = options.fetch(:enabled, nil)\n hostname = options.fetch(:hostname, nil)\n port = options.fetch(:port, nil)\n sampler = options.fetch(:sampler, nil)\n\n @enabled = enabled unless enabled.nil?\n @writer.transport.hostname = hostname unless hostname.nil?\n @writer.transport.port = port unless port.nil?\n @sampler = sampler unless sampler.nil?\n end", "def adapter_options\n []\n end", "def initialize(app, adapter_options = {})\n super(app)\n @adapter_options = adapter_options\n end", "def initialize(options = {})\n expect! options => { :adapter => String }\n\n adapter_url = options[:adapter]\n\n EM.next_tick do\n @adapter = RubPubSub::Adapter.create(adapter_url)\n end\n end", "def configure(con)\n con.use :instrumentation\n\n # The definition order is execution order\n con.request :ph_data_sanitization\n con.request :ph_default_headers\n con.request :json\n con.request :multipart\n con.request :url_encoded\n\n # The definition order is reverse to the execution order\n con.response :ph_recursive_open_struct\n con.response :ph_data_sanitization\n con.response :dates\n con.response :json, content_type: /\\bjson$/\n con.response :follow_redirects\n\n con.adapter Faraday.default_adapter\n end", "def init_adapter_from(context)\n self.adapter = adapter_class.new(context)\n end", "def configure(silent = false)\n self.configuration ||= Configuration.new\n yield(configuration)\n self.sender = Sender.new(configuration)\n # Attempt to attach an adapter, either by class or name\n if adapters.include? configuration.adapter\n self.adapter = configuration.adapter.new(configuration)\n elsif configuration.adapter\n adapter_class = Ribbit::Adapters.load_adapter configuration.adapter\n self.adapter = adapter_class.new(configuration) rescue nil\n end\n self.adapter.activate! if self.adapter\n end", "def adapter\n cfg_get(:adapter) || HyperResource::Adapter::HAL_JSON\n end", "def http_adapter\n @adapter ||= set_http_adapter\n end", "def initialize(adapter); end", "def adapter\n Spree::Config.events.adapter\n end", "def set_adapter\n @adapter = Adapter.find(params[:id])\n end", "def adapter\n self.class.adapter\n end", "def setup_config\n # To be Extended\n end", "def configure(opts)\n #This is a stub, used for indexing\n end", "def adapter adpt = default_adapter\n if adpt == default_adapter\n @adapter ||= adpt\n else\n @adapter = adpt\n end\n end", "def adapter_class\n @@adapters[configuration[:adapter]]\n end", "def adapter\n cfg_get(:adapter) ||\n HyperResource::Adapter::HAL_JSON\n end", "def use_logger(logger)\n adapter.logger = logger\n end", "def faraday_adapter(adapter)\n @configuration[:faraday_adapter] = adapter\n end", "def use(new_adapter)\n @adapter = load_adapter(new_adapter)\n end", "def use(new_adapter)\n @adapter = load_adapter(new_adapter)\n end", "def force_adapter(adapter_class)\n @adapter_options[:force_adapter] = adapter_class\n self\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.androidGeneralDeviceConfiguration\"\n end", "def configure(options, cfg)\n cfg = super(options, cfg)\n cfg[:offline_queueing] = options[:offline_queueing]\n cfg[:filter_params] = options[:filter_params]\n cfg\n end", "def initialize(request_adapter)\n super(Hash.new, request_adapter, \"{+baseurl}\")\n MicrosoftKiotaAbstractions::ApiClientBuilder.register_default_serializer(MicrosoftKiotaSerializationJson::JsonSerializationWriterFactory)\n MicrosoftKiotaAbstractions::ApiClientBuilder.register_default_deserializer(MicrosoftKiotaSerializationJson::JsonParseNodeFactory)\n if @request_adapter.get_base_url.nil? || @request_adapter.get_base_url.empty?\n @request_adapter.set_base_url('https://graph.microsoft.com/v1.0')\n end\n @path_parameters['baseurl'] = @request_adapter.get_base_url\n end", "def set_http_adapter( module_name='RestClientAdapter' )\n \n # what is happening here:\n # strips the Adapter portion of the module name to get at the client name\n # convention over configurationing to get the file name as it relates to files in http_client/adapter\n # require the hopefully found file\n # modify the RestAPI class to extend the Rest methods from the adapter\n # add the RestAPI to Aqua for easy access throughout the library\n \n @adapter = module_name\n mod = @adapter.gsub(/Adapter/, '')\n file_name = mod.underscore\n require File.dirname(__FILE__) + \"/adapters/#{file_name}\"\n RestAPI.adapter = \"CouchSpring::#{module_name}\".constantize\n extend(RestAPI)\n @adapter # return the adapter \n end", "def configuration_object\n Datadog.configuration.tracing\n end", "def init_adapters(adapter_manager)\n end", "def initialize(adapter)\n @adapter = Nunes::Adapter.wrap(adapter)\n end", "def drivers\n send :adapters\n end", "def adapter\n return @adapter if @adapter\n self.use self.default_adapter\n @adapter\n end", "def adapter\n return @adapter if @adapter\n self.use self.default_adapter\n @adapter\n end", "def default_adapter=(adapter)\n @default_adapter = resolve_adapter(adapter)\n end", "def apply_adapter_name(config)\n db_adapter = config[:db_adapter] || config[:adapter]\n config.merge(:adapter => db_adapter)\n end", "def initialize(...)\n super()\n configure(...)\n end", "def opts\n adapter_connection.opts\n end", "def initialize(implement_adapter_class)\n @adapter = implement_adapter_class.new\n end", "def register_adapter name, klass\n (@@adapters ||= {})[name] = klass\n end", "def initialize\n @influxdb_hosts = DEFAULTS[:influxdb_hosts]\n @influxdb_port = DEFAULTS[:influxdb_port]\n @influxdb_username = DEFAULTS[:influxdb_username]\n @influxdb_password = DEFAULTS[:influxdb_password]\n @influxdb_database = DEFAULTS[:influxdb_database]\n @async = DEFAULTS[:async]\n @use_ssl = DEFAULTS[:use_ssl]\n @retry = DEFAULTS[:retry]\n @open_timeout = DEFAULTS[:open_timeout]\n @read_timeout = DEFAULTS[:read_timeout]\n @max_delay = DEFAULTS[:max_delay]\n @time_precision = DEFAULTS[:time_precision]\n\n @series_name_for_controller_runtimes = DEFAULTS[:series_name_for_controller_runtimes]\n @series_name_for_view_runtimes = DEFAULTS[:series_name_for_view_runtimes]\n @series_name_for_db_runtimes = DEFAULTS[:series_name_for_db_runtimes]\n @series_name_for_exceptions = DEFAULTS[:series_name_for_exceptions]\n @series_name_for_instrumentation = DEFAULTS[:series_name_for_instrumentation]\n\n @tags_middleware = DEFAULTS[:tags_middleware]\n @rails_app_name = DEFAULTS[:rails_app_name]\n\n @ignored_exceptions = DEFAULTS[:ignored_exceptions].dup\n @ignored_exception_messages = DEFAULTS[:ignored_exception_messages].dup\n @ignored_reports = DEFAULTS[:ignored_reports].dup\n @ignored_environments = DEFAULTS[:ignored_environments].dup\n @ignored_user_agents = DEFAULTS[:ignored_user_agents].dup\n @backtrace_filters = DEFAULTS[:backtrace_filters].dup\n @environment_variable_filters = DEFAULTS[:environment_variable_filters]\n @aggregated_exception_classes = []\n\n @debug = false\n @rescue_global_exceptions = false\n @instrumentation_enabled = true\n end", "def init\n adapter.setup_connection_specification_name\n adapter.process_excluded_models\n end", "def initialize(measurement_id, api_secret, client_id = nil, options = {})\n @measurement_id = measurement_id\n @api_secret = api_secret\n @client_id = client_id\n @adapters = []\n\n self.events = []\n end", "def initialize(authentication: required('authentication'),\n adapter: nil,\n user_agent: nil,\n debug_mode: false,\n &config)\n @authentication = authentication\n @adapter = adapter || Faraday.default_adapter\n @environment_info = EnvironmentInfo.new(user_agent)\n @debug_mode = debug_mode\n @config = config\n end", "def configure!(options={})\n self.local_config = options\n end", "def setup(args={})\n super\n @conf_key = (args[:config_key] || :http_endpoints).to_sym\n set_points\n end", "def setup_connection\n Faraday.new(:url => @api_url) do |connection|\n #connection.request :url_encoded\n connection.request :json\n #connection.request :retry\n\n connection.response :logger if debug?\n connection.response :raise_error\n connection.response :json, :content_type => /\\bjson$/\n\n connection.use :instrumentation\n connection.adapter Faraday.default_adapter\n end\n end", "def initialize_adapters\n adapters\n nil\n end", "def initialize(name, adapter, options = {})\n @name = name\n @key = name.to_s\n @instrumenter = options.fetch(:instrumenter, Flipper::Instrumenters::Noop)\n @adapter = adapter\n end", "def adapters\n @__adapters__ ||= {}\n end", "def adapter(name, options = {}, &block)\n use(Adapters.const_get(name), options, &block)\n end", "def adapters\n @adapters ||= {}\n end", "def faraday_configuration(config)\n config.configure_faraday do |conn|\n conn.request :url_encoded\n conn.use :instrumentation\n conn.response :logger\n conn.response :follow_redirects\n end\n end", "def initialize\n config.base_uri = Config::BASE_URI\n config.user_agent = Config::USER_AGENT\n config.extend(Config)\n end", "def with(metadata_adapter: self.metadata_adapter, storage_adapter: self.storage_adapter)\n new_adapter = self.class.new(metadata_adapter: metadata_adapter, storage_adapter: storage_adapter, transaction: true, characterize: @characterize, queue: queue, handlers: handlers)\n return new_adapter unless block_given?\n yield new_adapter\n end", "def shared_config(config)\n config = apply_adapter_name(config)\n extract_base_config(config)\n end", "def adapters\n @adapters ||= {}\n end", "def load_adapter\n adapter_name = config.robot.adapter\n adapter_class = adapters[adapter_name.to_sym]\n\n unless adapter_class\n logger.fatal I18n.t(\"lita.robot.unknown_adapter\", adapter: adapter_name)\n abort\n end\n\n adapter_class.new(self)\n end", "def configure\n @mauth_client = ::MAuth::Client.new(mauth_config)\n\n @connection = Faraday.new do |builder|\n builder.use MAuth::Faraday::MAuthClientUserAgent, \"MediTAF Mauth Client Adapter\"\n builder.use MAuth::Faraday::RequestSigner, :mauth_client => @mauth_client\n builder.use MAuth::Faraday::ResponseAuthenticator, :mauth_client => @mauth_client if mauth_config[:authenticate_response]\n builder.use FaradayMiddleware::ParseJson, content_type: /\\bjson$/\n builder.use FaradayMiddleware::ParseXml, content_type: /\\bxml$/\n builder.adapter Faraday.default_adapter\n end\n end", "def load_adapter\n self.adapter_class =\n case framework\n when :rails then SimpleNavigation::Adapters::Rails\n when :sinatra then SimpleNavigation::Adapters::Sinatra\n when :padrino then SimpleNavigation::Adapters::Padrino\n when :nanoc then SimpleNavigation::Adapters::Nanoc\n end\n end", "def metadata_adapter\n Valkyrie.config.metadata_adapter\n end", "def metadata_adapter\n Valkyrie.config.metadata_adapter\n end", "def adapter_class; raise_method_error(\"[#{self.class.name}] does not have `adapter_class` defined.\"); end", "def adapter\n if @adapter.nil?\n \n # initialize the adapter\n class_name = adapter_name.to_s.camelcase\n LOG.info \"Attempting to load adapter #{class_name}.\"\n a = init_adapter( class_name )\n if a.nil?\n LOG.warn \"Attempting to load adapter file.\"\n load_adapter( adapter_name )\n a = init_adapter( \"ActiveMessaging::Adapters::#{class_name}\")\n a = init_adapter( \"Adapters::#{class_name}\") if a.nil?\n a = init_adapter( class_name ) if a.nil?\n end\n \n # configure the adapter\n unless a.nil?\n begin\n a.configure(@options)\n rescue NoMethodError\n LOG.warn \"Adapter #{a.class} lacks a configure method.\"\n rescue ArgumentError => error\n LOG.error \"Bad arguments when configuring #{a.class}.\\n\\t#{error}\"\n end\n end\n \n if a.nil?\n raise BadConfigurationException, \"Adapter #{adapter_name.inspect} \" +\n \"unavailable.\\n\\tAdapter class #{class_name} does not appear to \" +\n \"be in the $LOAD_PATH:\\n\\t#{$LOAD_PATH.join(\"\\n\\t\\t\")}\"\n end\n @adapter = a \n end\n return @adapter\n end", "def configure(&block)\n @config = BeaconControl::Base::Config.new &block\n end", "def initialize(options = {})\n super\n @api_key = settings.delete(:api_key)\n @async = settings.delete(:async) || false\n @ip_pool = settings.delete(:ip_pool)\n @send_at = settings.delete(:send_at)\n unless @send_at.nil? or String === @send_at\n @send_at = @send_at.utc.strftime('%Y-%m-%d %T')\n end\n end", "def initialize\n set_config\n end", "def <<(adapter)\n @adapters << adapter\n end", "def from(adapter, options = {})\n @loader.from(adapter, options)\n self\n end", "def configure(config)\n @index = config[\"index\"].to_i\n VCAP::Logging.setup_from_config(config[\"logging\"])\n @logger = VCAP::Logging.logger(\"collector\")\n @tsdb_host = config[\"tsdb\"][\"host\"]\n @tsdb_port = config[\"tsdb\"][\"port\"]\n\t @mysql_host=config['mysql']['host']\n\t @mysql_username=config['mysql']['username']\n\t @mysql_password=config['mysql']['password']\n\t @mysql_db_name=config['mysql']['db_name']\n\t @mysql_port=config['mysql']['port'] || 3306\n @noah_parentPath=config['noah_parentPath']\n @noah_authKey=config['noah_authKey']\n intervals = config[\"intervals\"]\n @varz_interval = intervals[\"varz\"] || 10\n @timeout_check = config[\"timeout_check\"] || 2\n end", "def current_adapter\n ENV.fetch('TEMPING_ADAPTER')\n end", "def configure\n super()\n syncer_klass.configure(settings) if syncer_klass\n end", "def adapter(name ,&block)\n endpoint() if @endpoints.empty?\n default_endpoint.use(name, &block)\n end", "def with_adapter(method, request, adapter)\n adapter, adapter_class = Adapter.load adapter\n\n log \"HTTPI executes HTTP #{method.to_s.upcase} using the #{adapter} adapter\"\n yield adapter_class.new(request)\n end", "def adapter_name\n return 'Clickatell'\n end", "def use(adapter_klass, options = {})\n @options = options.symbolize_keys\n \n case adapter_klass\n when String, Symbol\n adapter_name = \"LiveValidations::Adapters::\" + adapter_klass.to_s.camelize\n self.current_adapter = adapter_name.constantize\n when Class\n self.current_adapter = adapter_klass\n end\n \n rescue NameError => e\n raise AdapterNotFound, \"The adapter `#{adapter_klass}' (#{adapter_name}) was not found.\"\n end" ]
[ "0.6528803", "0.64820033", "0.63295126", "0.63270533", "0.63270533", "0.63130987", "0.62300193", "0.62179124", "0.62179124", "0.62179124", "0.61572814", "0.6125403", "0.61173004", "0.6108507", "0.6079167", "0.6046269", "0.6033778", "0.6027153", "0.59944105", "0.5957694", "0.59305376", "0.59305376", "0.58491945", "0.5844653", "0.58435893", "0.5825134", "0.58011323", "0.5795193", "0.5739555", "0.57339805", "0.56972253", "0.5685258", "0.5684569", "0.5668502", "0.56638485", "0.5656536", "0.563239", "0.5597844", "0.559515", "0.558212", "0.5572577", "0.5568162", "0.5553188", "0.5536523", "0.55181193", "0.55077076", "0.55077076", "0.54878473", "0.54770046", "0.54703104", "0.54669076", "0.54252076", "0.54136765", "0.5385342", "0.53816843", "0.53675115", "0.535419", "0.5352317", "0.53455204", "0.5342332", "0.5338608", "0.533486", "0.5331082", "0.5322307", "0.5321706", "0.5317545", "0.5310074", "0.5299247", "0.5292238", "0.52859324", "0.52821535", "0.5281943", "0.52737904", "0.52679974", "0.52642006", "0.5260887", "0.5255567", "0.52543324", "0.5251278", "0.5246269", "0.5240802", "0.5239957", "0.5217981", "0.52043724", "0.52002376", "0.52002376", "0.5192572", "0.5191117", "0.51843053", "0.5178903", "0.517047", "0.51688576", "0.5168085", "0.51627606", "0.5157426", "0.51546836", "0.51544553", "0.5139061", "0.5127234", "0.5127124" ]
0.5801335
26
Registers the metrics to be collected
def register_metrics! return if @registered @registered = true with_instance do |t| # Worker related t.add_gauge :dynflow_active_workers, 'The number of currently busy workers', [:queue, :world] t.add_counter :dynflow_worker_events, 'The number of processed events', [:queue, :world, :worker] # Execution plan related t.add_gauge :dynflow_active_execution_plans, 'The number of active execution plans', [:action, :world, :state] t.add_gauge :dynflow_queue_size, 'Number of items in queue', [:queue, :world] t.add_counter :dynflow_finished_execution_plans, 'The number of execution plans', [:action, :world, :result] # Step related # TODO: Configure buckets in a sane manner t.add_histogram :dynflow_step_real_time, 'The time between the start end end of the step', [:action, :phase] t.add_histogram :dynflow_step_execution_time, 'The time spent executing a step', [:action, :phase] # Connector related t.add_counter :dynflow_connector_envelopes, 'The number of envelopes handled by a connector', [:world, :direction] # Persistence related t.add_histogram :dynflow_persistence, 'The time spent communicating with the database', [:world, :method] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(...)\n @metrics = {}\n register(...)\n end", "def collect(metrics)\n metrics\n end", "def setup_metrics\n end", "def setup_metrics\n end", "def setup_metrics\n end", "def metrics\n @metrics ||= collect_metrics\n end", "def collect_metrics(*)\n raise NotImplementedError, 'Must implement collect_metrics'\n end", "def register(*metrics)\n begin\n metrics.each do |metric|\n @registry.register(metric)\n end\n rescue Prometheus::Client::Registry::AlreadyRegisteredError\n end\n end", "def register_metric(metric)\n @metrics << metric\n metric\n end", "def custom_metrics\n @custom_metrics ||= {}\n end", "def metrics\n @metrics ||= []\n end", "def collect(metrics)\n metrics[:polled_total] = rand(100)\n metrics\n end", "def metrics\n manager_instance(MetricManager)\n end", "def register_counter( name )\n @metrics.counter( name )\n end", "def registry\n UnicornMetrics::Registry\n end", "def enable_all_metrics_collection\n enable_metrics_collection\n end", "def metric(name,type,value)\n @metrics[name] = {\n :type => type,\n :value => value\n }\nend", "def build_metrics\n {}\n end", "def metrics\n with_stats_lock do\n @stats_hash.keys.map { |spec| spec.to_s }\n end\n end", "def metric(data={})\n if @@metrics_buffer.empty?\n @@metrics_buffer = [data]\n else\n @@metrics_buffer << data\n end\n end", "def collect_metrics(data: {}, labels: {})\n metric(:pool_jobs_waiting_total)&.observe(data['pool_jobs_waiting_total'].to_i, labels)\n metric(:pool_ready_workers_total)&.observe(data['pool_ready_workers_total'].to_i, labels)\n metric(:pool_workers_total)&.observe(data['pool_workers_total'].to_i, labels)\n metric(:pool_initial_size)&.observe(data['pool_initial_size'].to_i, labels)\n metric(:poll_period)&.observe(data['poll_period'].to_i, labels)\n metric(:thread_pool_exhausted)&.observe(data['thread_pool_exhausted'].to_i, labels)\n end", "def push_metrics!\n metrics = Prometheus::Client.registry\n url = Rails.application.secrets.prometheus_push_gateway_url\n\n Prometheus::Client::Push.new(\"push-gateway\", nil, url).add(metrics)\n end", "def register\n @typeperf = TypeperfWrapper.new(PerfmonProcGetter.new, @interval)\n @counters.each { |counter| @typeperf.add_counter(counter) }\n end", "def metrics_with_methods\n {metrics: @metrics, methods: @methods}\n end", "def metrics_with_methods\n {metrics: @metrics, methods: @methods}\n end", "def additional_metrics\n []\n end", "def metrics(*fields)\n @metrics ||= ListParameter.new(:metrics, [])\n @metrics << fields\n end", "def counters\n metrics(Counter)\n end", "def cpu_metrics\n super\n end", "def collect(data)\n custom_labels = data.fetch('custom_labels', nil)\n labels = custom_labels.nil? ? @default_labels : @default_labels.merge(custom_labels)\n collect_metrics(data: data, labels: labels)\n end", "def persist_metrics\n self.metrics.each(&:save)\n end", "def collect_metrics\n\n # Build a set of matchers to match the paths we need to find metrics\n # for.\n path_matchers = []\n @paths.each do |path|\n path_matchers << { :path => matcher_for_path(path) }\n end\n\n # Figure out what metric model to use (Metric or one of the average\n # models).\n metric_model = metric_model_for_timespan\n\n # Build a query to locate the metrics.\n query = metric_model.where(:$or => path_matchers)\n query = query.where(:node_id => @node_id)\n query = query.where(:timestamp.gte => @from)\n query = query.where(:timestamp.lte => @to)\n query = query.sort(:timestamp.asc)\n metrics = query.all\n\n # Return a data set based on the collection of metrics.\n data_set_for_metrics(metrics)\n\n end", "def set_metrics\n if rails?\n @metrics = MetricFu::AVAILABLE_METRICS + [:stats, :rails_best_practices]\n else\n @metrics = MetricFu::AVAILABLE_METRICS\n end\n end", "def timers\n metrics(Timer)\n end", "def add(args)\n args.each do |key, value|\n if value.respond_to?(:each)\n metric = value\n metric[:name] = key.to_s\n type = metric.delete(:type) || metric.delete('type') || 'gauge'\n else\n metric = {:name => key.to_s, :value => value}\n type = :gauge\n end\n type = (\"#{type}s\").to_sym\n unless skip_measurement_times\n metric[:measure_time] ||= epoch_time\n end\n @queued[type] ||= []\n @queued[type] << metric\n end\n queued\n end", "def set_metrics(metrics, batch)\n _this_ts, label, latency, error, threads, http_code = metrics\n ['ALL', label].each do |key|\n # load test worker threads are recorded at the start of the interval\n batch[key]['threads'] = threads unless batch[key]['threads']\n batch[key]['requests'] += 1\n batch[key]['errors'] += error\n batch[key]['http_code_distribution'][http_code] += 1\n # latency samples are not counted for failed requests\n unless error == 1\n batch[key]['latency_distribution'][latency] += 1\n batch[key]['latency_sum'] += latency\n end\n end\n end", "def initialize(metrics)\n @metrics = metrics\n end", "def setup\n SidekiqPrometheus::Metrics.register_sidekiq_job_metrics\n SidekiqPrometheus::Metrics.register_sidekiq_gc_metric if gc_metrics_enabled?\n SidekiqPrometheus::Metrics.register_sidekiq_worker_gc_metrics if gc_metrics_enabled? && periodic_metrics_enabled?\n SidekiqPrometheus::Metrics.register_sidekiq_global_metrics if global_metrics_enabled? && periodic_metrics_enabled?\n sidekiq_setup\n end", "def initialize\n @metrics = { processed: 0, skipped: 0, failed: 0, updated: 0,\n unchanged: 0, start_time: 0, failed_list: [],\n warning: 0 }\n end", "def register_histogram( name )\n @metrics.histogram( name )\n end", "def register_counter(type)\n register_metric( Drone::Metrics::Counter.new(type) )\n end", "def metrics(*args)\n @metrics = args.map { |id| @playground.metric(id) } unless args.empty?\n @metrics\n end", "def register_meter( name )\n @metrics.meter( name )\n end", "def collect_measurement_statistics\n Ggi::Taxon.all.select { |t| t.family? }.each do |taxon|\n Ggi::ClassificationImporter::MEASUREMENT_URIS_TO_LABELS.each do |uri, label|\n measurement = taxon.measurements.detect { |m| m[:measurementType] == uri }\n value = measurement ? measurement[:measurementValue] : DEFAULT_SCORE\n @measurement_type_values[uri] ||= Hash.new(DEFAULT_SCORE)\n @measurement_type_values[uri][value] += 1\n end\n end\n end", "def get_all_metrics()\n return nil unless Config.metrics\n f = Fiber.current\n resp = metrics.find().defer_as_a\n resp.callback do |doc|\n f.resume doc\n end\n resp.errback do |err|\n raise *err\n end\n docs = Fiber.yield\n # convert ids to int\n docs.collect{|doc| doc['_id'] = doc['_id'].to_i ; doc }\n end", "def get_metrics\n {\n method: \"Performance.getMetrics\"\n }\n end", "def metrics=(array=[])\n @metrics = array.map { |m| m.is_a?(Metric) ? m : Metric.by_key(m) }.compact\n end", "def metrics\n @metrics ||= Mongo.collection(\"slanger.metrics.data\")\n end", "def metrics\n @metrics ||= parent_klass.metrics.dup\n end", "def each(&block)\n # delegate to the @metrics hash until we need something fancier\n @metrics_lock.synchronize do\n @metrics.each(&block)\n end\n end", "def instance_metrics\n metrics = Dir.glob(\"tmp/drb-process-metrics-*.sock\").map do |filename|\n application_metrics = DRbObject.new_with_uri(\"drbunix:#{filename}\")\n application_metrics.update_process_metrics\n rescue IOError, DRb::DRbConnError\n # XXX Ignore any errors we may receive when fetching metrics from a remote process that has shut down (usually by the Puma worker killer)\n Danbooru::Metric::Set.new\n end\n\n metrics.reduce(&:merge) || Danbooru::Metric::Set.new\n end", "def register_timer(name)\n register_metric( Drone::Metrics::Timer.new(name) )\n end", "def setup_metrics\n valid_passenger_versions = [3, 4]\n\n raise ConfigurationError, \"passenger_version config variable must be set\" unless defined?(passenger_version)\n raise ConfigurationError, \"Passenger version must be one of #{valid_passenger_versions}\" unless valid_passenger_versions.include?(passenger_version)\n\n\n @matches = {}\n\n @matches[:processes_max] = /max\\s+=\\s+(\\d+)/ if passenger_version.eql?(3)\n #Max pool size : 6\n @matches[:processes_max] = /Max pool size\\s+:\\s+(\\d+)/ if passenger_version.eql?(4)\n\n\n @matches[:processes_running] = /count\\s+=\\s+(\\d+)/ if passenger_version.eql?(3)\n #Processes : 6\n @matches[:processes_running] = /Processes\\s+:\\s+(\\d+)/ if passenger_version.eql?(4)\n\n\n @matches[:queue_waiting] = /Waiting on global queue:\\s+(\\d+)/ if passenger_version.eql?(3)\n #Requests in top-level queue : 0\n @matches[:queue_waiting] = /Requests in top-level queue\\s+:\\s+(\\d+)/ if passenger_version.eql?(4)\n\n end", "def []=(key, value)\n @metrics[key] = value\n end", "def report_metrics(metrics=MetricFu.metrics)\n MetricFu.configuration.metrics.sort_by! {|x| x == :hotspots ? 1 : 0 }\n MetricFu.configuration.metrics\n end", "def all\n @@all_metrics ||= self.from_file(\n File.join(Rails.root, 'config', 'metrics.yml')\n )\n end", "def tags\n @meta.merge(@metrics)\n end", "def application_metrics\n metrics = Danbooru::Metric::Set.new({\n danbooru_info: [:counter, \"Information about the current application build.\"],\n danbooru_artists_total: [:gauge, \"The total number of artists.\"],\n danbooru_artist_urls_total: [:gauge, \"The total number of artist URLs.\"],\n danbooru_artist_versions_total: [:counter, \"The total number of artist versions.\"],\n danbooru_background_jobs_total: [:gauge, \"The total number of background jobs.\"],\n danbooru_bans_total: [:gauge, \"The total number of user bans.\"],\n danbooru_bulk_update_requests_total: [:gauge, \"The total number of bulk update requests.\"],\n danbooru_comments_total: [:gauge, \"The total number of comments.\"],\n danbooru_comment_votes_total: [:gauge, \"The total number of comment votes.\"],\n danbooru_favorites_total: [:gauge, \"The total number of favorites.\"],\n danbooru_favorite_groups_total: [:gauge, \"The total number of favorite groups.\"],\n danbooru_forum_posts_total: [:gauge, \"The total number of forum posts.\"],\n danbooru_forum_topics_total: [:gauge, \"The total number of forum topics.\"],\n danbooru_media_assets_total: [:gauge, \"The total number of media assets. Excludes processing or failed assets.\"],\n danbooru_media_assets_file_size_bytes_total: [:gauge, \"The total file size of all active media assets. Does not include thumbnails.\"],\n danbooru_media_assets_pixels_total: [:gauge, \"The total number of pixels in all active media assets (that is, the sum of width * height for all images). Does not account for animated images.\"],\n danbooru_media_assets_duration_seconds_total: [:gauge, \"The total runtime of all active media assets. Includes videos, animated GIFs and PNGs, and ugoiras.\"],\n danbooru_post_votes_total: [:gauge, \"The total number of post votes.\"],\n danbooru_posts_total: [:gauge, \"The total number of posts.\"],\n danbooru_post_appeals_total: [:gauge, \"The total number of post appeals.\"],\n danbooru_post_flags_total: [:gauge, \"The total number of post flags.\"],\n danbooru_notes_total: [:gauge, \"The total number of notes.\"],\n danbooru_note_versions_total: [:counter, \"The total number of note versions.\"],\n danbooru_pools_total: [:gauge, \"The total number of pools.\"],\n danbooru_pools_post_count_total: [:gauge, \"The total number of posts in pools.\"],\n danbooru_tags_total: [:gauge, \"The total number of tags (excluding empty tags).\"],\n danbooru_tags_post_count_total: [:gauge, \"The total number of tags on posts.\"],\n danbooru_uploads_total: [:gauge, \"The total number of uploads.\"],\n danbooru_users_total: [:counter, \"The total number of users.\"],\n danbooru_user_feedbacks_total: [:gauge, \"The total number of user feedbacks (excluding deleted feedbacks).\"],\n danbooru_wiki_pages_total: [:gauge, \"The total number of wiki pages.\"],\n danbooru_wiki_page_versions_total: [:counter, \"The total number of wiki page versions.\"],\n })\n\n status = ServerStatus.new\n versions = {\n danbooru_version: status.danbooru_version,\n ruby_version: status.ruby_version,\n rails_version: status.rails_version,\n puma_version: status.puma_version,\n distro_version: status.distro_version,\n libvips_version: status.libvips_version,\n ffmpeg_version: status.ffmpeg_version,\n exiftool_version: status.exiftool_version,\n }\n metrics[:danbooru_info][versions].set(1)\n\n Artist.group(:is_deleted).pluck(Arel.sql(\"is_deleted, COUNT(*)\")).each do |deleted, count|\n metrics[:danbooru_artists_total][deleted: deleted].set(count)\n end\n\n ArtistURL.group(:is_active).pluck(Arel.sql(\"is_active, COUNT(*)\")).each do |active, count|\n metrics[:danbooru_artist_urls_total][active: active].set(count)\n end\n\n ArtistVersion.pluck(Arel.sql(\"COUNT(*)\")).each do |count|\n metrics[:danbooru_artist_versions_total].set(count)\n end\n\n metrics[:danbooru_background_jobs_total][status: \"queued\"].set(BackgroundJob.queued.count)\n metrics[:danbooru_background_jobs_total][status: \"running\"].set(BackgroundJob.running.count)\n metrics[:danbooru_background_jobs_total][status: \"finished\"].set(BackgroundJob.finished.count)\n metrics[:danbooru_background_jobs_total][status: \"discarded\"].set(BackgroundJob.discarded.count)\n\n Ban.pluck(Arel.sql(\"COUNT(*)\")).each do |count|\n metrics[:danbooru_bans_total].set(count)\n end\n\n BulkUpdateRequest.group(:status).pluck(Arel.sql(\"status, COUNT(*)\")).each do |status, count|\n metrics[:danbooru_bulk_update_requests_total][status: status].set(count)\n end\n\n Comment.group(:is_deleted).pluck(Arel.sql(\"is_deleted, COUNT(*)\")).each do |deleted, count|\n metrics[:danbooru_comments_total][deleted: deleted].set(count)\n end\n\n CommentVote.group(:score).active.pluck(Arel.sql(\"score, COUNT(*)\")).each do |score, count, score_sum|\n metrics[:danbooru_comment_votes_total][type: score > 0 ? \"up\" : \"down\"].set(count)\n end\n\n FavoriteGroup.group(:is_public).pluck(Arel.sql(\"is_public, COUNT(*)\")).each do |is_public, count|\n metrics[:danbooru_favorite_groups_total][public: is_public].set(count)\n end\n\n ForumPost.group(:is_deleted).pluck(Arel.sql(\"is_deleted, COUNT(*)\")).each do |deleted, count|\n metrics[:danbooru_forum_posts_total][deleted: deleted].set(count)\n end\n\n ForumTopic.group(:is_deleted).pluck(Arel.sql(\"is_deleted, COUNT(*)\")).each do |deleted, count|\n metrics[:danbooru_forum_topics_total][deleted: deleted].set(count)\n end\n\n MediaAsset.active.group(:file_ext).pluck(Arel.sql(\"file_ext, COUNT(*), SUM(file_size), SUM(image_width*image_height), COALESCE(SUM(duration), 0)\")).each do |file_ext, count, file_size, pixels, duration|\n metrics[:danbooru_media_assets_total][file_ext: file_ext].set(count)\n metrics[:danbooru_media_assets_file_size_bytes_total][file_ext: file_ext].set(file_size)\n metrics[:danbooru_media_assets_pixels_total][file_ext: file_ext].set(pixels)\n metrics[:danbooru_media_assets_duration_seconds_total][file_ext: file_ext].set(duration.round(4))\n end\n\n Post.pluck(Arel.sql(\"SUM(up_score), ABS(SUM(down_score)), SUM(fav_count), COUNT(*) FILTER (WHERE is_pending), COUNT(*) FILTER (WHERE is_flagged), COUNT(*) FILTER (WHERE is_deleted), COUNT(*)\")).each do |upvote_count, downvote_count, favorite_count, pending_count, flagged_count, deleted_count, total_count|\n metrics[:danbooru_post_votes_total][type: \"up\"].set(upvote_count)\n metrics[:danbooru_post_votes_total][type: \"down\"].set(downvote_count)\n metrics[:danbooru_favorites_total].set(favorite_count)\n\n metrics[:danbooru_posts_total][status: \"pending\"].set(pending_count)\n metrics[:danbooru_posts_total][status: \"flagged\"].set(flagged_count)\n metrics[:danbooru_posts_total][status: \"deleted\"].set(deleted_count)\n metrics[:danbooru_posts_total][status: \"active\"].set(total_count - pending_count - deleted_count - flagged_count)\n end\n\n PostAppeal.group(:status).pluck(Arel.sql(\"status, COUNT(*)\")).each do |status, count|\n metrics[:danbooru_post_appeals_total][status: status].set(count)\n metrics[:danbooru_posts_total][status: \"appealed\"].set(count) if status == \"pending\"\n end\n\n PostFlag.group(:status).pluck(Arel.sql(\"status, COUNT(*)\")).each do |status, count|\n metrics[:danbooru_post_flags_total][status: status].set(count)\n end\n\n Note.group(:is_active).pluck(Arel.sql(\"is_active, COUNT(*)\")).each do |active, count|\n metrics[:danbooru_notes_total][deleted: !active].set(count)\n end\n\n NoteVersion.pluck(Arel.sql(\"COUNT(*)\")).each do |count|\n metrics[:danbooru_note_versions_total].set(count)\n end\n\n Pool.group(:category).pluck(Arel.sql(\"category, COUNT(*), SUM(cardinality(post_ids))\")).each do |category, count, post_count|\n metrics[:danbooru_pools_total][category: category].set(count)\n metrics[:danbooru_pools_post_count_total][category: category].set(post_count)\n end\n\n Tag.nonempty.group(:category).pluck(Arel.sql(\"category, COUNT(*), SUM(post_count)\")).each do |category, count, post_count|\n metrics[:danbooru_tags_total][category: TagCategory.reverse_mapping[category]].set(count)\n metrics[:danbooru_tags_post_count_total][category: TagCategory.reverse_mapping[category]].set(post_count)\n end\n\n Upload.group(:status).pluck(Arel.sql(\"status, COUNT(*)\")).each do |status, count|\n metrics[:danbooru_uploads_total][status: status].set(count)\n end\n\n User.pluck(Arel.sql(\"COUNT(*)\")).each do |count|\n metrics[:danbooru_users_total].set(count)\n end\n\n UserFeedback.active.group(:category).pluck(Arel.sql(\"category, COUNT(*)\")).each do |category, count|\n metrics[:danbooru_user_feedbacks_total][category: category].set(count)\n end\n\n WikiPage.group(:is_deleted).pluck(Arel.sql(\"is_deleted, COUNT(*)\")).each do |deleted, count|\n metrics[:danbooru_wiki_pages_total][deleted: deleted].set(count)\n end\n\n WikiPageVersion.pluck(Arel.sql(\"COUNT(*)\")).each do |count|\n metrics[:danbooru_wiki_page_versions_total].set(count)\n end\n\n metrics\n end", "def collect!\n collectors.each do |collector|\n if config.debug?\n yabeda.collect_duration.measure({ location: collector.source_location.join(\":\") }, &collector)\n else\n collector.call\n end\n end\n end", "def gauges\n metrics(Gauge)\n end", "def call\n missing_metrics.each(&method(:create_metric))\n missing_methods.each(&method(:create_method))\n end", "def record_customer_metrics\n return unless enabled?\n return unless NewRelic::Agent.config[METRICS_ENABLED_KEY]\n\n @counter_lock.synchronize do\n return unless @seen > 0\n\n NewRelic::Agent.increment_metric(LINES, @seen)\n @seen_by_severity.each do |(severity, count)|\n NewRelic::Agent.increment_metric(line_metric_name_by_severity(severity), count)\n end\n\n @seen = 0\n @seen_by_severity.clear\n end\n end", "def Metric(metric_name, &class_body)\n metric_collector = Class.new(::Critical::MetricBase)\n metric_class_name = Critical::Metrics.const_set(metric_name.to_s.capitalize, metric_collector)\n metric_collector.metric_name = metric_name\n log.debug { \"Defining metric '#{metric_name}' as '#{metric_class_name}'\"}\n metric_collector.class_eval(&class_body) if block_given?\n MonitorDSL.define_metric(metric_name, metric_collector)\n metric_collector\n end", "def get_metrics_list\n\t\ttest_file\n\t\t[@metric]\n end", "def store(*metrics)\n\t\t\tgroups = Hash.new do |h1,mclass|\n\t\t\t\th1[mclass] = Hash.new do |h2,mtype|\n\t\t\t\t\th2[mtype] = Array.new\n\t\t\t\tend\n\t\t\tend\n\t\t\t\t\n\t\t\tmetrics.each do |metric| \n\t\t\t\tmtype = metric.metricType\n\t\t\t\tmclass = metric.metricClass\n\t\t\t\tensured = self.ensureMetricType(mtype,mclass)\n\t\t\t\t\n\t\t\t\tunless ensured\n\t\t\t\t\tself.logger.error(\"unable to store metric(#{mtype}/#{mclass}) #{metric}\")\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tgroups[mclass][mtype] << metric\n\t\t\tend\n\t\t\t\n\t\t\tgroups.each do |mclass,mtypes| \n\t\t\t\tlogic = @logic[:store][mclass]\n\t\t\t\tmtypes.each do |mtype, typMetrics|\n\t\t\t\t\tfailMessages = typMetrics.map {|metric| \"unable to store metric(#{mclass}/#{mtype}): #{metric}\"}\n\t\t\t\t\t \n\t\t\t\t\tself.tryBlock(*failMessages) do case logic.arity\n\t\t\t\t\t\twhen -2 then self.instance_exec(mtype, *typMetrics, &logic)\n\t\t\t\t\t\twhen -3 then self.instance_exec(mtype, mclass, *typMetrics, &logic)\n\t\t\t\t\tend end \n\t\t\t\tend\n\t\t\tend\n\n\t\t\tself\n\t\tend", "def register_monitored_class(klass)\n @monitored_classes << klass\n end", "def summary_metrics\n []\n end", "def setup_metrics\n require 'fog'\n @options = NewRelic::Plugin::Config.config.newrelic\n log.debug 'Establishing connection to New Relic'\n end", "def metrics=(new_metrics)\n @metrics = new_metrics\n @metrics[:missing] = @metrics.first[1] unless @metrics[:missing]\n end", "def gauge_metrics(metrics, params = { :ago => DEFAULT_RANGE })\n metrics_request_string = metrics.join(',')\n metrics_json = query_api(metrics_request_string, params)\n\n metrics.map { |metric_name| metrics_json[metric_name] }\n end", "def sidekiq_setup\n Sidekiq.configure_server do |config|\n config.server_middleware do |chain|\n chain.add SidekiqPrometheus::JobMetrics\n end\n\n if periodic_metrics_enabled?\n config.on(:startup) { SidekiqPrometheus::PeriodicMetrics.reporter.start }\n config.on(:shutdown) { SidekiqPrometheus::PeriodicMetrics.reporter.stop }\n end\n\n config.on(:startup) { SidekiqPrometheus.metrics_server }\n config.on(:shutdown) { SidekiqPrometheus.metrics_server.kill }\n end\n end", "def update_metrics!(*args)\n self.class.metrics.each do |metric, options|\n send(metric, *args)\n end\n end", "def report_metrics\n metadata = {\n 'sourcetype' => 'json',\n 'source' => 'chef-handler',\n 'host' => node.hostname,\n 'index' => @index,\n 'check-index' => false\n }\n\n # We're creating a new Hash b/c 'node' and 'all_resources' in run_status\n # are just TOO large.\n event = {\n :failed => run_status.failed?,\n :start_time => run_status.start_time,\n :end_time => run_status.end_time,\n :elapsed_time => run_status.elapsed_time,\n :exception => run_status.formatted_exception\n }.to_json\n\n splunk_post(event, metadata)\n end", "def metric(*names)\n metrics = names.map do |name|\n id = name.to_s.downcase.gsub(/\\W+/, '_').to_sym\n Vanity.playground.metrics[id] ||= Vanity::Metric.new(Vanity.playground, name)\n end\n names.size == 1 ? metrics.first : metrics\n end", "def collect_metrics(name, check_cfg)\n metrics = []\n begin\n # invoke method name method on metric object\n metrics = @metrics.send(name, check_cfg)\n # :nocov:\n rescue NoMethodError => e\n log.error(\n \"Method '#{name}' is not present on Metrics object: '#{e}'\"\n )\n end\n # :nocov:\n metrics\n end", "def add_custom_metric(index, value)\n self.custom_metrics[\"cm#{index}\"] = value\n end", "def prepare_metrics(metric_name, results)\n metrics = []\n results.each do |result|\n source = result['metric']['instance']\n value = result['value'][1].to_i\n log.debug(\"[#{metric_name}] value: '#{value}', source: '#{source}'\")\n metrics << { 'source' => source, 'value' => value }\n end\n metrics\n end", "def index\n @metrics = Metric.all\n end", "def metrics_server\n @_metrics_server ||= Thread.new do\n Rack::Handler::WEBrick.run(\n Rack::Builder.new {\n use Prometheus::Middleware::Exporter, registry: SidekiqPrometheus.registry\n run ->(_) { [301, { 'Location' => '/metrics' }, []] }\n },\n Port: SidekiqPrometheus.metrics_port,\n BindAddress: '127.0.0.1',\n )\n end\n end", "def add_metrics_for(resource, range, metric_params: {}, step: 60.seconds)\n range.step_value(step).each do |time|\n metric_params[:timestamp] = time\n metric_params[:resource_id] = resource.id\n metric_params[:resource_name] = resource.name\n metric_params[:parent_ems_id] = ems.id\n metric_params[:derived_vm_numvcpus] = resource.container_node.hardware.cpu_total_cores\n if metric_params[:mem_usage_absolute_average].to_i > 0\n metric_params[:derived_memory_used] = (metric_params[:mem_usage_absolute_average] / 100.0) * resource.container_node.hardware.memory_mb\n metric_params[:derived_memory_available] = resource.container_node.hardware.memory_mb - metric_params[:derived_memory_used]\n end\n resource.metrics << FactoryBot.create(:metric, metric_params)\n end\n end", "def register_timer( name )\n Timer.new( @metrics.timer( name ) )\n end", "def metrics_for_metric_name\n @metrics = Metric.includes(:metric_name).where(metric_name_id: metric_name_id[:id]);\n render json: @metrics.order({created_at: :asc}),include: [:metric_name], status: :ok\n end", "def initialize(metric_name: 'rails.request', **opts)\n super\n\n @metric_name = metric_name\n Datadog::Notifications.subscribe 'process_action.action_controller' do |reporter, event|\n record reporter, event\n end\n end", "def get_metrics metrics, since\n # compute the length of the interval between the last time\n # this monitor ran and now\n last_report_timestamp = accumulators.get(report_timestamp_key).to_i\n now = Time.now.to_i\n interval = now - last_report_timestamp\n\n accumulators.keys.each do |target|\n next if target == report_timestamp_key\n next unless regexp && regexp =~ target\n current_count = accumulators.getset(target, 0) rescue 0.0\n\n # if we don't know when the last time we ran was, we bail,\n # resetting the accumulated count to 0 in preparation for\n # the next iteration\n #\n # we lost a data point this way (say the monitor went down\n # for a while and we brought it back up) but we also don't\n # ruin the scale of the graph...\n next if last_report_timestamp == 0\n \n rate = current_count.to_f / interval.to_f rescue 0.0\n metrics << [target, rate] # no need to scope as targets are pre-scoped\n end\n\n # store the timestamp for this run for the next\n accumulators.set(report_timestamp_key, now)\n end", "def record_values(metrics, opts = {})\n record_internal(metrics, opts)\n end", "def metric_names\n @metrics.keys\n end", "def refresh_metrics()\n # Only run this on the master\n return unless Config.metrics\n return if not Cluster.is_master?\n Fiber.new {\n Logger.debug log_message(\"Calculating metrics.\")\n # Retrieve last timestamp\n f = Fiber.current\n resp = variables.find_one(_id: 'metrics.last_timestamp')\n resp.callback do |doc|\n f.resume doc\n end\n resp.errback do |err|\n raise *err\n end\n last_timestamp_record = Fiber.yield \n last_timestamp = if last_timestamp_record.nil?\n 0\n else\n last_timestamp_record['timestamp']\n end\n new_timestamp = Time.now.to_i\n work_data.map_reduce(\n map_function,\n reduce_function,\n {\n query: {timestamp: {'$gte' => last_timestamp}},\n out: {reduce: 'slanger.metrics.data'}\n }\n )\n # Save timestamp\n variables.update(\n {_id: 'metrics.last_timestamp'},\n {'$set' => {timestamp: new_timestamp}},\n {upsert: true}\n )\n }.resume\n end", "def reset_metrics\n flush_cache\n self\n end", "def add_class_methods_to_metric_fu\n instance_variables.each do |name|\n method_name = name[1..-1].to_sym\n method = <<-EOF\n def self.#{method_name}\n configuration.send(:#{method_name})\n end\n EOF\n MetricFu.module_eval(method)\n end\n end", "def has_metric(types)\n has_gauges(:metric, types, kind_class_name: 'analyzing/metric')\n end", "def merge_metrics(storage, metrics)\n metrics.each do |metric, value|\n storage.store(\n metric.to_s,\n storage[metric.to_s].to_a << value.to_f\n )\n end\n storage\n end", "def create\n metric = metrics.create(create_params)\n\n respond_with(metric)\n end", "def report_counter_metric(metric, type, value)\n @processors ||= {}\n\n if @processors[metric].nil?\n @processors[metric] = NewRelic::Processor::EpochCounter.new\n end\n\n report_metric metric, type, @processors[metric].process(value)\n end", "def add_metric\n\t\tp_language = ProgrammingLanguage.find_by_name(RubyCoverage::PROGRAMMING_LANGUAGE)\n\t\t \n\t\tbegin\n\t\t Metric.table_exists?\n\t\t metric_analyser = RubyCoverage::ANALYSER\n\t\t metric_name = RubyCoverage::NAME\n\t\t if Metric.find_by_name(metric_name).nil?\n\t\t\tmetric = Metric.new(:name => metric_name, :analyser => metric_analyser)\n\t\t\tmetric.programming_language = p_language\n\t\t\tmetric.save!\n\t\t end \n\t\trescue\n\t\t raise \"ActiveRecord::Metric does not exist.\"\n\t\tend\n\t end", "def response_time_metrics\n result = {}\n @urls.each do |url|\n result[url[:name]] = get_metrics(url[:path])\n end\n print result\n end", "def send_solr_jmx_metrics_to_metric_reporter(mbean_type, collection_name, metric_aggr_type, solr_mbean_json_resp_obj)\n\n if mbean_type.start_with? \"/\"\n mbean_type = mbean_type.slice(1,mbean_type.length-1)\n end\n\n # Some mbean types contains slash(/). All such slashes will be converted to '.' ex: admin/segments will be converted to admin.segments\n mbean_type = mbean_type.sub(/\\//, '.')\n\n # Format of mbeans is:\n # {\n # \"solr:category=QUERY,dom1=core,dom2=ngiso-app_shard2_replica1,name=org.apache.solr.handler.component.SearchHandler,reporter=_jmx_994115484,scope=/select\":\n # {\n # \"95thPcRequestTime\": 0.392329,\n # \"99thPcRequestTime\": 0.392329\n # }\n #}\n mbeans = solr_mbean_json_resp_obj[\"value\"]\n\n # Format of mbean_names - solr:category=QUERY,dom1=core,dom2=ngiso-app_shard2_replica1,name=org.apache.solr.handler.component.SearchHandler,reporter=_jmx_994115484,scope=/select\n mbean_names = mbeans.keys\n\n mbean_aggr_metric_map_obj = Hash.new()\n mbeans.each do |mbean_name, mbean_metrics|\n\n mbean_metrics.each do |metric_key, metric_value|\n metric_value = get_raw_metrics(metric_value, mbean_aggr_metric_map_obj[metric_key])\n mbean_aggr_metric_map_obj[metric_key] = metric_value\n end\n end\n\n mbean_aggr_metric_map_obj.each do |metric_key, metric_agg_value|\n metric_key = metric_key.delete \"\\s\\n\"\n if metric_aggr_type == \"ADD_METRICS\"\n\n fields = {\"#{mbean_type}.\"+metric_key => metric_agg_value.to_s }\n\n # write metrics to medusa log (/opt/solr/log/jmx_medusa_stats.log)\n if (@medusa_log_writer != nil)\n if collection_name != nil && !collection_name.empty?\n @medusa_log_writer.write_medusa_log(collection_name, fields, @time)\n else\n @medusa_log_writer.write_medusa_log(MedusaLogWriter::CONST_CLUSTER_SUMMARY, fields, @time)\n end\n end\n\n # Write the metrics to Graphite\n if (@graphite_writer != nil)\n if collection_name != nil && !collection_name.empty?\n @graphite_writer.write_collection_specific_metric(\"#{mbean_type}.\"+metric_key, GraphiteWriter::CONST_CORE_SUMMARY, metric_agg_value.to_s, @time, collection_name)\n else\n @graphite_writer.write_metric(\"#{mbean_type}.\"+metric_key, GraphiteWriter::CONST_CORE_SUMMARY, metric_agg_value.to_s, @time)\n end\n end\n\n else\n metric_avg_aggr_value = metric_agg_value / mbean_names.size\n\n fields = {\"#{mbean_type}.\"+metric_key => metric_avg_aggr_value.to_s}\n # write metrics to medusa log (/opt/solr/log/jmx_medusa_stats.log)\n if (@medusa_log_writer != nil)\n if collection_name != nil && !collection_name.empty?\n @medusa_log_writer.write_medusa_log(collection_name, fields, @time)\n else\n @medusa_log_writer.write_medusa_log(MedusaLogWriter::CONST_CLUSTER_SUMMARY, fields, @time)\n end\n end\n\n # Write the metrics to Graphite\n if (@graphite_writer != nil)\n if collection_name != nil && !collection_name.empty?\n @graphite_writer.write_collection_specific_metric(\"#{mbean_type}.\"+metric_key, GraphiteWriter::CONST_CORE_SUMMARY, metric_avg_aggr_value.to_s, @time, collection_name)\n else\n @graphite_writer.write_metric(\"#{mbean_type}.\"+metric_key, GraphiteWriter::CONST_CORE_SUMMARY, metric_avg_aggr_value.to_s, @time)\n end\n\n end\n\n end\n end\n end", "def collect\n @sample_counter ||= 0\n\n extra_remnant_key = Remnant::Discover.results.delete(:extra_remnant_key)\n\n # don't send timings in development or test environments\n unless ::Rails.env.development? || ::Rails.env.test?\n # only log if above sample rate\n if @sample_counter > configuration.sample_rate\n key_prefix = [\n Remnant.configuration.tag,\n Remnant.configuration.env,\n extra_remnant_key\n ].compact.join('.')\n\n Remnant::Discover.results.map do |remnant_key, ms|\n Remnant.handler.timing(\"#{key_prefix}.#{remnant_key}\", ms.to_i)\n end\n\n Remnant.handler.timing(\"#{key_prefix}.gc\", Remnant::GC.time.to_i)\n Remnant.handler.timing(\"#{key_prefix}.db\", Remnant::Database.total_time.to_i)\n Remnant.handler.timing(\"#{key_prefix}.filters\", Remnant::Filters.total_time.to_i)\n\n @sample_counter = 0\n else\n @sample_counter += 1\n end\n end\n\n # run hook if given for all environments\n unless Remnant.configuration.custom_hook.nil?\n begin\n Remnant.configuration.custom_hook.call(Remnant::Discover.results)\n rescue => e\n ::Rails.logger.error \"Failed to run hook: #{e.message}\"\n end\n end\n\n Remnant::Database.reset\n Remnant::Template.reset\n Remnant::Filters.reset\n Remnant::Discover.results.clear\n end", "def create_metrics_for_snapshot(snapshot)\n\n @eth0_rx_counter ||= 0\n @eth0_tx_counter ||= 0\n @uptime_counter ||= 0\n \n # Build a random value for the network counters.\n @eth0_rx_counter += rand(100000)\n @eth0_tx_counter += rand(200000)\n\n # Increase the uptime counter by one minute.\n @uptime_counter += 1.minute\n\n # Create the load.average metric.\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'load.average',\n :counter => rand()\n )\n\n # Create the memory metrics.\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'memory.physical.used',\n :counter => rand(100000) + 1000\n )\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'memory.swap.used',\n :counter => rand(1000) + 1000\n )\n \n # Create a uptime metric.\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'uptime',\n :counter => @uptime_counter\n )\n\n # Create the process count metric.\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'processes.count',\n :counter => rand(100) + 10\n )\n\n # Create the eth0 network metrics.\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'network_interfaces.eth0.bytes.rx',\n :counter => @eth0_rx_counter\n )\n Sherlock::Models::Metric.create!(\n :node_id => snapshot.node_id,\n :timestamp => snapshot.timestamp,\n :path => 'network_interfaces.eth0.bytes.tx',\n :counter => @eth0_tx_counter\n )\n\nend", "def metrics\n begin\n Timeout::timeout(metrics_per_gear_timeout) do\n processor = MetricsLineProcessor.new(self)\n parser = BufferedLineParser.new(metrics_max_line_length, processor)\n\n cartridge_metrics(processor, parser)\n application_metrics(processor, parser)\n end\n rescue Timeout::Error => e\n puts(\"Gear metrics exceeded timeout of #{metrics_per_gear_timeout}s for gear #{uuid}\")\n end\n end", "def all(options = {})\n data = service.list_metric_descriptors(options).body['metrics'] || []\n load(data)\n end" ]
[ "0.74799824", "0.74355805", "0.73074955", "0.73074955", "0.73074955", "0.72846323", "0.68729484", "0.6775329", "0.67341197", "0.6715236", "0.6691084", "0.6645215", "0.6636278", "0.6546899", "0.6383423", "0.63759995", "0.63454545", "0.6331616", "0.633156", "0.6291296", "0.6282754", "0.62708235", "0.62146807", "0.62129796", "0.62129796", "0.61630255", "0.6153306", "0.6149404", "0.6118186", "0.6106344", "0.6080384", "0.60672545", "0.6058754", "0.60208005", "0.60065204", "0.59896296", "0.5981062", "0.597321", "0.59720755", "0.5965179", "0.59266484", "0.5923626", "0.5916547", "0.5881354", "0.584906", "0.58167636", "0.5813839", "0.5809439", "0.57878953", "0.5774221", "0.5713617", "0.5706165", "0.56901014", "0.56760734", "0.5657144", "0.56487215", "0.5646391", "0.5634923", "0.5606992", "0.5596354", "0.5577709", "0.55723", "0.55585927", "0.55550265", "0.55411434", "0.5528907", "0.55207956", "0.54963225", "0.549039", "0.5486166", "0.54833037", "0.5482057", "0.5476338", "0.54689175", "0.5465121", "0.54639447", "0.54631835", "0.5453703", "0.54447216", "0.5444059", "0.5429689", "0.54145557", "0.54098547", "0.5397539", "0.53922224", "0.53513587", "0.5338888", "0.5322514", "0.53054917", "0.53024954", "0.5296811", "0.52953464", "0.52947617", "0.52872473", "0.5253116", "0.525139", "0.52437276", "0.5242388", "0.5228685", "0.521115" ]
0.74661225
1
Cleans up nokogiri search results
def cleanup(results) results.map { |r| r.value.strip }.reject(&:empty?).uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup_nokogiri_values(results)\n results.map { |a| a.value.strip }.reject { |s| s.empty? }.uniq\n end", "def cleanup_nokogiri_values(results)\n results.map { |a| a.value.strip }.reject { |s| s.empty? }.uniq\n end", "def clean_results(parse_results, existing_article_titles)\n parse_results.uniq!\n cleaned_results = clean_results_of_partial_phrases(parse_results)\n cleaned_results = clean_results_of_redirects_to_detected_articles(cleaned_results)\n cleaned_results = clean_results_of_redirects_to_wikified_titles(cleaned_results, existing_article_titles)\n cleaned_results\n end", "def remove_unwanted_nodes!\n # Search for and remove all unwanted nodes\n unwanted_nodes = {\n \"WSJ\" => ['span.article-chiclet'],\n \"BBC\" => ['p.media-message', 'p.date', 'p.disclaimer', 'div.comment-introduction', 'noscript'],\n \"Japan Today\" => ['div#article_content p.article_smalltext'],\n \"South China Morning Post\" => ['div.subtitle', 'div.subline-ticks', 'div.subscribe-wrapper'],\n \"Tokyo Reporter\" => ['p.posttags', 'div.single_postmeta', 'div.sharedaddy']\n }\n # Only remove unwanted nodes if they're present in the hash.\n if unwanted_nodes[@source].present?\n unwanted_nodes[@source].each {|node| @page.search(node).remove}\n end\n end", "def reset_search\n # Reset_Searchs the search\n search.frontier = []\n search.came_from = {}\n search.path = {}\n end", "def unset( search_nodes )\n return apply(search_nodes)\n end", "def discard_results; end", "def reset_results\n @loaded = false\n @results = ResultSet.new\n @solr_response = nil\n end", "def clean_nokogiri_document(document)\n document.remove_namespaces!\n document.root.add_namespace(nil, \"xmlns\")\n nokogiri_document(document.to_xml)\n end", "def reset\n @results = @hits = @verified_hits = @total = @solr_response = @doc_ids = nil\n end", "def reset\n @results = @hits = @verified_hits = @total = @solr_response = @doc_ids = nil\n end", "def termdef_unnest_cleanup(xmldoc)\n desgn = \"//p/admitted | //p/deprecates | //p/preferred | //p//related\"\n nodes = xmldoc.xpath(desgn)\n while !nodes.empty?\n nodes[0].parent.replace(nodes[0].parent.children)\n nodes = xmldoc.xpath(desgn)\n end\n end", "def discard_doc!\n links # force parsing of page links before we trash the document\n @doc = @body = nil\n end", "def clean_article_body\n get_source_selectors.each do |selector|\n if @page.search(selector).present?\n @page = page.search(selector)\n break\n end\n end\n # Strip unwanted spaces and newlines.\n @page.collect {|elt| elt.content.strip.gsub(/\\n|\\r/, '').gsub(/\\ +/, ' ')}.join(' ')\n end", "def discard_search_results(search_id:)\n {\n method: \"DOM.discardSearchResults\",\n params: { searchId: search_id }.compact\n }\n end", "def abandon_results!()\n #This is a stub, used for indexing\n end", "def clean_html(doc)\n\n # Remove font tags\n doc.xpath('//font').each do |node|\n node.children.each do |child|\n child.parent = node.parent\n end\n node.remove\n end\n\n # Remove path to links:\n doc.xpath('//a').each do |node|\n href = node.attr(\"href\")\n href =~ /([^\\/]*)$/\n node.set_attribute(\"href\", $1)\n end\n\n # Remove <br> tags within li elements\n doc.xpath('//li').each do |li|\n li.xpath('//br').each do |br|\n br.remove\n end\n end\n\n # Remove <p> tags within li elements\n doc.xpath('//li').each do |li|\n li.xpath('//p').each do |p|\n p.children.each do |child|\n child.parent = p.parent\n end\n p.remove\n end\n end\n\n return doc\n end", "def find_entities(results)\n document = ::Nokogiri::XML(results.body)\n document.remove_namespaces!\n document.xpath('//entry')\n end", "def clean!(html)\n @whitelist_nodes = []\n fragment = Nokogiri::HTML::DocumentFragment.parse(html)\n clean_node!(fragment)\n @whitelist_nodes = []\n\n output_method_params = {:encoding => 'utf-8', :indent => 0}\n\n if @config[:output] == :xhtml\n output_method = fragment.method(:to_xhtml)\n output_method_params[:save_with] = Nokogiri::XML::Node::SaveOptions::AS_XHTML\n elsif @config[:output] == :html\n output_method = fragment.method(:to_html)\n else\n raise Error, \"unsupported output format: #{@config[:output]}\"\n end\n\n result = output_method.call(output_method_params)\n\n # Ensure that the result is always a UTF-8 string in Ruby 1.9, no matter\n # what. Nokogiri seems to return empty strings as ASCII for some reason.\n result.force_encoding('utf-8') if RUBY_VERSION >= '1.9'\n\n return result == html ? nil : html[0, html.length] = result\n end", "def process_query\n @results = str_to_obj.flatten.collect do |url|\n doc = Mechanize.new.get(url)\n els = doc.search(CGI.unescape(@xpath))\n els.map { |el| [el.text] }\n end\n @results = @results.flatten.map { |r| [r] }\n end", "def search_content\n ''\n end", "def strip_google_tracking_links(doc)\n doc.css(\"a\").each do |node|\n href = node.attr(\"href\").to_s\n next if href.blank?\n\n query_string = URI.parse(href).query\n actual_url = Rack::Utils.parse_nested_query(query_string)[\"q\"]\n\n node[\"href\"] = actual_url\n end\n end", "def reset\n @conditions.reset\n @results = []\n end", "def search_for_no_results\n visit('/locations?keyword=asdfdsggfdg')\n end", "def clear\n @query = {}\n @query[:searchTerms] = []\n @query[:startPage] = 1\n @query[:count] = 20\n @total_results = 0\n @search_type = \"request\"\n self\n end", "def remove_search search\n search = normalize search\n @searches.delete search.to_s\n @search_objects.delete search.to_s\n end", "def query_unset_all\n rebuild_uri :query => nil\n end", "def cleanup(node)\n node = node.root if ::Nokogiri::XML::Document === node\n # remove unwanted tags\n node.xpath(\"//*[@jam='erase']\").each do |n|\n unwrap(n)\n end\n # remove jam attributes\n\n #\n node\n end", "def generate_xpath_queries!\n # do nothing\n end", "def normalise(html)\n doc = Nokogiri::HTML(html)\n body = doc.xpath('//body')\n\n body.xpath('//script').each {|s| s.remove}\n body.xpath('//comment()').each {|c| c.remove}\n body.xpath('//text()').find_all {|t| t.to_s.strip == ''}.map(&:remove)\n body.xpath('//header').remove\n body.xpath('//footer').remove\n body.xpath('//div[@id = \"global-cookie-message\"]').remove\n body.xpath('//div[@id = \"global-header-bar\"]').remove\n body.xpath('//div[@class = \"phase-banner-alpha\"]').remove\n body.xpath('//@class').remove\n body.xpath('//@id').remove\n body.xpath('//a').xpath('//@href').remove\n body.xpath('//label').xpath('//@for').remove\n body.xpath('//input').xpath('//@name').remove\n body.xpath('//input').xpath('//@value').remove\n\n remove_attributes(body, 'data')\n remove_attributes(body, 'aria')\n\n body.to_s\n .gsub(/>\\s+/, '>')\n .gsub(/\\s+</, '<')\n .gsub('><', \">\\n<\")\n end", "def parse_search; end", "def search_clear\n @search_text = @sb[:search_text] = nil\n params[:miq_grid_checks] = []\n if params[:in_explorer] == \"true\"\n reload\n else # non-explorer screens\n javascript_redirect(last_screen_url)\n end\n end", "def reset!\n self.result = nil\n @rows = nil\n @docs = nil\n end", "def filter_entry(entry_file)\n docs = get_docs(entry_file)\n return nil unless docs\n \n docs = docs.select do |doc|\n if @query.match(doc.content)\n doc.search(\".subentry\").each do |subentry|\n subentry.remove() unless @subquery.match(subentry.content)\n end\n doc.search(\"li\").each do |subentry|\n subentry.remove() unless @subquery.match(subentry.content)\n end\n else\n nil\n end\n end\n\n docs.map{|doc| doc.to_html}.join(\"\\n\")\n end", "def parse\n #Target\n doc = nokogiriDoc(@target)\n \n doc.xpath(\"//#{@xmlns}spectrum_query\").each do |query|\n count = query.xpath(\".//#{@xmlns}search_hit\").length\n 1.upto(count) {|i| @matches << psm(query, \"1\", i)}\n end\n GC.start # More memory can be salvaged by placing this before the end, but speed greatly declines.\n \n #Decoy\n doc = nokogiriDoc(@decoy)\n \n doc.xpath(\"//#{@xmlns}spectrum_query\").each do |query|\n count = query.xpath(\".//#{@xmlns}search_hit\").length\n 1.upto(count) {|i| @matches << psm(query, \"-1\", i)}\n end\n GC.start\n end", "def ref_cleanup(xmldoc)\n xmldoc.xpath(\"//p/ref\").each do |r|\n parent = r.parent\n parent.previous = r.remove\n end\n end", "def sanitize!\n\t\t\t@doc.downcase!\n\t\t\t@doc.gsub!(/<style.*?\\/style>/m, '')\n\t\t\t@doc.gsub!(/<script.*?\\/script>/m, '')\n\t\t\t@doc.gsub!(/<.*?>/m, ' ')\n\t\t\t@doc.gsub!(/\\s+/, ' ')\n\t\tend", "def delete_all(xpath); end", "def distill\n @results.each do |r|\n row = {}\n @columns.each do |c|\n # 1. highlight the search terms\n # 2. replace the search terms in the results with bold text\n # index starting at the first character of the search terms\n # to the length of the search terms + the padding config value\n string = r.send(c).to_s\n row[c] = highlight string # need to find a better way to do this\n if @to_filter.include? c\n row[c] = highlight string[\n string.index(@terms[0]), \n string.index(@terms[0]) + @terms.length + @padding\n ] << \"...\"\n end\n end\n @formatted_results.push({:id =>r.id}.merge(row))\n end\n end", "def clean_tweets(results)\n results.first($number_of_tweets).map(&:text).join.gsub(URLS,\"\").gsub(HANDLES_AND_ADV_TWITTER,\"\").squeeze(\" \")\nend", "def reset\n @parser = Nokogiri::XML::SAX::PushParser.new(self, \"UTF-8\")\n @elem = @doc = nil\n end", "def clear_results\n @derived_values = []\n end", "def search_results\r\n @browser.divs(class: 'rc').collect do |div|\r\n div.h3.a.text\r\n end\r\n end", "def search_clear\n @search = SearchForm.new(model)\n end", "def filter\n doc = @mode == :xml ? Hpricot.XML(@str) : Hpricot(@str)\n attr_rgxp = %r/\\[@(\\w+)\\]$/o\n path_to_root = \"\"\n path_parts = @page.destination.split('/') - SITE.output_dir.split('/')\n (path_parts.length - 1).times { path_to_root += \"../\" }\n Webby.site.xpaths.each do |xpath|\n @attr_name = nil\n doc.search(xpath).each do |element|\n @attr_name ||= attr_rgxp.match(xpath)[1]\n a = element.get_attribute(@attr_name)\n if a[0..0] == '/' # Only 'fix' absolute URIs\n new_uri = path_to_root + a[1..-1]\n # puts \"Updating URI: #{a}\"\n # puts \" to: #{new_uri}\"\n element.set_attribute(@attr_name, new_uri)\n end\n end\n end\n \n doc.to_html\n end", "def crawl\n while NG_URL.where(:a_hrefs_unprocessed => { :$not => { :$size => 0}}).count > 0 do\n next_unprocessed_url\n end\n end", "def initialize(opts={})\n @url = opts[:url].strip\n\n s = RecipeDocument.read_document(opts)\n\n @options = DEFAULT_OPTIONS.merge(opts)\n # remove hardspaces &nbsp with a simple space.\n s.gsub!('&nbsp;', ' ')\n @doc = Nokogiri::HTML(s)\n\n\n @trimmed_doc = Nokogiri::HTML(s)\n\n @trimmed_doc.css(\"object, embed\").each do |elem|\n elem.remove\n end\n\n remove_unlikely_candidates!\n remove_divs_with_high_link_density!\n\n @title = @doc.xpath(\"//title\").text.lstrip.rstrip.gsub(/[\\n]+/, \" \")\n end", "def fakesearch_all_nodes(options = {})\n fakesearch_nodes(nil, options)\nend", "def do_search(term = nil)\n @terms = term unless term.nil? #replace saved term with argument, if passed\n @attempts += 1\n @doc = Nokogiri::XML(open(build_call(@terms)))\n parse\n end", "def jira_search\n\n @lunch_special = SlackJIRABot.new\n doc = Nokogiri::HTML(open('http://www.truetastes.com/anitas-cafe-lunch-catering/'))\n\n ####\n # Search for nodes by css\n\n if(doc)\n doc.css('div.specials_copy').each do |specials|\n @lunch_special.html_content = specials.inner_html\n @lunch_special.text_content = specials.content\n end\n end\n\n return @lunch_special\n\nend", "def parse_results (params)\n\t# Parses results and returns an array for each result as JSON\n\t# Function parameters\n\tresults = params[:results]\n\tcheck_re = (params[:check_re] or /(.*)/)\n\n\tnewly_added = Set.new\n\tret = []\n\n\tresults = results.gsub(/<\\/div>|<div id=\"gs_ccl_results\">/, '').strip # remove closing divs\n\n\tresults.split(/<div class=\"gs_r\">/).each do |result|\n\t\t# IGNORE result\n\t\t# if it's empty\n\t\t# OR\n\t\t# if result is user's home page (not paper)\n\t\t# OR\n\t\t# if result is a user citation\n\t\t# OR\n\t\t# if it's not validated by the string\n\t\tunless result == '' or result =~ /(.*(user profiles for).*|\\[citation\\])/i or (not result =~ check_re)\n\t\t\t# this variable contains the link to the PDF from Google Scholar, (regardless paid or not)\n\t\t\t# this one hold the rest of the data as HTML content\n\t\t\tinf_div = result.match(/<div class=\"gs_ri\">(.*)$/)[0].gsub(/^<div class=\"gs_ri\">/, '')\n\n\t\t\t# title of paper as well as link to it\n\t\t\ttitle_link = inf_div.match(/<h\\d(.*)<\\/h\\d>/)[0].gsub(/^<h\\d(.*)><a|<\\/h\\d>$/, '')\n\t\t\tpublication_title = title_link.match(/>(.*)<\\/a>/)[0].gsub(/(^>|<\\/a>$)/, '')\n\t\t\ttitle_sha2 = Digest::SHA2.hexdigest(publication_title)\n\t\t\t# if title is already indexed, or was visitied before in the current parse then skip\n\t\t\tif USE_INDEX and (INDEX.include? (title_sha2 + \"\\n\") or newly_added.include? title_sha2)\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\tpublication_link = title_link.match(/href=\"([^\"]*)\"/)[0].gsub(/(^href=\"|\"$)/, '')\n\t\t\t# authors of it, also contains the link of the publisher as well as a tag of some sort referring to the topic\n\t\t\tauthors_div_arr = inf_div.match(/<div class=\"gs_a\">(.*)<div class=\"gs_rs\">/)[0].gsub(/^<div class=\"gs_a\">|<div class=\"gs_rs\">$/, '').gsub(/\"/, '\\\"').gsub(/<([^<>]*)>/, '').split('-')\n\t\t\t# abstract extracted by Google Scholar\n\t\t\tabstract_div = inf_div.match(/<div class=\"gs_rs\">(.*)<div class=\"gs_fl\">/)[0].gsub(/^<div class=\"gs_rs\">|<div class=\"gs_fl\">$/, '')\n\n\t\t\t# get the section containing the pdf info and link\n\t\t\t# remove beginning div tag and trailing div from next\n\t\t\tpdf_div = result.match(/<div class=\"gs_ggs gs_fl\">(.*)<div class=\"gs_ri\">/)\n\t\t\t# no guarantee for pdf div from Google\n\t\t\tpdf_link = nil\n\t\t\tunless pdf_div.nil?\n\t\t\t\tpdf_div = pdf_div[0].gsub(/(<div class=\"gs_ggs gs_fl\">|<div class=\"gs_ri\">$)/, '')\n\t\t\t\tpdf_link = pdf_div.match(/href=\"([^\"]*)\"/)[0].gsub(/(^href=\"|\"$)/, '')\n\t\t\tend\n\n\n\t\t\t# dictionary holding the data\n\t\t\tres = {}\n\n\t\t\tres[:__title__] = publication_title.gsub(/\"/, '\\\"').gsub(/<([^<>]*)>/, '').strip\n\t\t\tres[:__link__] = publication_link.gsub(/\"/, '\\\"').gsub(/<([^<>]*)>/, '').strip\n\t\t\tres[:__authors__] = authors_div_arr[0].strip\n\t\t\tres[:__abstract__] = abstract_div.gsub(/\"/, '\\\"').gsub(/<([^<>]*)>/, '').strip\n\t\t\tres[:__publisher__] = ($SITE_NAMES[authors_div_arr[-1].strip] or authors_div_arr[-1]).strip\n\t\t\tres[:__hash__] = title_sha2\n\t\t\tpdf_link.nil? ? res[:__pdf__] = nil : res[:__pdf__] = pdf_link.gsub(/\"/, '\\\"').gsub(/<([^<>]*)>/, '').strip\n\n\t\t\t# append to return variable\n\t\t\tret << res\n\t\t\tnewly_added << res[:__hash__] if USE_INDEX\n\t\tend\n\tend\n\n\treturn ret, newly_added\nend", "def purge_resources\n fetch_page\n parse_page\n @urls = find_resources\n\n return if @urls.empty?\n\n tidy_resources\n purge_queue\n end", "def empty_results(hits = 0)\n {\n 'SearchRequest'=>\n {\n 'SearchCriteria'=>\n {\n 'Queries'=>nil,\n 'SearchMode'=>'',\n 'IncludeFacets'=>'y',\n 'Sort'=>'relevance',\n 'AutoSuggest'=>'n',\n 'AutoCorrect'=>'n'\n },\n 'RetrievalCriteria'=>\n {\n 'View'=>'brief',\n 'ResultsPerPage'=>20,\n 'Highlight'=>'y',\n 'IncludeImageQuickView'=>'n'\n },\n 'SearchCriteriaWithActions'=>\n {\n 'QueriesWithAction'=>nil\n }\n },\n 'SearchResult'=>\n {\n 'Statistics'=>\n {\n 'TotalHits'=>hits,\n 'TotalSearchTime'=>0,\n 'Databases'=>[]\n },\n 'Data'=> {'RecordFormat'=>'EP Display'},\n 'AvailableCriteria'=>{'DateRange'=>{'MinDate'=>'0001-01', 'MaxDate'=>'0001-01'}}\n }\n }\n end", "def unlink!\n parse \n @tags.each do |tag|\n @doc.xpath(\"//a[ends_with(@href,'#{tag}')]\", EndsWithFilter.new).each do |element|\n element.swap(element.children)\n end\n end\n output = @doc.xpath(\"/#{@wrap_tag}/body/p\").inner_html\n output = @doc.xpath(\"/#{@wrap_tag}/body\").inner_html if output == \"\"\n output\n end", "def reset_xml_statistics\n super\n end", "def clear_search\n add_actions 'ClearSearch()'\n end", "def build_results(solr_docs)\n results = Nokogiri::XML::Builder.new do |xml|\n xml.documents( :total => solr_docs[\"response\"][\"numFound\"], :\"page-size\" => solr_docs[\"page_size\"], :\"page-number\" => solr_docs[\"page\"] ) { \n solr_docs[\"response\"][\"docs\"].each do |doc| \n xml.document(:created => check_solr_field(doc[\"fgs_createdDate_date\"]), :\"last-modified\" => check_solr_field(doc[\"fgs_lastModifiedDate_date\"]), :name => doc[\"id\"] ) {\n xml.details {\n solr_docs[\"queries\"].each do |q| \n xml.detail_ check_solr_field(doc[q])\n end\n }\n }\n end\n }\n end\n return results.to_xml\n end", "def sanitize_result(result)\n result = result.downcase\n\n # many times, featured results, or additional producers are appended\n # to the result like so: (featuring beep and boop...)\n result = result.gsub(/[\\(\\)\\[\\]]/, \"\")\n\n # remove all [.'!&+] and replace them with \"\"\n result = result.gsub(/[.'!&+]/, \"\")\n\n # remove all - or _ and replace them with \" \"\n result = result.gsub(/[-_]/, \" \")\n\n # remove all blacklisted articles\n result = result.gsub(/\\b(#{BLACKLIST})\\b/, \"\")\n\n # replace multiple spaces with a single space\n result = result.gsub(/\\s+/, \" \").strip\n end", "def nodes\n strong_memoize(:nodes) do\n nodes = doc.xpath(XPATH)\n nodes.drop(EMBED_LIMIT).each(&:remove)\n\n nodes\n end\n end", "def parse_result_page(page)\n page.search(\"div.listing div.title a\").map do |result_row|\n result_row.attribute(\"href\").value\n end\nend", "def parse_result_page(page)\n page.search(\"div.listing div.title a\").map do |result_row|\n result_row.attribute(\"href\").value\n end\nend", "def empty\n each { |x| x.inner_html = nil }\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 build_candidates\n doc = Nokogiri::HTML(open(\"http://www.google.com/search?q=#{query}&num=30\"))\n doc.xpath('//div/cite').each do |node|\n @candidates << Sanitize.clean(node)\n end\n\n @candidates = @candidates.collect{|c| c if c.include?(\"http\") && (c.include?(\"youtube.com\") || c.include?(\"soundcloud.com\") || c.include?(\"bandcamp.com\")) }.compact\n\n #replace each with url, score, and title\n set = []\n\n @candidates.each do |c|\n if c.include?(\"youtube\")\n set << get_youtube(c)\n elsif c.include?(\"soundcloud\")\n set << get_soundcloud(c)\n elsif c.include?(\"bandcamp\")\n set << get_bandcamp(c)\n end\n end\n\n @candidates = set\n @candidates.sort!{|x,y| y[:score] <=> x[:score]}\n puts @candidates.count\n end", "def clean_and_save\r\n begin\r\n num_results = clean_save_helper\r\n \r\n #KS- if there were no results, blow away the place because it wasn't found in yahoo\r\n if num_results == 0\r\n p \"deleting bogus place \\'#{name}\\' because no results were found\"\r\n self.deleted_by_clean = 1\r\n self.save\r\n \r\n #KS- search 25 miles around the zip code for anything with the same\r\n #name and add them all to the database\r\n clean_save_helper(nil, 25, 20, nil, self.zip, true)\r\n end\r\n rescue Exception => exc\r\n p exc\r\n logger.info(\"Error opening URL #{url}: #{exc}\")\r\n raise exc\r\n end\r\n end", "def setup\n xml_results = <<BEGIN\n <search:response total=\"2\" start=\"1\" page-length=\"10\" xmlns:search=\"http://marklogic.com/appservices/search\">\n <search:result index=\"1\" uri=\"/documents/discoverBook.xml\" path=\"fn:doc('/documents/discoverBook.xml')\" score=\"243\" confidence=\"0.97047\" fitness=\"1\">\n <search:snippet>\n <search:match path=\"fn:doc('/documents/discoverBook.xml')/*:book/*:bookinfo/*:title\">Discoverers <search:highlight>and</search:highlight> Explorers</search:match>\n <search:match path=\"fn:doc('/documents/discoverBook.xml')/*:book/*:chapter[1]/*:chapterinfo/*:biblioentry/*:title\">Discoverers <search:highlight>and</search:highlight> Explorers</search:match>\n </search:snippet>\n </search:result>\n <search:result index=\"2\" uri=\"/documents/a_and_c.xml\" path=\"fn:doc('/documents/a_and_c.xml')\" score=\"234\" confidence=\"0.952329\" fitness=\"1\">\n <search:snippet>\n <search:match path=\"fn:doc('/documents/a_and_c.xml')/PLAY/PERSONAE/PERSONA[10]\">Officers, Soldiers, Messengers, <search:highlight>and</search:highlight> other Attendants.</search:match>\n </search:snippet>\n </search:result>\n <search:qtext>and</search:qtext>\n <search:metrics>\n <search:query-resolution-time>PT0.009197S</search:query-resolution-time>\n <search:facet-resolution-time>PT0.000083S</search:facet-resolution-time>\n <search:snippet-resolution-time>PT0.019534S</search:snippet-resolution-time>\n <search:total-time>PT0.029033S</search:total-time>\n </search:metrics>\n</search:response>\nBEGIN\n\n xml_results_noh = <<BEGIN\n <search:response total=\"2\" start=\"1\" page-length=\"10\" xmlns:search=\"http://marklogic.com/appservices/search\">\n <search:result index=\"1\" uri=\"/documents/discoverBook.xml\" path=\"fn:doc('/documents/discoverBook.xml')\" score=\"243\" confidence=\"0.97047\" fitness=\"1\">\n <search:snippet>\n <search:match path=\"fn:doc('/documents/discoverBook.xml')/*:book/*:bookinfo/*:title\">Discoverers and Explorers</search:match>\n <search:match path=\"fn:doc('/documents/discoverBook.xml')/*:book/*:chapter[1]/*:chapterinfo/*:biblioentry/*:title\">Discoverers and Explorers</search:match>\n </search:snippet>\n </search:result>\n <search:result index=\"2\" uri=\"/documents/a_and_c.xml\" path=\"fn:doc('/documents/a_and_c.xml')\" score=\"234\" confidence=\"0.952329\" fitness=\"1\">\n <search:snippet>\n <search:match path=\"fn:doc('/documents/a_and_c.xml')/PLAY/PERSONAE/PERSONA[10]\">Officers, Soldiers, Messengers, and other Attendants.</search:match>\n </search:snippet>\n </search:result>\n <search:qtext>and</search:qtext>\n <search:metrics>\n <search:query-resolution-time>PT0.009197S</search:query-resolution-time>\n <search:facet-resolution-time>PT0.000083S</search:facet-resolution-time>\n <search:snippet-resolution-time>PT0.019534S</search:snippet-resolution-time>\n <search:total-time>PT0.029033S</search:total-time>\n </search:metrics>\n</search:response>\nBEGIN\n\n results_with_facets = <<-BEGIN\n<search:response total=\"21973\" start=\"1\" page-length=\"10\" xmlns:search=\"http://marklogic.com/appservices/search\">\n <search:result index=\"9\" uri=\"/Users/clarkrichey/Downloads/wits/wits21402.xml\" path=\"fn:doc(&quot;/Users/clarkrichey/Downloads/wits/wits21402.xml&quot;)\" score=\"196\" confidence=\"0.338805\" fitness=\"0.890659\">\n <search:snippet>\n <search:match path=\"fn:doc(&quot;/Users/clarkrichey/Downloads/wits/wits21402.xml&quot;)/*:Incident/*:Subject\">1 newspaper editor injured in letter <search:highlight>bomb</search:highlight> attack by Informal Anarchist Federation in Turin, Piemonte, Italy</search:match>\n <search:match path=\"fn:doc(&quot;/Users/clarkrichey/Downloads/wits/wits21402.xml&quot;)/*:Incident/*:EventTypeList\">\n<search:highlight>Bombing</search:highlight>\n</search:match>\n <search:match path=\"fn:doc(&quot;/Users/clarkrichey/Downloads/wits/wits21402.xml&quot;)/*:Incident/*:WeaponTypeList/*:WeaponType\">Letter <search:highlight>Bomb</search:highlight></search:match>\n </search:snippet>\n </search:result>\n <search:result index=\"10\" uri=\"/Users/clarkrichey/Downloads/wits/wits23118.xml\" path=\"fn:doc(&quot;/Users/clarkrichey/Downloads/wits/wits23118.xml&quot;)\" score=\"196\" confidence=\"0.338805\" fitness=\"0.890659\">\n <search:snippet>\n <search:match path=\"fn:doc(&quot;/Users/clarkrichey/Downloads/wits/wits23118.xml&quot;)/*:Incident/*:Subject\">1 government employee killed in <search:highlight>bombing</search:highlight> in Ghazni, Afghanistan</search:match>\n <search:match path=\"fn:doc(&quot;/Users/clarkrichey/Downloads/wits/wits23118.xml&quot;)/*:Incident/*:EventTypeList\">\n<search:highlight>Bombing</search:highlight>\n</search:match>\n </search:snippet>\n </search:result>\n <search:facet name=\"Region\">\n <search:facet-value name=\"Africa\" count=\"622\">Africa</search:facet-value>\n <search:facet-value name=\"Central and South America\" count=\"1012\">Central and South America</search:facet-value>\n <search:facet-value name=\"East Asia-Pacific\" count=\"1198\">East Asia-Pacific</search:facet-value>\n <search:facet-value name=\"Eurasia\" count=\"761\">Eurasia</search:facet-value>\n <search:facet-value name=\"Europe\" count=\"1057\">Europe</search:facet-value>\n <search:facet-value name=\"Middle East and Persian Gulf\" count=\"10374\">Middle East and Persian Gulf</search:facet-value>\n <search:facet-value name=\"North America and Caribbean\" count=\"16\">North America and Caribbean</search:facet-value>\n <search:facet-value name=\"South Asia\" count=\"6933\">South Asia</search:facet-value>\n </search:facet>\n <search:facet name=\"Country\">\n <search:facet-value name=\"England\" count=\"200\">England</search:facet-value>\n <search:facet-value name=\"Ireland\" count=\"422\">Ireland</search:facet-value>\n <search:facet-value name=\"Brazil\" count=\"10\">Brazil</search:facet-value>\n </search:facet>\n <search:qtext>bomb</search:qtext>\n <search:metrics>\n <search:query-resolution-time>PT0.420016S</search:query-resolution-time>\n <search:facet-resolution-time>PT0.002873S</search:facet-resolution-time>\n <search:snippet-resolution-time>PT0.039998S</search:snippet-resolution-time>\n <search:total-time>PT0.463759S</search:total-time>\n </search:metrics>\n</search:response>\n BEGIN\n @search_results = ActiveDocument::SearchResults.new(xml_results)\n @search_results_noh = ActiveDocument::SearchResults.new(xml_results_noh)\n @faceted_results = ActiveDocument::SearchResults.new(results_with_facets)\n end", "def parse_search(q)\n # TODO continue\n end", "def clear_result; end", "def reset\n @results = {}\n @success = false\n end", "def reset_search_params\n Parameters.sanitize(to_h).except(:page, :counter)\n end", "def get_zomato_results(url)\n\t\tvisit(url)\n\t doc = Nokogiri::HTML(page.html)\n\t results = doc.css(\".result-title\")\n\n\t if results.present?\n\t \tresults.each do |result|\n\t \t\tname = result.text\n\t \t\thref = result[\"href\"]\n\t \t\tp name\n\t \t\tp href\n\t \t\t#get_page_data(href)\n\t \tend\n\t end\n\t #p doc\n\t #reviews = doc.css('.rev-text')\n\t #if reviews.present?\n\t #\treviews.each do |review|\n\t #\t\tp review.text.strip\n\t #\t\tp \"****************\"\n\t #\tend\n\t #end\t \n\tend", "def remove!\n self.results.each{ |r| r.remove! }\n self.metadata.remove!\n end", "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 clear!\n @documents = {}\n @attributes = {}\n @lookup_map = nil\n @all_loaded = false\n @all = []\n end", "def make_new_searches\n\t\n\turl = \"/Users/MichaelB/Documents/TenTracks/artists.html\"\n\t\n\t\n\tdoc = Nokogiri::HTML(open(url))\n\tbands_array = doc.css(\"h1\")\n\ti=259\n\t#Rails.logger.debug(i)\n\t\n\twhile i < bands_array.length or i < 10\n\t\n\tRails.logger.debug(i)\n\tRails.logger.debug(bands_array[i].content)\n\t\n\ttest = EventSearch.where(:bandName => bands_array[i].content)\n\t\n\tif !test[0]\n\t\n\tes = EventSearch.new\n\tes.bandName = bands_array[i].content\n\t\n\tband_search = bands_array[i].content.split(' ').join(\"+\")\n\t\n\turl2 = \"http://www.myspace.com/search/music?q=\" << band_search << \"&ac=t\"\n\t#Rails.logger.debug(url2)\n\t\n\tif validate(url2)\n\tdoc2 = Nokogiri::HTML(open(url2))\n\tband_url_array = doc2.css(\".beacon .beacon\")\n\t\n\t\tif band_url_array[0]\n\t\t\tRails.logger.debug(band_url_array[0][:href])\n\t\t\tes.urlOne = band_url_array[0][:href]\n\t\t\tes.eventDateCSS = \".entryDate\"\n\t\t\tes.eventLocationCSS = \"#module9 a\"\n\t\t\tes.descriptionCSS = \"#module9 p\"\n\t\telse\n\t\tRails.logger.debug(\"Invalid myspace link\")\n\t\tes.urlOne = \"Invalid myspace link\"\n\t\tend\n\t\n\telse\n\tRails.logger.debug(\"Invalid myspace link\")\n\tes.urlOne = \"Invalid myspace link\"\n\t\n\tend # of validate\n\t\n\tes.save\n\t\n\tend #of test\n\t\n\ti += 1\n\tend # of while\n\t\n end", "def scrape_page(url) \r\n puts \"Scraping \" + url + \".\"\r\n elements = []\r\n \r\n begin\r\n doc = Nokogiri::HTML(open(url))\r\n elements = doc.xpath(\"//a[@href]\")\r\n rescue RuntimeError\r\n #puts \"Runtime error caught\"\r\n rescue OpenURI::HTTPError\r\n #puts \"OpenURI error caught\"\r\n rescue OpenURI::HTTPRedirect \r\n #puts \"OpenURI redir error caught\"\r\n rescue SocketError\r\n #puts \"SocketError caught\"\r\n end\r\n \r\n puts \"Number of href elements found: \" + elements.length.to_s\r\n results = []\r\n elements.each do |link|\r\n #link = (link.first.to_s.scan(/.+?href=\".*\"/)) # Replaced by URI::extract!!\r\n urls = URI::extract(link.to_s) # extract URL\r\n if !urls.empty?\r\n urls.each do |u| \r\n if u.include?(\"http\") # don't store links which aren't prefixed with \"http\"\r\n results << (u.to_s) # store link\r\n end\r\n end\r\n end\r\n end\r\n \r\n if results.empty? then puts \"No links found in \" + url + \".\" end\r\n \r\n results.compact.uniq # avoid nils and duplicates\r\n \r\nend", "def process_results(agent)\n links = ScraperWiki.select(\"link FROM links\")\n links.collect{ |x| x['link'] }.each do | link |\n load_details(agent, link)\n delete_link(link)\n sleep 10\n end\n ScraperWiki.save_var(INDEX, 0)\nend", "def process_results(agent)\n links = ScraperWiki.select(\"link FROM links\")\n links.collect{ |x| x['link'] }.each do | link |\n load_details(agent, link)\n delete_link(link)\n sleep 10\n end\n ScraperWiki.save_var(INDEX, 0)\nend", "def clear_cache\n @results = nil\n @result_ids = nil\n @num_results = nil\n @letters = nil\n end", "def cinii_issn(issn)\n doc = Nokogiri::XML(open(\"http://ci.nii.ac.jp/books/opensearch/search?issn=#{issn}\", proxy: IllConfig.config[\"proxy_server_url\"]))\n namespaces = {\n \"xmlns\" => \"http://www.w3.org/2005/Atom\", \n \"xmlns:dc\" => \"http://purl.org/dc/elements/1.1/\",\n \"xmlns:cinii\" => \"http://ci.nii.ac.jp/ns/1.0/\",\n \"xmlns:dcterms\" => \"http://purl.org/dc/terms/\" ,\n \"xmlns:opensearch\" => \"http://a9.com/-/spec/opensearch/1.1/\" ,\n \"xmlns:prism\" => \"http://prismstandard.org/namespaces/basic/2.0/\"\n } \n i = 1\n results = []\n while i <= doc.xpath('//opensearch:totalResults', namespaces).text.to_i\n result = {}\n result[:title] = doc.xpath(\"//xmlns:entry[#{i}]/xmlns:title\", namespaces).text\n result[:author] = doc.xpath(\"//xmlns:entry[#{i}]/xmlns:author/xmlns:name\", namespaces).text\n result[:publisher] = doc.xpath(\"//xmlns:entry[#{i}]/dc:publisher\", namespaces).text\n result[:pubdate] = doc.xpath(\"//xmlns:entry[#{i}]/prism:publicationDate\", namespaces).text\n results << result\n i += 1\n end\n results\nend", "def scrap\n\t\turl = 'https://sg.carousell.com/search/products/?query=' + @input\n \tpage = @agent.get(url)\n\t\t@searchData = Nokogiri::HTML(page.body)\n\tend", "def parse_single_page(page)\n rows = page.search(\"form[name='search'] table > tr > td > table > tr\")\n \n dentist_name = ''\n company_name = ''\n address = ''\n \n rows.each do |row|\n plain = row.text.gsub(/\\s*\\302\\240\\302\\240/, '').gsub(/\\s\\s/, '').strip\n if plain.start_with?(\"Name\")\n dentist_name = plain.gsub(/Name/, '')\n end\n if plain.start_with?(\"Primary Practice Place\")\n company_name = plain.gsub(/Primary Practice Place/, '')\n end\n if plain.start_with?(\"Practice Address\")\n address = row.text.gsub(/\\s\\s/, '').gsub(/\\302\\240\\302\\240/, ' ').gsub(/Practice Address/, '').strip\n end\n end\n p [dentist_name, company_name, address]\n\n RESULT_COLL.insert(:contact => [dentist_name, company_name, address])\nend", "def blank_tag_search_fast_count\n nil\n end", "def filter_long_or_empty\n if params[:q].split.size > 10 || params[:q].blank?\n @query = params[:q]\n @results = []\n render and return\n end\n end", "def init_results_for_search\n # try to find asqs and tags that match search string\n search_string = params[:search].downcase\n @title = \"Search for \\\"#{params[:search]}\\\"\"\n @matched_names = search_asqs_by_column('name', search_string)\n @matched_queries = search_asqs_by_column('query', search_string)\n @matched_tags = Asq.tagged_with(search_string.split(' '), wild: true)\n @matched_creator = Asq.where(created_by: search_string)\n @matched_modifier = Asq.where(modified_by: search_string)\n sort_matched_arrays\n redirect_if_single_result\n end", "def content(clean = false, index = 0)\n return @content[[clean, index]] if @content[[clean, index]]\n return '' if !@content_candidates || @content_candidates.empty?\n \n content_branch = content_at(index)\n orphans_to_remove = []\n \n #ap content_branch.to_html\n #exit\n \n # Go through every piece of the content and rip out sections that contain too many tags compared to words\n # This is usually indicative of \"widgets\" or link bar sections\n content_branch.css('*').each_with_index do |el, i|\n next unless el\n\n if el.name == \"h1\"\n el.remove\n next\n end\n\n if el.name == \"h2\" && content_branch.inner_html.scan('<h2').size == 1\n el.remove\n end\n\n # Remove elements that contain words but there are more tags than words overall\n # First, count the words\n #word_count = 0\n #el.traverse do |subel|\n # if subel.text? && subel.path !~ /\\/a\\// && subel.path !~ /\\/(h1|h2|h3|h4|h5|h6)\\//\n # word_count += (subel.text.downcase.scan(/[a-z]{4,}/) - META_WORDS).size\n # end\n #end\n #\n ## .. then count the tags\n #\n #inner_tags = el.inner_html.scan(/\\<\\w.*?\\>/).size\n #if word_count < inner_tags && inner_tags > 3 && word_count < 250\n # puts \"At #{el.name} #{el['id']} #{el['class']} containing '#{el.text[0..20]}' we have #{word_count} valid words to #{el.inner_html.scan(/\\<\\w.*?\\>/).size} tags\"\n # #puts \"Removing #{el.name} #{el['id']} #{el['class']} TOO MANY TAGS FOR WORDS\"\n # el.remove\n # next\n #end\n\n # If there are at least 2 words and a third of them are \"meta words,\" remove the element\n #inner_words = el.text.to_s.downcase.scan(/[a-z]{3,}/)\n #if BLOCK_OUTPUT_ELEMENTS.include?(el.name) && inner_words.size >= 2\n # if ((inner_words & META_WORDS).size >= (inner_words.size / 3))\n # el.remove\n # end\n #end\n\n if el.text && el.text.strip.length < 3 && !%w{img}.include?(el.name) && el.inner_html !~ /\\<img/\n el.remove\n next\n end\n\n if el.name == \"p\" && el.text !~ /(\\.|\\?|\\!|\\\"|\\')(\\s|$)/ && el.inner_html !~ /\\<img/\n el.remove\n next\n end\n\n # If the ID or class of the element contains a fatally bad word, get rid of it\n if (BAD_WORDS & (el['id'].to_s + ' ' + el['class'].to_s).downcase.scan(/[a-z]+/)).length > 0\n #puts \"Removing #{el.name} #{el['id']} #{el['class']} BAD\"\n el.remove\n next\n end\n end\n\n # If a title was found early in the result document but had text before it, remove that text - it's probably crap\n orphans_to_remove.each { |el| el.remove }\n \n # Clean up the HTML again - Nokogiri outputs it with full doctype and crap\n clean_html = strip(Sanitize.clean(content_branch.to_html, :elements => (clean ? BLOCK_OUTPUT_ELEMENTS : OUTPUT_ELEMENTS), :attributes => (clean ? OK_CLEAN_ATTRIBUTES : OK_ATTRIBUTES)))\n \n # If the content is desired as \"clean\" (i.e. plain-text), do some quick fix-ups\n if clean\n # Get rid of line break tags, make list items look nice, remove all other HTML tags, and clean up spaces and newlines\n clean_html.gsub!(/<br.*?>/, \"\\n\")\n clean_html.gsub!(/<li>/, '* ')\n clean_html.gsub!(/<\\w+>/, '')\n clean_html.gsub!(/<\\/\\w+>/, \"\\n\")\n clean_html.gsub!(/\\ +/, ' ')\n clean_html.gsub!(/^\\s+\\n/, \"\\n\")\n clean_html.gsub!(/\\n{2,}/, \"\\n\")\n clean_html.strip!\n end\n \n # If tags butt up against each other across lines, remove the line break(s)\n clean_html.gsub!(/\\>\\n+\\</, '><')\n\n # Get rid of images whose sources are relative (TODO: Make this optional)\n clean_html.gsub!(/\\<img .*?\\>/i) do |img_tag|\n img_tag =~ /\\Whttp/ ? img_tag : ''\n end\n\n # Remove empty tags\n clean_html.gsub!(/<(\\w+)><\\/\\1>/, \"\")\n\n # Just a messy, hacky way to make output look nicer with subsequent paragraphs..\n clean_html.gsub!(/<\\/(div|p|h1|h2|h3|h4|h5|h6)>/, '</\\1>' + \"\\n\\n\")\n \n @content[[clean, index]] = clean_html\n end", "def get_page_results\n url = \"http://sfbay.craigslist.org/sfc/pet/\"\n doc = Nokogiri::HTML(open(url))\nend", "def get_page_results(date_str)\n url = \"http://losangeles.craigslist.org/search/lac/pet\"\n page = Nokogiri::HTML(open(url))\n\n # map page elements to a hash with date, title, location\n all_rows = page.css(\".row .txt\").map do |row| {\n date: row.css(\".pl time\").text,\n title: row.css(\".pl a\").text,\n location: row.css(\".l2 .pnr small\").text,\n pic: row.css(\"span .p\").text\n }\n end\n\n get_todays_results(all_rows, date_str)\nend", "def prepare_search(term, opts = {})\n data_nil?\n r1 = build_regexp(term, opts)\n @search_result = []\n r1\n end", "def parse_results(raw_results)\n results = []\n results << ['Name', 'URL', 'Price', 'Neighborhood']\n\n raw_results.each do |result|\n link = result.css('a')[1] #mechanize library\n name = link.text.strip\n url = \"http://sfbay.craigslist.org\" + link.attributes[\"href\"].value\n price = result.search('span.price').text\n neighborhood = result.search('span.pnr').text[3..-13]\n\n puts \"This apartment is located in #{neighborhood}\"\n\n a = Apartment.new(name,url,price,neighborhood)\n\n results << [a.name, a.url, a.price, a.neighborhood]\n create_csv(results)\n end\nend", "def delete_previous_results(all = false)\n if pom?\n get_scenario_type_child_element.elements.delete(\"#{@ns}:AnnualSavingsSiteEnergy\")\n get_scenario_type_child_element.elements.delete(\"#{@ns}:AnnualSavingsCost\")\n get_scenario_type_child_element.elements.delete(\"#{@ns}:CalculationMethod\")\n get_scenario_type_child_element.elements.delete(\"#{@ns}AnnualSavingsByFuels\")\n end\n\n # Delete elements from the xml and reset the attributes to empty\n if pom? || cb_modeled? || all\n get_scenario_type_child_element.elements.delete(\"#{@ns}AllResourceTotals\")\n get_scenario_type_child_element.elements.delete(\"#{@ns}ResourceUses\")\n @resource_uses = []\n @all_resource_totals = []\n end\n end", "def format_query\n output = query.q.dup\n words_to_remove = %w(international airport municipal)\n words_to_remove.each do |word|\n output.gsub!(/#{word}/i, \"\")\n end\n output\n end", "def normalize!\n data = read\n html = Nokogiri::XML.parse(data)\n html.encoding = 'utf-8'\n\n # Process the @DOM\n standardize_dom(html)\n remove_scripts(html)\n change_hrefs(html)\n\n write(html.to_s)\n end", "def clean(html)\n dupe = html.dup\n clean!(dupe) || dupe\n end", "def clear_filter\n @filter_string = ''\n @found_count = -1\n model.refilter\n filter\n end", "def normalise_html(html)\n Nokogiri::HTML5.fragment(html).to_s.gsub(\"\\n\", \"\")\n end", "def clear\n @fetch = nil\n @query = {}\n @query[:q] = []\n self\n end", "def clear\n @fetch = nil\n @query = {}\n @query[:q] = []\n self\n end", "def noSearchResults\n render :layout => false\n end" ]
[ "0.6969907", "0.6969907", "0.6474414", "0.6459164", "0.63297373", "0.6205105", "0.6119024", "0.6105318", "0.60710776", "0.60671186", "0.60671186", "0.59995866", "0.5929215", "0.5851275", "0.5839145", "0.58225596", "0.5798297", "0.5768296", "0.5734931", "0.57054216", "0.5648686", "0.5638651", "0.56341416", "0.5582736", "0.55619234", "0.5552561", "0.55498636", "0.55450416", "0.5533677", "0.55155987", "0.5502303", "0.5490627", "0.54792315", "0.5476021", "0.5454554", "0.5395677", "0.5395542", "0.53924006", "0.53890926", "0.5374427", "0.5372016", "0.5371739", "0.53662115", "0.5358933", "0.53462416", "0.5333694", "0.5318809", "0.53085816", "0.5291762", "0.5287324", "0.52733314", "0.5272377", "0.5267365", "0.5265692", "0.5263837", "0.526249", "0.52568483", "0.5243159", "0.5241679", "0.52404314", "0.52404314", "0.5234392", "0.5234", "0.5233145", "0.5223772", "0.52203125", "0.52089226", "0.5208343", "0.5204654", "0.52040565", "0.5181392", "0.5178867", "0.51784265", "0.51748556", "0.5173564", "0.517047", "0.5170373", "0.5170373", "0.51687497", "0.5154215", "0.51536644", "0.51482815", "0.5141236", "0.5133989", "0.51322305", "0.5131223", "0.5129807", "0.51136553", "0.5098833", "0.5098103", "0.50970876", "0.50906557", "0.5081473", "0.5079026", "0.5072184", "0.50707793", "0.5068914", "0.5068914", "0.50605047" ]
0.6275678
6
initialize from an existing data structure
def initialize(k=5, data=nil) super(data) @k = k || 5 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(attrs={})\n from_hash(attrs)\n end", "def initialize(hash_that_represents_json)\n\t\t@data = hash_that_represents_json\n\tend", "def initialize(a_hash)\n from_h(a_hash)\n end", "def initialize(data)\n data.each { |key, value| send(\"#{key}=\", value) unless key.nil? }\n end", "def init_with(c)\n c.map.keys.each do|k|\n instance_variable_set(\"@#{k}\", c.map[k])\n end\n\n @table.keys.each do|k|\n new_ostruct_member(k)\n end\n end", "def initialize\n super()\n self.keys = List.new()\n self.values = List.new()\n end", "def initialize aData = {}\n merge! aData\n end", "def init(para=nil)\n @attributes = Array.new if @attributes.nil?\n @sequence = Array.new if @sequence.nil?\n\n set_objects_to_acessor\n set_attributes_to_reader\n if para.kind_of? Hash\n from_hash(para)\n end\nend", "def initialize(hash=nil)\n @table = HashWithIndifferentAccess.new\n\n for k,v in hash\n @table[k] = v\n new_ostruct_member(k)\n end if hash\n end", "def initialize\n super()\n @i_keys = List.new()\n @i_values = List.new()\n end", "def initialize(data) # {{{\n @data = {}\n data.each do |k, v|\n @data.merge! @@mapping[k] ? {@@mapping[k] => v} : {k => v}\n end\n\n true\n end", "def initialize(data)\r\n @data = data.dup\r\n end", "def initialize(data)\n\n end", "def initialize(data)\n @data = expand(data)\n end", "def initialize(data = {})\n data.each do |key, value|\n self.send(:\"#{key.to_s}=\", value)\n end\n end", "def from_data(data)\n obj = new\n\n @attributes.each do |key|\n value = obj.send \"parse_#{key}\", data\n obj.send \"#{key}=\", value\n end\n\n obj\n end", "def initialize_attributes(attributes); end", "def __initialize_with(val)\n val.each { |v| new(v) }\n end", "def initialize_data\n end", "def initialize(_ = {})\n @data = {}\n end", "def from_hash(para)\n hash_objects = from_hash_to_array_objects(para)\n set_atr_object_from_hash(para,hash_objects)\n end", "def initialize data\n self.data = data\n end", "def initialize data\n self.data = data\n end", "def initialize data\n self.data = data\n end", "def initialize data\n self.data = data\n end", "def initialize data\n self.data = data\n end", "def initialize data\n self.data = data\n end", "def initialize data\n self.data = data\n end", "def initialize data\n self.data = data\n end", "def from_a(ary)\n ary.each { |e|\n self[e[0]] = e[1]\n }\n end", "def initialize() end", "def initialize(obj); end", "def initialize(*args)\n super\n @data = {}\n end", "def initialize(*args)\n if args.size == 1\n from_matrix(args[0]) if args[0].is_a? Matrix\n from_arrays(args[0]) if args[0].is_a? Array and args[0].first\n elsif args.size == 3\n\t\t\tfrom_hash(args[0], args[1], args[2]) if args[0].is_a? Hash\n\t\tend\n end", "def initialize\n super()\n init_data()\n end", "def initialize(attributes = {})\n case attributes[:matrix_option]\n when Hash\n options << OpenStruct.new(\n type_id: attributes[:matrix_option][:value][:'@type_id'],\n value_id: attributes[:matrix_option][:value][:'@internal_id'],\n script_id: attributes[:matrix_option][:@script_id],\n name: attributes[:matrix_option][:value][:name]\n )\n when Array\n attributes[:matrix_option].each do |option|\n options << OpenStruct.new(\n type_id: option[:value][:'@type_id'],\n value_id: option[:value][:'@internal_id'],\n script_id: option[:@script_id],\n name: option[:value][:name]\n )\n end\n end\n end", "def initialize new_attributes = {}\n _assign_attributes new_attributes\n end", "def initialize(elements = nil)\n super()\n (elements || {}).each_pair{ |key, value| self[key] = value }\n end", "def initialize(structures=[])\n super()\n @records[Structure] = @list = structures\n end", "def initialize(id); end", "def initialize(data={})\n if data.is_a?(Hash)\n @data = Hashie::Mash.new(data)\n elsif data.is_a?(Entity)\n @data = Hashie::Mash.new(data.data)\n else\n raise ArgumentError.new(\"data must be a Hash or Entity.\")\n end\n end", "def initialize(attributes={})\n attributes.each do |att, val|\n val = val.first[\"data\"] if val.is_a?(Array) && val.first.has_key?(\"data\")\n self.__send__(\"#{att}=\", val) if self.respond_to?(\"#{att}=\")\n end\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(object)\n @id = object[\"id\"]\n @value = object[\"value\"]\n @type = object[\"type\"]\n end", "def initialize(object)\n @id = object[\"id\"]\n @value = object[\"value\"]\n @type = object[\"type\"]\n end", "def initialize(hash={})\n self.init_attrs_from_hash(hash)\n end", "def initialize(data)\n assert_kind_of 'data', data, Hash\n @data = data\n end", "def construct(json={})\n refresh_from(json)\n end", "def construct(json={})\n refresh_from(json)\n end", "def initialize()\n @hash = {}\n @values = []\n end", "def initialize(datatype, lngth, array=nil)\n @struct = Numrb::Vec.const_get(\"Struct_#{datatype}\").new\n @struct[:dtype] = TYPES_AR.index(datatype)\n @struct[:size] = lngth\n @struct[:ptr] = Numrb::Vec::Data.new(lngth, STRIDES[datatype])\n if array\n @struct[:ptr].send(\"put_array_of_#{datatype}\", 0, array)\n end\n end", "def initialize()\n #@ch = Concept.init_concept_hash()\n #Indexer.initialize_dict()\n #@ch = Indexer.init_concept_hash\n end", "def initialize arg\n\t # self.merge arg\n\t super\n\t for k,v in arg\n\t self[k]=v\n\t end\n\n\t end", "def from data\n obj = new\n obj.decode data\n obj\n end", "def initialize(hash={})\n @data = Hash.new\n hash.each do |key, value|\n self[key] = value\n end\n end", "def initialize(attrs={})\n load_attributes!(attrs)\n end", "def initialize(data)\n\t\t@data = data\n\tend", "def from_hash(hash)\n hash = DEFAULTS.merge(hash)\n hash['spdx_id'] = hash.delete('spdx-id')\n ordered_array = hash.values_at(*members.map(&:to_s))\n new(*ordered_array)\n end", "def initialize(d = [])\n super()\n @data = d\n end", "def initialize(arry = [])\n @base = arry.collect{|el| el } # poor man's clone\n @tree_hash = run_layers\n end", "def initialize(object)\n @id = object[\"id\"]\n @data = object[\"data\"]\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 from_h!(value)\n value = {} if value.nil?\n self.textDocument = value['textDocument'] # Unknown type\n self.contentChanges = value['contentChanges'].map { |val| val } unless value['contentChanges'].nil? # Unknown array type\n self\n end", "def initialize_dup( * ) # :nodoc:\n\t\t@hash = deep_copy( @hash )\n\tend", "def initialize(attrs = {})\n if attrs.respond_to?(:with_indifferent_access)\n attrs = attrs.with_indifferent_access\n end\n @id = attrs.delete(:id)\n @_key = attrs.delete(:_key)\n @_value = attrs.delete(:_value)\n @_doc = attrs.delete(:_doc)\n @_meta = attrs.delete(:_meta)\n @_attributes = ::Hash.new do |h, k|\n default = self.class.attributes[k]\n h[k] = if default.respond_to?(:call)\n default.call\n else\n default\n end\n end\n update_attributes(@_doc || attrs)\n end", "def initialize(algorithms, connection, data); end", "def initialize(*args)\n @hash = HashWithIndifferentAccess.new(*args)\n end", "def initialize(data = {})\n @data = data\n end", "def initialize(hash={})\n self.attributes = hash\n end", "def initialize\n @hashes = Hash.new\n bootstrap\n populate\n end", "def initialize(dictionnary)\n @dictionnary = dictionnary\n end", "def initialize data\n self.data = data\n parse_data\n end", "def initialize(data:{}, options:{map_keys: true})\n @options = options\n self.class.keys.each{ |attribute| self[attribute] = data[attribute] }\n end", "def initialize(hash)\n super(hash)\n end", "def initialize(hash)\n @cw_id = hash[\"cw_id\"]\n @cik = hash[\"cik\"]\n @name = hash[\"company_name\"]\n @irs_number = hash[\"irs_number\"]\n @sic_code = hash[\"sic_code\"]\n @industry = hash[\"industry_name\"]\n @sic_sector = hash[\"sic_sector\"]\n @sector_name = hash[\"sector_name\"]\n @source_type = hash[\"source_type\"]\n @address = hash[\"raw_address\"]\n @country = hash[\"country_code\"]\n @state = hash[\"subdiv_code\"]\n @top_parent_id = hash[\"top_parent_id\"]\n @num_parents = hash[\"num_parents\"]\n @num_children = hash[\"num_children\"]\n @max_year = hash[\"max_year\"]\n @min_year = hash[\"min_year\"]\n end", "def initialize(attributes = {})\n\t\t\tload(attributes)\n\t\tend", "def build_from_hash(attributes)\n self.class.swagger_types.each_pair do |key, type|\n if type =~ /\\AArray<(.*)>/i\n # check to ensure the input is an array given that the the attribute\n # is documented as an array but the input is not\n if attributes[self.class.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })\n end\n elsif !attributes[self.class.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[self.class.attribute_map[key]]))\n elsif attributes[self.class.attribute_map[key]].nil?\n self.send(\"#{key}=\", attributes[self.class.attribute_map[key]])\n end # or else data not found in attributes(hash), not an issue as the data can be optional\n end\n self\n end", "def initialize(attributes={})\n attributes.each {|key, value| self.send(\"#{key}=\", value)}\n end", "def initialize( hash )\n\t\t\t@hash = hash.dup\n\t\t\t@dirty = false\n\t\tend", "def initialize(data = nil)\n ActiveSupport::JSON.decode(data).each do |k, v|\n self.send(\"#{k}=\", v) if self.respond_to?(\"#{k}=\")\n end if data\n end", "def initialize(data)\n @index = data['index']\n @codec_name = data['codec_name']\n @codec_type = data['codec_type']\n @tags = (data['tags']) ? data['tags'] : []\n end", "def instantiate hash, extra_attributes={}\n return hash unless hash.kind_of? Hash\n# init = hash.values_at(*@singulars).compact.first\n init = hash[@singular]\n inits = hash[@plural]\n if init\n new init.merge extra_attributes\n elsif inits\n inits.map {|each| new each.merge extra_attributes}\n else\n hash\n end\n end", "def initialize(values = {})\n @root = nil\n\n values.each { |key, value| put(key, value) }\n end", "def initialize(data=nil, &block)\n @table = ::Hash.new(&block)\n update!(data || {})\n end", "def initialize(payload); end", "def initialize(keys, data)\n @keys = {}\n keys.each_with_index { |x, i| @keys[x.to_sym] = i }\n @data = data\n end", "def initialize(*rest) end", "def initialize(attributes)\n attributes.each do |k,v|\n send(\"#{k}=\", v)\n end\n end", "def initialize(attributes)\n attributes.each do |k,v|\n send(\"#{k}=\", v)\n end\n end", "def initialize(data)\n @data = data\n end", "def initialize(data)\n @data = data\n end", "def initialize(object)\n @id = object[\"id\"]\n @label = object[\"label\"]\n @order = object[\"order\"]\n end", "def initialize\n @type_variants = Container.new\n @extension_index = Container.new\n @data_version = VERSION.dup.freeze\n end", "def collection_from(json_data, lims)\n new(json_data.reverse_merge(lims_id: lims))\n end", "def initialize(data_array)\n raise Exception.new(\"parameter should be an Array of data!\") unless data_array.is_a?(Array)\n\n self.root = nil\n\n data_array.each do |data|\n self.insert(data)\n end\n end", "def initialize(table)\n @table, @data = table, table.data\n \n initialize_values\n define_accessors\n end", "def initialize(attributes)\n attributes.each {|key, value| self.send(\"#{key}=\", value)}\n end" ]
[ "0.6634179", "0.6486545", "0.6420666", "0.6391342", "0.6370806", "0.6345665", "0.63190126", "0.6297687", "0.62938595", "0.6274947", "0.6261995", "0.61940104", "0.61899304", "0.617698", "0.6168579", "0.615784", "0.6148702", "0.6121417", "0.61162597", "0.61074525", "0.61015946", "0.6045719", "0.6045719", "0.6045719", "0.6045719", "0.6045719", "0.6045719", "0.6045719", "0.6045719", "0.6045218", "0.60315907", "0.59888273", "0.5984747", "0.59842646", "0.59794873", "0.59721357", "0.59656715", "0.59552526", "0.59531415", "0.59419185", "0.59393436", "0.59226525", "0.5906133", "0.5906133", "0.5906133", "0.5906133", "0.5906133", "0.5903632", "0.5903632", "0.59000546", "0.58970946", "0.5895629", "0.5895629", "0.5888959", "0.5878038", "0.5873173", "0.587085", "0.5870594", "0.5860948", "0.5860282", "0.5858109", "0.58573174", "0.5848773", "0.58360887", "0.5835073", "0.5834972", "0.58289355", "0.58187896", "0.5818021", "0.58116966", "0.58109784", "0.5810617", "0.580879", "0.5799676", "0.57976776", "0.5793632", "0.5790941", "0.57893485", "0.5788204", "0.5784602", "0.5776989", "0.5771323", "0.57706845", "0.5768812", "0.57664126", "0.57656574", "0.57646024", "0.5759917", "0.5759874", "0.57530314", "0.5751102", "0.5746361", "0.5746361", "0.5741066", "0.5739967", "0.5737709", "0.57360065", "0.57339144", "0.57269496", "0.57223964", "0.5721921" ]
0.0
-1
calculate contribution of each feature (f) for each class (k)
def calc_contribution(f) each_class do |k| a, b, c, d = get_A(f, k), get_B(f, k), get_C(f, k), get_D(f, k) s = 0.0 x, y = b+d, a+c s = (d/x)**(@k) - (c/y)**(@k) if not x.zero? and not y.zero? set_feature_score(f, k, s) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_contribution(f)\n each_class do |k|\n a, c = get_A(f, k), get_C(f, k)\n \n s =0.0\n x = a+c\n \n s = a/x if not x.zero?\n \n set_feature_score(f, k, s)\n end\n end", "def calc_contribution(f)\n each_class do |k|\n b, d = get_B(f, k), get_D(f, k)\n \n s = 0.0\n x = b+d\n \n s = d/x if not x.zero?\n \n set_feature_score(f, k, s)\n end\n end", "def calc_contribution(f)\n each_class do |k|\n a, b, c, d = get_A(f, k), get_B(f, k), get_C(f, k), get_D(f, k)\n n = a+b+c+d\n \n s = 0.0\n if not n.zero?\n s = (a+d) / n\n end\n \n set_feature_score(f, k, s)\n end\n end", "def calc_contribution(f)\n each_class do |k|\n a, b, c, d = get_A(f, k), get_B(f, k), get_C(f, k), get_D(f, k)\n \n s = 0.0\n x = (a+b)*(a+c)*(b+d)*(c+d)\n \n s = (a*d-b*c) / Math.sqrt(x) if not x.zero?\n \n set_feature_score(f, k, s)\n end\n end", "def calc_contribution(f)\n each_class do |k|\n a, b, c, d = get_A(f, k), get_B(f, k), get_C(f, k), get_D(f, k)\n n = a+b+c+d\n \n s = 0.0\n x = (a+b)*(a+c)\n \n s = Math.log2(a*n/x) if not x.zero?\n \n set_feature_score(f, k, s)\n end\n end", "def calc_contribution(f)\n each_class do |k|\n a, b, c, d = get_A(f, k), get_B(f, k), get_C(f, k), get_D(f, k)\n \n s = 0.0\n x = b*c\n \n s = (a*d) / x if not x.zero?\n \n set_feature_score(f, k, s)\n end\n end", "def calc_contribution(f)\n each_class do |k|\n set_feature_score(f, k, rand)\n end\n end", "def calc_contribution(f) \n each_class do |k|\n a, b, c, d = get_A(f, k), get_B(f, k), get_C(f, k), get_D(f, k)\n \n # note: intentionally negated it\n R.eval \"rv <- fisher.test(matrix(c(#{a}, #{b}, #{c}, #{d}), nrow=2))$p.value\"\n s = -1.0 * R.rv\n \n set_feature_score(f, k, s)\n end\n end", "def calc_contribution(f)\n if not get_classes.size == 2\n abort \"[#{__FILE__}@#{__LINE__}]: \\n\"+\n \" Relief applicable only to two-class problems without missing data\"\n end\n \n ## use all samples if @m not provided\n #@m = get_sample_size if not @m\n \n k1, k2 = get_classes\n score = 0.0\n \n @m.times do \n # pick a sample at random\n rs, rk = pick_a_sample_at_random\n \n # find the nearest neighbor for each class\n nbrs = find_nearest_nb(rs, rk)\n \n # calc contribution from neighbors\n score += calc_score(f, rs, rk, nbrs)\n end\n \n s = score / @m\n \n set_feature_score(f, :BEST, s)\n end", "def calc_contribution(f)\n if not get_classes.size == 2\n abort \"[#{__FILE__}@#{__LINE__}]: \\n\"+\n \" suitable only for two-class problem with continuous feature\"\n end\n \n # collect data for class 1 and 2, respectively \n k1, k2 = get_classes\n R.s1 = get_feature_values(f, nil, k1) # class 1\n R.s2 = get_feature_values(f, nil, k2) # class 2\n \n # Wilcoxon rank sum test\n R.eval \"rv <- wilcox.test(s1, s2)$p.value\"\n \n # intensionally negate it\n s = -1.0 * R.rv # pull the p-value from R\n \n set_feature_score(f, :BEST, s)\n end", "def calc_contribution(f)\n # cache H(c), frequently used\n if not @hc\n cv = get_class_labels\n @hc = get_marginal_entropy(cv)\n end\n \n # H(c|f)\n # collect class labels (cv) and feature values (fv)\n cv = get_class_labels\n fv = get_feature_values(f, :include_missing_values)\n hcf = get_conditional_entropy(cv, fv)\n \n # information gain\n s = @hc - hcf\n \n set_feature_score(f, :BEST, s) \n end", "def features_sum_all(code)\r\n features(code).inject(0.0) {|r, ft| r += ft.value }\r\n end", "def features_sum_all(code)\n features(code).inject(0.0) {|r, ft| r += ft.value }\n end", "def feature_contribution(f1, f2, idx)\n weight = @weight[idx]\n dist = f1 != f2 ? weight : 0.0\n end", "def discretize_by_TID!\n # cut points for each feature\n f2cp = {}\n \n each_feature do |f|\n cv = get_class_labels\n fv = get_feature_values(f)\n \n n = cv.size\n abort \"[#{__FILE__}@#{__LINE__}]: \\n\"+\n \" missing feature value is not allowed!\" if n != fv.size\n \n # sort cv and fv according to ascending order of fv\n sis = (0...n).to_a.sort { |i,j| fv[i] <=> fv[j] }\n cv = cv.values_at(*sis)\n fv = fv.values_at(*sis)\n \n # get initial boundaries\n bs = []\n fv_u = fv.uniq\n fv_u.each_with_index do |v, i|\n # cut points are the mean of two adjacent data points\n if i < fv_u.size-1\n bs << (v+fv_u[i+1])/2.0\n end\n end\n \n # test each pair cut point\n s_best, h1_best, h2_best = nil, nil, nil\n \n bs.each_with_index do |h1, i| \n bs.each_with_index do |h2, j|\n next if j <= i\n \n n_h1 = (0...n).to_a.select { |x| fv[x] < h1 }.size.to_f\n n_h1_h2 = (0...n).to_a.select { |x| fv[x] > h1 and fv[x] < h2 }.size.to_f\n n_h2 = (0...n).to_a.select { |x| fv[x] > h2 }.size.to_f\n \n s = 0.0\n \n each_class do |k|\n n_h1_k = (0...n).to_a.select { |x| fv[x] < h1 and cv[x] == k }.size.to_f\n n_h1_h2_k = (0...n).to_a.select { |x| fv[x] > h1 and fv[x] < h2 and cv[x] == k }.size.to_f\n n_h2_k = (0...n).to_a.select { |x| fv[x] > h2 and cv[x] == k }.size.to_f\n \n s += n_h1_k * Math.log2(n_h1_k/n_h1) if not n_h1_k.zero?\n s += n_h1_h2_k * Math.log2(n_h1_h2_k/n_h1_h2) if not n_h1_h2_k.zero?\n s += n_h2_k * Math.log2(n_h2_k/n_h2) if not n_h2_k.zero?\n \n #pp [s_best, s, h1, h2] + [n_h1, n_h1_k] + [n_h1_h2, n_h1_h2_k] + [n_h2, n_h2_k]\n end\n \n if not s_best or s > s_best\n s_best, h1_best, h2_best = s, h1, h2\n #pp [s_best, h1_best, h2_best]\n end\n \n break if s_best.zero? # allow early temination at maximum value 0.0\n end\n \n break if s_best.zero? # allow early temination at maximum value 0.0\n end\n \n #pp [s_best, h1_best, h2_best]\n f2cp[f] = [h1_best, h2_best]\n end\n \n # discretize based on cut points\n discretize_at_cutpoints!(f2cp, true)\n end", "def features_sum(code, id)\r\n features_with_id(code, id).inject(0.0) {|r, ft| r += ft.value }\r\n end", "def feature_adjustment\n total = 0\n self.contract_features.each do |f|\n if f.feature.amount\n total += f.feature.amount\n end\n end\n return total\n end", "def classify(features, k = 3)\r\n # # Order by probability\r\n feature_normalized = get_features_normalized(features)\r\n \r\n res = @dataset_normalized.sort_by do |features_ds|\r\n distance(features_ds, feature_normalized)\r\n end\r\n\r\n # Collect class of neighbors\r\n res[0...k].collect{|n| n.last }.mode\r\n end", "def features_sum(code, id)\n features_with_id(code, id).inject(0.0) {|r, ft| r += ft.value }\n end", "def * f\n result = Factorization.new(@factorbase)\n @factors.each do |b,e|\n result.add(b,e)\n end\n f.factors.each do |b,e|\n result.add(b,e)\n end\n result\n end", "def diff_feature(f, s1, s2, k1, k2)\n d = 0.0\n \n if s1.has_key?(f) and s2.has_key?(f) # no missing value\n d = (s1[f] == s2[f]) ? 0.0 : 1.0\n elsif not s1.has_key?(f) and not s2.has_key?(f) # two missing values\n fvs = get_feature_values(f).uniq\n fvs.each do |mv|\n d -= calc_p(f, mv, k1)*calc_p(f, mv, k2)\n end\n d += 1\n elsif not s1.has_key?(f) # s1: one missing value\n # diff(f, s1, s2) = 1 - P(value(f, s2)|class(s1))\n d = 1 - calc_p(f, s2[f], k1)\n else # s2: one missing value\n # diff(f, s1, s2) = 1 - P(value(f, s1)|class(s2))\n d = 1 - calc_p(f, s1[f], k2)\n end\n \n d\n end", "def calc(n, k)\n fac(n) / (fac(k) * fac(n - k)) * ((1.0/6.0)**k * (5.0/6.0)**(n-k)) * 100\n end", "def calc_score(f, rs, rk, nbrs)\n score = 0.0\n \n nbrs.each do |k, s|\n if k == rk # near hit\n score -= diff_feature(f, rs, s)**2\n else # near_miss\n score += diff_feature(f, rs, s)**2\n end\n end\n \n score\n end", "def score( instance )\n # Sum weights of all features labeled as TRUE\n sum = 0.0\n instance.each_index{ |jj| sum += @model.weights[jj] if instance[jj] }\n return sum\n end", "def get_SU_fc(f)\n cv = get_class_labels\n fv = get_feature_values(f, :include_missing_values)\n \n # Hf\n hf = get_marginal_entropy(fv)\n # cache for future use\n @f2hf ||= {}\n @f2hf[f] = hf\n \n # Hfc\n hfc = get_conditional_entropy(fv, cv)\n \n # Hc\n hc = get_marginal_entropy(cv)\n \n 2.0*(hf-hfc)/(hf+hc)\n end", "def replace_by_knn_value!(k=1)\n each_sample do |ki, si|\n # potential features having missing value\n mv_fs = get_features - si.keys\n next if mv_fs.empty? # sample si has no missing value\n \n # record object value for each feature missing value\n f2val = {}\n mv_fs.each do |mv_f|\n knn_s, knn_d = [], []\n \n each_sample do |kj, sj|\n # sample sj also has missing value of mv_f\n next if not sj.has_key? mv_f\n \n d = euclidean_distance(si, sj)\n idx = knn_d.index { |di| d<di }\n \n if idx\n knn_s.insert(idx, sj)\n knn_d.insert(idx, d)\n \n if knn_s.size > k\n knn_s = knn_s[0...k]\n knn_d = knn_d[0...k]\n end\n else\n if knn_s.size < k\n knn_s << sj\n knn_d << d\n end\n end\n end\n \n # distance-weighted value from knn\n knn_d_sum = knn_d.sum\n sz = knn_d.size\n val = 0.0\n knn_s.each_with_index do |s, i|\n if sz > 1\n if not knn_d_sum.zero?\n val += s[mv_f] * (knn_d_sum-knn_d[i]) / ((sz-1)*knn_d_sum)\n else\n val += s[mv_f] * 1.0 / sz\n end\n else # only one nearest neighbor\n val = s[mv_f]\n end\n end\n \n f2val[mv_f] = val\n #pp [si, mv_f, knn_s, knn_d, val]\n end\n \n # set value\n f2val.each do |f, v|\n si[f] = v\n end\n end\n \n # clear variables\n clear_vars\n end", "def calculate_feature_vector\n fd = current_domain.dictionary\n fd_ids = fd.keys.sort\n\n @feature_vector = fd_ids.map do |fd_id|\n feature = fd[fd_id]\n @feature_set.member?( feature ) ? 1 : 0 # TODO: TF-IDF here -- Thu Mar 1 19:25:21 2012\n end\n end", "def compute_score\n @query.items.map.with_index do |element, index|\n weight(index) * weight(@classification.items.index(element))\n end.sum\n end", "def feature_probability(index, value, class_name)\r\n features_of_class = get_feature_of_class(index, class_name)\r\n\r\n #statistical properties of the feature set\r\n fc_std = features_of_class.standard_deviation\r\n fc_mean = features_of_class.mean\r\n fc_var = features_of_class.variance \r\n\r\n # Calc prbobability of Normal Distribui\r\n\r\n exp = -((value - fc_mean)**2)/(2*fc_var)\r\n densy = (1.0/(Math.sqrt(2*Math::PI*fc_var))) * (Math::E**exp)\r\n\r\n return densy\r\n end", "def class_distribution dataset\n classes = Hash.new {|h,k| h[k] = 0}\n dataset.each do |item|\n classes[item[\"label\"]]=1+classes[item[\"label\"]]\n end\n \n result={}\n classes.each do |key,array|\n result[key]=array.to_f/dataset.size.to_f\n end\n \n return result\nend", "def sell_bonus\n features_sum(:sell_bonus)\n end", "def statistics_of_features(index, klass = nil)\r\n\r\n if klass.nil?\r\n features_of_class = @dataset.collect{|d| d[index]}\r\n else\r\n features_of_class = @dataset.select{|d| d[-1] == klass}.collect{|d| d[index]}\r\n end\r\n\r\n #statistical properties of the feature set\r\n f_std = features_of_class.standard_deviation\r\n f_mean = features_of_class.mean\r\n f_min = features_of_class.min\r\n f_max = features_of_class.max\r\n f_var = features_of_class.variance \r\n f_sum = features_of_class.sum\r\n\r\n return [f_min, f_max, f_mean, f_std, f_var, f_sum]\r\n end", "def get_feature_subset\n # feature subset\n subset = []\n \n # step 1: calc SU(i,c) for each feature\n f2su = {}\n get_features.each do |f|\n su = get_SU_fc(f)\n f2su[f] = su\n if su >= @delta\n subset << f\n end\n end\n \n # step 2: order subset by decreasing feature SU of\n subset = subset.sort { |x,y| f2su[y] <=> f2su[x] }\n \n # step 3: main algo\n fp = subset.first\n while fp\n fq = get_next_element(subset, fp)\n \n while fq\n su_pq = get_SU_pq(fp, fq)\n \n if su_pq >= f2su[fq]\n fq_new = get_next_element(subset, fq)\n subset.delete(fq) #remove fq\n fq = fq_new\n else\n fq = get_next_element(subset, fq)\n end\n end\n \n fp = get_next_element(subset, fp)\n end\n \n subset\n end", "def cdf(x, k)\n GSL::Cdf.tdist_P(x.to_f, k)\n end", "def get_statistics_of_features(klass = nil)\r\n # Statistics of features (min, max, mean, sd, var, sum)\r\n @statistics = []\r\n\r\n count_features.times do |i|\r\n f_min, f_max, f_mean, f_std, f_var, f_sum = statistics_of_features(i, klass)\r\n\r\n @statistics[i] = [f_min, f_max, f_mean, f_std, f_var, f_sum]\r\n end\r\n\r\n @statistics\r\n end", "def calculate_weighted_sum(base, weight_factors); end", "def gain(feature)\r\n\t\treturn self.info - self.featureInfo(feature)\r\n\tend", "def features_pi(code, id)\r\n features_with_id(code, id).inject(1.0) {|r, ft| r *= ft.value }\r\n end", "def step_divisor\n 10 + features_sum(:anger_mantain)\n end", "def calculate_fcost(p)\n\t\t@hcosts[p] + @gcosts[p]\n\tend", "def calculate_centroid\n\n # Clear the centroid vector\n @vcentroid.clear\n tcentroid = Hash.new(0)\n\n # Iterate through each feature vector\n @people.each do |person|\n\n # Sum the feature vectors in this cluster\n person.each do |key,value|\n tcentroid[key] = tcentroid.delete(key).to_i + value.to_i\n end\n\n end\n\n # Compute the average for the centroid\n tcentroid.each do |key,value|\n @vcentroid[key] = value.to_f / @people.length\n end\n\n end", "def get_feature_of_class(index, class_name)\r\n get_features = []\r\n features_of_class = @training_data[class_name]\r\n\r\n features_of_class.length.times do |i|\r\n get_features << features_of_class[i][index]\r\n end\r\n\r\n return get_features\r\n end", "def gain(feature)\r\n\t\treturn self.entropy - self.featureEntropy(feature)\r\n\tend", "def dot row, w\n f = row[\"features\"]\n f.keys.inject(0.0) {|u, k| u += f[k] * w[k]}\n end", "def F_score(gold)\n\t\tClustering.F_score(gold,self)\n\tend", "def f(i, k)\n if i == 1\n k < 7 ? 0.16666666666666667 : 0 #Uniform distribution of probability for one die\n elsif @cached_f[i] && @cached_f[i][k]\n @cached_f[i][k] #Using cached value if it exists\n else\n # Using exponentiation by squaring algorithm for determining probability\n sum = 0\n range = i < 3 ? ([k-6,1].max..[k-1,6].min) : ([k-6,1].max..k-1) \n range.each do |value|\n sum = sum + 0.16666666666666667*f(i-1,value)\n end\n # Storing the calculated value in cache\n @cached_f[i] ||= {}\n @cached_f[i][k] = sum \n end\n end", "def kernel(samples, koef, v_n_1, v_n_2)\r\n samples.each { |x|\r\n v_n_1, v_n_2 = koef*v_n_1 - v_n_2 + x, v_n_1\r\n }\r\n return v_n_1, v_n_2\r\n end", "def statistics_of_features(index)\r\n features_of_class = @dataset.collect{|d| d[index]}\r\n\r\n #statistical properties of the feature set\r\n f_std = features_of_class.standard_deviation\r\n f_mean = features_of_class.mean\r\n f_min = features_of_class.min\r\n f_max = features_of_class.max\r\n #f_var = features_of_class.variance \r\n\r\n return [f_min, f_max, f_mean, f_std]\r\n end", "def features\n\t\tcollection = []\n\t\tclasses.each do |_class|\n\t\t\t_class.features.each do |feature|\n\t\t\t\tcollection << feature\n\t\t\tend\n\t\tend\n\t\trace.features.each do |feature|\n\t\t\tcollection << feature\n\t\tend\n\t\tfeats.each do |feat|\n\t\t\tcollection << feat\n\t\tend\n\t\tcollection\n\tend", "def vector_add(w, x)\n sum_vector = @feature_count.times.map { |x| 0 }\n (0..@feature_count-1).each { |i| sum_vector[i] = w[i] + x[i] }\n sum_vector\nend", "def calc_spirit_attack\n features_sum(:spirit_attack)\n end", "def processSamples(samples, f, fs)\r\n processSamplesKoef(samples, calc_koef(f, fs))\r\n end", "def probability_of_feature_given_class(feature, classification)\n # the reason the rescue 0 is in there is tricky\n # because of the removal of redundant unigrams, it's possible that one of the features is never used/initialized\n ((@features[feature].count_for_class(classification) rescue 0) + 1)/ number_of_occurences_of_every_feature_in_class(classification).to_f\n end", "def gain(data, attr, target_attr):\n val_freq = {}\n subset_entropy = 0.0\n\n # Calculate the frequency of each of the values in the attribute\n data.each do |record|\n if val_freq.has_key? record[attr]\n val_freq[record[attr]] += 1.0\n else\n val_freq[record[attr]] = 1.0\n end\n end\n\n # Calculate the sum of the entropy for each subset of records weighted\n # by their probability of occuring in the training set.\n val_freq.each_key do |val|\n val_prob = val_freq[val] / val_freq.values.sum\n data_subset = data.collect { |record| record[attr] == val }\n subset_entropy += val_prob * entropy(data_subset, target_attr)\n end\n\n # Subtract the entropy of the chosen attribute from the entropy of the\n # whole data set with respect to the target attribute (and return it)\n entropy(data, target_attr) - subset_entropy\nend", "def precision category,a\n x=getValue category\n y=getValue category\n return a[x][y]/colsum(a,y).to_f\nend", "def features_pi(code, id)\n result = features_with_id(code, id).inject(1.0){ |r, ft|\n r *= (ft.value == 0.0) ? 0.0000001 : ft.value\n }\n end", "def classify(doc)\n frag, probs, feat = nil, nil, nil\n doc.frags.each do |frag|\n probs = @p0\n frag.features.each do |feat|\n probs *= @feats[feat]\n end\n frag.pred = probs / (probs + 1)\n end\n end", "def tf_idf\n tf.each do |tf_k, tf_v|\n idf_v = idf[tf_k]\n tfidf[tf_k] = bigdecimal(tf_v * idf_v)\n end\n tfidf\n end", "def classify(features)\r\n # # Order by probability\r\n feature_normalized = get_features_normalized(features)\r\n \r\n res = @classes.sort_by do |klasse|\r\n discriminating(klasse, feature_normalized)\r\n end.first\r\n\r\n res\r\n end", "def hcf(i,j)\n \nend", "def f\n self.g + self.h\n end", "def discretize_by_MID! \n # determine the final boundaries\n f2cp = {} # cut points for each feature\n each_feature do |f|\n cv = get_class_labels\n fv = get_feature_values(f)\n \n n = cv.size\n abort \"[#{__FILE__}@#{__LINE__}]: \\n\"+\n \" missing feature value is not allowed!\" if n != fv.size\n \n # sort cv and fv according to ascending order of fv\n sis = (0...n).to_a.sort { |i,j| fv[i] <=> fv[j] }\n cv = cv.values_at(*sis)\n fv = fv.values_at(*sis)\n \n # get initial boundaries\n bs = []\n fv.each_with_index do |v, i|\n # cut point (Ta) for feature A must always be a value between\n # two examples of different classes in the sequence of sorted examples\n # see orginal reference\n if i < n-1 and cv[i] != cv[i+1]\n bs << v\n end\n end\n bs.uniq! # remove duplicates\n \n # main algorithm, iteratively determine cut point\n cp = []\n partition(cv, fv, bs, cp)\n \n # record cut points for feature (f)\n f2cp[f] = cp.sort # sorted cut points\n end\n \n # discretize based on cut points\n discretize_at_cutpoints!(f2cp)\n end", "def cal_mean\n sum = @data.inject(0) do |accu, hash|\n accu + hash[:prediction] - hash[:rating]\n end\n sum.to_f / @data.size\n end", "def number_of_occurences_of_every_feature_in_class(classification)\n # return the cached value, if there is one\n return @occurences_of_every_feature_in_class[classification] if @occurences_of_every_feature_in_class[classification]\n \n # we drop the first (since there is no 0 feature) and sum on the rest\n # the reason the rescue 0 is in there is tricky\n # because of the removal of redundant unigrams, it's possible that one of the features is never used/initialized\n @occurences_of_every_feature_in_class[classification] = @features.values.rest.compact.inject(0) do |sum, feature_count|\n sum + feature_count.count_for_class(classification)\n end\n end", "def cdf(x, k)\n Statistics2.chi2dist(k.to_i,x)\n end", "def attribute_gain(attribute, attribute_values, examples, system_entropy)\n\n\t# Calculate entropy of each value of the attribute\n\t# 1. Get number of attribute appearances given each class\n\tclass_attr_appearances = {}\n\tex_gropued_by_class = examples.group_by{|x| x.last}.values # groups the examples by class value (On each index an array of examples from same class)\n\tposition_to_search = @attribute_position[attribute.to_sym] # Getting the index where the attribute is on each example\n\t\n\tgain = system_entropy\n\tattribute_values.each do |attr_val|\t# iterating over each possible attribute value\n\t\tattribute_quantities = [] # To Store number of attribute appeareances per attribute value\n\t\tsummation = []\n\t\tex_gropued_by_class.each do |class_group| # iterating over each group of examples with same class\n\t\t\tcount = 0\n\t\t\tclass_group.each do |ex| #iterating over each example of the current set of examples with same class\n\t\t\t\tcount +=1 if ex[position_to_search] == attr_val\n\t\t\tend\n\t\t\tattribute_quantities << count\t\t\t\n\t\tend\n\t\tattribute_quantities.each do |val|\n\t\t\tif val == 0 # assumming zero as value to avoid NaN given a Log2(0)\n\t\t\t\tsummation << 0\n\t\t\telse\n\t\t\t\tsummation << (val.to_f / attribute_quantities.inject(:+)) * Math::log((val.to_f / attribute_quantities.inject(:+)), 2)\n\t\t\tend\n\t\tend\n\t\tcurrent_entropy = -(summation.inject(:+)) # sums up and returns calculated attribute value entropy\t\t\n\t\tgain -= ((attribute_quantities.inject(:+).to_f / examples.count) * current_entropy.to_f)\n\tend\n\n\tgain # return gain\nend", "def classify(point, k)\n # Sort the data based on the euclidean distance from the given point\n tmp = @data.sort_by { |datapoint, _| point.euclidean_distance(datapoint) }.\n\n # Limit to the nearest k datapoints\n first(k).\n\n # Get the classifications for these points\n map(&:last).\n\n # Create a hash mapping each classification to its frequency\n reduce(Hash.new(0)) { |hash, e| hash[e] += 1; hash }.\n\n # Sort in descending order of frequency\n sort_by(&:last).reverse\n\n # If there is a tie, repeat with k = k - 1\n if tmp.length > 1 && tmp[0].last == tmp[1].last\n classify(point, k - 1)\n else\n tmp[0].first\n end\n end", "def fcount(f,cat)\n if @fc[f] && @fc[f][cat]\n Float(@fc[f][cat])\n else\n 0\n end\n end", "def discretize_by_ChiMerge!(alpha=0.10)\n # degree of freedom equals one less than number of classes\n df = get_classes.size-1\n chisq = pval2chisq(alpha, df)\n \n # for intialization\n hzero = {}\n each_class do |k|\n hzero[k] = 0.0\n end\n \n # determine the final boundaries for each feature\n f2bs = {}\n each_feature do |f|\n #f = :\"sepal-length\"\n # 1a. initialize boundaries\n bs, cs, qs = [], [], []\n fvs = get_feature_values(f).uniq.sort\n fvs.each do |v|\n bs << v\n cs << hzero.dup\n end\n \n # 1b. initialize counts for each interval\n each_sample do |k, s|\n next if not s.has_key? f\n i = bs.rindex { |x| s[f] >= x }\n cs[i][k] += 1.0\n end\n \n # 1c. initialize chi-squared values between two adjacent intervals\n cs.each_with_index do |c, i|\n if i+1 < cs.size\n qs << chisq_calc(c, cs[i+1])\n end\n end\n \n # 2. iteratively merge intervals\n until qs.empty? or qs.min > chisq\n qs.each_with_index do |q, i|\n next if q != qs.min\n \n # update cs for merged two intervals\n cm = {}\n each_class do |k|\n cm[k] = cs[i][k]+cs[i+1][k]\n end\n \n # update qs if necessary\n # before merged intervals\n if i-1 >= 0\n qs[i-1] = chisq_calc(cs[i-1], cm)\n end\n # after merged intervals\n if i+1 < qs.size\n qs[i+1] = chisq_calc(cm, cs[i+2])\n end\n \n # merge up\n bs.delete_at(i+1)\n cs.delete_at(i);cs.delete_at(i);cs.insert(i, cm)\n qs.delete_at(i)\n \n # break out\n break\n end\n end\n \n # 3. record the final boundaries\n f2bs[f] = bs\n end\n \n # discretize according to each feature's boundaries\n discretize_at_cutpoints!(f2bs)\n end", "def classify(features)\r\n # Order by probability\r\n res = classes.sort_by do |class_name|\r\n class_probability(features, class_name)\r\n end\r\n\r\n return res[-1]\r\n end", "def calc_class(weights)\n sum = weights.inner_product @attributes\n if sum > 0\n 1\n else\n 0\n end\n end", "def activation_output(w, x)\n sum = (0..@feature_count-1).inject(0.0) { |sum, i| (sum + (w[i] * x[i])) }\n ((sum + @bias) >= @theta) ? 1 : 0\nend", "def fielding_total\n self.rating_6 +\n self.rating_7 +\n self.rating_8 +\n self.rating_9 +\n self.rating_10 +\n self.rating_11 +\n self.rating_12 +\n self.rating_13 +\n self.rating_14\n end", "def classify(doc)\n frag = nil\n probs = 1\n feat = ''\n doc.frags.each do |frag|\n probs = @p0\n frag.features.each do |feat|\n probs *= @feats[feat]\n end\n frag.pred = probs / (probs + 1)\n end\n end", "def calc_k(n, g)\n H(n, n, g)\n end", "def calculate_score\n # @frames.flatten.compact.map(&:to_i).sum\n # @frames.map.with_index { |k, i| Frame.new((i+1), k.first, k.last).sum }.sum\n #my_frames = frames\n\n # TODO: actually calculate the score magically\n\n # Previous implementation\n # my_frames.map(&:sum).sum\n Frame.final_scoring(frames)\n end", "def calculate(data = @data)\r\n ft = []\r\n for k in 0...data.length do\r\n tot = 0\r\n data.each_with_index do |x_n, n|\r\n tot += x_n * Math::E ** (Complex(0,-1) * 2.0 * Math::PI * k * n / data.length.to_f)\r\n end\r\n ft << tot\r\n end\r\n ft\r\n end", "def calc_k(n, g)\n H(n, n, g)\n end", "def score(category, feature)\n n = Float(@total_lines)\n n11 = Float(f_n11(category, feature))\n n1dot = Float(f_n1dot(category))\n ndot1 = Float(f_ndot1(feature))\n n01 = Float(f_n01(category, feature))\n n0dot = Float(f_n0dot(category))\n n10 = Float(f_n10(category, feature))\n ndot0 = Float(f_ndot0(feature))\n n00 = Float(f_n00(category, feature))\n\n score = 0.0\n\n score += (n11/n)*log2(n*n11/(n1dot*ndot1)) if n11 > 0.0 and n1dot > 0.0 and ndot1 > 0.0\n score += (n01/n)*log2((n*n01)/(n0dot*ndot1)) if n01 > 0.0 and n0dot > 0.0 and ndot1 > 0.0\n score += (n10/n)*log2(n*n10/(n1dot*ndot0)) if n10 > 0.0 and n1dot > 0.0 and ndot0 > 0.0\n score += (n00/n)*log2(n*n00/(n0dot*ndot0)) if n00 > 0.0 and n0dot > 0.0 and ndot0 > 0.0\n\n score\n end", "def class_average(grade_hash)\n sum, n = 0, 0\n grade_hash.each do |k,array|\n array.each do |grade|\n n += 1\n sum += grade\n end\n end\n return sum/n\nend", "def est_feature_probabilities(samples)\r\n probs_matrix = []\r\n total_count = samples.count.to_f\r\n\r\n @feature_list.each do |feature|\r\n feature_count = samples.count {|e| e[feature] == 0}\r\n probs_matrix << (feature_count / total_count).round(2)\r\n end\r\n probs_matrix\r\n end", "def class_average(grade_hash)\n class_array = grade_hash.map do |k,v|\n averages v\n end\n averages class_array\nend", "def hitting_total\n self.rating_19 +\n self.rating_20 +\n self.rating_21 +\n self.rating_22 +\n self.rating_23 +\n self.rating_24 +\n self.rating_25 +\n self.rating_26 +\n self.rating_27\n end", "def totalHeures\n total=0\n @feuilles.each { |f| total = total + f.totalHeures }\n total\n end", "def silhouette_scikit feature, cluster\n silhouette_point(feature, cluster).sum / feature.length\nend", "def kcal\n x = collect{|a| a.kcal}\n y = x.inject(0, :+)\n y\n end", "def update_rating\n @product.rating = @product.likes.size * 10\n @product.feature_groups.where(singles: false).each do |fg|\n fg.features.each do |f|\n up_rating = f.likes.where(up: true).size\n down_rating = f.likes.where(up: false).size\n @product.rating += up_rating - down_rating\n end\n end\n @product.feature_groups.where(singles: true).each do |singles|\n singles.features.each do |f|\n @product.rating += f.likes.where(up: true).size - f.likes.where(up: false).size\n end\n end\n # here we should somehow incorporate comments on the product into the rating\n @product.save\n end", "def lifter_total_cost\n total_cost = 0 \n self.memberships.each do |membership_instance|\n total_cost += membership_instance.cost \n end\n total_cost\n end", "def calc_spirit_defense\n features_sum(:spirit_defense)\n end", "def each_feature\n self.each do |element|\n element.each_feature do |feat|\n yield @feature_instance_class.new(element,feat)\n end\n end\n end", "def discretize_by_Chi2!(delta=0.02) \n # degree of freedom equals one less than number of classes \n df = get_classes.size-1\n \n #\n # Phase 1\n #\n \n sig_level = 0.5\n sig_level0 = sig_level\n \n inst_cnt = get_instance_count\n inconsis_rate = get_IR_by_count(inst_cnt)\n \n # f2bs = {\n # :'sepal-length' => [4.4],\n # :'sepal-width' => [2.0],\n # :'petal-length' => [1.0, 3.0, 5.0],\n # :'petal-width' => [0.1, 1.0, 1.7],\n # }\n \n while true\n chisq = pval2chisq(sig_level, df)\n f2bs = {} # cut ponts\n \n each_feature do |f|\n bs, cs, qs = chi2_init(f)\n chi2_merge(bs, cs, qs, chisq)\n \n f2bs[f] = bs\n end\n \n inconsis_rate = chi2_get_inconsistency_rate(inst_cnt, f2bs)\n \n if inconsis_rate <= delta\n sig_level -= 0.1\n sig_level0 = sig_level\n \n break if sig_level0 <= 0.2 # phase 1 stop at level == 0.2\n else # data inconsistency\n break\n end \n end\n \n #\n # Phase 2\n #\n \n try_levels = [0.1, 0.01, 0.001, 1e-4, \n 1e-5, 1e-6, 1e-7, 1e-8, \n 1e-9, 1e-10, 1e-11, 1e-12] \n mergeble_fs = []\n f2sig_level = {}\n \n each_feature do |f|\n mergeble_fs << f\n f2sig_level[f] = sig_level0\n end\n \n f2bs = {} # cut ponts\n \n while not mergeble_fs.empty?\n mergeble_fs.each do |f|\n #pp f\n bs, cs, qs = chi2_init(f)\n chisq_now = pval2chisq(f2sig_level[f], df)\n chi2_merge(bs, cs, qs, chisq_now)\n \n # backup\n bs_bak = nil\n if f2bs.has_key? f\n bs_bak = f2bs[f]\n end\n f2bs[f] = bs\n \n inconsis_rate = chi2_get_inconsistency_rate(inst_cnt, f2bs)\n \n if (inconsis_rate <= delta)\n # try next level\n next_level = chi2_decrease_sig_level(f2sig_level[f], try_levels)\n f2sig_level[f] = next_level\n \n if not next_level # we've tried all levels\n mergeble_fs.delete(f)\n else\n f2bs[f] = bs # record cut points for this level\n end\n else # cause more inconsistency\n f2bs[f] = bs_bak if bs_bak # restore last cut points\n mergeble_fs.delete(f) # not mergeble\n end\n end\n end\n #pp f2bs\n #pp f2sig_level\n \n # if there is only one interval, remove this feature\n each_sample do |k, s|\n s.delete_if { |f, v| f2bs[f].size <= 1 }\n end\n \n # discretize according to each feature's cut points\n discretize_at_cutpoints!(f2bs)\n end", "def fit; end", "def rating factorization\n num_items = factorization.num_items\n num_users = factorization.num_users\n\n\n feature_dim = factorization.getItemFeatures(factorization.get_item_id_mappings.iterator.next.get_key.long_value).length\n\n vektor = factorization.getItemFeatures(factorization.get_item_id_mappings.iterator.next.get_key.long_value)\n\n item_matrix = factorization.get_item_id_mappings.iterator.inject([]) do |item_matrix, item_map| \n item_row = item_map.get_value\n item_vector = factorization.getItemFeatures(item_map.get_key.long_value).to_a\n item_matrix << item_vector\n item_matrix\n end\n\n user_matrix = factorization.get_user_id_mappings.iterator.inject([]) do |user_matrix, user_map| \n user_row = user_map.get_value\n user_matrix << factorization.getUserFeatures(user_map.get_key.long_value).to_a\n user_matrix\n end\n\n user_matrix = Matrix.rows(user_matrix)\n item_matrix = Matrix.rows(item_matrix)\n \n rating_matrix = item_matrix * user_matrix.transpose\n \n\n dense_matrix = DenseMatrix.new(num_users, num_items)\n\n rating_matrix.each_with_index{|num, row, col|\n dense_matrix.set_quick(col, row, num) \n }\n\n dense_matrix\n\n# factorization.get_item_id_mappings.iterator.each do |item_map| \n# item_row = item_map.get_value\n# item_matrix = Matrix[factorization.getItemFeatures(item_map.get_key.long_value).to_a]\n# factorization.get_user_id_mappings.iterator.each do |user_map| \n# user_row = user_map.get_value\n# user_matrix = Matrix[factorization.getUserFeatures(user_map.get_key.long_value).to_a]\n# rating = item_matrix*user_matrix.transpose\n# rating_matrix.set_quick(user_row,item_row,rating[0,0])\n# end\n# end\n\n \n #TODO: multiply the vectors and put it into the matrix \n end", "def compute_score\n\n total_score=0\n total_weights=0\n self.class.field_mappings.each do |field_name,field_config|\n if !field_config[:weight].blank?\n total_score += field_config[:weight].to_f * (self.class.blank_value?(self.send(field_name)) ? 0 : 1) # if the field is blank, it is a 0 regardless of weight, otherwise it is a 1 times its weight\n total_weights += field_config[:weight].to_f\n end\n end\n\n return ((total_score/total_weights)*100).ceil\n\n end", "def run_aggregation\n GRADES.each_with_index do |grade, idx|\n classifier[grade].each_pair do |metric, values|\n all_values = values\n all_values += classifier[GRADES[idx + 1]][metric] if (idx + 1) < GRADES.count\n\n classifier[grade][metric] =\n if all_values.count <= 2\n values.max || 0\n else\n (all_values.sum / all_values.count).round(2)\n end\n end\n end\n end", "def calculate_result\n process_events(@events)\n\n elements = {}\n i = 0\n @images.each do |image|\n element_list = image['elements'].split(',')\n rank_multiplier = 5 - @final_rank[i]\n element_list.each do |element_name|\n # \"cf:\" is a legacy prefix, if it exists remove it.\n element_name = element_name[3..-1] if element_name[0..2] == 'cf:'\n elements[element_name] ||= 0\n elements[element_name] += rank_multiplier\n end\n i += 1\n end\n\n elements\n end", "def combin(k)\n return self.factorial / (k.factorial * (n - k).factorial)\n end", "def estimate_count\n -(m / k.to_f) * Math.log(1 - (filter.cardinality / m.to_f))\n end", "def klass_average(k)\n assignments = self.assignments.select {|a| a.klasses.include?(k)}\n points_possible = assignments.map(&:value).compact.reduce(:+)\n points_earned = self.grades.select {|g| assignments.include?(g.assignment)}.map(&:value).compact.reduce(:+)\n \"#{points_earned.to_f / points_possible.to_f * 100}%\"\n end", "def icc_1_k_f(rho=0)\n num=msr*(1-rho)\n den=msw\n Statsample::Test::F.new(num, den, @df_bt, @df_wt)\n end" ]
[ "0.78788304", "0.7792636", "0.7778219", "0.772977", "0.7694428", "0.76803815", "0.7582821", "0.7445391", "0.6979485", "0.6889027", "0.6828307", "0.63680226", "0.6309623", "0.62906444", "0.60808206", "0.5987632", "0.5912798", "0.59023523", "0.59009403", "0.5873083", "0.5818051", "0.5727831", "0.5646196", "0.56368846", "0.56032956", "0.5524575", "0.5518999", "0.5495646", "0.5462184", "0.5458423", "0.5388588", "0.5336838", "0.5330669", "0.5317559", "0.5294055", "0.5289621", "0.5278971", "0.5265311", "0.526285", "0.5258301", "0.52547514", "0.52361804", "0.521351", "0.52023447", "0.51953584", "0.5189757", "0.51872927", "0.51709604", "0.51613975", "0.5138607", "0.5113571", "0.51012653", "0.50970095", "0.5085816", "0.5076288", "0.50750154", "0.50735563", "0.50638336", "0.505784", "0.505062", "0.5037518", "0.50365824", "0.5036047", "0.50104904", "0.5007783", "0.5000957", "0.5000255", "0.4990316", "0.4979272", "0.49755475", "0.4960119", "0.4955005", "0.49520108", "0.4950219", "0.49416834", "0.49324661", "0.4930841", "0.49109682", "0.4909685", "0.4903894", "0.4898902", "0.48981136", "0.48921847", "0.48919085", "0.4872602", "0.4868411", "0.48673275", "0.48663273", "0.48574802", "0.48569602", "0.48418304", "0.48295417", "0.48286054", "0.48284057", "0.48282105", "0.48215732", "0.48213878", "0.48093906", "0.4808206", "0.48043203" ]
0.7799466
1
Set the association reflection to use, and whether the association should be reloaded if an array method is called.
def initialize(instance, reflection, reload=nil) @instance = instance @reflection = reflection @reload = reload end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def association_reflection(association)\n uar = used_association_reflections\n Sequel.synchronize{uar[association] ||= true}\n super\n end", "def reflect_on_association(name)\n ActiveRecordAssociationAdapter.for_association(associations[name]) if associations[name]\n end", "def freeze\n used_association_reflections\n super\n end", "def reflect_on_association(name)\n self.class.reflect_on_association(name)\n end", "def reflect_on_association(name)\n if orm_association = klass.reflect_on_association(name)\n self.class.const_get(:Association).new(orm_association,self)\n end\n end", "def reflection_for(method) #:nodoc:\n @object.class.reflect_on_association(method) if @object.class.respond_to?(:reflect_on_association)\n end", "def define_association_methods\n @associations = Associations.register(self)\n return if association_methods_generated?\n self.class.association_methods_generated = true\n end", "def reflection_for(method) #:nodoc:\n @object.class.reflect_on_association(method) if @object.class.respond_to?(:reflect_on_association)\n end", "def preloader_for(reflection)\n if reflection.options[:through]\n ThroughAssociation\n else\n Association\n end\n end", "def association_reflection\n @opts[:association_reflection]\n end", "def used_association_reflections\n Sequel.synchronize{@used_association_reflections ||= {}}\n end", "def set_association(key, value)\n _associations[key.to_sym] = _cast_association(key, value)\n end", "def method_missing(meth, *args, &block)\n (ARRAY.respond_to?(meth) ? @instance.send(:load_associated_objects, @reflection, @reload) : @instance.send(@reflection.dataset_method)).\n send(meth, *args, &block)\n end", "def association\n @association ||= model.reflect_on_association(@name)\n end", "def def_association_method(opts)\n association_module_def(opts.association_method, opts) do |*dynamic_opts, &block|\n Sequel::Deprecation.deprecate(\"Passing multiple arguments to ##{opts.association_method}\", \"Additional arguments are currently ignored\") if dynamic_opts.length > 1\n load_associated_objects(opts, dynamic_opts.length == 0 ? OPTS : dynamic_opts[0], &block)\n end\n end", "def association(name)\n association = super\n reflection = self.class.reflect_on_association(name)\n case reflection.try(:macro)\n when :belongs_to\n association.extend(HasAggregatedExtension) if reflection.options[:aggregated]\n when :has_one\n association.extend(HasCurrentExtension) if reflection.options[:is_current]\n else # do nothing\n end\n association\n end", "def associations; self.class.class_eval(\"@@associations\") end", "def reflect_on_association(name)\n association_by_name[name.to_sym]\n end", "def reflect_on_association(association)\n reflections[association.to_s]\n end", "def reflect_on_association(association)\n reflections[association.to_s]\n end", "def method_missing(method_name, *args, &block)\r\n if @loaded[method_name]\r\n @loaded[method_name]\r\n elsif self.class.associations(version)[method_name] ||\r\n self.class.model.reflect_on_association(method_name)\r\n\r\n class_eval <<CODE, __FILE__, __LINE__ + 1\r\ndef #{method_name}\r\n @loaded[#{method_name.inspect}] ||\r\n Restful::Resource::AssociationProxy.new(self, :#{method_name})\r\nend\r\nCODE\r\n\r\n send method_name\r\n elsif args.size <= 1 && attributes(*args).has_key?(method_name)\r\n self[method_name, *args]\r\n else\r\n super\r\n end\r\n # rescue => e\r\n # raise [method_name, args, block].inspect\r\n end", "def touch_associations\n model.touched_associations.each do |assoc, column|\n r = model.association_reflection(assoc)\n next unless r.can_have_associated_objects?(self)\n ds = send(r.dataset_method)\n\n if ds.send(:joined_dataset?)\n # Can't update all values at once, so update each instance individually.\n # Instead if doing a simple save, update via the instance's dataset,\n # to avoid going into an infinite loop in some cases.\n send(assoc).each{|x| x.this.update(column=>touch_association_value)}\n else\n # Update all values at once for performance reasons.\n ds.update(column=>touch_association_value)\n associations.delete(assoc)\n end\n end\n end", "def reflect_on_all_associations(*macros)\n self.class.reflect_on_all_associations(*macros)\n end", "def def_association_instance_methods(opts)\n association_module_def(opts.dataset_method, opts){_dataset(opts)}\n def_association_method(opts)\n\n return if opts[:read_only]\n\n if opts[:setter] && opts[:_setter]\n # This is backwards due to backwards compatibility\n association_module_private_def(opts._setter_method, opts, &opts[:setter])\n association_module_def(opts.setter_method, opts, &opts[:_setter])\n end\n\n if adder = opts[:adder]\n association_module_private_def(opts._add_method, opts, &adder)\n association_module_def(opts.add_method, opts){|o,*args| add_associated_object(opts, o, *args)}\n end\n\n if remover = opts[:remover]\n association_module_private_def(opts._remove_method, opts, &remover)\n association_module_def(opts.remove_method, opts){|o,*args| remove_associated_object(opts, o, *args)}\n end\n\n if clearer = opts[:clearer]\n association_module_private_def(opts._remove_all_method, opts, &clearer)\n association_module_def(opts.remove_all_method, opts){|*args| remove_all_associated_objects(opts, *args)}\n end\n end", "def foreign_key_as_association(enabled)\n configuration.foreign_key_as_association = enabled\n end", "def detect_association(c)\n assoc, assoc_method = assoc_and_assoc_method_for_column(c)\n if assoc\n assoc_column = assoc.klass.columns_hash[assoc_method]\n assoc_method_type = assoc_column.try(:type)\n\n # if association column is boolean, display a checkbox (or alike), otherwise - a combobox (or alike)\n if c[:nested_attribute]\n c[:editor] ||= editor_for_attr_type(assoc_method_type)\n else\n c[:editor] ||= assoc_method_type == :boolean ? editor_for_attr_type(:boolean) : editor_for_association\n c[:assoc] = true\n end\n end\n end", "def preloadable_associations\n @@preloadable_associations[self.name] ||= \n reflect_on_all_associations.reject{|a| a.options[:polymorphic] || a.macro == :has_many}.map(&:name)\n end", "def association_instance_set(name, association)\n @association_cache[name] = association\n end", "def association_instance_set(name, association)\n @association_cache[name] = association\n end", "def association_instance_set(name, association)\n @association_cache[name] = association\n end", "def reflect_on_all_associations(macro = nil)\n association_reflections = reflections.values\n macro ? association_reflections.select { |reflection| reflection.macro == macro } : association_reflections\n end", "def save_belongs_to_many_association(reflection)\n previously_new_record_before_save = (@new_record_before_save ||= false)\n @new_record_before_save = new_record?\n\n association = association_instance_get(reflection.name)\n association&.build_changes { save_collection_association(reflection) }\n rescue ::ActiveRecord::RecordInvalid\n throw(:abort)\n ensure\n @new_record_before_save = previously_new_record_before_save\n end", "def association_reflection(name)\n association_reflections[name]\n end", "def process_association(class_name, assoc)\n\n STDERR.print \"\\t\\tProcessing model association #{assoc.name.to_s}\\n\" if @options.verbose\n\n # Skip \"belongs_to\" associations\n return if assoc.macro.to_s == 'belongs_to'\n\n # Only non standard association names needs a label\n \n # from patch #12384\n # if assoc.class_name == assoc.name.to_s.singularize.camelize\n \n assoc_class_name = (assoc.class_name.respond_to? 'underscore') ? assoc.class_name.pluralize.singularize.camelize : assoc.class_name \n if assoc_class_name == assoc.name.to_s.singularize.camelize\n assoc_name = ''\n else\n assoc_name = assoc.name.to_s\n end \n\n if assoc.macro.to_s == 'has_one' \n assoc_type = 'one-one'\n elsif assoc.macro.to_s == 'has_many' && (! assoc.options[:through])\n assoc_type = 'one-many'\n else # habtm or has_many, :through\n return if @habtm.include? [assoc.class_name, class_name, assoc_name]\n assoc_type = 'many-many'\n @habtm << [class_name, assoc.class_name, assoc_name]\n end \n # from patch #12384 \n # @graph.add_edge [assoc_type, class_name, assoc.class_name, assoc_name]\n @graph.add_edge [assoc_type, class_name, assoc_class_name, assoc_name] \n end", "def association(name) #:nodoc:\n association = association_instance_get(name)\n\n if association.nil?\n reflection = self.class.reflect_on_association(name)\n association = reflection.association_class.new(self, reflection)\n association_instance_set(name, association)\n end\n\n association\n end", "def association_for(reflection)\n inverse = inverse_association_name(reflection)\n Registry[reflection.klass].detect do |mapping|\n association = mapping.associations.detect { |a| a.name == inverse }\n break association if association\n end\n end", "def association!(association, record_id)\n if preloadable_association?(association.name)\n associations.register(association, record_id)\n end\n end", "def load_associated_objects(opts, reload=false)\n name = opts[:name]\n if @associations.include?(name) and !reload\n @associations[name]\n else\n objs = if opts.returns_array?\n send(opts.dataset_method).all\n else\n if !opts[:key]\n send(opts.dataset_method).all.first\n elsif send(opts[:key])\n send(opts.dataset_method).first\n end\n end\n run_association_callbacks(opts, :after_load, objs)\n # Only one_to_many associations should set the reciprocal object\n objs.each{|o| add_reciprocal_object(opts, o)} if opts.set_reciprocal_to_self?\n @associations[name] = objs\n end\n end", "def run_association_callbacks(reflection, callback_type, object)\n # The reason we automatically set raise_error for singular associations is that\n # assignment in ruby always returns the argument instead of the result of the\n # method, so we can't return nil to signal that the association callback prevented\n # the modification\n raise_error = raise_on_save_failure || !reflection.returns_array?\n stop_on_false = [:before_add, :before_remove, :before_set].include?(callback_type)\n reflection[callback_type].each do |cb|\n res = case cb\n when Symbol\n send(cb, object)\n when Proc\n cb.call(self, object)\n else\n raise Error, \"callbacks should either be Procs or Symbols\"\n end\n\n if res == false and stop_on_false\n Sequel::Deprecation.deprecate(\"Having #{callback_type} association callback return false to cancel modification\", \"Instead, call Model#cancel_action inside the association callback\")\n raise(HookFailed, \"Unable to modify association for #{inspect}: one of the #{callback_type} hooks returned false\")\n end\n end\n rescue HookFailed\n return false unless raise_error\n raise\n end", "def load_target_with_scrooge\n scrooge_seen_association!(@reflection)\n load_target_without_scrooge\n end", "def detect_through_associations\n reflections.each do |association, reflection|\n next if ignored_association?(association) || version_association?(association)\n self.through_associations << reflection.options.symbolize_keys[:through].try(:to_sym)\n end\n self.through_associations = through_associations.compact.uniq.reject {|association| ignored_association?(association) }\n end", "def reflect_on_all_associations(macro = nil)\n association_reflections = reflections.values\n association_reflections.select! { |reflection| reflection.macro == macro } if macro\n association_reflections\n end", "def reflect_on_all_associations(macro = nil)\n association_reflections = reflections.values\n association_reflections.select! { |reflection| reflection.macro == macro } if macro\n association_reflections\n end", "def _apply_association_options(opts, ds)\n unless ds.kind_of?(AssociationDatasetMethods)\n ds = opts.apply_dataset_changes(ds)\n end\n ds = ds.clone(:model_object => self)\n ds = ds.eager_graph(opts[:eager_graph]) if opts[:eager_graph] && opts.eager_graph_lazy_dataset?\n ds = instance_exec(ds, &opts[:block]) if opts[:block]\n ds\n end", "def destroyed_by_association=(reflection)\n @destroyed_by_association = reflection\n end", "def setup_associations; end", "def preload_one_association(records, association, preload_options={})\n class_to_reflection = {}\n # Not all records have the same class, so group then preload\n # group on the reflection itself so that if various subclass share the same association then\n # we do not split them unnecessarily\n records.group_by { |record| class_to_reflection[record.class] ||= record.class.reflections[association]}.each do |reflection, _records|\n raise ConfigurationError, \"Association named '#{ association }' was not found; perhaps you misspelled it?\" unless reflection\n\n # 'reflection.macro' can return 'belongs_to', 'has_many', etc. Thus,\n # the following could call 'preload_belongs_to_association',\n # 'preload_has_many_association', etc.\n send(\"preload_#{reflection.macro}_association\", _records, reflection, preload_options)\n end\n end", "def allow_lazy_load_for_static_cache_associations\n # :nocov:\n if defined?(::Sequel::Plugins::StaticCache::ClassMethods)\n # :nocov:\n @association_reflections.each_value do |ref|\n if ref.associated_class.is_a?(::Sequel::Plugins::StaticCache::ClassMethods)\n ref[:forbid_lazy_load] = false\n end\n end\n end\n end", "def load_association_objects_options(dynamic_opts, &block)\n dynamic_opts = case dynamic_opts\n when true, false, nil\n Sequel::Deprecation.deprecate(\"Passing #{dynamic_opts.inspect} an argument to an association loading method\", \"Pass {:reload=>#{dynamic_opts.inspect}} instead\")\n {:reload=>dynamic_opts}\n when Hash\n Hash[dynamic_opts]\n else\n if dynamic_opts.respond_to?(:call)\n Sequel::Deprecation.deprecate(\"Passing callbable argument #{dynamic_opts.inspect} to an association loading method\", \"Pass a block to the method to use a callback\")\n {:callback=>dynamic_opts}\n else\n Sequel::Deprecation.deprecate(\"Passing #{dynamic_opts.inspect} an argument to an association loading method\", \"Pass {:reload=>true} if you would like to reload the association\")\n {:reload=>true}\n end\n end\n\n if block_given?\n dynamic_opts[:callback] = block\n end\n\n dynamic_opts\n end", "def association(name) # :nodoc:\n association = association_instance_get(name)\n\n if association.nil?\n unless reflection = self.class._reflect_on_association(name)\n raise AssociationNotFoundError.new(self, name)\n end\n association = reflection.association_class.new(self, reflection)\n association_instance_set(name, association)\n end\n\n association\n end", "def association(name) #:nodoc:\n association = association_instance_get(name)\n\n if association.nil?\n unless reflection = self.class._reflect_on_association(name)\n raise AssociationNotFoundError.new(self, name)\n end\n association = reflection.association_class.new(self, reflection)\n association_instance_set(name, association)\n end\n\n association\n end", "def preloader_for(reflection, owners)\n if owners.first.association(reflection.name).loaded?\n return AlreadyLoaded\n end\n reflection.check_preloadable!\n\n if reflection.options[:through]\n ThroughAssociation\n else\n Association\n end\n end", "def setup_associations\n Optimizations::Associations::AssociationSet.new\n end", "def association\n @association ||= options[:association]\n end", "def add_association(type, class_name, name)\n define_method(name) do\n Associations::Factory.create(type, name, self)\n end\n define_method(\"#{name}=\") do |object|\n object.parentize(self, name)\n @attributes[name] = object.mongoidize\n end\n end", "def set_reflection\n @reflection = Reflection.find(params[:id])\n end", "def add_solr_eager_loaded_association association_name\n name = association_name.to_s\n unless self.solr_eager_loaded_associations.include?(name)\n self.solr_eager_loaded_associations << name\n end\n end", "def prepare_to_change_association(object)\n name = association_name(object)\n send(\"#{name}_will_change!\")\n end", "def reflect_on_all_associations(*macros)\n relations.values.select { |meta| macros.include?(meta.macro) }\n end", "def reciprocal_association?(assoc_reflect)\n possible_reciprocal_types.include?(assoc_reflect[:type]) &&\n (begin; assoc_reflect.associated_class; rescue NameError; end) == self[:model] &&\n assoc_reflect[:conditions].nil? &&\n assoc_reflect[:block].nil?\n end", "def has_many(association_name, metadata={})\n\n add_association association_name, :has_many, metadata\n\n association_class_name = metadata.try(:fetch, :class_name, [name.split('::')[0..-2].join('::'), association_name.to_s.classify].reject(&:blank?).join('::'))\n\n # foos\n define_method(association_name) do |*query|\n association_class = association_class_name.constantize\n\n # TODO: Support a more generic version of lazy-loading\n if query.empty? # Ex: Books.all, so we want to cache it.\n ivar = \"@#{association_name}\"\n if instance_variable_defined?(ivar)\n instance_variable_get(ivar)\n elsif self.class.autoload_associations? && association_class.respond_to?(:all)\n instance_variable_set(ivar, Array(association_class.all(\"#{self.class.name.underscore}_id\" => id)))\n else\n []\n end\n else # Ex: Book.all(:name => \"The...\"), so we do not want to cache it\n if self.class.autoload_associations? && association_class.respond_to?(:all)\n Array(association_class.all({\"#{self.class.name.demodulize.underscore}_id\" => id}.merge(query.first)))\n end\n end\n end\n\n # foos=\n define_method(\"#{association_name}=\") do |arg|\n association_class = association_class_name.constantize\n\n attr_name = self.class.name.demodulize.underscore\n objs = (arg.is_a?(Hash) ? arg.values : Array(arg)).map do |obj|\n o = association_class.cast(obj)\n\n if o.respond_to?(\"#{attr_name}=\")\n o.send(\"#{attr_name}=\", self)\n end\n\n if o.respond_to?(\"#{attr_name}_id=\") && respond_to?(:id)\n o.send(\"#{attr_name}_id=\", id)\n end\n\n o\n end\n instance_variable_set(\"@#{association_name}\", objs)\n end\n end", "def check_association(model, association)\n raise(Sequel::UndefinedAssociation, \"Invalid association #{association} for #{model.name}\") unless reflection = model.association_reflection(association)\n raise(Sequel::Error, \"Eager loading is not allowed for #{model.name} association #{association}\") if reflection[:allow_eager] == false\n reflection\n end", "def preloadable_association?( association )\n @klass.preloadable_associations.include?( association.to_sym )\n end", "def run_association_callbacks(reflection, callback_type, object)\n raise_error = raise_on_save_failure || !reflection.returns_array?\n stop_on_false = [:before_add, :before_remove].include?(callback_type)\n reflection[callback_type].each do |cb|\n res = case cb\n when Symbol\n send(cb, object)\n when Proc\n cb.call(self, object)\n else\n raise Error, \"callbacks should either be Procs or Symbols\"\n end\n if res == false and stop_on_false\n save_failure(\"modify association for\", raise_error)\n return false\n end\n end\n end", "def freeze\n @touched_associations.freeze\n\n super\n end", "def decorates_association(relation_name, with: :__guess__)\n relation_name = relation_name.to_sym\n\n define_method(relation_name) do\n @_decorated_associations[relation_name] ||= decorate(__getobj__.public_send(relation_name), with: with)\n end\n end", "def set_association\n @association = Association.find(params[:id])\n end", "def finalize_associations\n @association_reflections.each_value(&:finalize)\n end", "def associations(*associations)\n self._associations = associations\n end", "def call_association(object, associations); end", "def touch_associations(*associations)\n associations.flatten.each do |a|\n a = {a=>touch_column} if a.is_a?(Symbol)\n a.each do |k,v|\n raise(Error, \"invalid association: #{k}\") unless association_reflection(k)\n touched_associations[k] = v\n end\n end\n end", "def association\n a = element.dataset[:association]\n # send is spoopy, make sure the message you're sending is actually an association\n return unless safe?(session[:model], a)\n\n session[:model].send(a)\n end", "def association(association_name,\n as: nil,\n viewmodel: nil,\n viewmodels: nil,\n external: false,\n read_only: false,\n through: nil,\n through_order_attr: nil)\n\n vm_association_name = (as || association_name).to_s\n\n if through\n direct_association_name = through\n indirect_association_name = association_name\n else\n direct_association_name = association_name\n indirect_association_name = nil\n end\n\n target_viewmodels = Array.wrap(viewmodel || viewmodels)\n\n association_data = AssociationData.new(\n owner: self,\n association_name: vm_association_name,\n direct_association_name: direct_association_name,\n indirect_association_name: indirect_association_name,\n target_viewmodels: target_viewmodels,\n external: external,\n read_only: read_only,\n through_order_attr: through_order_attr)\n\n _members[vm_association_name] = association_data\n\n @generated_accessor_module.module_eval do\n define_method vm_association_name do\n _read_association(vm_association_name)\n end\n\n define_method :\"serialize_#{vm_association_name}\" do |json, serialize_context: self.class.new_serialize_context|\n _serialize_association(vm_association_name, json, serialize_context: serialize_context)\n end\n end\n end", "def init_inherited_assoc(association_id)\n if new_record? and instance_variable_get(\"@#{association_id}\").nil?\n send(\"build_#{association_id}\")\n instance_variable_get(\"@#{association_id}\").subtype = self.class.to_s\n end\n end", "def association_changeset(name)\n association = self.item.send(name)\n # association = association.source if association.decorated?\n\n self.changeset_class(association).new(association, self.data['associations'].fetch(name.to_s).try(:fetch, 'changes'))\n end", "def def_association(opts)\n if !opts[:is_used] && @unused_associations_data && (data = @unused_associations_data[name]) && (unused = data[opts[:name].to_s])\n set_unused_options_for_association(opts, unused)\n end\n \n super\n end", "def _load_associated_object_array(opts, dynamic_opts)\n if !dynamic_opts[:callback] && (bv = association_bound_variables(opts)) && (ps = association_prepared_statement(opts, bv))\n ps.call(bv)\n else\n super\n end\n end", "def associations!(merge: true)\n merge ? PathMerger.new(@associations).merge : @associations\n end", "def save_belongs_to_association(reflection)\n association = association_instance_get(reflection.name)\n return unless association && association.loaded? && !association.stale_target?\n\n record = association.load_target\n if record && !record.destroyed?\n autosave = reflection.options[:autosave]\n\n if autosave && record.marked_for_destruction?\n foreign_key = Array(reflection.foreign_key)\n foreign_key.each { |key| self[key] = nil }\n record.destroy\n elsif autosave != false\n saved = record.save(validate: !autosave) if record.new_record? || (autosave && record.changed_for_autosave?)\n\n if association.updated?\n primary_key = Array(compute_primary_key(reflection, record)).map(&:to_s)\n foreign_key = Array(reflection.foreign_key)\n\n primary_key_foreign_key_pairs = primary_key.zip(foreign_key)\n primary_key_foreign_key_pairs.each do |primary_key, foreign_key|\n association_id = record._read_attribute(primary_key)\n self[foreign_key] = association_id unless self[foreign_key] == association_id\n end\n association.loaded!\n end\n\n saved if autosave\n end\n end\n end", "def target_reflection(database_record)\n database_record.class.reflect_on_association(name)\n end", "def finalize_associations!(relations:)\n super do\n associations.map do |definition|\n Memory::Associations.const_get(definition.type).new(definition, relations)\n end\n end\n end", "def reload(*)\n result = super\n\n self.class.relations_of_type(:has_many).each do |klass|\n attr_name = klass.to_s.pluralize.underscore\n instance_variable_set(\"@#{attr_name}\", nil)\n end\n\n result\n end", "def association(association_name); end", "def _association(args, default_options={})\n return if options.nil?\n\n options = args.first\n\n if options.is_a?(Hash)\n options = {}.merge(options)\n name = options.keys.first\n properties = options.delete(name)\n\n @associations[name] = default_options.merge({ :include => properties }).merge(options)\n elsif options.is_a?(Array)\n options.each do |option|\n association option\n end\n else\n @associations[options] = args[1] || {}\n end\n end", "def association?(column)\n case column\n when String\n model.associations.map(&:to_s).include?(column)\n else\n model.association_reflection(column)\n end\n end", "def true_class\n return AssociationProxyWrapper\n end", "def mapping_for(reflection)\n inverse = inverse_association_name(reflection)\n Registry[reflection.klass].detect do |mapping|\n mapping.associations.any? { |a| a.name == inverse }\n end\n end", "def validate_collection_association(reflection)\n if association = association_instance_get(reflection.name)\n if records = associated_records_to_validate_or_save(association, new_record?, reflection.options[:autosave])\n records.each_with_index { |record, index| association_valid?(reflection, record, index) }\n end\n end\n end", "def association(name, *options); end", "def assoc_and_assoc_method_for_attr(c)\n assoc_name, assoc_method = c[:name].split('__')\n assoc = data_class.reflect_on_association(assoc_name.to_sym) if assoc_method\n [assoc, assoc_method]\n end", "def define_accessor(klass)\n klass.class_eval <<-EOS\n def #{@association_name}\n @#{@association_name} || (@#{@association_name} = DataMapper::Associations::HasManyAssociation::Set.new(self, #{@association_name.inspect}))\n end\n\n def #{@association_name}=(value)\n #{@association_name}.set(value)\n end\n\n private\n def #{@association_name}_keys=(value)\n #{@association_name}.clear\n\n associated_constant = #{@association_name}.association.associated_constant\n associated_table = #{@association_name}.association.associated_table\n associated_constant.all(associated_table.key => [*value]).each do |entry|\n #{@association_name} << entry\n end\n end\n EOS\n end", "def child_association(method)\n if @resource_config[:child_assoc]\n raise DefinitionError, \"child_association already declared in #{self}\"\n end\n @resource_config[:child_assoc] = method\n end", "def vim_performance_state_association(ts, assoc)\n if assoc.to_s == \"miq_regions\"\n return respond_to?(:miq_regions) ? miq_regions : MiqRegion.none\n end\n\n # this is a virtual reflection, just return the value\n if !self.class.reflect_on_association(assoc)\n return vim_performance_state_for_ts(ts).public_send(assoc)\n end\n\n if !defined?(@last_vps_ts) || @last_vps_ts != ts\n @last_vps_ts = ts\n # we are using a different timestamp\n # clear out relevant associations\n (VimPerformanceState::ASSOCIATIONS & self.class.reflections.keys.map(&:to_sym)).each do |vps_assoc|\n association(vps_assoc).reset\n end\n end\n\n if !association(assoc.to_sym).loaded?\n MiqPreloader.preload_from_array(self, assoc, vim_performance_state_for_ts(ts).public_send(assoc))\n end\n public_send(assoc)\n end", "def _set_associated_object(opts, o)\n a = associations[opts[:name]]\n return if a && a == o && !set_associated_object_if_same?\n run_association_callbacks(opts, :before_set, o)\n remove_reciprocal_object(opts, a) if a\n send(opts._setter_method, o)\n associations[opts[:name]] = o\n add_reciprocal_object(opts, o) if o\n run_association_callbacks(opts, :after_set, o)\n o\n end", "def reset_associations\n reflections.each_value do |r|\n r.instance_variable_set(:@quoted_table_name, nil)\n table_name = r.instance_variable_get(:@table_name)\n if (table_name)\n table_name = table_name.split(\".\").last\n klass = r.class_name.constantize\n schema_name = klass.tenanted? ? Roomer.current_tenant.try(:schema_name) : Roomer.shared_schema_name\n schema_name &&= schema_name.to_s\n schema_name ||= \"__no_tenant__\"\n table_name = \"#{schema_name}#{Roomer.schema_seperator}#{table_name}\"\n r.instance_variable_set(:@table_name, table_name)\n r.instance_variable_set(:@quoted_table_name, connection.quote_table_name(table_name))\n end\n end\n end", "def attributes_for_persistence\n self.class.embedded_associations.inject(super) do |attrs, association|\n documents = instance_variable_get(association.ivar)\n # We must explicitly check #nil? (rather than just saying `if documents`)\n # because documents can be an association proxy that is proxying nil.\n # In this case ruby treats documents as true because it is not _really_ nil,\n # but #nil? will tell us if it is proxying nil.\n\n unless documents.nil?\n attrs[association.name] = documents.is_a?(Array) ? documents.map(&:attributes_for_persistence) : documents.attributes_for_persistence\n end\n attrs\n end\n end", "def initialize_association_cache(objects)\n name = self[:name]\n if assign_singular?\n objects.each{|object| object.associations[name] = nil}\n else\n objects.each{|object| object.associations[name] = []}\n end\n end", "def unset_has_many(name)\n if reflections[name]\n reflections.delete(name)\n undef_method \"#{name.to_s.singularize}_ids\"\n undef_method \"#{name.to_s.singularize}_ids=\"\n end\n end", "def have_many(models)\n HasManyReflection.new models\nend", "def subclass_loaded?\n (assoc_name = subclass_assoc_name) ? association(assoc_name).loaded? : false\n end", "def update_has_many_through_associations(assoc, orig, value, method)\n return if value.nil?\n assoc.through_associations(value).each do |ta|\n next if orig == ta\n source_value = @attributes[ta.source]\n # skip if source value is nil or if type of the association does not match type of source\n next unless source_value.class.to_s == ta.source_type\n ta.send method, source_value, value\n ta.source_associations(source_value).each do |sa|\n sa.send method, value, source_value\n end\n end\n end" ]
[ "0.6733766", "0.6379622", "0.6260179", "0.61640126", "0.6122636", "0.6003784", "0.5981053", "0.5974207", "0.5963262", "0.59341407", "0.59227055", "0.58970326", "0.5863634", "0.5852786", "0.5820544", "0.57778937", "0.5755563", "0.5709747", "0.56878394", "0.56878394", "0.56443536", "0.5618511", "0.5579787", "0.5570462", "0.5563869", "0.5560595", "0.55436015", "0.55421025", "0.55421025", "0.55421025", "0.55330205", "0.5521719", "0.5505218", "0.54971373", "0.5493898", "0.54897726", "0.54865813", "0.5486334", "0.5480316", "0.54639226", "0.54484373", "0.5443874", "0.5443874", "0.54388714", "0.5438624", "0.5407163", "0.5396973", "0.5385446", "0.5377716", "0.5366372", "0.536419", "0.53596663", "0.5357012", "0.535643", "0.53350776", "0.5309421", "0.53021973", "0.52844733", "0.5281671", "0.5264499", "0.5257083", "0.52471286", "0.52466977", "0.52369994", "0.52304506", "0.5228923", "0.5222706", "0.5212868", "0.5172302", "0.5171181", "0.51711535", "0.51683676", "0.51512665", "0.5148771", "0.5145489", "0.51417917", "0.5140327", "0.5131623", "0.51204026", "0.51135135", "0.5111292", "0.5106389", "0.50975287", "0.50889134", "0.5087702", "0.50741553", "0.5072714", "0.5072068", "0.5071993", "0.50714475", "0.5070239", "0.50496507", "0.5043922", "0.5035791", "0.5035043", "0.5026108", "0.5021791", "0.5020114", "0.5020062", "0.5018478", "0.5016927" ]
0.0
-1
Call the method given on the array of associated objects if the method is an array method, otherwise call the method on the association's dataset.
def method_missing(meth, *args, &block) (ARRAY.respond_to?(meth) ? @instance.send(:load_associated_objects, @reflection, @reload) : @instance.send(@reflection.dataset_method)). send(meth, *args, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def def_association_method(opts)\n association_module_def(opts.association_method, opts) do |*dynamic_opts, &block|\n Sequel::Deprecation.deprecate(\"Passing multiple arguments to ##{opts.association_method}\", \"Additional arguments are currently ignored\") if dynamic_opts.length > 1\n load_associated_objects(opts, dynamic_opts.length == 0 ? OPTS : dynamic_opts[0], &block)\n end\n end", "def call_association(object, associations); end", "def method_missing(method_name, *args, &block)\n if self.all? { |item| item.respond_to?(method_name) }\n return self.collect { |item| item.__send__(method_name, *args, &block) }\n else\n raise NoMethodError.new(\"undefined method '#{method_name}' for Array\")\n end\n end", "def association_dataset_proc\n ASSOCIATION_DATASET_PROC\n end", "def _associated_dataset(opts, dynamic_opts)\n ds = send(opts.dataset_method)\n if callback = dynamic_opts[:callback]\n ds = callback.call(ds)\n end\n ds\n end", "def method_missing(method, *args, &block)\n relation.send(method, *args, &block)\n end", "def method_missing(method, *args)\n return super if ::SolidusRelatedProducts.config[:no_conflict]\n # Fix for Ruby 1.9\n raise NoMethodError if method == :to_ary\n\n relation_type = find_relation_type(method)\n if relation_type.nil?\n super\n else\n relations_for_relation_type(relation_type)\n end\n end", "def _load_associated_object_array(opts, dynamic_opts)\n if !dynamic_opts[:callback] && (bv = association_bound_variables(opts)) && (ps = association_prepared_statement(opts, bv))\n ps.call(bv)\n else\n super\n end\n end", "def multiple?(method_name)\n return false if association(method_name).nil?\n\n name = association(method_name).respond_to?(:many?) ? :many? : :collection?\n association(method_name).send(name)\n end", "def def_model_dataset_method(meth)\n return if respond_to?(meth, true)\n\n if meth.to_s =~ /\\A[A-Za-z_][A-Za-z0-9_]*\\z/\n instance_eval(\"def #{meth}(*args, &block); dataset.#{meth}(*args, &block) end\", __FILE__, __LINE__)\n else\n define_singleton_method(meth){|*args, &block| dataset.public_send(meth, *args, &block)}\n end\n end", "def method_missing(method, *args, &block)\n self.array.send(method, *args, &block)\n end", "def def_model_dataset_method(meth)\n return if respond_to?(meth, true)\n\n if meth.to_s =~ /\\A[A-Za-z_][A-Za-z0-9_]*\\z/\n instance_eval(\"def #{meth}(*args, &block); dataset.#{meth}(*args, &block) end\", __FILE__, __LINE__)\n else\n (class << self; self; end).send(:define_method, meth){|*args, &block| dataset.send(meth, *args, &block)}\n end\n end", "def relationnal_result(method_name, *arguments)\n self.class.reload_fields_definition(false)\n if self.class.many2one_associations.has_key?(method_name)\n load_m2o_association(method_name, *arguments)\n elsif self.class.polymorphic_m2o_associations.has_key?(method_name)# && @associations[method_name]\n load_polymorphic_m2o_association(method_name, *arguments)\n# values = @associations[method_name].split(',')\n# self.class.const_get(values[0]).find(values[1], arguments.extract_options!)\n else # o2m or m2m\n load_x2m_association(method_name, *arguments)\n end\n end", "def _load_associated_object_array(opts, dynamic_opts)\n if loader = _associated_object_loader(opts, dynamic_opts)\n loader.all(*opts.predicate_key_values(self))\n else\n _associated_dataset(opts, dynamic_opts).all\n end\n end", "def pizzica(method_name, *method_args)\n self.map do |element|\n if element.respond_to? method_name\n element.send method_name, *method_args\n elsif element.is_a? Hash\n element[method_name]\n else\n raise ArgumentError, \"Array elements do not respond to #{method_name}.\"\n end\n end\n end", "def defines_belongs_to_many_finder_method(method_name, association_model, finder_key)\n ivar_name = :\"@#{method_name}\"\n define_method(method_name) do\n if instance_variable_defined?(ivar_name)\n instance_variable_get(ivar_name)\n elsif attributes.include?(method_name)\n attributes[method_name]\n elsif attributes.include?(\"#{method_name.to_s.singularize}_ids\")\n instance_variable_set(ivar_name, self.class.collection_parser.new(Array(attributes[\"#{method_name.to_s.singularize}_ids\"]).map { |x| SomeModel.find(x) }))\n else\n instance_variable_set(ivar_name, self.class.collection_parser.new)\n end\n end\n end", "def apply_to(dataset)\n if self.relation.relation?\n relation_name = self.relation.name\n self.predicate.apply_to(dataset[relation_name])\n else\n recursive_apply_to(self.relation.apply_to(dataset))\n end\n end", "def respond_to?(method)\n super || @array.respond_to?(method)\n end", "def explore_array(method, *arguments)\n ['a', 'b', 'c'].send(method, *arguments)\nend", "def method_missing(method, *args, &block)\n if @retract.respond_to?(method)\n # If this is an array method, just use that\n r = @retract.send(method, *args, &block)\n return r\n else\n # If this is an object-specific method, run an each on it.\n # A simple each won't work because that doesn't modify the\n # array elements in place as we want, so have to use collect\n # instead.\n @retract = @retract.collect do |o|\n unless o.kind_of?(Array)\n o.send(method, *args, &block)\n else\n # Update in 0.2.1: If the element of the array is an array\n # itself, then operate on it as a ReachingArray as well.\n o.reach.send(method, *args, &block).retract\n end\n end\n return self\n end\n end", "def process(model, data_set)\n if @data_set.is_a?(Array)\n @data_set.each do |data|\n process_data(model, data)\n end\n else\n process_data(model, @data_set)\n end\n end", "def ar_collection?(instance, method)\n defined?(ActiveRecord) &&\n instance.respond_to?(method) &&\n instance.send(method).is_a?(ActiveRecord::Relation)\n end", "def method_missing(meth, *args, &block)\n meth = meth.to_s\n collectible_class = active_record_class_from_association_method_name meth\n begin\n if collectible_class.method_defined?(:user_pointers) && User.method_defined?(meth)\n self.method(meth).call *args, &block\n else\n # puts \"Failed to define method '#{meth}'\"\n super\n end\n rescue Exception => e\n # puts \"D'OH! Couldn't create association between User and #{collectible_class}\"\n super\n end\n end", "def def_association_instance_methods(opts)\n association_module_def(opts.dataset_method, opts){_dataset(opts)}\n def_association_method(opts)\n\n return if opts[:read_only]\n\n if opts[:setter] && opts[:_setter]\n # This is backwards due to backwards compatibility\n association_module_private_def(opts._setter_method, opts, &opts[:setter])\n association_module_def(opts.setter_method, opts, &opts[:_setter])\n end\n\n if adder = opts[:adder]\n association_module_private_def(opts._add_method, opts, &adder)\n association_module_def(opts.add_method, opts){|o,*args| add_associated_object(opts, o, *args)}\n end\n\n if remover = opts[:remover]\n association_module_private_def(opts._remove_method, opts, &remover)\n association_module_def(opts.remove_method, opts){|o,*args| remove_associated_object(opts, o, *args)}\n end\n\n if clearer = opts[:clearer]\n association_module_private_def(opts._remove_all_method, opts, &clearer)\n association_module_def(opts.remove_all_method, opts){|*args| remove_all_associated_objects(opts, *args)}\n end\n end", "def reflection_for(method) #:nodoc:\n @object.class.reflect_on_association(method) if @object.class.respond_to?(:reflect_on_association)\n end", "def call(data)\n object.send(method, data)\n end", "def assoc_and_assoc_method_for_attr(c)\n assoc_name, assoc_method = c[:name].split('__')\n assoc = data_class.reflect_on_association(assoc_name.to_sym) if assoc_method\n [assoc, assoc_method]\n end", "def relationnal_result(method_name, *arguments)\n self.class.reload_fields_definition unless self.class.field_defined\n if self.class.many2one_relations.has_key?(method_name)\n self.class.load_relation(self.class.many2one_relations[method_name].relation, @relations[method_name][0], *arguments)\n elsif self.class.one2many_relations.has_key?(method_name)\n self.class.load_relation(self.class.one2many_relations[method_name].relation, @relations[method_name], *arguments)\n elsif self.class.many2many_relations.has_key?(method_name)\n self.class.load_relation(self.class.many2many_relations[method_name].relation, @relations[method_name], *arguments)\n else\n false\n end\n end", "def method_missing(method, *args)\n if Array.method_defined?(method) && !Object.method_defined?(method)\n if block_given?\n collection.send(method, *args) { |*block_args| yield(*block_args) }\n else\n collection.send(method, *args)\n end\n else\n super\n #message = \"undefined method `#{method.to_s}' for \\\"#{collection}\\\":#{collection.class.to_s}\"\n #raise NoMethodError, message\n end\n end", "def reflection_for(method) #:nodoc:\n @object.class.reflect_on_association(method) if @object.class.respond_to?(:reflect_on_association)\n end", "def method_missing(method_name, *args, &block)\n @array.send(method_name, *args, &block)\n end", "def method_missing(method, *args)\n # Break if first argument was not a model record\n return unless args[0].instance_of? model\n\n # Super if allowed_methods not defined or in not included in array\n am = self.class.allowed_methods\n super if am.nil? || !am.include?(method)\n\n resend_method(method, args)\n end", "def update_has_many_through_associations(assoc, orig, value, method)\n return if value.nil?\n assoc.through_associations(value).each do |ta|\n next if orig == ta\n source_value = @attributes[ta.source]\n # skip if source value is nil or if type of the association does not match type of source\n next unless source_value.class.to_s == ta.source_type\n ta.send method, source_value, value\n ta.source_associations(source_value).each do |sa|\n sa.send method, value, source_value\n end\n end\n end", "def method_missing(method_name, *args, &block)\n @array.send(method_name, *args, &block)\n end", "def method_missing(method_id, *args)\n super if method_id == :to_ary\n if (args.size == 1) && (Class === args[0])\n KeyPath.new([self, Join.new(method_id, InnerJoin, args[0])])\n else\n KeyPath.new([self, method_id])\n end\n end", "def method_missing(method, *args)\n if records.respond_to?(method)\n records.send(method, *args)\n else\n super\n end\n end", "def relation_value_perform\n # Build the relation depending on the various options (query methods).\n relation = AllTypesObject.all\n # Extract and apply query methods\n relation = apply_query_methods(relation, params)\n\n # Perform the query\n case params[:method]\n when \"any?\", \"blank?\", \"empty?\", \"many?\", \"size\", \"explain\", \"inspect\"\n @result = relation.send(params[:method])\n when \"exists?\"\n case params[:option]\n when \"id\"\n @result = relation.send(params[:method], params[:id])\n when \"conditions_array\"\n @result = relation.send(params[:method], build_conditions('joined', 'array', params[:conditions]).flatten)\n when \"conditions_hash\"\n @result = relation.send(params[:method], *build_conditions('joined', 'hash', params[:conditions]).flatten)\n else\n @result = relation.send(params[:method])\n end\n when \"average\", \"count\", \"maximum\", \"minimum\", \"sum\", \"calculate\", \"pluck\", \"ids\"\n # Check if the column_name is allowed (the column_name parameter for the method pluck is considered safe by Rails and thus this parameter should be checked against a whitelist)\n return redirect_to read_test_relation_value_form_path(params[:method], params[:option]), :alert => \"Selected column_name is not a valid attribute of AllTypesObject!\" if params[:column_name].present? && !calculate_column_names(params[:sub_method] || params[:method]).include?(params[:column_name])\n sub_method = [params[:sub_method].to_sym] if params[:method] == \"calculate\" # Only calculate takes a sub_method. For other methods sub method is ignored and not used as an argument.\n column_name = [params[:column_name].presence] unless params[:method] == 'ids'\n options = [{ :distinct => (params[:distinct_calculate] == \"true\") }] if params[:distinct_calculate].present? # Only count and calculate take distinct (and actually only calculate with sub_method=count used distinct)\n @result = relation.send(params[:method], *sub_method, *column_name, *options)\n else\n raise \"Unknown method '#{params[:method]}'\"\n end\n\n respond_with(@result)\n end", "def association\n a = element.dataset[:association]\n # send is spoopy, make sure the message you're sending is actually an association\n return unless safe?(session[:model], a)\n\n session[:model].send(a)\n end", "def method_missing(method, *args, &block)\n @retract = @retract.collect do |o|\n unless o.kind_of?(Array)\n o.send(method, *args, &block)\n else\n # Update in 0.2.1: If the element of the array is an array\n # itself, then operate on it as a ReachingArray as well.\n o.slap.send(method, *args, &block).retract\n end\n end\n return self\n end", "def _apply_association_options(opts, ds)\n unless ds.kind_of?(AssociationDatasetMethods)\n ds = opts.apply_dataset_changes(ds)\n end\n ds = ds.clone(:model_object => self)\n ds = ds.eager_graph(opts[:eager_graph]) if opts[:eager_graph] && opts.eager_graph_lazy_dataset?\n ds = instance_exec(ds, &opts[:block]) if opts[:block]\n ds\n end", "def relation_objects_perform\n # Build the relation depending on the various options (query methods).\n relation = AllTypesObject.all\n # Extract and apply query methods.\n relation = apply_query_methods(relation, params)\n\n # Perform the query\n case params[:method]\n when \"first\", \"last\", \"take\"\n amount = params[:amount].to_i if params[:amount].present?\n @results = relation.send(params[:method], *amount)\n when \"to_a\", \"all\", \"load\", \"reload\", \"first!\", \"last!\", \"take!\"\n @results = relation.send(params[:method])\n when \"select\"\n @results = relation.send(params[:method]) { true } # Select with a block acts as a finder method. The block simply returns true to not futher limit the results.\n when \"find\"\n case params[:option]\n when \"sub_method\"\n if FIND_SUB_METHODS.include?(params[:sub_method])\n @results = relation.send(params[:method], params[:sub_method].to_sym)\n else\n flash[:alert] = \"Unknown sub method selected\" unless running?\n end\n when \"single_id\"\n @results = relation.send(params[:method], params[:id])\n when \"id_list\"\n @results = relation.send(params[:method], *params[:id])\n when \"id_array\"\n @results = relation.send(params[:method], params[:id])\n end\n when \"find_by\", \"find_by!\"\n conditions = build_conditions('joined', 'list', params[:conditions]).first || [nil]\n @results = relation.send(params[:method], *conditions)\n when \"find_or_initialize_by\", \"find_or_create_by\", \"find_or_create_by!\"\n conditions = build_conditions('joined', 'hash', params[:conditions]).flatten.first || {}\n attributes = params[:attributes].reject { |k,v| v.blank? }\n if attributes.present?\n @results = relation.send(params[:method], conditions) { |object| object.attributes = attributes }\n else\n @results = relation.send(params[:method], conditions)\n end\n when \"dynamic_find_by\", \"dynamic_find_by!\"\n # Check if the attribute name is allowed to prevent errors.\n return redirect_to read_test_relation_objects_form_path(params[:method], params[:option]), :alert => \"Selected attribute is not a valid attribute of AllTypesObject!\" unless AllTypesObject.column_names.include?(params[:attribute])\n method = \"find_by_#{params[:attribute]}\" + (params[:method] == \"dynamic_find_by!\" ? \"!\" : \"\")\n @results = relation.send(method, params[:value])\n when \"find_each\", \"find_in_batches\"\n @results = []\n options = {}\n options[:start] = params[:start].to_i if params[:start].present?\n options[:batch_size] = params[:batch_size].to_i if params[:batch_size].present?\n relation.send(params[:method], options) { |results| @results << results }\n when \"first_or_initialize\", \"first_or_create\", \"first_or_create!\"\n @results = relation.send(params[:method], params[:attributes].presence)\n else\n raise \"Unknown method '#{params[:method]}'\"\n end\n\n # Wrap the result(s) in array and flatten (since the template expects an array of results)\n @all_types_objects = (@results.present? ? [@results].flatten : nil)\n\n @includes = (relation.eager_load_values + relation.includes_values + relation.preload_values).uniq\n\n respond_with(@all_types_objects)\n end", "def assoc_and_assoc_method_for_column(c)\n assoc_name, assoc_method = c[:name].split('__')\n assoc = data_class.reflect_on_association(assoc_name.to_sym) if assoc_method\n [assoc, assoc_method]\n end", "def method_missing(meth, *args, &block)\n if meth.to_s == '[]'\n @data.fetch(args[0])\n else\n @data.fetch(meth.to_s)\n end\n end", "def campiona(*method_names)\n self.map do |element|\n method_names.map do |method_name|\n if element.respond_to? method_name\n element.send method_name\n elsif element.is_a? Hash\n element[method_name]\n else\n raise ArgumentError, \"Array elements do not respond to #{method_name}.\"\n end\n end\n end\n end", "def method_missing(method, *args, &block)\n if model.respond_to?(method)\n delegate_to_model(method, *args, &block)\n elsif relationship = relationships[method] || relationships[method.to_s.singular.to_sym]\n delegate_to_relationship(relationship, *args)\n else\n super\n end\n end", "def call(*args)\n ((combine? || composite?) ? relation : (relation >> mapper)).call(*args)\n end", "def call(relation)\n transformers.reduce(relation.to_a) { |a, e| e.call(a) }\n end", "def array(method = nil)\n -> (v) do\n if v\n v.split(\",\").map{|a| cast(a, method) }\n end\n end\n end", "def array(method = nil)\n -> (v) do\n if v\n v.split(',').map{|a| cast(a, method) }\n end\n end\n end", "def touch_associations\n model.touched_associations.each do |assoc, column|\n r = model.association_reflection(assoc)\n next unless r.can_have_associated_objects?(self)\n ds = send(r.dataset_method)\n\n if ds.send(:joined_dataset?)\n # Can't update all values at once, so update each instance individually.\n # Instead if doing a simple save, update via the instance's dataset,\n # to avoid going into an infinite loop in some cases.\n send(assoc).each{|x| x.this.update(column=>touch_association_value)}\n else\n # Update all values at once for performance reasons.\n ds.update(column=>touch_association_value)\n associations.delete(assoc)\n end\n end\n end", "def method_map(arr, meth,*args)\n arr.map {|e| e.send(meth,*args) }\n end", "def call(ds)\n if @callable.respond_to?(:arity) && @callable.arity == 1\n @callable.call(ds)\n else\n @callable.call\n end\n end", "def modify_via_segment_holder_acts_as_list_method(method, segment)\n segment_holder = segment_holder_for(segment)\n raise segment_not_associated_message(method, segment) unless segment_holder \n segment_holder.send(method) \n end", "def _dataset_method\n :\"_#{self[:name]}_dataset\"\n end", "def perform(id, method, *args)\n if id # instance\n find(id).send(method, *args)\n else # class method\n send(method, *args)\n end\n end", "def associated_records\n raise NotImplementedError\n end", "def method_missing(method_name, *args, &block)\r\n if @loaded[method_name]\r\n @loaded[method_name]\r\n elsif self.class.associations(version)[method_name] ||\r\n self.class.model.reflect_on_association(method_name)\r\n\r\n class_eval <<CODE, __FILE__, __LINE__ + 1\r\ndef #{method_name}\r\n @loaded[#{method_name.inspect}] ||\r\n Restful::Resource::AssociationProxy.new(self, :#{method_name})\r\nend\r\nCODE\r\n\r\n send method_name\r\n elsif args.size <= 1 && attributes(*args).has_key?(method_name)\r\n self[method_name, *args]\r\n else\r\n super\r\n end\r\n # rescue => e\r\n # raise [method_name, args, block].inspect\r\n end", "def reflect_on_association(name)\n ActiveRecordAssociationAdapter.for_association(associations[name]) if associations[name]\n end", "def method_missing(name, *args, &block)\n return super unless respond_to_missing?(name, false)\n result = @array.map do |item|\n next nil if item.nil?\n item.public_send(name, *args, &block)\n end\n\n self.class.new(\"#{self.name}.#{name}\", result)\n end", "def wrap_dataset(dataset)\n if relation.is_a?(Relation::Composite)\n relation.new(dataset).to_a\n else\n dataset\n end\n end", "def call(relation)\n relation\n end", "def assoc_and_assoc_method_for_attr(column_name)\n assoc_name, assoc_method = column_name.split('__')\n assoc = @model_class.reflect_on_association(assoc_name.to_sym) if assoc_method\n [assoc, assoc_method]\n end", "def def_one_to_many(opts)\n super\n return if opts[:type] == :one_to_one\n def_association_pks_getter(opts) do\n send(opts.dataset_method).select_map(opts[:primary_key])\n end\n def_association_pks_setter(opts) do |pks|\n checked_transaction do\n ds = send(opts.dataset_method)\n ds.unfiltered.filter(opts[:primary_key]=>pks).update(opts[:key]=>pk)\n ds.exclude(opts[:primary_key]=>pks).update(opts[:key]=>nil)\n end\n end\n end", "def method_missing(method, *args)\n ## If not loaded, load and retry.\n unless loaded\n return self.get.send(method, *args)\n end\n\n\n ## Otherwise, try to match against attributes, then objects, then links.\n method = method.to_s\n if method[-1,1] == '='\n return attributes[method[0..-2]] = args.first if attributes && attributes.has_key?(method[0..-2])\n else\n return attributes[method] if attributes && attributes.has_key?(method.to_s)\n return objects[method] if objects && objects[method]\n if links && links[method]\n if args.count > 0\n return links[method].where(*args)\n else\n return links[method]\n end\n end\n end\n\n raise NoMethodError, \"undefined method `#{method}' for #{self.inspect}\"\n end", "def method_missing(method, *args, &block) # :nodoc:\n if first.respond_to?(method)\n if size > 1\n if [:meta, :meta_data, :metadata].include?(method.to_sym) ||\n first.meta_data_method?(method)\n first.send(method, *args, &block)\n else\n fail \"Error, calling #{method} on a multi-bit collection is not implemented!\"\n end\n else\n first.send(method, *args, &block)\n end\n else\n fail \"BitCollection does not have a method named #{method}!\"\n end\n end", "def method_missing(method_name, *args, &proc)\n collection.send(method_name, *args, &proc)\n end", "def data_to_method(data)\n raise \"No safe methods defined!\" unless @safe_methods.size > 0\n @safe_methods.each do |method|\n if data['mode'] == method.to_s\n self.send(data['mode'], data)\n end\n end\n end", "def method_missing(method_name, *args)\n table_name = method_name.to_s.singularize\n class_name = table_name.camelcase\n\n # Convert to the class object\n target_class = nil\n ObjectSpace.each_object(Class) do |o|\n if o.name =~ /^Ensembl::Core::#{class_name}$/\n target_class = o\n end\n end\n\n # If it exists, see if it implements Sliceable\n if ! target_class.nil? and target_class.include?(Sliceable)\n inclusive = false\n if [TrueClass, FalseClass].include?(args[0].class)\n inclusive = args[0]\n end\n return self.get_objects(target_class, table_name, inclusive)\n end\n\n raise NoMethodError\n\n end", "def relay(array, data_type)\n # Write your code here\n array.map { |d| d.send(\"to_#{data_type}\")}\nend", "def sanitize_association(assoc, sanitizer_info)\n current_data = self.metadata[assoc]\n return unless current_data.is_a?(Array)\n self.metadata[assoc] = current_data.map do |item|\n sanitize_item(item, sanitizer_info)\n end\n end", "def method_missing(method_name, *args)\r\n table_name = method_name.to_s.singularize\r\n class_name = table_name.camelcase\r\n\r\n # Convert to the class object\r\n target_class = nil\r\n ObjectSpace.each_object(Class) do |o|\r\n if o.name =~ /^Ensembl::Core::#{class_name}$/\r\n target_class = o\r\n end\r\n end\r\n\r\n # If it exists, see if it implements Sliceable\r\n if ! target_class.nil? and target_class.include?(Sliceable)\r\n inclusive = false\r\n if [TrueClass, FalseClass].include?(args[0].class)\r\n inclusive = args[0]\r\n end\r\n return self.get_objects(target_class, table_name, inclusive)\r\n end\r\n\r\n raise NoMethodError\r\n\r\n end", "def method_missing(meth, *args, &block)\n if data.respond_to?(meth)\n return data.send(meth, *args, &block)\n else\n super\n end\n end", "def update_with_multiple_args(observed_method, object, *args) #:nodoc:\n if args.any?\n send(observed_method, object, *args) if respond_to?(observed_method)\n else\n update_without_multiple_args(observed_method, object)\n end\n end", "def association_method\n self[:name]\n end", "def has_and_belongs_to_many(method_name, options = { })\n # Get joining class name (dev can specify over :joining_class option)\n _self_ref, _class_name = _build_joining_class_name(method_name)\n _joining_class_name = (options[:joining_class] || _class_name).to_sym\n\n # Build field name\n _fields = [_build_field_name(self.name), _build_field_name(method_name)]\n\n # Eval dynamic joining class\n _joining_class = _build_joining_class(\n _joining_class_name, _fields, _self_ref)\n\n # Create setter for setting all <target> records\n _build_habtm_class_accessors(\n _joining_class_name, method_name, _fields, _self_ref)\n\n self.associated_classes[\"#{method_name.to_s.singularize}_id\".to_sym] =\n _joining_class.name.to_sym\n (self.associations[:has_and_belongs_to_many] ||= []) << method_name\n end", "def fetch_assoc(method, klass = self.class)\n list = api_obj.send(method, true)\n list.map {|api_obj| klass.new(api_obj)}\n end", "def method_missing(name, *args)\n\t\t[].send(name, *args) # Proxy nil onto []\n\trescue NoMethodError\n\t\tsuper\n\tend", "def belongs_in_array(arr, num)\n # write your code here\nend", "def method_missing(m, *args, &block)\n self.to_a.send m, *args, &block\n end", "def set_has_many_right_methods(klass, original_klass, join_model, join_alias)\n # #{klass}_ids\n define_method \"#{klass}_ids\" do\n find_right_ids(klass, join_model, join_alias)\n end\n \n # klass.pluralize\n define_method \"#{klass}_ids=\" do |ids|\n ids = [] if ids.nil?\n raise \"Error, you must pass an instance of array\" unless ids.is_a? Array\n set_right_ids(klass, join_model, join_alias, ids)\n end\n\n # klass.pluralize\n define_method \"#{klass.pluralize}\" do\n find_right_models(klass, original_klass, join_model, join_alias)\n end\n\n end", "def apply_dataset_changes(ds)\n ds = ds.with_extend(AssociationDatasetMethods).\n clone(:association_reflection => self)\n self[:extend].each{|m| ds = ds.with_extend(m)}\n ds = ds.select(*select) if select\n if c = self[:conditions]\n ds = (c.is_a?(Array) && !Sequel.condition_specifier?(c)) ? ds.where(*c) : ds.where(c)\n end\n ds = ds.order(*self[:order]) if self[:order]\n ds = ds.limit(*self[:limit]) if self[:limit]\n ds = ds.limit(1).skip_limit_check if limit_to_single_row?\n ds = ds.eager(self[:eager]) if self[:eager]\n ds = ds.distinct if self[:distinct]\n ds\n end", "def method_missing(method, *args, &block)\n @dataset = @dataset.send(method, *args, &block)\n raise(Sequel::Error, \"method #{method.inspect} did not return a dataset\") unless @dataset.is_a?(Dataset)\n self\n end", "def apply_associated_eager(type, request, ds)\n columns_for(type, request).each do |col|\n if association?(col)\n if model = associated_model_class(col)\n eager = model.eager_for(:association, request) || model.eager_graph_for(:association, request)\n ds = ds.eager(col=>eager)\n else\n ds = ds.eager(col)\n end\n end\n end\n ds\n end", "def apply_conditions(relation, method, conditions)\n conditions.each { |condition| relation = relation.send(method, *condition) if condition.present? }\n relation\n end", "def has_many_update data, relation\n data = { model.compare => ''}.merge data\n\n if relation.blank?\n warn \"[ARRGUMENT MISSING]: 'has_many_update' don't know about current relation, and check all relations\"\n end\n\n has_many_cleaner data.symbolize_keys, relation\n end", "def method_missing_with_basepack(method, *args, &block)\n # if refering to a column, just pass it to the original method_missing\n return method_missing_without_basepack(method, *args, &block) if self.class.column_names.include?(method.to_s)\n \n split = method.to_s.split(/\\.|__/)\n if split.size > 1\n if split.last =~ /=$/ \n if split.size == 2\n # search for association and assign it to self\n assoc = self.class.reflect_on_association(split.first.to_sym)\n assoc_method = split.last.chop\n if assoc\n begin\n assoc_instance = assoc.klass.send(\"find_by_#{assoc_method}\", *args)\n rescue NoMethodError\n assoc_instance = nil\n logger.debug \"!!! no find_by_#{assoc_method} method for class #{assoc.klass.name}\\n\"\n end\n if (assoc_instance)\n self.send(\"#{split.first}=\", assoc_instance)\n else\n logger.debug \"!!! Couldn't find association #{split.first} by #{assoc_method} '#{args.first}'\"\n end\n else\n method_missing_without_basepack(method, *args, &block)\n end\n else\n method_missing_without_basepack(method, *args, &block)\n end\n else\n res = self\n split.each do |m|\n if res.respond_to?(m)\n res = res.send(m) unless res.nil?\n else\n res.nil? ? nil : method_missing_without_basepack(method, *args, &block)\n end\n end\n res\n end\n else\n method_missing_without_basepack(method, *args, &block)\n end\n end", "def solr_method method_name, options = {}\n\n if options[:attributes]\n self.add_solr_observed_attributes(*Array(options[:attributes]))\n end\n\n Array(options[:associations]).each do |assoc|\n if association = self.reflect_on_association(assoc[:name])\n self.add_solr_observer_to_association(\n association, \n assoc[:attributes],\n assoc[:return_association]\n )\n # TODO : consider adding the association to eager loads\n else\n raise \"The association #{assoc[:name]} is not defined (yet?).\"\n end\n end\n\n as = options[:as] || method_name\n\n self.solr_powered = true\n self.add_solr_document_method(as, method_name)\n SolrPowered.add_index(as, index_options(options))\n end", "def lazy_method(name)\n ->(rec, acc) { acc.replace Array(rec.send(name)) }\nend", "def collection_field(method, opts = {}, html_options = {})\n assoc = @object.class.reflect_on_association(method)\n\n selected = opts[:selected] || @object.send(method)\n selected = [ selected ] if ! selected.respond_to?(:first)\n ref_obj = opts[:collection] ? opts[:collection].first : selected.first\n ref_class = (ref_obj && ref_obj.class) || (assoc && assoc.klass)\n\n value_meth = opts[:value_method] || :to_param\n text_meth = opts[:text_method] || text_method_for(reference_object)\n collection = opts[:collection] || ref_class ? ref_class.find(:all) : []\n multiple = opts[:multiple]\n\n # Below, we switch multiple on if we have a *_many relationship on this\n # method and it hasn't already been set. We also switch the method to be\n # either method_ids or method_id, depending on the association. This lets\n # the assignment happen correctly once the form data returns to the\n # controller, thus eliminating the need for special handling.\n if assoc\n if assoc.macro.to_s =~ /_many$/\n multiple = true unless multiple.nil?\n\n method = \"#{method.to_s.singularize}_ids\" unless opts[:value_method]\n elsif assoc.macro.to_s == 'belongs_to'\n method = \"#{method.to_s}_id\" unless opts[:value_method]\n end\n end\n\n all_values = collection.collect do |item|\n [ item.send(text_meth), item.send(value_meth) ]\n end\n selected_vals = selected.collect { |item| item.send(value_meth) }\n\n self.select(method, all_values,\n opts.merge(:selected => selected_vals, :multiple => multiple),\n html_options)\n end", "def associated_mtm_objects(request, assoc, obj)\n ds = obj.send(\"#{assoc}_dataset\")\n if assoc_class = associated_model_class(assoc)\n ds = assoc_class.apply_dataset_options(:association, request, ds)\n end\n ds\n end", "def _call_of(method)\n proc{ |*args| send(method, *args) }\n end", "def fetch_method(object, field, field_instructions)\n fetch_method_array(field, field_instructions).detect {|method|\n object.respond_to?(method) }\n end", "def relation(related, arguments=[])\n self.send(related.to_sym)\n end", "def association_method\n self[:name]\n end", "def array name, **params, &cb\n current = @current # closure scope\n\n nested = begin\n Nested.!(current, &cb)\n rescue Errors::AnonymousTypeDetected => err\n Utils.Type err.type\n end\n\n case\n when !params[:class].nil? # cb.nil?\n type = Utils.Type(params.delete(:class))\n schema { Utils.smart_send(__send__(current, name), *(type ? [:each, type] : [:maybe])) }\n when name.nil? then schema { each(nested) } # FIXME: CAN IT BE NIL?!\n else schema { __send__(current, name).each(nested) }\n end\n\n case\n when params[:discard_empty] then schema.discarded!(name)\n when Nested === self then # do nothing\n else define_method(name) { @inputs[name] }\n end\n end", "def method_missing(meth, *args, &block)\n # If the setter is missing but it's in the available_custom_field_names, delegate it to the source\n field_name = get_custom_field_name_for_method(meth)\n if self.available_custom_field_names.include?(field_name)\n # If it's a \"many\" or \"belong_to\" field, pass in the right objects\n if is_many_custom_field?(field_name)\n new_args = args.collect { |list| get_many_field_objects(field_name, list) }\n\n # Get the objects which we need to save\n self.objects_to_save ||= []\n self.objects_to_save += new_args.flatten\n\n # If it's a has_many field, set the positions\n if is_has_many_custom_field?(field_name)\n self.set_positions_for_has_many(new_args.flatten, field_name)\n end\n\n self.source.send(meth, *new_args, &block)\n elsif is_belongs_to_custom_field?(field_name)\n new_args = args.collect { |slug| get_belongs_field_object(meth, slug) }\n self.source.send(meth, *new_args, &block)\n else\n self.source.send(meth, *args, &block)\n end\n else\n super\n end\n end", "def handle_belongs_to(model, associated)\n __method = __method__\n # trace __FILE__, __LINE__, self, __method__, \" : model.class=#{model.class} associated=#{associated.class} has?=#{has?}\"\n associated = [associated] unless associated.is_a?(Array)\n # trace __FILE__, __LINE__, self, __method__, \" : associated.size=#{associated.size}\"\n if has?\n associated.each do |associate|\n # trace __FILE__, __LINE__, self, __method, \" : model.class=#{model.class} associate=#{associate.class}\"\n inverse = associate.class.belongs_to_association(collection)\n # trace __FILE__, __LINE__, self, __method, \" : model.class=#{model.class} associate=#{associate.class}\"\n if inverse\n # trace __FILE__, __LINE__, self, __method, \" : setting inverse associate.class##{inverse.local_attr} to #{model.class}\"\n associate.send(:\"#{inverse.local_attr}=\", model)\n # trace __FILE__, __LINE__, self, __method\n end\n end\n end\n end", "def related_to(*args)\n@relations = args.map(&:to_s)\nend", "def command\n associations.reduce(left.command.curry(left)) do |a, (assoc, other)|\n case other\n when Changeset\n a >> other.command.with_association(assoc).curry(other)\n when Associated\n a >> other.command.with_association(assoc)\n when Array\n raise NotImplementedError, \"Changeset::Associate does not support arrays yet\"\n else\n a.with_association(assoc, parent: other)\n end\n end\n end", "def method_missing(m, *args, &block) \n self.to_a.send m, *args, &block\n end" ]
[ "0.5923405", "0.5919031", "0.5654072", "0.56209105", "0.5603869", "0.5594049", "0.5547502", "0.55241543", "0.5513814", "0.54701936", "0.54488176", "0.5444896", "0.54447496", "0.54361165", "0.5424518", "0.53747237", "0.5359915", "0.5343474", "0.5343114", "0.53042823", "0.53014463", "0.52989703", "0.5298597", "0.5298178", "0.5271716", "0.52479434", "0.5243526", "0.5233203", "0.5229498", "0.521965", "0.5218571", "0.5215717", "0.5201179", "0.5182313", "0.517768", "0.5172986", "0.51652455", "0.5157272", "0.510857", "0.5104877", "0.5102625", "0.50710845", "0.5069863", "0.50555485", "0.5047547", "0.5038321", "0.50238305", "0.50144374", "0.4997848", "0.49895346", "0.49859297", "0.497219", "0.49648565", "0.49573535", "0.4940307", "0.49225044", "0.49098513", "0.49082586", "0.49024087", "0.4885591", "0.48812822", "0.4869481", "0.48629975", "0.48606575", "0.48329243", "0.4825006", "0.48147073", "0.48123387", "0.48102582", "0.48080274", "0.48039815", "0.4787742", "0.47685146", "0.4768342", "0.4764983", "0.47611016", "0.47381493", "0.4727847", "0.47174656", "0.47167024", "0.4714902", "0.47142866", "0.47113925", "0.46997994", "0.4676449", "0.4672618", "0.4672164", "0.46715724", "0.4666438", "0.46640477", "0.46625385", "0.46572274", "0.4652097", "0.46500835", "0.464706", "0.46451095", "0.4633474", "0.46309692", "0.46298945", "0.46242768" ]
0.6684384
0
DRIVER TESTS GO BELOW THIS LINE
def assert raise "Assertion failed!" unless yield end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running_test_case; end", "def testing\n # ...\n end", "def test_cases; end", "def running_test_step; end", "def test_step; end", "def test_case; end", "def test_steps; end", "def test_steps; end", "def tests; end", "def tests; end", "def testloop\n \n end", "def testing_end\n end", "def after_test(_test); end", "def after_test(_test); end", "def after_test(_test); end", "def before_test(test); end", "def before_test(test); end", "def test_0_dummy\n\t\tend", "def test_method\n end", "def test_setup\r\n \r\n end", "def run_test\n # Add your code here...\n end", "def run_test\n # Add your code here...\n end", "def self_test; end", "def self_test; end", "def my_tests\n end", "def test_008\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n @@pj = Pj.find_by_name('SamplePJ1')#\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n # test for value of master into combobox in master tab\n assert_equal [\"sample_c_cpp\"], get_select_options(\"master_id\")\n assert is_text_present(_(\"Optional setting\"))\n\n click $xpath[\"task\"][\"registration_task_button\"]\n sleep 2\n #assert !60.times{ break if (is_text_present(\"解析ツール未選択 入力内容に問題があるためタスクを登録できません。\") rescue false); sleep 2 }\n\n\n # logout\n logout\n\n end", "def test_0_before\n\t\t$report = Report.new()\n \t\t$testReport = $report.createReport($REPORT)\n\n\t\t$browser = Watir::Browser.new\n\t\t$current=\"\"\n\tend", "def test \n end", "def test_order; end", "def test_007\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n @@pu = Pu.find_by_name('SamplePU1')\n\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n @@pj = Pj.find_by_name('SamplePJ1')\n\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n # test for value of master into combobox in master tab\n assert_equal [\"sample_c_cpp\"], get_select_options(\"master_id\")\n assert is_text_present(_(\"Optional setting\"))\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link\"]\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n # click link setup QAC++\n assert is_text_present(\"qacpp\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link2\"]\n sleep 2\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n\n\n # logout\n logout\n\n end", "def test\n\n end", "def test\n end", "def test\n end", "def test\n end", "def test_001\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n # #Find a PU\n #Pu created\n pu_name = 'pu'\n register_pu(pu_name)\n @@pu = Pu.find(:last)\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n pj_name = 'pj'\n register_pj(pj_name)\n @@pj = Pj.find(:last)\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析\n select \"analyze_type\", \"label=#{@individual}\"\n #Click Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n @@pu.destroy\n # logout\n logout\n\n end", "def run\n test_using_random_sample\n test_using_first_of\n end", "def __dummy_test__\n end", "def test_004\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n # #Find a PU\n #Pu created\n pu_name = 'pu'\n register_pu(pu_name)\n @@pu = Pu.find(:last)\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n pj_name = 'pj'\n register_pj(pj_name)\n @@pj = Pj.find(:last)\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 全体解析 (Analysis of all)\n select \"analyze_type\", \"label=#{@overall}\"\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n #There is no display below \"selection of the upload method of an individual analysis file.\"\n assert !is_text_present(_(\"Select the upload method of individual analysis files\"))\n\n @@pu.destroy\n # logout\n logout\n\n end", "def test_010\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n #Pu created\n\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link\"]\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end", "def self_test(switches)\n #Visual test to see if we loaded data correctly.\n switches.each do |s|\n pp s\n end\nend", "def test_005\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n # #Find a PU\n #Pu created\n pu_name = 'pu'\n register_pu(pu_name)\n @@pu = Pu.find(:last)\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n pj_name = 'pj'\n register_pj(pj_name)\n @@pj = Pj.find(:last)\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析\n select \"analyze_type\", \"label=#{@individual}\"\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n # Below \"selection of the upload method of an individual analysis file\" is displayed.\n assert is_text_present(_(\"Select a master\"))\n assert is_text_present(_(\"Master\"))\n assert is_text_present(_(\"Select the upload method of individual analysis files\"))\n assert is_text_present(_(\"Upload of individual analysis files\"))\n\n @@pu.destroy\n # logout\n logout\n\n end", "def run_one_test(session)\n \n end", "def test_011\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n #Pu created\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n sleep 2\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n # click link setup QAC++\n assert is_text_present(\"qacpp\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link2\"]\n # check log in the navigation bar\n sleep 2\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end", "def _test_pages_available\n #execute this code x number of times\n @custom_number_of_users.times do |i|\n puts 'Running tests for user #'+i.to_s\n # assert_section nil\n end\n end", "def test_connection\n end", "def graffiti_test\n end", "def run_app_tests\n end", "def default_test\r\n end", "def test1Action\n executeTest(\n 'DummyUser',\n {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ]\n }\n }\n )\n end", "def spec; end", "def spec; end", "def test03_L1DLT03_TC_24418\n\t\t#skipping for now, currently unable to interact with the \"Like\" button\n\tend", "def test_021\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n #uncheck an option setup of a directory.\n click $xpath[\"task\"][\"master_option_chk2\"]\n sleep 3\n\n #Set Make_root as a suitable directory.\n type \"option_makeroot\", \"public/\"\n\n #The button \"which returns reflecting change\" is clicked.\n click $xpath[\"task\"][\"back_to_reflect_the_changes\"]\n sleep 3\n\n #An option setup of the target tool is changed.\n assert is_text_present(_(\"Make root\")+\":\")\n\n # logout\n logout\n\n end", "def smoke_test()\n return [\"case_aaaa\"]\n end", "def boostrap_test_function()\n\n # sleep(2)\n # puts \"Test sending mms\"\n # require_relative './code-snippets/send-mms'\n # read_extension_phone_number_detect_mms_feature()\n # return\n # sleep(2)\n # puts \"Test sending Fax\"\n # require_relative './code-snippets/send-fax'\n # send_fax()\n #\n # sleep(2)\n # puts \"Test reading message store\"\n # require_relative './code-snippets/message-store'\n # read_extension_message_store()\n #\n # sleep(2)\n # puts \"Test reading number features\"\n # require_relative './code-snippets/number-features'\n # detect_sms_feature()\n\n # sleep(2)\n # puts \"Test export message store\"\n # require_relative './code-snippets/message-store-export'\n # create_message_store_report()\n\n sleep(2)\n puts \"Test sending batch sms\"\n require_relative './code-snippets/send-a2p-sms'\n read_extension_phone_number_detect_a2psms_feature()\nend", "def test_006\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #A task type is changed into \"individual analysis\"\n # with a \"general control\" tab.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析 (Individual Analysis)\n select \"analyze_type\", \"label=#{@individual}\"\n #Click Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n #An option setup of \"master: A qac\" subwindow is displayed.\n click $xpath[\"task\"][\"option_setup_link\"]\n # click \"link=設定する\"\n sleep 3\n # #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n assert !60.times{ break if (@selenium.is_text_present(_(\"Optional setting\")+\":qac\") rescue false); sleep 2 }\n sleep 2\n\n # logout\n logout\n\n end", "def test_002\n\n # login\n login\n @@pu = 1\n @@pj = 1\n open\"/devgroup/pj_index/#{@@pu}/#{@@pj}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu}/#{@@pj}\")\n #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析\n select \"analyze_type\", \"label=#{@individual}\"\n #Click Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n #Select \"uploading a file individually\"\n click \"file_upload_upload_way_upload_each\"\n assert is_text_present(_(\"Uploaded individually.\"))\n click $xpath[\"task\"][\"read_tree\"]\n\n assert !60.times{ break if (is_text_present(_(\"Directory structure\")) rescue false); sleep 2 }\n # logout\n logout\n\n end", "def test_025\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n user_id = @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\",USER_LAST_NAME\n @selenium.type \"user_first_name\", USER_FIRST_NAME\n @selenium.type \"user_email\", USER_EMAIL\n @selenium.type \"user_password\", USER_PASSWORD\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n begin\n assert_equal user_id, @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n end", "def test_027\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\", USER_LAST_NAME\n @selenium.type \"user_first_name\", USER_FIRST_NAME\n @selenium.type \"user_email\", USER_EMAIL\n @selenium.type \"user_password\", USER_PASSWORD\n @selenium.type \"user_password_confirmation\", WRONG_PASSWORD\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n (2..7).each do |i|\n if(i!=3)\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td\")\n else\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_last_name']\")\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_first_name']\")\n end\n end\n logout\n end", "def setup\r\n puts 'starting a new test: ' + self.name\r\n cfT1 = CustomField.new(\"testField\", \"kuku\")\r\n cfT2 = CustomField.new(\"tester\", \"new_tester\")\r\n @reportiumClient.testStart(self.name, TestContext.new(TestContext::TestContextBuilder\r\n\t .withCustomFields(cfT1, cfT2)\r\n .withTestExecutionTags('TagYW1', 'TagYW2', 'unittest')\r\n .build()))\r\n end", "def test_009\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n #Pu created\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"analyze_allow_file_link\"]\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(\"analyze_allow_files(qac)\") rescue false); sleep 2 }\n run_script \"destroy_subwindow()\"\n # click link setup QAC++\n assert is_text_present(\"qacpp\")\n sleep 3\n click $xpath[\"task\"][\"analyze_allow_file_link2\"]\n # check log in the navigation bar\n sleep 2\n assert !60.times{ break if (is_text_present(\"analyze_allow_files(qacpp)\") rescue false); sleep 2 }\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end", "def run_fe_tests\n end", "def test_FleetRequest_FromSearchPage\n # Navigate to the volvo demo site\n @driver.get $env\n \n #1. Login to the application \n Login($uname, $pwd, \"1.0\") \n \n #2. Perform vehicle search with unit# and verify the search results \n VehicleSearchWithUnit_No(\"222\", \"2\")\n \n #3. Perform service location search with location field and verify the search results\n Search_Service_Location_With_Location(\"Dallas,TX\", \"3\")\n \n #4. Create service request for the searched vehicle and service location and submit the request.\n Create_Service_Request(\"123\",\"Engine failure\", \"Please respond immediately\", \"9876543210\", \"testdriver\", \"9876543210\", \"street1\", \"Dallas\", \"Virginia\", \"4\")\n \n end", "def before() ; end", "def test_024\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\", USER_LAST_NAME\n @selenium.type \"user_first_name\", USER_FIRST_NAME\n @selenium.type \"user_email\", USER_EMAIL\n @selenium.type \"user_password\", USER_PASSWORD\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n (2..7).each do |i|\n if(i!=3)\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td\")\n else\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_last_name']\")\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_first_name']\")\n end\n end\n logout\n end", "def test_028\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n user_id = @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\",USER_LAST_NAME\n @selenium.type \"user_first_name\", USER_FIRST_NAME\n @selenium.type \"user_email\", USER_EMAIL\n @selenium.type \"user_password\", USER_PASSWORD\n @selenium.type \"user_password_confirmation\", WRONG_PASSWORD\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n begin\n assert_equal user_id, @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n end", "def testing_begin(files)\n end", "def test_nothing\n end", "def setup\n\n end", "def setup\n\n end", "def setup\n\n end", "def test_025\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n #uncheck an option setup of a directory.\n click $xpath[\"task\"][\"master_option_chk2\"]\n sleep 3\n\n #Set Make_root as a suitable directory.\n type \"option_makeroot\", \"public/\"\n\n #The button \"which returns reflecting change\" is clicked.\n click $xpath[\"task\"][\"back_to_reflect_the_changes\"]\n sleep 3\n\n #An option setup of the target tool is changed.\n assert is_text_present(_(\"Make root\")+\":\")\n\n #The Make root directory set as the make_root field enters.\n assert_equal \"public/\", get_value($xpath[\"task\"][\"make_root_main_link\"])\n\n #Move to general control tab\n click $xpath[\"task\"][\"general_control_tab\"]\n\n #The information set does not disappear and remains.\n assert_equal \"public/\", get_value($xpath[\"task\"][\"make_root_main_link\"])\n\n # logout\n logout\n\n end", "def test2ActionsDifferentTools\n executeTest(\n 'DummyUser',\n {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ]\n },\n 'DummyTool2' => {\n 'DummyAction2' => [\n []\n ]\n }\n }\n )\n end", "def run_tests\n\n ::RSpec::Core::Runner.run([])\n\n print ::IRB.CurrentContext.io.prompt\n\n end", "def before_assert\n end", "def test_010\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n user_id = @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_first_name\",USER_FIRST_NAME\n @selenium.type \"user_email\", USER_EMAIL\n @selenium.type \"user_password\", USER_PASSWORD\n @selenium.type \"user_password_confirmation\", USER_PASSWORD\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n begin\n assert_equal user_id, @selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[1]/td\")\n rescue Test::Unit::AssertionFailedError\n @verification_errors << $!\n end\n logout\n end", "def setup\r\n\r\n # Save the Global variable's original settings so that they can be changed in this\r\n # test without affecting other test, so long as they are restored by teardown\r\n @@VERBOSE_ORIG = $VERBOSE\r\n @@DEBUG_ORIG = $DEBUG\r\n @@FAST_SPEED_ORIG = $FAST_SPEED\r\n @@HIDE_IE_ORIG = $HIDE_IE\r\n\r\n # Record the time that current test case starts\r\n @@tTestCase_StartTime = Time.now\r\n\r\n # Start a new Logger Object and assign it to a Global Object\r\n #\r\n # Using the default values:\r\n # Create a \"waitr_works/results\" directory within the OS's Temporary directory\r\n # That directory will contain the single log file used for all tests.\r\n # If the current log file gets too big, output rolls to another log file.\r\n if(@@bLogOutput == true)\r\n $logger = capture_results()\r\n end\r\n\r\n # Hide the annoying console window so that it doesn't cover any of the screen\r\n minimize_ruby_console()\r\n\r\n # Record the test environment if it hasen't already been recorded\r\n if($bEnvironmentRecorded != true)\r\n $bEnvironmentRecorded = record_environment()\r\n @@bContinue = $bEnvironmentRecorded\r\n end\r\n\r\n # Open the Workbook containing the data for the test cases,\r\n # and read the data into memory if it hasen't already been read\r\n if((@@bContinue == true) and ($bDataSetRead != true))\r\n #$bDataSetRead = read_dataset()\r\n @@bContinue = $bDataSetRead\r\n end\r\n\r\n # Open a browser and access the site if it hasen't already been recorded\r\n #if((@@bContinue == true) and ($bWebSiteAccessed != true))\r\n\r\n $browser = start_browser($sDefaultBrowser)\r\n #$browser.goto(\"www.ask.com\")\r\n\r\n #$bWebSiteAccessed = access_dishonline()\r\n @@bContinue = $bWebSiteAccessed\r\n #end\r\n\r\n\r\n\r\n end", "def test_021\n test_000\n login(\"root\",\"root\")\n @selenium.open($xpath[\"admin_menu_page\"])\n sleep WAIT_TIME\n @selenium.click($xpath[\"user\"][\"user_management\"])\n sleep WAIT_TIME\n @selenium.click(\"link=#{$link_texts[\"register\"]}\")\n sleep WAIT_TIME\n @selenium.type \"user_account_name\", USER_ACCOUNT_NAME\n @selenium.type \"user_last_name\", USER_LAST_NAME\n @selenium.type \"user_first_name\", USER_FIRST_NAME\n @selenium.type \"user_email\", USER_EMAIL\n @selenium.type \"user_password_confirmation\", USER_PASSWORD\n @selenium.click($xpath[\"pu_user\"][\"register_button\"])\n sleep WAIT_TIME\n (2..7).each do |i|\n if(i!=3)\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td\")\n else\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_last_name']\")\n assert_equal \"\",@selenium.get_text($xpath[\"user\"][\"user_register\"]+\"/tr[#{i}]/td/input[@id='user_first_name']\")\n end\n end\n logout\n end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end" ]
[ "0.7314821", "0.71384305", "0.7115481", "0.69865227", "0.69382966", "0.69194865", "0.68478084", "0.68478084", "0.6834436", "0.6834436", "0.6828251", "0.66902995", "0.66128016", "0.66128016", "0.66128016", "0.66114205", "0.66114205", "0.6592395", "0.6572524", "0.6570699", "0.6533217", "0.6533217", "0.65114456", "0.65114456", "0.6490457", "0.6480552", "0.6478144", "0.64591813", "0.6426159", "0.6424881", "0.6422028", "0.6415494", "0.6415494", "0.6415494", "0.63750774", "0.6362039", "0.6330071", "0.6322717", "0.63058317", "0.6301118", "0.6295357", "0.62909055", "0.6253522", "0.6252288", "0.6251544", "0.6250918", "0.6243277", "0.62301385", "0.6223182", "0.6218105", "0.6218105", "0.62135893", "0.62125856", "0.62082803", "0.6186421", "0.61861974", "0.6182519", "0.6180623", "0.61623776", "0.61574525", "0.61521995", "0.61514646", "0.6135323", "0.6132808", "0.6131683", "0.612867", "0.61282045", "0.61277753", "0.61243486", "0.61243486", "0.61243486", "0.6124282", "0.6121684", "0.61201704", "0.61168957", "0.61122125", "0.6111989", "0.61087984", "0.6107309", "0.6107309", "0.6107309", "0.6107309", "0.6107309", "0.6107309", "0.6107309", "0.6107309", "0.6107309", "0.6107309", "0.6107309", "0.6107309", "0.6107309", "0.6107309", "0.6107309", "0.6107309", "0.6107309", "0.6107309", "0.6107309", "0.6105826", "0.6105826", "0.6105826", "0.6105826" ]
0.0
-1
GET /fractions GET /fractions.json
def index @totalReg = Fraction.all.count @limit = params.has_key?(:limit) ? params[:limit].to_i : 10 @page = params.has_key?(:page) ? params[:page].to_i : 1 @status = 200 @msg = "ok" @totalPage = @totalReg / @limit + (@totalReg % @limit != 0 ? 1 : 0) @start = ((@page-1) * @limit) +1 @sortDirection = params.has_key?(:sortDirection) && params[:sortDirection] == 'ascending' ? 'ASC' : 'DESC' @sortBy = params.has_key?(:sortBy) ? params[:sortBy] : 'name' @findBy = params.has_key?(:findBy) ? params[:findBy] : 'name' if !params.has_key?(:limit) && !params.has_key?(:page) && !params.has_key?(:findQuery) @fractions = Fraction.first(@limit) #raise @providers.size.to_yaml @end = Fraction.page(@page).last_page? ? @start + @fractions.size - 1 : @start + @limit -1 return end @fractions = Fraction.order("#{@sortBy} #{@sortDirection}").page(@page).per(@limit) if params[:findBy] || params[:findQuery] @fractions = Fraction.where("#{@findBy} like ?", "%#{params[:findQuery]}%").order("#{@sortBy} #{@sortDirection}").page(@page).per(@limit) @totalReg = @fractions.count @totalPage = @totalReg / @limit + (@totalReg % @limit != 0 ? 1 : 0) @start = ((@page-1) * @limit) +1 #raise @provider.to_yaml end @end = Fraction.page(@page).last_page? ? @start + @fractions.size - 1 : @start + @limit -1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fraction_params\n params.require(:fraction).permit(:fraction)\n end", "def show\n @fraction = Fraction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fraction }\n end\n end", "def type\n :fractional\n end", "def fraction(x, y)\n execute(:fraction, x, y)\n end", "def set_fraction\n @fraction = Fraction.find(params[:id])\n end", "def update\n respond_to do |format|\n if @fraction.update(fraction_params)\n format.html { redirect_to @fraction, notice: 'Fraction was successfully updated.' }\n format.json { render :show, status: :ok, location: @fraction }\n else\n format.html { render :edit }\n format.json { render json: @fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def routing_fraction_to_percentage(fraction)\n \"#{(fraction * 100).to_i}%\"\n end", "def index\n @member_fractions = MemberFraction.all\n @fractions = Fraction.all\n end", "def create\n @fraction = Fraction.new(fraction_params)\n\n respond_to do |format|\n if @fraction.save\n format.html { redirect_to @fraction, notice: 'Fraction was successfully created.' }\n format.json { render :show, status: :created, location: @fraction }\n else\n format.html { render :new }\n format.json { render json: @fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def mixed_fraction(s)\n numerator, denominator = s.split('/').map(&:to_i)\n\n raise ZeroDivisionError if denominator.to_i.zero?\n \n if evenly_divides?(numerator, denominator)\n (numerator / denominator).to_s\n else\n simplify_fraction(numerator, denominator)\n end\nend", "def fractional\n @fractional ||= Fractional.new(calculate_fractional, id)\n end", "def all\n @fractions, @alphaParams = \n Fraction.all.sort_by{ |f| f.name }\n .alpha_paginate(params[:letter], {:js => true}){|fraction| fraction.name}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fractions }\n end\n end", "def member_fraction_params\n params.require(:member_fraction).permit(:parliament_id, :structural_id, :fraction_id)\n end", "def fractional; end", "def destroy\n @fraction.destroy\n respond_to do |format|\n format.html { redirect_to fractions_url, notice: 'Fraction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def to_s_fraction(values)\n return \"#{values[1] - values[0]} / #{values[1]}\"\n end", "def update\n respond_to do |format|\n if @member_fraction.update(member_fraction_params)\n format.html { redirect_to member_fractions_path, notice: 'Member fraction was successfully updated.' }\n format.json { render :show, status: :ok, location: @member_fraction }\n else\n format.html { render :edit }\n format.json { render json: @member_fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def curious_fraction(numerator,denominator)\n numerators = numerator.to_s.split('').map(&:to_i)\n denominators = denominator.to_s.split('').map(&:to_i)\n\n if numerators[0]==denominators[0] && numerators[0]!=0\n numerators.shift\n denominators.shift\n return (numerators[0].to_f)/denominators[0]\n \n elsif numerators[1]==denominators[0] && numerators[1]!=0\n numerators.pop\n denominators.shift\n return (numerators[0].to_f)/denominators[0]\n \n elsif numerators[0]==denominators[1] && numerators[0]!=0\n numerators.shift\n denominators.pop\n return (numerators[0].to_f)/denominators[0]\n\n elsif numerators[1]==denominators[1] && numerators[1]!=0\n numerators.pop\n denominators.pop\n return (numerators[0].to_f)/denominators[0]\n else\n false\n end\n\nend", "def divide_term_list_by_fraction\n\ttl_fraction = Fraction.new(term_list.line, term_list.col, numerator: term_list)\n\treturn multiply_fraction_and_fraction(invert_fraction(fraction), tl_fraction)\nend", "def sec_fraction\n subsec\n end", "def divide_fraction_by_term_list(fraction, term_list)\n\ttl_fraction = Fraction.new(term_list.line, term_list.col, denominator: term_list)\n\treturn multiply_fraction_and_fraction(fraction, tl_fraction)\nend", "def mixed_fraction(string)\n improper = Rational(*(string.split('/').map(&:to_i)))\n integer = improper.to_i\n fraction = improper - integer\n \n return \"#{integer}\" if (fraction).numerator == 0\n return \"#{fraction}\" if integer == 0\n \"#{integer} #{fraction.abs}\"\nend", "def extract_fraction ( string )\n match_fraction = /(\\d{1,})([\\/\\+])(\\d{1,})+/\n # m = string.match(match_fraction)[0]\n m = string.match(match_fraction)\n value = nil\n if m != nil\n value = Rational m[0]\n end\n return value\n end", "def get_fraction( pattern )\n r = nil\n pattern.reverse.each_with_index do |n, i|\n r = (i == 0 ? n : n + Rational(1, r))\n end\n return r\nend", "def mixed_fraction(s)\n f = s\n fraction = f.split(\"/\").map { |x| x = x.to_i }\n p initial = Rational(fraction[0],fraction[1])\n p initial_split = initial.to_s.split(\"/\").map { |x| x = x.to_i }\n \n if initial_split[0] < 1\n initial_split[0] = initial_split[0] * -1\n initial_split[0]\n initial_split[2] = \"-\"\n initial_split[2]\n end\n if initial_split[1] == initial_split[0]\n final_answer = Array.new\n final_answer[0] = initial_split[2]\n final_answer[1] = initial_split[0]\n final_answer = final_answer.join\n elsif initial_split[0] == 0\n final_answer = \"0\"\n elsif (initial_split[0] / initial_split[1]) < 1\n final_answer = initial.to_s\n elsif (initial_split[0] / initial_split[1]) > 1\n if initial_split[0] % initial_split[1] == 0\n final_answer = \"#{initial_split[2]}#{initial_split[0]/initial_split[1]}\"\n elsif \n final_answer = Array.new\n final_answer[0] = initial_split[2]\n final_answer[1] = \"#{(initial_split[0]/initial_split[1])}\"\n final_answer[2] = \" #{initial_split[0] % initial_split[1]}/#{initial_split[1]}\"\n final_answer = final_answer.join\n end\n else \n final_answer = Array.new\n final_answer[0] = initial_split[2]\n final_answer[1] = \"#{(initial_split[0]/initial_split[1])}\"\n final_answer[2] = \" #{initial_split[0] % initial_split[1]}/#{initial_split[1]}\"\n final_answer = final_answer.join\n end\n p final_answer\nend", "def importance_fraction\n @grpc.importance_fraction\n end", "def fractional\n self\n end", "def divide_term_by_fraction(term, fraction)\n\tterm_fraction = Fraction.new(term.line, term.col, numerator: term)\n\treturn multiply_fraction_and_fraction(invert_fraction(fraction), term_fraction)\nend", "def get_resource_fraction(entry_data_type, entry_data)\n unit_type = (entry_data & 0xF)\n case unit_type\n when COMPLEX_UNIT_FRACTION\n unit_name = \"%\"\n when COMPLEX_UNIT_FRACTION_PARENT\n unit_name = \"%p\"\n else\n unit_name = \"\"\n end\n\n # Return float as a percentage\n return (complex_to_float(entry_data) * 100).to_s + unit_name\n end", "def create\n @member_fraction = MemberFraction.new(member_fraction_params)\n\n respond_to do |format|\n if @member_fraction.save\n format.html { redirect_to member_fractions_path, notice: 'Member fraction was successfully created.' }\n format.json { render :show, status: :created, location: @member_fraction }\n else\n format.html { render :new }\n format.json { render json: @member_fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def fraction_to_float(fraction)\n return 0.0 if fraction == \"0\"\n sign = PDG::single_character(fraction) == \"+\" ? 1.0 : -1.0\n sign * Rational(*(fraction[1..-1].split(\"/\").map(&:to_i))).to_f\n end", "def reduce(frac)\n n, d = frac.split('/').map(&:to_i)\n unless (g = gcd(n, d)) == 1\n n /= g; d /= g\n end\n \"#{n}/#{d}\"\nend", "def divide_fraction_by_fraction(frac1, frac2)\n\tif frac1 == frac2\n\t\treturn Term.new(frac1.line, frac1.col, magnitude: 1)\n\telsif frac1.numerator == frac2.numerator\n\t\treturn Fraction.new(frac1.line, frac1.col, numerator: frac2.denominator, denominator: frac1.denominator)\n\telsif frac1.denominator == frac2.denominator\n\t\treturn Fraction.new(frac1.line, frac1.col, numerator: frac1.numerator, denominator: frac2.numerator)\n\telse\t\t\n\t\treturn multiply_fraction_and_fraction(frac1, invert_fraction(frac2))\n\tend\nend", "def set_member_fraction\n @member_fraction = MemberFraction.find(params[:id])\n end", "def day_fraction_to_time fraction # :nodoc:\n seconds, fraction = fraction.divmod SECONDS_IN_DAY\n hours, seconds = seconds.divmod 3600\n minutes, seconds = seconds.divmod 60\n [hours, minutes, seconds, fraction * 86400]\n end", "def destroy\n @fraction = Fraction.find(params[:id])\n @fraction.destroy\n\n respond_to do |format|\n format.html { redirect_to regions_url }\n format.json { head :no_content }\n end\n end", "def to_a\n return fraction.to_a\n end", "def Fraction(*args)\n Fraction.new(*args)\nend", "def modulo_of(fraction); end", "def divide_fraction_by_term(fraction, term)\n\tterm_fraction = Fraction.new(term.line, term.col, denominator: term)\n\treturn multiply_fraction_and_fraction(fraction, term_fraction)\nend", "def index\n @fraction_votes = FractionVote.all\n end", "def calculate_fractional\n calculate_fractional ||= if @value.positive?\n @value / 100.rationalize\n else\n -100 / @value.rationalize\n end\n end", "def day_fraction(arg0, arg1, *rest)\n end", "def add_fraction_and_fraction(frac1, frac2)\n\tif frac1.denominator != frac2.denominator\n\t\tnew_frac1_numerator = multiply_unknown_terms_or_term_lists(frac1.numerator, frac2.denominator)\n\t\tnew_frac2_numerator = multiply_unknown_terms_or_term_lists(frac2.numerator, frac1.denominator)\n\t\tnew_numerator = add_unknown_terms_or_term_lists(new_frac1_numerator, new_frac2_numerator)\n\t\tnew_denominator = multiply_unknown_terms_or_term_lists(frac1.denominator, frac2.denominator)\n\t\treturn Fraction.new(frac1.line, frac1.col, numerator: new_numerator, denominator: new_denominator)\n\tend\n\tnew_numerator = add_unknown_terms_or_term_lists(frac1.numerator, frac2.numerator)\n\treturn Fraction.new(frac1.line, frac1.col, numerator: new_numerator, denominator: frac1.denominator)\nend", "def to_s\n return \"#{fraction.to_s}\"\n end", "def fraction_vote_params\n params.require(:fraction_vote).permit(:fraction_id, :vote_id, :number_of_present, :yes, :no, :dont_know)\n end", "def update\n @fraction = Fraction.find(params[:id])\n\n respond_to do |format|\n if @fraction.update_attributes(params[:fraction])\n format.html { redirect_to @fraction.municipality, notice: 'Fraction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def fractionalseconds\n set_function_and_argument(:fractionalseconds, nil)\n end", "def find_rate()\n uri_string = \"https://free.currconv.com/api/v7/convert?q=GBP_\"\\\n \"#{@currency}&compact=ultra&apiKey=2d46a9b5b650dca0dbb1\"\n uri = URI(uri_string)\n res = Net::HTTP.get_response(uri)\n return(JSON.parse(res.body)[\"GBP_#{@currency}\"]/100.0)\n end", "def destroy\n @member_fraction.destroy\n respond_to do |format|\n format.html { redirect_to member_fractions_url, notice: 'Member fraction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def output_fraction(nd_array)\n n, d = nd_array\n if d == 1\n puts n\n else\n puts n.to_s + '/' + d.to_s\n end\nend", "def denominator\n @data[1]\n end", "def initialize(numerator=0, denominator=1)\n @fraction = Vector[denominator,numerator]\n end", "def set_fraction_vote\n @fraction_vote = FractionVote.find(params[:id])\n end", "def frac_to_float(str)\n numerator, denominator = str.split(\"/\").map(&:to_f)\n denominator ||= 1\n numerator/denominator\n end", "def /(denominator)\n raise MoneyError, \"Denominator must be a Fixnum. (#{denominator} is a #{denominator.class})\"\\\n unless denominator.is_a? Fixnum\n\n result = []\n equal_division = (cents / denominator).round\n denominator.times { result << Money.create_from_cents(equal_division) }\n extra_pennies = cents - (equal_division * denominator)\n \n # Make sure we don't loose any pennies!\n extra_pennies.times { |p| result[p] += 0.01 }\n result\n end", "def fractional\n value = to_d * currency.subunit_to_unit\n if self.class.infinite_precision\n value\n else\n value.round(0, self.class.rounding_mode).to_i\n end\n end", "def update\n respond_to do |format|\n if @fraction_vote.update(fraction_vote_params)\n format.html { redirect_to @fraction_vote, notice: 'Fraction vote was successfully updated.' }\n format.json { render :show, status: :ok, location: @fraction_vote }\n else\n format.html { render :edit }\n format.json { render json: @fraction_vote.errors, status: :unprocessable_entity }\n end\n end\n end", "def day_fraction\n 0.0\n end", "def ldexp\n\t\tresult = Math.ldexp(@input)\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": [fraction, exponent]}'}, status: 400\n\tend", "def fraction(hash,n)\n result = {}\n result[:n] = (n - hash[:minus]**2)/hash[:n]\n result[:i] = (Math.sqrt(n).to_i + hash[:minus])/result[:n]\n result[:minus] = result[:i]*result[:n]-hash[:minus]\n result\nend", "def spot_price_fraction(val=nil)\n if val\n spot_price( price.to_f * val )\n else\n spot_price / price rescue 0\n end\n end", "def test_Rational_InstanceMethods_denominator\n\t\tassert_equal(3, Rational(\"2/3\").denominator)\n\t\tassert_equal(365, Rational(\"343434/365\").denominator)\n\tend", "def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end", "def decimal\n if denominator.to_i == 0\n puts \"ERROR\"\n else\n x = numerator.to_f/denominator.to_f\n puts x\n end\n end", "def new\n @fraction = Fraction.new\n @municipality = nil\n if params[:municipality_id]\n @municipality = Municipality.find(params[:municipality_id].to_i)\n else\n @municipality = Municipality.first\n end\n @object = [@municipality, @fraction]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fraction }\n end\n end", "def show\n @fractions, @alphaParams = \n @municipality.fractions.sort_by{ |m| m.name.downcase }\n .alpha_paginate(params[:letter], {:js => true, :bootstrap3 => true}){|fraction| fraction.name}\n end", "def create\n @fraction = Fraction.new(params[:fraction])\n\n @municipality = @fraction.municipality\n\n respond_to do |format|\n if @fraction.save\n format.html { redirect_to @municipality, notice: 'Fraction was successfully created.' }\n format.json { render json: @fraction, status: :created, location: @fraction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def fracToDec(num,den)\r\n return num.to_f/den.to_f\r\nend", "def subtract_fraction_from_fraction(frac1, frac2)\n\treturn add_fraction_and_fraction(frac2, flip_sign_on_fraction(frac1))\nend", "def denominator() end", "def add_frac(frac1, frac2)\n numerator1 = frac1[0]\n numerator2 = frac2[0]\n denominator1 = frac1[1]\n denominator2 = frac2[1]\n\n if denominator1 == denominator2\n [numerator1 + numerator2, denominator1]\n else\n [numerator1 * denominator2 + numerator2 * denominator1, denominator1 * denominator2]\n end\nend", "def progressive_fraction(x, y)\n cfe = continued_fraction(x, y)\n ret = []\n 1.upto(cfe.size - 1) do |i|\n ret.push(expand(cfe[0...i]))\n end\n ret\n end", "def continued_fraction(n)\n a0 = Math.sqrt(n).floor\n cf = [a0]\n\n m = 0\n d = 1\n loop do\n m = d * cf.last - m\n d = (n - m**2)/d\n a = (a0 + m)/d\n cf << a\n\n break if a == 2 * a0\n end\n\n cf\nend", "def divide(numerator, denominator)\n puts \"#{numerator} / #{denominator} = #{numerator / denominator}\\n\"\nend", "def create\n @fraction_vote = FractionVote.new(fraction_vote_params)\n\n respond_to do |format|\n if @fraction_vote.save\n format.html { redirect_to @fraction_vote, notice: 'Fraction vote was successfully created.' }\n format.json { render :show, status: :created, location: @fraction_vote }\n else\n format.html { render :new }\n format.json { render json: @fraction_vote.errors, status: :unprocessable_entity }\n end\n end\n end", "def /(*_params)\n raise \"Division of money NOT allowed - use 'split_between' to avoid rounding errors\"\n end", "def egyptian(input_fraction)\n output = []\n unit_denominator = 1\n current = Rational(1, unit_denominator)\n\n loop do \n \n if input_fraction - current >= 0\n output << unit_denominator\n input_fraction = input_fraction - current\n end\n unit_denominator += 1\n current = Rational(1, unit_denominator)\n\n break if input_fraction == 0\n end\n output\nend", "def with_frames_as_fraction\n vp = value_parts.dup\n vp[-1] = (100.0 / @fps) * vp[-1]\n WITH_FRACTIONS_OF_SECOND % vp\n end", "def with_frames_as_fraction\n vp = value_parts.dup\n vp[-1] = (100.0 / @fps) * vp[-1]\n WITH_FRACTIONS_OF_SECOND % vp\n end", "def long_division (numerator, denominator)\n base = 10\n fraction = (numerator / denominator) . to_s + \".\"\n position = fraction . length\n seen = {}\n\n numerator %= denominator\n\n while !seen [numerator] do\n if numerator == 0\n then return (fraction)\n end\n seen [numerator] = position\n fraction += (base * numerator / denominator) . to_s\n numerator = base * numerator % denominator\n position += 1\n end\n\n return (fraction [0 .. seen [numerator] - 1] + \"(\" +\n fraction [ seen [numerator] .. -1] + \")\")\n \nend", "def get_portions_with_http_info(name, slide_index, shape_index, paragraph_index, password = nil, folder = nil, storage = nil, sub_shape = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_portions ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_portions\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.get_portions\"\n end\n # verify the required parameter 'shape_index' is set\n if @api_client.config.client_side_validation && shape_index.nil?\n fail ArgumentError, \"Missing the required parameter 'shape_index' when calling SlidesApi.get_portions\"\n end\n # verify the required parameter 'paragraph_index' is set\n if @api_client.config.client_side_validation && paragraph_index.nil?\n fail ArgumentError, \"Missing the required parameter 'paragraph_index' when calling SlidesApi.get_portions\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}/shapes/{shapeIndex}/paragraphs/{paragraphIndex}/portions'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'shapeIndex', shape_index)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'paragraphIndex', paragraph_index)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n query_params[:'subShape'] = @api_client.prepare_for_query(sub_shape) unless sub_shape.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Portions')\n return data, status_code, headers\n end", "def multiply_fraction_and_fraction(left, right)\n\tnew_numerator = multiply_unknown_terms_or_term_lists(left.numerator, right.numerator)\n\tnew_denominator = multiply_unknown_terms_or_term_lists(left.denominator, right.denominator)\n\treturn Fraction.new(left.line, left.col, numerator: new_numerator, denominator: new_denominator)\nend", "def day_fraction_time(t = Time.utc(2000, 01, 01, 12, 00, 00, \"+00:00\"))\n t.nil? ? t = Time.utc(2000, 01, 01, 12, 00, 00, \"+00:00\") : t\n t == 0 ? t = Time.utc(2000, 01, 01, 12, 00, 00, \"+00:00\") : t\n time = t.to_a\n time[2] / DAY_HOURS +\n time[1] / DAY_MINUTES +\n time[0] / DAY_SECONDS\n #~ t.usec / DAY_USECS\n end", "def subtract_term_list_from_fraction\n\treturn add_fraction_and_term_list(fraction, flip_sign_on_fraction(term_list))\nend", "def invert_fraction fraction\n\treturn Fraction.new(fraction.line, fraction.col, numerator: fraction.denominator, denominator: fraction.numerator)\nend", "def flip_sign_on_fraction fraction\n\tcase fraction.numerator\n\tin Term\n\t\treturn Fraction.new(fraction.line, fraction.col, numerator: flip_sign_on_term(fraction.numerator), denominator: fraction.denominator)\n\tin TermList\n\t\treturn Fraction.new(fraction.line, fraction.col, numerator: flip_sign_on_term_list(fraction.numerator), denominator: fraction.denominator)\n\telse\n\t\tthrow_error(\"When flipping sign on #{fraction}, found something that is not a Term or a TermList (#{__LINE__})\", fraction, []) # TODO: Add stack trace (make a global)\n\tend\nend", "def sec_fraction() time[3] end", "def divide(numerator, denominator)\n $LOG.debug(\"Numerator: #{numerator}, denominator #{denominator}\")\n begin\n result = numerator / denominator\n rescue Exception => e\n $LOG.error \"Error in division!: #{e}\"\n\tresult = nil\n end\n return result\n end", "def compute_fractional_quantities(attributes_hash)\n fraction_pattern = \"[[:space:]]*[0-9]+[[:space:]]*\\/[[:space:]]*[0-9]+[[:space:]]*\"\n attributes_hash.each do |key, attr|\n computed_quantity = attr[GroceryList::QUANTITY_KEY].match(/#{fraction_pattern}/) do |fraction|\n parts = fraction.string.split(\"/\")\n numerator = parts[0].strip.to_f\n denominator = parts[1].strip.to_f\n numerator / denominator\n end\n attr[GroceryList::QUANTITY_KEY] = computed_quantity.nil? ? attr[GroceryList::QUANTITY_KEY] : computed_quantity\n end\n end", "def fraction()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.TimerComponentState_fraction(@handle.ptr)\n result\n end", "def get_percentage(number, differential, min)\n if differential == 0\n percentage = number\n else\n percentage = (number.to_f - min) / (differential)\n end\n percentage\n end", "def subtract_fraction_from_term_list(fraction, term_list)\n\treturn add_fraction_and_term_list(flip_sign_on_fraction(fraction), term_list)\nend", "def destroy\n @fraction_vote.destroy\n respond_to do |format|\n format.html { redirect_to fraction_votes_url, notice: 'Fraction vote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def sectoral_time_frac(t,interval_duration)\n @sec_prf.collect do |prf|\n h_season = prf[:hourly].keys.include?(:annual) ? :annual : season(t.yday)\n d_season = prf[:daily].keys.include?(:annual) ? :annual : season(t.yday)\n monthly_fraction = prf[:monthly][t.month-1]\n weeks_in_month = weeks_in_month(t.month, t.year)\n daily_fraction = prf[:daily][d_season][t.wday] / weeks_in_month\n hourly_fraction = prf[:hourly][h_season][t.hour-1]\n duration = interval_duration / 3600.0\n hourly_fraction * daily_fraction * monthly_fraction * duration\n end\n end", "def json_percent_differential(game)\n\t\tpercent_diff_map = {}\n\t\tgore = Candidate.find_by_name(\"Gore\")\n\t\tbush = Candidate.find_by_name(\"Bush\")\n\t\tpercent_diff_map['red_states'] = State.margin_map(bush)\n\t\tpercent_diff_map['blue_states'] = State.margin_map(gore)\n\n\t\tpercent_diff_map.to_json.html_safe\n\tend", "def show\n @breadcrumb = 'read'\n @ratio_group = RatioGroup.find(params[:id])\n @ratios = @ratio_group.ratios.paginate(:page => params[:page], :per_page => per_page).order(:code)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ratio_group }\n end\n end", "def add_fraction_and_term_list(fraction, term_list)\n\tterm_list_as_numerator = multiply_unknown_terms_or_term_lists(fraction.denominator, term_list)\n\tnew_numerator = add_unknown_terms_or_term_lists(fraction.numerator, term_list_as_numerator)\n\treturn Fraction.new(frac1.line, frac1.col, numerator: new_numerator, denominator: fraction.denominator)\nend", "def return_rational(numerator)\n\t\tnumerator/36.to_r\n\tend", "def index\n @divisions = Division.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @divisions }\n end\n end" ]
[ "0.6959134", "0.68787956", "0.6531463", "0.65141433", "0.6512246", "0.6369864", "0.63340855", "0.6251424", "0.6208444", "0.6196881", "0.60611004", "0.6049666", "0.5980671", "0.59733593", "0.58948046", "0.58325404", "0.5831485", "0.57648724", "0.575185", "0.5750398", "0.57118565", "0.57103413", "0.5686475", "0.5679904", "0.56757504", "0.5661727", "0.5648195", "0.56370425", "0.5636577", "0.56232804", "0.5619779", "0.56195694", "0.560052", "0.5587769", "0.55449426", "0.5517581", "0.5515693", "0.54994506", "0.5490906", "0.54897285", "0.54752755", "0.544648", "0.5445061", "0.5434359", "0.5416379", "0.5393156", "0.5377661", "0.5360538", "0.5320117", "0.5311516", "0.52982163", "0.5260042", "0.52586585", "0.52580106", "0.52118486", "0.520708", "0.5202333", "0.52006626", "0.5192663", "0.518098", "0.5180895", "0.5172996", "0.5153543", "0.51516545", "0.51470804", "0.51352435", "0.5119039", "0.51107323", "0.50958586", "0.5090695", "0.5073355", "0.5070239", "0.50678384", "0.50428647", "0.5039312", "0.50116354", "0.50075704", "0.50002563", "0.4990382", "0.4990382", "0.4985339", "0.49787822", "0.49749872", "0.49262443", "0.49253938", "0.49210384", "0.4918871", "0.48716435", "0.48581275", "0.4853846", "0.48416352", "0.48349124", "0.48324203", "0.48268571", "0.48090485", "0.4806829", "0.47937247", "0.478199", "0.47586963", "0.4755116" ]
0.55959487
33
GET /fractions/1 GET /fractions/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @fraction = Fraction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fraction }\n end\n end", "def fraction_params\n params.require(:fraction).permit(:fraction)\n end", "def set_fraction\n @fraction = Fraction.find(params[:id])\n end", "def type\n :fractional\n end", "def fraction(x, y)\n execute(:fraction, x, y)\n end", "def update\n respond_to do |format|\n if @fraction.update(fraction_params)\n format.html { redirect_to @fraction, notice: 'Fraction was successfully updated.' }\n format.json { render :show, status: :ok, location: @fraction }\n else\n format.html { render :edit }\n format.json { render json: @fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fraction = Fraction.new(fraction_params)\n\n respond_to do |format|\n if @fraction.save\n format.html { redirect_to @fraction, notice: 'Fraction was successfully created.' }\n format.json { render :show, status: :created, location: @fraction }\n else\n format.html { render :new }\n format.json { render json: @fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def fractional\n @fractional ||= Fractional.new(calculate_fractional, id)\n end", "def mixed_fraction(s)\n numerator, denominator = s.split('/').map(&:to_i)\n\n raise ZeroDivisionError if denominator.to_i.zero?\n \n if evenly_divides?(numerator, denominator)\n (numerator / denominator).to_s\n else\n simplify_fraction(numerator, denominator)\n end\nend", "def routing_fraction_to_percentage(fraction)\n \"#{(fraction * 100).to_i}%\"\n end", "def index\n @member_fractions = MemberFraction.all\n @fractions = Fraction.all\n end", "def fractional; end", "def destroy\n @fraction.destroy\n respond_to do |format|\n format.html { redirect_to fractions_url, notice: 'Fraction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def mixed_fraction(string)\n improper = Rational(*(string.split('/').map(&:to_i)))\n integer = improper.to_i\n fraction = improper - integer\n \n return \"#{integer}\" if (fraction).numerator == 0\n return \"#{fraction}\" if integer == 0\n \"#{integer} #{fraction.abs}\"\nend", "def update\n respond_to do |format|\n if @member_fraction.update(member_fraction_params)\n format.html { redirect_to member_fractions_path, notice: 'Member fraction was successfully updated.' }\n format.json { render :show, status: :ok, location: @member_fraction }\n else\n format.html { render :edit }\n format.json { render json: @member_fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def extract_fraction ( string )\n match_fraction = /(\\d{1,})([\\/\\+])(\\d{1,})+/\n # m = string.match(match_fraction)[0]\n m = string.match(match_fraction)\n value = nil\n if m != nil\n value = Rational m[0]\n end\n return value\n end", "def member_fraction_params\n params.require(:member_fraction).permit(:parliament_id, :structural_id, :fraction_id)\n end", "def fractional\n self\n end", "def all\n @fractions, @alphaParams = \n Fraction.all.sort_by{ |f| f.name }\n .alpha_paginate(params[:letter], {:js => true}){|fraction| fraction.name}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fractions }\n end\n end", "def set_member_fraction\n @member_fraction = MemberFraction.find(params[:id])\n end", "def get_fraction( pattern )\n r = nil\n pattern.reverse.each_with_index do |n, i|\n r = (i == 0 ? n : n + Rational(1, r))\n end\n return r\nend", "def to_s_fraction(values)\n return \"#{values[1] - values[0]} / #{values[1]}\"\n end", "def fraction_to_float(fraction)\n return 0.0 if fraction == \"0\"\n sign = PDG::single_character(fraction) == \"+\" ? 1.0 : -1.0\n sign * Rational(*(fraction[1..-1].split(\"/\").map(&:to_i))).to_f\n end", "def get_resource_fraction(entry_data_type, entry_data)\n unit_type = (entry_data & 0xF)\n case unit_type\n when COMPLEX_UNIT_FRACTION\n unit_name = \"%\"\n when COMPLEX_UNIT_FRACTION_PARENT\n unit_name = \"%p\"\n else\n unit_name = \"\"\n end\n\n # Return float as a percentage\n return (complex_to_float(entry_data) * 100).to_s + unit_name\n end", "def create\n @member_fraction = MemberFraction.new(member_fraction_params)\n\n respond_to do |format|\n if @member_fraction.save\n format.html { redirect_to member_fractions_path, notice: 'Member fraction was successfully created.' }\n format.json { render :show, status: :created, location: @member_fraction }\n else\n format.html { render :new }\n format.json { render json: @member_fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def curious_fraction(numerator,denominator)\n numerators = numerator.to_s.split('').map(&:to_i)\n denominators = denominator.to_s.split('').map(&:to_i)\n\n if numerators[0]==denominators[0] && numerators[0]!=0\n numerators.shift\n denominators.shift\n return (numerators[0].to_f)/denominators[0]\n \n elsif numerators[1]==denominators[0] && numerators[1]!=0\n numerators.pop\n denominators.shift\n return (numerators[0].to_f)/denominators[0]\n \n elsif numerators[0]==denominators[1] && numerators[0]!=0\n numerators.shift\n denominators.pop\n return (numerators[0].to_f)/denominators[0]\n\n elsif numerators[1]==denominators[1] && numerators[1]!=0\n numerators.pop\n denominators.pop\n return (numerators[0].to_f)/denominators[0]\n else\n false\n end\n\nend", "def divide_fraction_by_fraction(frac1, frac2)\n\tif frac1 == frac2\n\t\treturn Term.new(frac1.line, frac1.col, magnitude: 1)\n\telsif frac1.numerator == frac2.numerator\n\t\treturn Fraction.new(frac1.line, frac1.col, numerator: frac2.denominator, denominator: frac1.denominator)\n\telsif frac1.denominator == frac2.denominator\n\t\treturn Fraction.new(frac1.line, frac1.col, numerator: frac1.numerator, denominator: frac2.numerator)\n\telse\t\t\n\t\treturn multiply_fraction_and_fraction(frac1, invert_fraction(frac2))\n\tend\nend", "def Fraction(*args)\n Fraction.new(*args)\nend", "def destroy\n @fraction = Fraction.find(params[:id])\n @fraction.destroy\n\n respond_to do |format|\n format.html { redirect_to regions_url }\n format.json { head :no_content }\n end\n end", "def mixed_fraction(s)\n f = s\n fraction = f.split(\"/\").map { |x| x = x.to_i }\n p initial = Rational(fraction[0],fraction[1])\n p initial_split = initial.to_s.split(\"/\").map { |x| x = x.to_i }\n \n if initial_split[0] < 1\n initial_split[0] = initial_split[0] * -1\n initial_split[0]\n initial_split[2] = \"-\"\n initial_split[2]\n end\n if initial_split[1] == initial_split[0]\n final_answer = Array.new\n final_answer[0] = initial_split[2]\n final_answer[1] = initial_split[0]\n final_answer = final_answer.join\n elsif initial_split[0] == 0\n final_answer = \"0\"\n elsif (initial_split[0] / initial_split[1]) < 1\n final_answer = initial.to_s\n elsif (initial_split[0] / initial_split[1]) > 1\n if initial_split[0] % initial_split[1] == 0\n final_answer = \"#{initial_split[2]}#{initial_split[0]/initial_split[1]}\"\n elsif \n final_answer = Array.new\n final_answer[0] = initial_split[2]\n final_answer[1] = \"#{(initial_split[0]/initial_split[1])}\"\n final_answer[2] = \" #{initial_split[0] % initial_split[1]}/#{initial_split[1]}\"\n final_answer = final_answer.join\n end\n else \n final_answer = Array.new\n final_answer[0] = initial_split[2]\n final_answer[1] = \"#{(initial_split[0]/initial_split[1])}\"\n final_answer[2] = \" #{initial_split[0] % initial_split[1]}/#{initial_split[1]}\"\n final_answer = final_answer.join\n end\n p final_answer\nend", "def sec_fraction\n subsec\n end", "def importance_fraction\n @grpc.importance_fraction\n end", "def to_s\n return \"#{fraction.to_s}\"\n end", "def divide_term_by_fraction(term, fraction)\n\tterm_fraction = Fraction.new(term.line, term.col, numerator: term)\n\treturn multiply_fraction_and_fraction(invert_fraction(fraction), term_fraction)\nend", "def update\n @fraction = Fraction.find(params[:id])\n\n respond_to do |format|\n if @fraction.update_attributes(params[:fraction])\n format.html { redirect_to @fraction.municipality, notice: 'Fraction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_fraction_vote\n @fraction_vote = FractionVote.find(params[:id])\n end", "def reduce(frac)\n n, d = frac.split('/').map(&:to_i)\n unless (g = gcd(n, d)) == 1\n n /= g; d /= g\n end\n \"#{n}/#{d}\"\nend", "def divide_fraction_by_term_list(fraction, term_list)\n\ttl_fraction = Fraction.new(term_list.line, term_list.col, denominator: term_list)\n\treturn multiply_fraction_and_fraction(fraction, tl_fraction)\nend", "def divide_fraction_by_term(fraction, term)\n\tterm_fraction = Fraction.new(term.line, term.col, denominator: term)\n\treturn multiply_fraction_and_fraction(fraction, term_fraction)\nend", "def add_fraction_and_fraction(frac1, frac2)\n\tif frac1.denominator != frac2.denominator\n\t\tnew_frac1_numerator = multiply_unknown_terms_or_term_lists(frac1.numerator, frac2.denominator)\n\t\tnew_frac2_numerator = multiply_unknown_terms_or_term_lists(frac2.numerator, frac1.denominator)\n\t\tnew_numerator = add_unknown_terms_or_term_lists(new_frac1_numerator, new_frac2_numerator)\n\t\tnew_denominator = multiply_unknown_terms_or_term_lists(frac1.denominator, frac2.denominator)\n\t\treturn Fraction.new(frac1.line, frac1.col, numerator: new_numerator, denominator: new_denominator)\n\tend\n\tnew_numerator = add_unknown_terms_or_term_lists(frac1.numerator, frac2.numerator)\n\treturn Fraction.new(frac1.line, frac1.col, numerator: new_numerator, denominator: frac1.denominator)\nend", "def new\n @fraction = Fraction.new\n @municipality = nil\n if params[:municipality_id]\n @municipality = Municipality.find(params[:municipality_id].to_i)\n else\n @municipality = Municipality.first\n end\n @object = [@municipality, @fraction]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fraction }\n end\n end", "def divide_term_list_by_fraction\n\ttl_fraction = Fraction.new(term_list.line, term_list.col, numerator: term_list)\n\treturn multiply_fraction_and_fraction(invert_fraction(fraction), tl_fraction)\nend", "def calculate_fractional\n calculate_fractional ||= if @value.positive?\n @value / 100.rationalize\n else\n -100 / @value.rationalize\n end\n end", "def to_a\n return fraction.to_a\n end", "def day_fraction(arg0, arg1, *rest)\n end", "def modulo_of(fraction); end", "def denominator\n @data[1]\n end", "def destroy\n @member_fraction.destroy\n respond_to do |format|\n format.html { redirect_to member_fractions_url, notice: 'Member fraction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def output_fraction(nd_array)\n n, d = nd_array\n if d == 1\n puts n\n else\n puts n.to_s + '/' + d.to_s\n end\nend", "def initialize(numerator=0, denominator=1)\n @fraction = Vector[denominator,numerator]\n end", "def index\n @fraction_votes = FractionVote.all\n end", "def index\n @totalReg = Fraction.all.count\n\n @limit = params.has_key?(:limit) ? params[:limit].to_i : 10\n @page = params.has_key?(:page) ? params[:page].to_i : 1\n\n @status = 200\n @msg = \"ok\"\n\n @totalPage = @totalReg / @limit + (@totalReg % @limit != 0 ? 1 : 0)\n\n @start = ((@page-1) * @limit) +1\n \n\n @sortDirection = params.has_key?(:sortDirection) && params[:sortDirection] == 'ascending' ? 'ASC' : 'DESC'\n @sortBy = params.has_key?(:sortBy) ? params[:sortBy] : 'name'\n @findBy = params.has_key?(:findBy) ? params[:findBy] : 'name'\n\n\n if !params.has_key?(:limit) && !params.has_key?(:page) && !params.has_key?(:findQuery)\n @fractions = Fraction.first(@limit)\n #raise @providers.size.to_yaml\n @end = Fraction.page(@page).last_page? ? @start + @fractions.size - 1 : @start + @limit -1\n return\n end\n \n @fractions = Fraction.order(\"#{@sortBy} #{@sortDirection}\").page(@page).per(@limit)\n\n if params[:findBy] || params[:findQuery]\n @fractions = Fraction.where(\"#{@findBy} like ?\", \"%#{params[:findQuery]}%\").order(\"#{@sortBy} #{@sortDirection}\").page(@page).per(@limit)\n @totalReg = @fractions.count\n @totalPage = @totalReg / @limit + (@totalReg % @limit != 0 ? 1 : 0)\n @start = ((@page-1) * @limit) +1\n #raise @provider.to_yaml\n end\n @end = Fraction.page(@page).last_page? ? @start + @fractions.size - 1 : @start + @limit -1\n end", "def create\n @fraction = Fraction.new(params[:fraction])\n\n @municipality = @fraction.municipality\n\n respond_to do |format|\n if @fraction.save\n format.html { redirect_to @municipality, notice: 'Fraction was successfully created.' }\n format.json { render json: @fraction, status: :created, location: @fraction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fraction_vote.update(fraction_vote_params)\n format.html { redirect_to @fraction_vote, notice: 'Fraction vote was successfully updated.' }\n format.json { render :show, status: :ok, location: @fraction_vote }\n else\n format.html { render :edit }\n format.json { render json: @fraction_vote.errors, status: :unprocessable_entity }\n end\n end\n end", "def fraction_vote_params\n params.require(:fraction_vote).permit(:fraction_id, :vote_id, :number_of_present, :yes, :no, :dont_know)\n end", "def find_rate()\n uri_string = \"https://free.currconv.com/api/v7/convert?q=GBP_\"\\\n \"#{@currency}&compact=ultra&apiKey=2d46a9b5b650dca0dbb1\"\n uri = URI(uri_string)\n res = Net::HTTP.get_response(uri)\n return(JSON.parse(res.body)[\"GBP_#{@currency}\"]/100.0)\n end", "def subtract_fraction_from_fraction(frac1, frac2)\n\treturn add_fraction_and_fraction(frac2, flip_sign_on_fraction(frac1))\nend", "def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end", "def fractional\n value = to_d * currency.subunit_to_unit\n if self.class.infinite_precision\n value\n else\n value.round(0, self.class.rounding_mode).to_i\n end\n end", "def day_fraction_to_time fraction # :nodoc:\n seconds, fraction = fraction.divmod SECONDS_IN_DAY\n hours, seconds = seconds.divmod 3600\n minutes, seconds = seconds.divmod 60\n [hours, minutes, seconds, fraction * 86400]\n end", "def frac_to_float(str)\n numerator, denominator = str.split(\"/\").map(&:to_f)\n denominator ||= 1\n numerator/denominator\n end", "def fractionalseconds\n set_function_and_argument(:fractionalseconds, nil)\n end", "def decimal\n if denominator.to_i == 0\n puts \"ERROR\"\n else\n x = numerator.to_f/denominator.to_f\n puts x\n end\n end", "def denominator() end", "def test_Rational_InstanceMethods_denominator\n\t\tassert_equal(3, Rational(\"2/3\").denominator)\n\t\tassert_equal(365, Rational(\"343434/365\").denominator)\n\tend", "def create\n @fraction_vote = FractionVote.new(fraction_vote_params)\n\n respond_to do |format|\n if @fraction_vote.save\n format.html { redirect_to @fraction_vote, notice: 'Fraction vote was successfully created.' }\n format.json { render :show, status: :created, location: @fraction_vote }\n else\n format.html { render :new }\n format.json { render json: @fraction_vote.errors, status: :unprocessable_entity }\n end\n end\n end", "def fraction(hash,n)\n result = {}\n result[:n] = (n - hash[:minus]**2)/hash[:n]\n result[:i] = (Math.sqrt(n).to_i + hash[:minus])/result[:n]\n result[:minus] = result[:i]*result[:n]-hash[:minus]\n result\nend", "def spot_price_fraction(val=nil)\n if val\n spot_price( price.to_f * val )\n else\n spot_price / price rescue 0\n end\n end", "def show\n @fractions, @alphaParams = \n @municipality.fractions.sort_by{ |m| m.name.downcase }\n .alpha_paginate(params[:letter], {:js => true, :bootstrap3 => true}){|fraction| fraction.name}\n end", "def multiply_fraction_and_fraction(left, right)\n\tnew_numerator = multiply_unknown_terms_or_term_lists(left.numerator, right.numerator)\n\tnew_denominator = multiply_unknown_terms_or_term_lists(left.denominator, right.denominator)\n\treturn Fraction.new(left.line, left.col, numerator: new_numerator, denominator: new_denominator)\nend", "def flip_sign_on_fraction fraction\n\tcase fraction.numerator\n\tin Term\n\t\treturn Fraction.new(fraction.line, fraction.col, numerator: flip_sign_on_term(fraction.numerator), denominator: fraction.denominator)\n\tin TermList\n\t\treturn Fraction.new(fraction.line, fraction.col, numerator: flip_sign_on_term_list(fraction.numerator), denominator: fraction.denominator)\n\telse\n\t\tthrow_error(\"When flipping sign on #{fraction}, found something that is not a Term or a TermList (#{__LINE__})\", fraction, []) # TODO: Add stack trace (make a global)\n\tend\nend", "def ldexp\n\t\tresult = Math.ldexp(@input)\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": [fraction, exponent]}'}, status: 400\n\tend", "def egyptian(input_fraction)\n output = []\n unit_denominator = 1\n current = Rational(1, unit_denominator)\n\n loop do \n \n if input_fraction - current >= 0\n output << unit_denominator\n input_fraction = input_fraction - current\n end\n unit_denominator += 1\n current = Rational(1, unit_denominator)\n\n break if input_fraction == 0\n end\n output\nend", "def invert_fraction fraction\n\treturn Fraction.new(fraction.line, fraction.col, numerator: fraction.denominator, denominator: fraction.numerator)\nend", "def day_fraction\n 0.0\n end", "def fracToDec(num,den)\r\n return num.to_f/den.to_f\r\nend", "def add_frac(frac1, frac2)\n numerator1 = frac1[0]\n numerator2 = frac2[0]\n denominator1 = frac1[1]\n denominator2 = frac2[1]\n\n if denominator1 == denominator2\n [numerator1 + numerator2, denominator1]\n else\n [numerator1 * denominator2 + numerator2 * denominator1, denominator1 * denominator2]\n end\nend", "def divide(numerator, denominator)\n puts \"#{numerator} / #{denominator} = #{numerator / denominator}\\n\"\nend", "def set_infraction\n @infraction = Infraction.find(params[:id])\n end", "def destroy\n @fraction_vote.destroy\n respond_to do |format|\n format.html { redirect_to fraction_votes_url, notice: 'Fraction vote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\n @breadcrumb = 'read'\n @ratio_group = RatioGroup.find(params[:id])\n @ratios = @ratio_group.ratios.paginate(:page => params[:page], :per_page => per_page).order(:code)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ratio_group }\n end\n end", "def fraction_calculator fraction_one, fraction_two, operator\n num_one = Rational(fraction_one)\n num_two = Rational(fraction_two)\n \n final_result = case operator\n when '/' then num_one / num_two\n when '*' then num_one * num_two\n when '+' then num_one + num_two\n when '-' then num_one - num_two\n end\n\n String(final_result)\n\n print String(final_result)\n\nend", "def continued_fraction(n)\n a0 = Math.sqrt(n).floor\n cf = [a0]\n\n m = 0\n d = 1\n loop do\n m = d * cf.last - m\n d = (n - m**2)/d\n a = (a0 + m)/d\n cf << a\n\n break if a == 2 * a0\n end\n\n cf\nend", "def return_rational(numerator)\n\t\tnumerator/36.to_r\n\tend", "def long_division (numerator, denominator)\n base = 10\n fraction = (numerator / denominator) . to_s + \".\"\n position = fraction . length\n seen = {}\n\n numerator %= denominator\n\n while !seen [numerator] do\n if numerator == 0\n then return (fraction)\n end\n seen [numerator] = position\n fraction += (base * numerator / denominator) . to_s\n numerator = base * numerator % denominator\n position += 1\n end\n\n return (fraction [0 .. seen [numerator] - 1] + \"(\" +\n fraction [ seen [numerator] .. -1] + \")\")\n \nend", "def subtract_term_from_fraction\n\treturn add_fraction_and_term(fraction, flip_sign_on_fraction(term))\nend", "def add_fraction_and_term(fraction, term)\n\tterm_as_numerator = multiply_unknown_terms_or_term_lists(fraction.denominator, term)\n\tnew_numerator = add_unknown_terms_or_term_lists(fraction.numerator, term_as_numerator)\n\treturn Fraction.new(frac1.line, frac1.col, numerator: new_numerator, denominator: fraction.denominator)\nend", "def reciprocal\n\t\tresult = 1/@input\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": num}'}, status: 400\n\tend", "def fraction()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.TimerComponentState_fraction(@handle.ptr)\n result\n end", "def progressive_fraction(x, y)\n cfe = continued_fraction(x, y)\n ret = []\n 1.upto(cfe.size - 1) do |i|\n ret.push(expand(cfe[0...i]))\n end\n ret\n end", "def / number\n self.class[ self.with_values do |val|\n raise TErr, \"Compositions with rational exponents \" +\n \"not implemented!\" if val % number != 0\n val / number\n end ]\n end", "def subtract_term_list_from_fraction\n\treturn add_fraction_and_term_list(fraction, flip_sign_on_fraction(term_list))\nend", "def get_percentage(number, differential, min)\n if differential == 0\n percentage = number\n else\n percentage = (number.to_f - min) / (differential)\n end\n percentage\n end", "def test_Rational_InstanceMethods_numerator\n\t\tassert_equal(2, Rational(\"2/3\").numerator)\n\t\t# TODO, assert_equal(1978, Rational(\"1978/840\").numerator)\n\tend", "def get_portions_with_http_info(name, slide_index, shape_index, paragraph_index, password = nil, folder = nil, storage = nil, sub_shape = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_portions ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_portions\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.get_portions\"\n end\n # verify the required parameter 'shape_index' is set\n if @api_client.config.client_side_validation && shape_index.nil?\n fail ArgumentError, \"Missing the required parameter 'shape_index' when calling SlidesApi.get_portions\"\n end\n # verify the required parameter 'paragraph_index' is set\n if @api_client.config.client_side_validation && paragraph_index.nil?\n fail ArgumentError, \"Missing the required parameter 'paragraph_index' when calling SlidesApi.get_portions\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}/shapes/{shapeIndex}/paragraphs/{paragraphIndex}/portions'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'shapeIndex', shape_index)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'paragraphIndex', paragraph_index)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n query_params[:'subShape'] = @api_client.prepare_for_query(sub_shape) unless sub_shape.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Portions')\n return data, status_code, headers\n end", "def with_frames_as_fraction\n vp = value_parts.dup\n vp[-1] = (100.0 / @fps) * vp[-1]\n WITH_FRACTIONS_OF_SECOND % vp\n end", "def with_frames_as_fraction\n vp = value_parts.dup\n vp[-1] = (100.0 / @fps) * vp[-1]\n WITH_FRACTIONS_OF_SECOND % vp\n end", "def /(denominator)\n raise MoneyError, \"Denominator must be a Fixnum. (#{denominator} is a #{denominator.class})\"\\\n unless denominator.is_a? Fixnum\n\n result = []\n equal_division = (cents / denominator).round\n denominator.times { result << Money.create_from_cents(equal_division) }\n extra_pennies = cents - (equal_division * denominator)\n \n # Make sure we don't loose any pennies!\n extra_pennies.times { |p| result[p] += 0.01 }\n result\n end", "def subtract_fraction_from_term_list(fraction, term_list)\n\treturn add_fraction_and_term_list(flip_sign_on_fraction(fraction), term_list)\nend", "def add_fraction_and_term_list(fraction, term_list)\n\tterm_list_as_numerator = multiply_unknown_terms_or_term_lists(fraction.denominator, term_list)\n\tnew_numerator = add_unknown_terms_or_term_lists(fraction.numerator, term_list_as_numerator)\n\treturn Fraction.new(frac1.line, frac1.col, numerator: new_numerator, denominator: fraction.denominator)\nend", "def sec_fraction() time[3] end" ]
[ "0.725403", "0.6951041", "0.69046235", "0.6887498", "0.66118616", "0.659512", "0.64443827", "0.63384795", "0.628042", "0.6266492", "0.6194288", "0.61718965", "0.6122079", "0.60069895", "0.60061103", "0.5995959", "0.59928447", "0.59596133", "0.59295726", "0.5925297", "0.5869408", "0.5868963", "0.5859071", "0.5836774", "0.5821315", "0.58212197", "0.5809808", "0.58079594", "0.5780233", "0.5780195", "0.57648665", "0.5739068", "0.5725209", "0.5696571", "0.5689375", "0.5661831", "0.5644362", "0.56365067", "0.5632464", "0.5618264", "0.5611542", "0.5578893", "0.5573616", "0.5570167", "0.5565501", "0.5534743", "0.553239", "0.5500895", "0.5481073", "0.54714555", "0.5458891", "0.5456318", "0.5412231", "0.5399754", "0.5394095", "0.5374453", "0.53701466", "0.53186584", "0.5313727", "0.530422", "0.530234", "0.5296191", "0.5274973", "0.52530646", "0.5251024", "0.52377987", "0.5236415", "0.5222648", "0.51904726", "0.51796705", "0.5171174", "0.5167738", "0.51529217", "0.5149374", "0.512306", "0.51084405", "0.5091633", "0.505356", "0.5035244", "0.5033296", "0.5027766", "0.50245476", "0.49955422", "0.49896082", "0.49884048", "0.4985274", "0.49787363", "0.49713576", "0.4971029", "0.49681932", "0.4960811", "0.4958022", "0.4945046", "0.4923156", "0.4914657", "0.49000505", "0.49000505", "0.48918507", "0.4889847", "0.4882689", "0.48804235" ]
0.0
-1
POST /fractions POST /fractions.json
def create @fraction = Fraction.new(fraction_params) respond_to do |format| if @fraction.save format.html { redirect_to @fraction, notice: 'Fraction was successfully created.' } format.json { render :show, status: :created, location: @fraction } else format.html { render :new } format.json { render json: @fraction.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fraction_params\n params.require(:fraction).permit(:fraction)\n end", "def member_fraction_params\n params.require(:member_fraction).permit(:parliament_id, :structural_id, :fraction_id)\n end", "def create\n @member_fraction = MemberFraction.new(member_fraction_params)\n\n respond_to do |format|\n if @member_fraction.save\n format.html { redirect_to member_fractions_path, notice: 'Member fraction was successfully created.' }\n format.json { render :show, status: :created, location: @member_fraction }\n else\n format.html { render :new }\n format.json { render json: @member_fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_fraction\n @fraction = Fraction.find(params[:id])\n end", "def fraction_vote_params\n params.require(:fraction_vote).permit(:fraction_id, :vote_id, :number_of_present, :yes, :no, :dont_know)\n end", "def fraction(x, y)\n execute(:fraction, x, y)\n end", "def update\n respond_to do |format|\n if @fraction.update(fraction_params)\n format.html { redirect_to @fraction, notice: 'Fraction was successfully updated.' }\n format.json { render :show, status: :ok, location: @fraction }\n else\n format.html { render :edit }\n format.json { render json: @fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fraction_vote = FractionVote.new(fraction_vote_params)\n\n respond_to do |format|\n if @fraction_vote.save\n format.html { redirect_to @fraction_vote, notice: 'Fraction vote was successfully created.' }\n format.json { render :show, status: :created, location: @fraction_vote }\n else\n format.html { render :new }\n format.json { render json: @fraction_vote.errors, status: :unprocessable_entity }\n end\n end\n end", "def type\n :fractional\n end", "def create\n @fraction = Fraction.new(params[:fraction])\n\n @municipality = @fraction.municipality\n\n respond_to do |format|\n if @fraction.save\n format.html { redirect_to @municipality, notice: 'Fraction was successfully created.' }\n format.json { render json: @fraction, status: :created, location: @fraction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def divide_fraction_by_term_list(fraction, term_list)\n\ttl_fraction = Fraction.new(term_list.line, term_list.col, denominator: term_list)\n\treturn multiply_fraction_and_fraction(fraction, tl_fraction)\nend", "def routing_fraction_to_percentage(fraction)\n \"#{(fraction * 100).to_i}%\"\n end", "def update\n respond_to do |format|\n if @member_fraction.update(member_fraction_params)\n format.html { redirect_to member_fractions_path, notice: 'Member fraction was successfully updated.' }\n format.json { render :show, status: :ok, location: @member_fraction }\n else\n format.html { render :edit }\n format.json { render json: @member_fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def divide_term_by_fraction(term, fraction)\n\tterm_fraction = Fraction.new(term.line, term.col, numerator: term)\n\treturn multiply_fraction_and_fraction(invert_fraction(fraction), term_fraction)\nend", "def fractional; end", "def divide_term_list_by_fraction\n\ttl_fraction = Fraction.new(term_list.line, term_list.col, numerator: term_list)\n\treturn multiply_fraction_and_fraction(invert_fraction(fraction), tl_fraction)\nend", "def mixed_fraction(s)\n numerator, denominator = s.split('/').map(&:to_i)\n\n raise ZeroDivisionError if denominator.to_i.zero?\n \n if evenly_divides?(numerator, denominator)\n (numerator / denominator).to_s\n else\n simplify_fraction(numerator, denominator)\n end\nend", "def add_fraction_and_fraction(frac1, frac2)\n\tif frac1.denominator != frac2.denominator\n\t\tnew_frac1_numerator = multiply_unknown_terms_or_term_lists(frac1.numerator, frac2.denominator)\n\t\tnew_frac2_numerator = multiply_unknown_terms_or_term_lists(frac2.numerator, frac1.denominator)\n\t\tnew_numerator = add_unknown_terms_or_term_lists(new_frac1_numerator, new_frac2_numerator)\n\t\tnew_denominator = multiply_unknown_terms_or_term_lists(frac1.denominator, frac2.denominator)\n\t\treturn Fraction.new(frac1.line, frac1.col, numerator: new_numerator, denominator: new_denominator)\n\tend\n\tnew_numerator = add_unknown_terms_or_term_lists(frac1.numerator, frac2.numerator)\n\treturn Fraction.new(frac1.line, frac1.col, numerator: new_numerator, denominator: frac1.denominator)\nend", "def destroy\n @fraction.destroy\n respond_to do |format|\n format.html { redirect_to fractions_url, notice: 'Fraction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def fraction_to_float(fraction)\n return 0.0 if fraction == \"0\"\n sign = PDG::single_character(fraction) == \"+\" ? 1.0 : -1.0\n sign * Rational(*(fraction[1..-1].split(\"/\").map(&:to_i))).to_f\n end", "def divide_fraction_by_term(fraction, term)\n\tterm_fraction = Fraction.new(term.line, term.col, denominator: term)\n\treturn multiply_fraction_and_fraction(fraction, term_fraction)\nend", "def to_s_fraction(values)\n return \"#{values[1] - values[0]} / #{values[1]}\"\n end", "def fractional\n @fractional ||= Fractional.new(calculate_fractional, id)\n end", "def mixed_fraction(s)\n f = s\n fraction = f.split(\"/\").map { |x| x = x.to_i }\n p initial = Rational(fraction[0],fraction[1])\n p initial_split = initial.to_s.split(\"/\").map { |x| x = x.to_i }\n \n if initial_split[0] < 1\n initial_split[0] = initial_split[0] * -1\n initial_split[0]\n initial_split[2] = \"-\"\n initial_split[2]\n end\n if initial_split[1] == initial_split[0]\n final_answer = Array.new\n final_answer[0] = initial_split[2]\n final_answer[1] = initial_split[0]\n final_answer = final_answer.join\n elsif initial_split[0] == 0\n final_answer = \"0\"\n elsif (initial_split[0] / initial_split[1]) < 1\n final_answer = initial.to_s\n elsif (initial_split[0] / initial_split[1]) > 1\n if initial_split[0] % initial_split[1] == 0\n final_answer = \"#{initial_split[2]}#{initial_split[0]/initial_split[1]}\"\n elsif \n final_answer = Array.new\n final_answer[0] = initial_split[2]\n final_answer[1] = \"#{(initial_split[0]/initial_split[1])}\"\n final_answer[2] = \" #{initial_split[0] % initial_split[1]}/#{initial_split[1]}\"\n final_answer = final_answer.join\n end\n else \n final_answer = Array.new\n final_answer[0] = initial_split[2]\n final_answer[1] = \"#{(initial_split[0]/initial_split[1])}\"\n final_answer[2] = \" #{initial_split[0] % initial_split[1]}/#{initial_split[1]}\"\n final_answer = final_answer.join\n end\n p final_answer\nend", "def set_member_fraction\n @member_fraction = MemberFraction.find(params[:id])\n end", "def divide_fraction_by_fraction(frac1, frac2)\n\tif frac1 == frac2\n\t\treturn Term.new(frac1.line, frac1.col, magnitude: 1)\n\telsif frac1.numerator == frac2.numerator\n\t\treturn Fraction.new(frac1.line, frac1.col, numerator: frac2.denominator, denominator: frac1.denominator)\n\telsif frac1.denominator == frac2.denominator\n\t\treturn Fraction.new(frac1.line, frac1.col, numerator: frac1.numerator, denominator: frac2.numerator)\n\telse\t\t\n\t\treturn multiply_fraction_and_fraction(frac1, invert_fraction(frac2))\n\tend\nend", "def set_fraction_vote\n @fraction_vote = FractionVote.find(params[:id])\n end", "def Fraction(*args)\n Fraction.new(*args)\nend", "def update\n @fraction = Fraction.find(params[:id])\n\n respond_to do |format|\n if @fraction.update_attributes(params[:fraction])\n format.html { redirect_to @fraction.municipality, notice: 'Fraction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @fraction = Fraction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fraction }\n end\n end", "def curious_fraction(numerator,denominator)\n numerators = numerator.to_s.split('').map(&:to_i)\n denominators = denominator.to_s.split('').map(&:to_i)\n\n if numerators[0]==denominators[0] && numerators[0]!=0\n numerators.shift\n denominators.shift\n return (numerators[0].to_f)/denominators[0]\n \n elsif numerators[1]==denominators[0] && numerators[1]!=0\n numerators.pop\n denominators.shift\n return (numerators[0].to_f)/denominators[0]\n \n elsif numerators[0]==denominators[1] && numerators[0]!=0\n numerators.shift\n denominators.pop\n return (numerators[0].to_f)/denominators[0]\n\n elsif numerators[1]==denominators[1] && numerators[1]!=0\n numerators.pop\n denominators.pop\n return (numerators[0].to_f)/denominators[0]\n else\n false\n end\n\nend", "def multiply_fraction_and_fraction(left, right)\n\tnew_numerator = multiply_unknown_terms_or_term_lists(left.numerator, right.numerator)\n\tnew_denominator = multiply_unknown_terms_or_term_lists(left.denominator, right.denominator)\n\treturn Fraction.new(left.line, left.col, numerator: new_numerator, denominator: new_denominator)\nend", "def add_fraction_and_term_list(fraction, term_list)\n\tterm_list_as_numerator = multiply_unknown_terms_or_term_lists(fraction.denominator, term_list)\n\tnew_numerator = add_unknown_terms_or_term_lists(fraction.numerator, term_list_as_numerator)\n\treturn Fraction.new(frac1.line, frac1.col, numerator: new_numerator, denominator: fraction.denominator)\nend", "def reduce(frac)\n n, d = frac.split('/').map(&:to_i)\n unless (g = gcd(n, d)) == 1\n n /= g; d /= g\n end\n \"#{n}/#{d}\"\nend", "def add_frac(frac1, frac2)\n numerator1 = frac1[0]\n numerator2 = frac2[0]\n denominator1 = frac1[1]\n denominator2 = frac2[1]\n\n if denominator1 == denominator2\n [numerator1 + numerator2, denominator1]\n else\n [numerator1 * denominator2 + numerator2 * denominator1, denominator1 * denominator2]\n end\nend", "def day_fraction(arg0, arg1, *rest)\n end", "def update\n respond_to do |format|\n if @fraction_vote.update(fraction_vote_params)\n format.html { redirect_to @fraction_vote, notice: 'Fraction vote was successfully updated.' }\n format.json { render :show, status: :ok, location: @fraction_vote }\n else\n format.html { render :edit }\n format.json { render json: @fraction_vote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @infraction = Infraction.new(infraction_params)\n\n respond_to do |format|\n if @infraction.save\n format.html { redirect_to @infraction, notice: 'Infraction was successfully created.' }\n format.json { render :show, status: :created, location: @infraction }\n else\n format.html { render :new }\n format.json { render json: @infraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def fractionalseconds\n set_function_and_argument(:fractionalseconds, nil)\n end", "def modulo_of(fraction); end", "def destroy\n @member_fraction.destroy\n respond_to do |format|\n format.html { redirect_to member_fractions_url, notice: 'Member fraction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def infraction_params\n params.require(:infraction).permit(:motif, :montant, :source, :zonecouverturemotif_id, :region_id, :departement_id, :arrondissement_id, :classe)\n end", "def destroy\n @fraction = Fraction.find(params[:id])\n @fraction.destroy\n\n respond_to do |format|\n format.html { redirect_to regions_url }\n format.json { head :no_content }\n end\n end", "def get_fraction( pattern )\n r = nil\n pattern.reverse.each_with_index do |n, i|\n r = (i == 0 ? n : n + Rational(1, r))\n end\n return r\nend", "def output_fraction(nd_array)\n n, d = nd_array\n if d == 1\n puts n\n else\n puts n.to_s + '/' + d.to_s\n end\nend", "def index\n @member_fractions = MemberFraction.all\n @fractions = Fraction.all\n end", "def add_fraction_and_term(fraction, term)\n\tterm_as_numerator = multiply_unknown_terms_or_term_lists(fraction.denominator, term)\n\tnew_numerator = add_unknown_terms_or_term_lists(fraction.numerator, term_as_numerator)\n\treturn Fraction.new(frac1.line, frac1.col, numerator: new_numerator, denominator: fraction.denominator)\nend", "def day_fraction_to_time fraction # :nodoc:\n seconds, fraction = fraction.divmod SECONDS_IN_DAY\n hours, seconds = seconds.divmod 3600\n minutes, seconds = seconds.divmod 60\n [hours, minutes, seconds, fraction * 86400]\n end", "def calculate_fractional\n calculate_fractional ||= if @value.positive?\n @value / 100.rationalize\n else\n -100 / @value.rationalize\n end\n end", "def new\n @fraction = Fraction.new\n @municipality = nil\n if params[:municipality_id]\n @municipality = Municipality.find(params[:municipality_id].to_i)\n else\n @municipality = Municipality.first\n end\n @object = [@municipality, @fraction]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fraction }\n end\n end", "def multiply_fraction_and_term_list(fraction, term_list)\n\tnew_numerator = multiply_unknown_terms_or_term_lists(fraction.numerator, term_list)\n\treturn Fraction.new(fraction.line, fraction.col, numerator: new_numerator, denominator: new_denominator)\nend", "def to_a\n return fraction.to_a\n end", "def ldexp\n\t\tresult = Math.ldexp(@input)\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": [fraction, exponent]}'}, status: 400\n\tend", "def flip_sign_on_fraction fraction\n\tcase fraction.numerator\n\tin Term\n\t\treturn Fraction.new(fraction.line, fraction.col, numerator: flip_sign_on_term(fraction.numerator), denominator: fraction.denominator)\n\tin TermList\n\t\treturn Fraction.new(fraction.line, fraction.col, numerator: flip_sign_on_term_list(fraction.numerator), denominator: fraction.denominator)\n\telse\n\t\tthrow_error(\"When flipping sign on #{fraction}, found something that is not a Term or a TermList (#{__LINE__})\", fraction, []) # TODO: Add stack trace (make a global)\n\tend\nend", "def sec_fraction\n subsec\n end", "def mixed_fraction(string)\n improper = Rational(*(string.split('/').map(&:to_i)))\n integer = improper.to_i\n fraction = improper - integer\n \n return \"#{integer}\" if (fraction).numerator == 0\n return \"#{fraction}\" if integer == 0\n \"#{integer} #{fraction.abs}\"\nend", "def fractional\n self\n end", "def initialize(numerator=0, denominator=1)\n @fraction = Vector[denominator,numerator]\n end", "def /(denominator)\n raise MoneyError, \"Denominator must be a Fixnum. (#{denominator} is a #{denominator.class})\"\\\n unless denominator.is_a? Fixnum\n\n result = []\n equal_division = (cents / denominator).round\n denominator.times { result << Money.create_from_cents(equal_division) }\n extra_pennies = cents - (equal_division * denominator)\n \n # Make sure we don't loose any pennies!\n extra_pennies.times { |p| result[p] += 0.01 }\n result\n end", "def get_resource_fraction(entry_data_type, entry_data)\n unit_type = (entry_data & 0xF)\n case unit_type\n when COMPLEX_UNIT_FRACTION\n unit_name = \"%\"\n when COMPLEX_UNIT_FRACTION_PARENT\n unit_name = \"%p\"\n else\n unit_name = \"\"\n end\n\n # Return float as a percentage\n return (complex_to_float(entry_data) * 100).to_s + unit_name\n end", "def frac_to_float(str)\n numerator, denominator = str.split(\"/\").map(&:to_f)\n denominator ||= 1\n numerator/denominator\n end", "def create\n @percentage = Percentage.new(percentage_params)\n\n respond_to do |format|\n if @percentage.save\n format.html { redirect_to @percentage, notice: 'Percentage was successfully created.' }\n format.json { render :show, status: :created, location: @percentage }\n else\n format.html { render :new }\n format.json { render json: @percentage.errors, status: :unprocessable_entity }\n end\n end\n end", "def fracToDec(num,den)\r\n return num.to_f/den.to_f\r\nend", "def interval_params\n params.require(:interval).permit(:numerator, :denominator, :description, :name)\n end", "def extract_fraction ( string )\n match_fraction = /(\\d{1,})([\\/\\+])(\\d{1,})+/\n # m = string.match(match_fraction)[0]\n m = string.match(match_fraction)\n value = nil\n if m != nil\n value = Rational m[0]\n end\n return value\n end", "def compute_fractional_quantities(attributes_hash)\n fraction_pattern = \"[[:space:]]*[0-9]+[[:space:]]*\\/[[:space:]]*[0-9]+[[:space:]]*\"\n attributes_hash.each do |key, attr|\n computed_quantity = attr[GroceryList::QUANTITY_KEY].match(/#{fraction_pattern}/) do |fraction|\n parts = fraction.string.split(\"/\")\n numerator = parts[0].strip.to_f\n denominator = parts[1].strip.to_f\n numerator / denominator\n end\n attr[GroceryList::QUANTITY_KEY] = computed_quantity.nil? ? attr[GroceryList::QUANTITY_KEY] : computed_quantity\n end\n end", "def with_frames_as_fraction\n vp = value_parts.dup\n vp[-1] = (100.0 / @fps) * vp[-1]\n WITH_FRACTIONS_OF_SECOND % vp\n end", "def with_frames_as_fraction\n vp = value_parts.dup\n vp[-1] = (100.0 / @fps) * vp[-1]\n WITH_FRACTIONS_OF_SECOND % vp\n end", "def evaluate_continued_fraction(values)\n if values.size == 1\n Rational(values.shift)\n else Rational(values.shift) +\n Rational(1, evaluate_continued_fraction(values))\n end\n end", "def fraction(hash,n)\n result = {}\n result[:n] = (n - hash[:minus]**2)/hash[:n]\n result[:i] = (Math.sqrt(n).to_i + hash[:minus])/result[:n]\n result[:minus] = result[:i]*result[:n]-hash[:minus]\n result\nend", "def percentage_params\n params.require(:percentage).permit(:val_fact_1, :val_fact_2, :percent_fact, :val_inv_1, :val_inv_2, :percent_inv, :group_id, :pharmacy_id)\n end", "def to_s\n return \"#{fraction.to_s}\"\n end", "def fractionate\n # Set active_tab to use in view filters\n session[:active_tab] = \"pendings-tab\"\n\n # Params\n invoice_ids = params[:instalment][:invoices_ids].split(\",\")\n number_quotas = params[:instalment][:number_inst].to_i\n amount_first = params[:instalment][:amount_first].to_d\n charge = params[:instalment][:charge].to_d\n payment_method_id = params[:instalment][:payment_method_id]\n redirect_to client_payments_path + \"#tab_pendings\", alert: I18n.t(\"ag2_gest.client_payments.generate_error_payment\") and return if payment_method_id.blank?\n created_by = current_user.id if !current_user.nil?\n\n # Check that all invoices are from the same client\n clients = Client.joins(bills: :invoices).where('invoices.id IN (?)', invoice_ids).select('clients.id').group('clients.id').to_a\n if clients.count > 1\n redirect_to client_payments_path + \"#tab_pendings\", alert: \"Imposible aplazar facturas de varios clientes a la vez.\" and return\n end\n client_id = clients.first.id\n\n # Check that all invoices are from the same subscriber\n subscribers = Subscriber.joins(bills: :invoices).where('invoices.id IN (?)', invoice_ids).select('subscribers.id').group('subscribers.id').to_a\n subscriber_id = nil\n if subscribers.count == 1\n subscriber_id = subscribers.first.id if !subscribers.first.blank?\n end\n\n # Initialize invoices dataset\n invoices = Invoice.where(id: invoice_ids).joins(:bill, 'LEFT JOIN client_payments ON invoices.id=client_payments.invoice_id') \\\n .select('invoices.*, bills.client_id, bills.subscriber_id, COALESCE(sum(client_payments.amount),0) AS payments, invoices.receivables-COALESCE(sum(client_payments.amount),0) AS debts') \\\n .order('invoices.created_at') \\\n .group('invoices.id')\n organization_id = invoices.first.organization_id\n\n # Calcs\n invoice_debts = 0\n amount_first_surcharge = 0\n invoices.each { |i| invoice_debts += i.debts }\n invoice_debts_surcharge = invoice_debts * (charge / 100)\n if amount_first > 0\n number_quotas -= 1\n amount_first_surcharge = (amount_first * (charge / 100)).round(4)\n invoice_debts -= amount_first\n invoice_debts_surcharge -= amount_first_surcharge\n end\n each_instalment_amount = (invoice_debts / number_quotas).round(4)\n each_instalment_surcharge = (invoice_debts_surcharge / number_quotas).round(4)\n\n # Instalment plan No.\n client_id = invoices.first.client.id\n instalment_no = instalment_plan_next_no(client_id) || '0000000000000000000000'\n\n # Begin the creation transaction\n begin\n ActiveRecord::Base.transaction do\n ### Create plan ###\n plan = InstalmentPlan.create( instalment_no: instalment_no,\n instalment_date: Date.today,\n payment_method_id: payment_method_id,\n client_id: client_id,\n subscriber_id: subscriber_id,\n surcharge_pct: charge,\n created_by: created_by,\n organization_id: organization_id )\n ### Create instalments ###\n # Instalment 0\n if amount_first > 0\n Instalment.create( instalment_plan_id: plan.id,\n instalment: 0,\n payday_limit: Date.today,\n amount: amount_first,\n surcharge: amount_first_surcharge,\n created_by: created_by )\n end\n # Next instalments\n (1..number_quotas).each do |q|\n Instalment.create( instalment_plan_id: plan.id,\n instalment: q,\n payday_limit: Date.today + q.month,\n amount: each_instalment_amount,\n surcharge: each_instalment_surcharge,\n created_by: created_by )\n end\n ### Create deferred invoices ###\n i = 0\n instalment_id = 0\n instalment_balance = 0\n invoice = []\n amount = 0\n debt = 0\n new_debt = 0\n plan.instalments.each do |q|\n instalment_id = q.id\n instalment_balance = q.amount\n # Loop thru invoices\n while instalment_balance > 0.0001\n if i > invoices.size\n break\n end\n invoice = invoices[i]\n debt = new_debt > 0 ? new_debt : invoice.debts\n amount = debt > instalment_balance ? instalment_balance : debt\n new_debt = (debt - amount).round(4)\n instalment_balance = (instalment_balance - amount).round(4)\n InstalmentInvoice.create( instalment_id: instalment_id,\n bill_id: invoice.bill_id,\n invoice_id: invoice.id,\n debt: debt,\n amount: amount )\n i += 1 if new_debt <= 0.0001\n end\n end\n\n # Update invoice statuses\n invoices.each do |j|\n j.invoice_status_id = InvoiceStatus::FRACTIONATED\n j.save\n end\n end # ActiveRecord::Base.transaction\n redirect_to client_payments_path + \"#tab_pendings\", notice: I18n.t('ag2_gest.client_payments.fractionate_ok', var: instalment_no)\n rescue ActiveRecord::RecordInvalid\n redirect_to client_payments_path + \"#tab_pendings\", alert: I18n.t(:transaction_error, var: \"fractionate\") and return\n end # begin\n\n # Generic method rescue\n # rescue\n # redirect_to client_payments_path, alert: I18n.t('ag2_gest.client_payments.fractionate_error')\n end", "def subtract_fraction_from_term_list(fraction, term_list)\n\treturn add_fraction_and_term_list(flip_sign_on_fraction(fraction), term_list)\nend", "def rat_params\n params.fetch(:rat, {})\n end", "def /(*_params)\n raise \"Division of money NOT allowed - use 'split_between' to avoid rounding errors\"\n end", "def continued_fraction(n)\n a0 = Math.sqrt(n).floor\n cf = [a0]\n\n m = 0\n d = 1\n loop do\n m = d * cf.last - m\n d = (n - m**2)/d\n a = (a0 + m)/d\n cf << a\n\n break if a == 2 * a0\n end\n\n cf\nend", "def destroy\n @fraction_vote.destroy\n respond_to do |format|\n format.html { redirect_to fraction_votes_url, notice: 'Fraction vote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def subtract_fraction_from_fraction(frac1, frac2)\n\treturn add_fraction_and_fraction(frac2, flip_sign_on_fraction(frac1))\nend", "def index\n @fraction_votes = FractionVote.all\n end", "def day_fraction\n 0.0\n end", "def subtract_term_list_from_fraction\n\treturn add_fraction_and_term_list(fraction, flip_sign_on_fraction(term_list))\nend", "def index\n @totalReg = Fraction.all.count\n\n @limit = params.has_key?(:limit) ? params[:limit].to_i : 10\n @page = params.has_key?(:page) ? params[:page].to_i : 1\n\n @status = 200\n @msg = \"ok\"\n\n @totalPage = @totalReg / @limit + (@totalReg % @limit != 0 ? 1 : 0)\n\n @start = ((@page-1) * @limit) +1\n \n\n @sortDirection = params.has_key?(:sortDirection) && params[:sortDirection] == 'ascending' ? 'ASC' : 'DESC'\n @sortBy = params.has_key?(:sortBy) ? params[:sortBy] : 'name'\n @findBy = params.has_key?(:findBy) ? params[:findBy] : 'name'\n\n\n if !params.has_key?(:limit) && !params.has_key?(:page) && !params.has_key?(:findQuery)\n @fractions = Fraction.first(@limit)\n #raise @providers.size.to_yaml\n @end = Fraction.page(@page).last_page? ? @start + @fractions.size - 1 : @start + @limit -1\n return\n end\n \n @fractions = Fraction.order(\"#{@sortBy} #{@sortDirection}\").page(@page).per(@limit)\n\n if params[:findBy] || params[:findQuery]\n @fractions = Fraction.where(\"#{@findBy} like ?\", \"%#{params[:findQuery]}%\").order(\"#{@sortBy} #{@sortDirection}\").page(@page).per(@limit)\n @totalReg = @fractions.count\n @totalPage = @totalReg / @limit + (@totalReg % @limit != 0 ? 1 : 0)\n @start = ((@page-1) * @limit) +1\n #raise @provider.to_yaml\n end\n @end = Fraction.page(@page).last_page? ? @start + @fractions.size - 1 : @start + @limit -1\n end", "def multiply_fraction_and_term(fraction, term)\n\tnew_numerator = multiply_unknown_terms_or_term_lists(fraction.numerator, term)\n\treturn Fraction.new(fraction.line, fraction.col, numerator: new_numerator, denominator: new_denominator)\nend", "def importance_fraction\n @grpc.importance_fraction\n end", "def all\n @fractions, @alphaParams = \n Fraction.all.sort_by{ |f| f.name }\n .alpha_paginate(params[:letter], {:js => true}){|fraction| fraction.name}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fractions }\n end\n end", "def post_divide; end", "def denominator() end", "def rat_params\n params[:rat]\n end", "def day_fraction_time(t = Time.utc(2000, 01, 01, 12, 00, 00, \"+00:00\"))\n t.nil? ? t = Time.utc(2000, 01, 01, 12, 00, 00, \"+00:00\") : t\n t == 0 ? t = Time.utc(2000, 01, 01, 12, 00, 00, \"+00:00\") : t\n time = t.to_a\n time[2] / DAY_HOURS +\n time[1] / DAY_MINUTES +\n time[0] / DAY_SECONDS\n #~ t.usec / DAY_USECS\n end", "def >=(frac)\n\t \n\t (@numerador.to_f / @denominador) >= (frac.numerador.to_f / frac.denominador)\n\tend", "def >=(frac)\n\t \n\t (@numerador.to_f / @denominador) >= (frac.numerador.to_f / frac.denominador)\n\tend", "def test_Rational_InstanceMethods_denominator\n\t\tassert_equal(3, Rational(\"2/3\").denominator)\n\t\tassert_equal(365, Rational(\"343434/365\").denominator)\n\tend", "def progressive_fraction(x, y)\n cfe = continued_fraction(x, y)\n ret = []\n 1.upto(cfe.size - 1) do |i|\n ret.push(expand(cfe[0...i]))\n end\n ret\n end", "def round_params\n params.require(:round).permit(:number)\n end", "def fraction_calculator fraction_one, fraction_two, operator\n num_one = Rational(fraction_one)\n num_two = Rational(fraction_two)\n \n final_result = case operator\n when '/' then num_one / num_two\n when '*' then num_one * num_two\n when '+' then num_one + num_two\n when '-' then num_one - num_two\n end\n\n String(final_result)\n\n print String(final_result)\n\nend", "def decimal\n if denominator.to_i == 0\n puts \"ERROR\"\n else\n x = numerator.to_f/denominator.to_f\n puts x\n end\n end", "def update!(**args)\n @denominator = args[:denominator] if args.key?(:denominator)\n @numerator = args[:numerator] if args.key?(:numerator)\n end", "def apply_solved_equivalent_fractions_to_fraction\n int = self.solve_equivalent_fractions\n answer = []\n @reduced_row_echelon_form.each do |row|\n answer << row.last * int\n end\n answer << int\n count = 0\n @balanced = Hash.new\n @left_system_of_equations.each do |x,v|\n answer[count]\n @left_system_of_equations[x] = answer[count].to_i.abs unless answer[count].nil?\n count += 1\n end\n @right_system_of_equations.each do |x,v|\n answer[count]\n @right_system_of_equations[x] = answer[count].to_i.abs unless answer[count].nil?\n count += 1\n end\n answer\n @balanced = {left:@left_system_of_equations,right:@right_system_of_equations}\n self.balanced_string.gsub(/([\\D^])1([\\D$])/, '\\1\\2') # or (/1(?!\\d)/,\"\")\n end", "def subtract_term_from_fraction\n\treturn add_fraction_and_term(fraction, flip_sign_on_fraction(term))\nend" ]
[ "0.77332985", "0.68102807", "0.67114794", "0.65384734", "0.6472182", "0.64225864", "0.6376123", "0.62741846", "0.6221947", "0.6160466", "0.60524327", "0.6049844", "0.59856796", "0.58795744", "0.58648354", "0.58358276", "0.58195025", "0.5819296", "0.5800493", "0.5794508", "0.5789347", "0.5773113", "0.57702", "0.56694394", "0.5657986", "0.56526864", "0.56397736", "0.5537227", "0.55334055", "0.5494629", "0.5483475", "0.5472252", "0.5462131", "0.5438686", "0.5420132", "0.5409654", "0.54060644", "0.53789955", "0.5375907", "0.5370448", "0.5364914", "0.53487325", "0.5311254", "0.5299736", "0.527714", "0.5270823", "0.5266623", "0.52489537", "0.52322584", "0.51602244", "0.5157811", "0.5131753", "0.51262116", "0.5123901", "0.51113003", "0.5106411", "0.50946796", "0.5076113", "0.50741565", "0.50735563", "0.5061742", "0.5053424", "0.5022972", "0.5007527", "0.5003226", "0.4999512", "0.49964103", "0.49964103", "0.49620116", "0.495352", "0.49526092", "0.4948939", "0.494426", "0.49322113", "0.4927934", "0.49205223", "0.49115232", "0.4909591", "0.48880687", "0.48809507", "0.48739833", "0.48549232", "0.48545474", "0.4849038", "0.48159906", "0.48125845", "0.48101965", "0.48022103", "0.47948357", "0.47742817", "0.47542676", "0.47542676", "0.47420087", "0.4737018", "0.47344172", "0.47332808", "0.47316566", "0.47284317", "0.4727523", "0.472044" ]
0.7197817
1
PATCH/PUT /fractions/1 PATCH/PUT /fractions/1.json
def update respond_to do |format| if @fraction.update(fraction_params) format.html { redirect_to @fraction, notice: 'Fraction was successfully updated.' } format.json { render :show, status: :ok, location: @fraction } else format.html { render :edit } format.json { render json: @fraction.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @member_fraction.update(member_fraction_params)\n format.html { redirect_to member_fractions_path, notice: 'Member fraction was successfully updated.' }\n format.json { render :show, status: :ok, location: @member_fraction }\n else\n format.html { render :edit }\n format.json { render json: @member_fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fraction = Fraction.find(params[:id])\n\n respond_to do |format|\n if @fraction.update_attributes(params[:fraction])\n format.html { redirect_to @fraction.municipality, notice: 'Fraction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fraction_vote.update(fraction_vote_params)\n format.html { redirect_to @fraction_vote, notice: 'Fraction vote was successfully updated.' }\n format.json { render :show, status: :ok, location: @fraction_vote }\n else\n format.html { render :edit }\n format.json { render json: @fraction_vote.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_fraction\n @fraction = Fraction.find(params[:id])\n end", "def fraction_params\n params.require(:fraction).permit(:fraction)\n end", "def update!(**args)\n @denominator = args[:denominator] if args.key?(:denominator)\n @numerator = args[:numerator] if args.key?(:numerator)\n end", "def set_fraction_vote\n @fraction_vote = FractionVote.find(params[:id])\n end", "def update!(**args)\n @denominator = args[:denominator] if args.key?(:denominator)\n @numerator = args[:numerator] if args.key?(:numerator)\n @precision = args[:precision] if args.key?(:precision)\n @whole_number = args[:whole_number] if args.key?(:whole_number)\n end", "def fraction_vote_params\n params.require(:fraction_vote).permit(:fraction_id, :vote_id, :number_of_present, :yes, :no, :dont_know)\n end", "def member_fraction_params\n params.require(:member_fraction).permit(:parliament_id, :structural_id, :fraction_id)\n end", "def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = {\n 'op' => operation,\n 'path' => path,\n 'value' => value\n }\n response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version)\n @client.response_handler(response)\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 set_member_fraction\n @member_fraction = MemberFraction.find(params[:id])\n end", "def patch!\n request! :patch\n end", "def fraction(x, y)\n execute(:fraction, x, y)\n end", "def update!(**args)\n @test_fraction = args[:test_fraction] if args.key?(:test_fraction)\n @training_fraction = args[:training_fraction] if args.key?(:training_fraction)\n @validation_fraction = args[:validation_fraction] if args.key?(:validation_fraction)\n end", "def update!(**args)\n @test_fraction = args[:test_fraction] if args.key?(:test_fraction)\n @training_fraction = args[:training_fraction] if args.key?(:training_fraction)\n @validation_fraction = args[:validation_fraction] if args.key?(:validation_fraction)\n end", "def update\n respond_to do |format|\n if @circular.update(circular_params)\n format.html { redirect_to @circular, notice: 'Circular was successfully updated.' }\n format.json { render :show, status: :ok, location: @circular }\n else\n format.html { render :edit }\n format.json { render json: @circular.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 create\n @fraction = Fraction.new(fraction_params)\n\n respond_to do |format|\n if @fraction.save\n format.html { redirect_to @fraction, notice: 'Fraction was successfully created.' }\n format.json { render :show, status: :created, location: @fraction }\n else\n format.html { render :new }\n format.json { render json: @fraction.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 show\n @fraction = Fraction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fraction }\n end\n end", "def update\n respond_to do |format|\n if @percentage.update(percentage_params)\n format.html { redirect_to @percentage, notice: 'Percentage was successfully updated.' }\n format.json { render :show, status: :ok, location: @percentage }\n else\n format.html { render :edit }\n format.json { render json: @percentage.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(operation, path, value)\n response = @client.rest_patch(@data['uri'], 'body' => [{ op: operation, path: path, value: value }])\n @client.response_handler(response)\n end", "def update\n respond_to do |format|\n if @infraction.update(infraction_params)\n format.html { redirect_to @infraction, notice: 'Infraction was successfully updated.' }\n format.json { render :show, status: :ok, location: @infraction }\n else\n format.html { render :edit }\n format.json { render json: @infraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def patch(operation, path, value)\n response = @client.rest_patch(@data['uri'], 'body' => [{ op: operation, path: path, value: value }])\n @client.response_handler(response)\n end", "def update\n @asset.update(price: params[:asset][:price])\n json_response(@asset,:created)\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @fraction.destroy\n respond_to do |format|\n format.html { redirect_to fractions_url, notice: 'Fraction was successfully destroyed.' }\n format.json { head :no_content }\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 @subset.update(subset_params)\n format.html { redirect_to @subset, notice: 'Subset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @subset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @circle = Circle.find(params[:id])\n\n respond_to do |format|\n if @circle.update_attributes(params[:circle])\n format.html { redirect_to @circle, :notice => 'Circle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @circle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @progress = Progress.find(params[:id])\n\n respond_to do |format|\n if @progress.update_attributes(params[:progress])\n format.json { head :no_content }\n else\n format.json { render json: @progress.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @feat = @person.feats.find(params[:id])\n level_old = @person.level\n\n if params[:feat][:completed] == '1'\n @feat.complete\n else\n @feat.uncomplete\n end\n sign = params[:feat][:completed] == '1' ? '+': '-'\n \n has_leveled = @person.level > level_old\n\n respond_to do |format|\n format.json { render :json => {\n :xpGained => \"#{sign}#{@feat.xp}\",\n :xpTotal => @person.xp,\n :next_level_ratio => @person.next_level_ratio,\n :extra_life => @person.level_to_string,\n :has_leveled => has_leveled,\n :completed => @feat.completed,\n :streak => @feat.calculate_streak}}\n \n end\n\n end", "def type\n :fractional\n end", "def update\n @circle = Circle.find(params[:id])\n\n respond_to do |format|\n if @circle.update_attributes(params[:circle])\n format.html { redirect_to @circle, notice: 'Circle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @circle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @circle = Circle.find(params[:id])\n\n respond_to do |format|\n if @circle.update_attributes(params[:circle])\n format.html { redirect_to @circle, notice: 'Circle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @circle.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { render :show, status: :ok, location: @patch }\n else\n format.html { render :edit }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rat.update(rat_params)\n format.html { redirect_to @rat, notice: 'Rat was successfully updated.' }\n format.json { render :show, status: :ok, location: @rat }\n else\n format.html { render :edit }\n format.json { render json: @rat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_concern.update(api_v1_concern_params)\n format.html { redirect_to @api_v1_concern, notice: 'Concern was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_concern }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_concern.errors, status: :unprocessable_entity }\n end\n end\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 @division = Division.find(params[:id])\n\n respond_to do |format|\n if @division.update_attributes(params[:division])\n format.html { redirect_to @division, notice: 'Division was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @division.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, **args); 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 @compound = Compound.find(params[:id])\n\n respond_to do |format|\n if @compound.update_attributes(params[:compound])\n format.html { redirect_to @compound, notice: 'Compound was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compound.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end", "def update\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n if @gauge.update_attributes(params[:gauge])\n format.html { redirect_to @gauge, notice: 'Gauge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gauge.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @circle.update(circle_params)\n format.html { redirect_to @circle, notice: 'Circle was successfully updated.' }\n format.json { render :show, status: :ok, location: @circle }\n else\n format.html { render :edit }\n format.json { render json: @circle.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n end", "def update\n respond_to do |format|\n if @api_v1_progress.update(api_v1_progress_params)\n format.html { redirect_to @api_v1_progress, notice: 'Progress was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_progress }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_progress.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(uri, options = T.unsafe(nil)); end", "def reciprocal\n\t\tresult = 1/@input\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": num}'}, status: 400\n\tend", "def update\n respond_to do |format|\n if @grade_calc.update(grade_calc_params)\n format.html { redirect_to @grade_calc, notice: 'Grade calc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @grade_calc.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data, options = {})\n uri = build_uri(path, options)\n\n request = Net::HTTP::Patch.new(uri.request_uri)\n set_authorisation_header(request)\n request.set_form_data(data)\n\n response = https_client(uri).request(request)\n end", "def update\n respond_to do |format|\n if @pic.update(part_update_params)\n format.html { redirect_to @pic, notice: 'Pic was successfully updated.' }\n format.json { render :show, status: :ok, location: @pic }\n else\n format.html { render :edit }\n format.json { render json: @pic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @property.Rate = ((@property.CurrentPrice - @property.Price) / @property.Price) * 100\n @property.ShareValue = @property.CurrentPrice / @property.Shares\n # update share value in individual shares\n @property.shares.update_all(value: @property.ShareValue)\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Please Press edit to verify changes and PRESS UDATE again' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @grape.update(grape_params)\n format.html { redirect_to @grape, notice: 'Composition was successfully updated.' }\n format.json { render :show, status: :ok, location: @grape }\n else\n format.html { render :edit }\n format.json { render json: @grape.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @compound.update(compound_params)\n format.html { redirect_to @compound, notice: 'Compound was successfully updated.' }\n format.json { render :show, status: :ok, location: @compound }\n else\n format.html { render :edit }\n format.json { render json: @compound.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @calculation = Calculation.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @calculation.update_attributes(params[:calculation])\r\n format.html { redirect_to @calculation, notice: 'Calculation updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @calculation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def patch(url, options = {}, &block)\n request HttpPatch, url, options, &block\n end", "def update\n @radio = Radio.find(params[:id])\n respond_to do |format|\n if @radio.update(radio_params)\n format.json { render json: @radio, status: :ok }\n else\n format.json { render json: @radio.errors, status: :unprocessable_entity }\n end\n end\nend", "def routing_fraction_to_percentage(fraction)\n \"#{(fraction * 100).to_i}%\"\n end", "def update\n respond_to do |format|\n if @album_rating.update(album_rating_params)\n format.html { redirect_to @album_rating, notice: 'Album rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @album_rating }\n else\n format.html { render :edit }\n format.json { render json: @album_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @default_grade_denominator = args[:default_grade_denominator] if args.key?(:default_grade_denominator)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @weight = args[:weight] if args.key?(:weight)\n end", "def destroy\n @fraction = Fraction.find(params[:id])\n @fraction.destroy\n\n respond_to do |format|\n format.html { redirect_to regions_url }\n format.json { head :no_content }\n end\n end", "def update\n @pictures = Picture.all.order(created_at: :desc)\n @picture.update(picture_params)\n render json: @pictures\n # head :no_content\n end", "def update\n @calculation = Calculation.find(params[:id])\n\n respond_to do |format|\n if @calculation.update_attributes(params[:calculation])\n format.html { redirect_to @calculation, notice: 'Calculation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calculation.errors, status: :unprocessable_entity }\n end\n end\n end", "def divide_term_by_fraction(term, fraction)\n\tterm_fraction = Fraction.new(term.line, term.col, numerator: term)\n\treturn multiply_fraction_and_fraction(invert_fraction(fraction), term_fraction)\nend", "def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = [{ 'op' => operation, 'path' => path, 'value' => value }]\n patch_options = { 'If-Match' => @data['eTag'] }\n response = @client.rest_patch(@data['uri'], patch_options.merge('body' => body), @api_version)\n @client.response_handler(response)\n end", "def update\n respond_to do |format|\n if @instrument_patch.update(instrument_patch_params)\n format.html { redirect_to @instrument_patch, notice: 'Instrument patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instrument_patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, opts = {})\n request(:patch, path, opts).body\n end", "def update\n respond_to do |format|\n if @validate_percentage.update(validate_percentage_params)\n format.html { redirect_to @validate_percentage, notice: 'Validate percentage was successfully updated.' }\n format.json { render :show, status: :ok, location: @validate_percentage }\n else\n format.html { render :edit }\n format.json { render json: @validate_percentage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n \n respond_to do |format|\n updated_params = song_params\n if (@song.artist != song_params[:artist] || @song.songname != song_params[:songname])\n uri = 'http://developer.echonest.com/api/v4/song/search?api_key=6XUOAXHJOW28GGGRH&format=json&results=1&artist=' + Rack::Utils.escape(song_params[:artist]) + '&title=' + Rack::Utils.escape(song_params[:songname]) + '&bucket=audio_summary'\n result = open(uri).read\n parsed = JSON.parse(result)\n if parsed[\"response\"][\"songs\"].length > 0\n updated_params[:bpm] = parsed[\"response\"][\"songs\"][0][\"audio_summary\"][\"tempo\"]\n updated_params[:key] = parsed[\"response\"][\"songs\"][0][\"audio_summary\"][\"key\"]\n notice = \"Song found on EchoNest!\"\n else\n notice = \"Could not find updated song on EchoNest.\"\n end\n \n end\n if @song.update(updated_params)\n format.html { redirect_to @song, notice: \"#{notice} #{updated_params} \" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @calculation.update(calculation_params)\n format.html { redirect_to calculation_path(@calculation, token: @calculation.edit_token) }\n format.json { render :show, status: :ok, location: @calculation }\n else\n format.html { render :edit }\n format.json { render json: @calculation.errors, status: :unprocessable_entity }\n end\n end\n end", "def divide_fraction_by_term_list(fraction, term_list)\n\ttl_fraction = Fraction.new(term_list.line, term_list.col, denominator: term_list)\n\treturn multiply_fraction_and_fraction(fraction, tl_fraction)\nend", "def update\n @facet = Facet.find(params[:id])\n\n respond_to do |format|\n if @facet.update_attributes(params[:facet])\n format.html { redirect_to @facet, notice: 'Facet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @facet.errors, status: :unprocessable_entity }\n end\n end\n end", "def multi_update\n errors = false\n return_value = []\n file_infos_params = params.permit(file_infos: [:id, :review_done, :component_id]).require(:file_infos)\n file_infos_params.each do |key, file_info_entry|\n (return_value << nil) and (errors = true) and next unless file_info_entry[:id]\n file_info = FileInfo.find(file_info_entry[:id])\n (return_value << nil) and (errors = true) and next unless file_info\n if file_info.update(file_info_entry)\n return_value << file_info_entry\n else\n return_value << file_info.errors\n errors = true\n end\n end\n respond_to do |format|\n format.json { render json: return_value }\n if errors\n format.html { redirect_to :back, notice: 'Some entries have errors'}\n else\n format.html { redirect_to :back }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n params[:project][:fundsneeded] = params[:project][:fundsneeded].gsub(/[^\\d\\.]/, '')\n params[:project][:fundsraised] = params[:project][:fundsraised].gsub(/[^\\d\\.]/, '')\n if params[:project][:percentcomplete].nil? || params[:project][:percentcomplete] == ''\n params[:project][:percentcomplete] = 0\n end\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n pizza = @order.pizza_in_progress\n if pizza.update(size_factor: Pizza.weight(params[:size]))\n @order.recalculate\n # head :no_content\n render json: { size: I18n.t(pizza.size) , costs: @order.sign_price }.to_json, status: :ok\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update!(**args)\n @curvature_status = args[:curvature_status] if args.key?(:curvature_status)\n @radians_per_meter = args[:radians_per_meter] if args.key?(:radians_per_meter)\n @start_point_fraction = args[:start_point_fraction] if args.key?(:start_point_fraction)\n end", "def update\n @model = Model.find(params[:id])\n # @model.name = \"test\"\n @model.scale = 1\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to @model, notice: 'Model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "def bump_patch\n @patch += 1\n self.save\n end", "def update\n respond_to do |format|\n if @bracket_golfer.update(bracket_golfer_params)\n format.html { redirect_to @bracket_golfer, notice: 'Bracket golfer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bracket_golfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @member_fraction = MemberFraction.new(member_fraction_params)\n\n respond_to do |format|\n if @member_fraction.save\n format.html { redirect_to member_fractions_path, notice: 'Member fraction was successfully created.' }\n format.json { render :show, status: :created, location: @member_fraction }\n else\n format.html { render :new }\n format.json { render json: @member_fraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end", "def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\n end", "def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\n end", "def fractional; end", "def update\n @grade = Grade.find(params[:id])\n\n if @grade.update(grade_params)\n head :no_content\n else\n render json: @grade.errors, status: :unprocessable_entity\n end\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "def divide_fraction_by_term(fraction, term)\n\tterm_fraction = Fraction.new(term.line, term.col, denominator: term)\n\treturn multiply_fraction_and_fraction(fraction, term_fraction)\nend" ]
[ "0.69239014", "0.67371404", "0.66484714", "0.6586919", "0.65382516", "0.60311043", "0.60145515", "0.58613765", "0.58448154", "0.5799816", "0.57682145", "0.57394004", "0.5737671", "0.5685192", "0.5665652", "0.56449336", "0.56228745", "0.5622771", "0.5622771", "0.5612094", "0.56009454", "0.55752176", "0.5569194", "0.5569194", "0.55680376", "0.55485547", "0.5513786", "0.54816014", "0.54282725", "0.54219216", "0.5420552", "0.5398274", "0.5388649", "0.53760415", "0.53584516", "0.532407", "0.53147", "0.5287305", "0.5284683", "0.5281007", "0.52720183", "0.5250086", "0.5250086", "0.52320427", "0.5231827", "0.52296984", "0.5221708", "0.5206871", "0.5206871", "0.5204613", "0.519392", "0.5175352", "0.5173561", "0.5166262", "0.5164975", "0.51641965", "0.5163971", "0.51602423", "0.5156413", "0.5147884", "0.51408684", "0.5137051", "0.5135392", "0.51335245", "0.5130061", "0.51299185", "0.51290715", "0.5114106", "0.51027125", "0.5097438", "0.5093151", "0.50888866", "0.5087439", "0.5083609", "0.5078992", "0.5068924", "0.506547", "0.50652504", "0.50631833", "0.5061514", "0.50592", "0.5056813", "0.50562584", "0.5055194", "0.50541025", "0.5047488", "0.50471854", "0.5042217", "0.50369465", "0.5036271", "0.5026861", "0.50230694", "0.50203055", "0.5014741", "0.5012628", "0.5012628", "0.501249", "0.50047994", "0.50014806", "0.49973154" ]
0.7464898
0
DELETE /fractions/1 DELETE /fractions/1.json
def destroy @fraction.destroy respond_to do |format| format.html { redirect_to fractions_url, notice: 'Fraction was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @fraction = Fraction.find(params[:id])\n @fraction.destroy\n\n respond_to do |format|\n format.html { redirect_to regions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @member_fraction.destroy\n respond_to do |format|\n format.html { redirect_to member_fractions_url, notice: 'Member fraction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fraction_vote.destroy\n respond_to do |format|\n format.html { redirect_to fraction_votes_url, notice: 'Fraction vote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @infraction.destroy\n respond_to do |format|\n format.html { redirect_to infractions_url, notice: 'Infraction 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 @percentage.destroy\n respond_to do |format|\n format.html { redirect_to percentages_url, notice: 'Percentage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gauge = Gauge.find(params[:id])\n @gauge.destroy\n\n respond_to do |format|\n format.html { redirect_to gauges_url }\n format.json { head :no_content }\n end\n end", "def delete\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 @number = Number.where(:value => params[:number][:value]).first\n @number.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @compound = Compound.find(params[:id])\n @compound.destroy\n\n respond_to do |format|\n format.html { redirect_to compounds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @percentual_gordura.destroy\n respond_to do |format|\n format.html { redirect_to percentual_gorduras_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @gpath = Gpath.find(params[:id])\n @gpath.destroy\n\n respond_to do |format|\n format.html { redirect_to gpaths_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @division = Division.find(params[:id])\n @division.destroy\n\n respond_to do |format|\n format.html { redirect_to divisions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @basis = Base.find(params[:id])\n @basis.destroy\n\n respond_to do |format|\n format.html { redirect_to bases_url }\n format.json { head :no_content }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @gauge_graph.destroy\n respond_to do |format|\n format.html { redirect_to gauge_graphs_url, notice: 'Gauge graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @threshold = Threshold.find(params[:id])\n @threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to thresholds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subset.destroy\n respond_to do |format|\n format.html { redirect_to subsets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @calculation = Calculation.find(params[:id])\n @calculation.destroy\n\n respond_to do |format|\n format.html { redirect_to calculations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album_rating.destroy\n respond_to do |format|\n format.html { redirect_to album_ratings_url, notice: 'Album rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @club_path = ClubPath.find(params[:id])\n @club_path.destroy\n\n respond_to do |format|\n format.html { redirect_to club_paths_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @circular.destroy\n respond_to do |format|\n format.html { redirect_to circulars_url, notice: 'Circular was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(splat)\n bad_request if splat.empty?\n _delete resolve_uri(splat[0])\n end", "def destroy\n @portion = Portion.find(params[:id])\n @portion.destroy\n\n respond_to do |format|\n format.html { redirect_to portions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @song = Song.find(params[:id])\n #@song.remove_file_path!\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :ok }\n end\n end", "def delete(*rest) end", "def destroy\n @dart = Dart.find(params[:id])\n @dart.destroy\n\n respond_to do |format|\n format.html { redirect_to darts_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @calculation = Calculation.find(params[:id])\r\n @calculation.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to calculations_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n\n @album = @user.albums.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \t@album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :ok }\n end\n end", "def destroy\n #binding.pry\n @balance = Balance.find(params[:id])\n @balance.destroy\n respond_to do |format|\n format.html { redirect_to balances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @grade_calc.destroy\n respond_to do |format|\n format.html { redirect_to grade_calcs_url }\n format.json { head :no_content }\n end\n end", "def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\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(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 @operation = Operation.find(params[:id])\n @operation.destroy\n\n respond_to do |format|\n format.html { redirect_to operations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_progress.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_progresses_url, notice: 'Progress was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def api_remove\n data_hash = make_hash\n delete_hash = { division: data_hash[:division][:value] }\n handler.remove(delete_hash, path, subscriber_id)\n end", "def destroy\n @perfile = Perfile.find(params[:id])\n @perfile.destroy\n\n respond_to do |format|\n format.html { redirect_to perfiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :ok }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'+@color.id.to_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n Track.destroy(params[:id])\n delete_file BSON::ObjectId(params[:id])\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def fraction(x, y)\n execute(:fraction, x, y)\n end", "def destroy\n @three.destroy\n respond_to do |format|\n format.html { redirect_to threes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gain = Gain.find(params[:id])\n @gain.destroy\n\n respond_to do |format|\n format.html { redirect_to gains_url }\n format.json { head :ok }\n end\n end", "def destroy\n @picture = @album.pictures.find(params[:id]) #JRD111115\n @picture.destroy\n respond_to do |format|\n format.html { redirect_to album_pictures_url(@album), notice: 'Picture was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @circle = Circle.find(params[:id])\n @circle.destroy\n\n respond_to do |format|\n format.html { redirect_to circles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @circle = Circle.find(params[:id])\n @circle.destroy\n\n respond_to do |format|\n format.html { redirect_to circles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n album=@photo.album\n @photo.destroy\n save_to_json\n respond_to do |format|\n format.html { redirect_to album_path(album), notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @average_entry.destroy\n respond_to do |format|\n format.html { redirect_to average_entries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def destroy\n @average = Average.find(params[:id])\n @average.destroy\n\n respond_to do |format|\n format.html { redirect_to averages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quantile_period = QuantilePeriod.find(params[:id])\n @quantile_period.destroy\n\n respond_to do |format|\n format.html { redirect_to quantile_periods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end", "def destroy\n @backend_stat = Backend::Stat.find(params[:id])\n @backend_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to backend_stats_url }\n format.json { head :ok }\n end\n end", "def destroy\n @stat = Stat.find(params[:id])\n @stat.destroy\n\n respond_to do |format|\n format.html { redirect_to stats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'El album a sido removido satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stat = Stat.find(params[:id])\n @stat.destroy\n\n respond_to do |format|\n format.html { redirect_to stats_url }\n format.json { head :ok }\n end\n end", "def destroy\n @jam_circle.destroy\n respond_to do |format|\n format.html { redirect_to jam_circles_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 delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @blood_pressure = BloodPressure.find(params[:id])\n @blood_pressure.destroy\n\n respond_to do |format|\n format.html { redirect_to blood_pressures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fuel_balance.destroy\n respond_to do |format|\n format.html { redirect_to fuel_balances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to DelphiEstimation.find_by_id(@round.delphiEstimation_id), notice: 'Round wurde erfolgreich gelöscht' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @album = @photo.album\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_album_url(@album) }\n format.json { head :no_content }\n end\n end", "def destroy\n @git_datum = GitDatum.find(params[:id])\n @git_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to git_data_url }\n format.json { head :no_content }\n end\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @bracket_golfer.destroy\n respond_to do |format|\n format.html { redirect_to bracket_golfers_url }\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 delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n @rat.destroy\n respond_to do |format|\n format.html { redirect_to rats_url, notice: 'Rat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_json(url)\n JSON.parse(delete(url, :json, :json))\n end", "def destroy\n @photo = Photo.find(params[:id])\n\t@album = Album.find(@photo.album_id)\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to album_path(@album) }\n format.json { head :ok }\n end\n end", "def destroy\n @grade_scale = GradeScale.find(params[:id])\n @grade_scale.destroy\n\n respond_to do |format|\n format.html { redirect_to grade_scales_url }\n format.json { head :ok }\n end\n end", "def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_weight = TestWeight.find(params[:id])\n @test_weight.destroy\n\n respond_to do |format|\n format.html { redirect_to test_weights_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n render json: @album\n end" ]
[ "0.7416597", "0.7099154", "0.6915712", "0.6339604", "0.62519103", "0.62268734", "0.61898583", "0.6156016", "0.6055814", "0.60532826", "0.6031578", "0.59887844", "0.5967448", "0.5965297", "0.59568524", "0.59512883", "0.59381354", "0.59381354", "0.5929808", "0.5929391", "0.59202147", "0.59180975", "0.5909028", "0.59039456", "0.58958846", "0.58885944", "0.5879476", "0.5871539", "0.5870861", "0.5868829", "0.5862443", "0.5857922", "0.5856371", "0.58548474", "0.5854584", "0.5840915", "0.58375037", "0.5834196", "0.58313364", "0.58272326", "0.58214396", "0.5818844", "0.5818527", "0.581698", "0.58163464", "0.58161545", "0.58161545", "0.58161545", "0.58161545", "0.58161545", "0.58149475", "0.58102393", "0.5808011", "0.5807808", "0.5805654", "0.58041984", "0.5798842", "0.5798842", "0.5793078", "0.5788407", "0.5784248", "0.577241", "0.57715774", "0.5769602", "0.5761675", "0.57572705", "0.5755826", "0.5754733", "0.5752489", "0.57379866", "0.57365716", "0.5735407", "0.5730556", "0.5730417", "0.5726627", "0.5726627", "0.5726627", "0.5726627", "0.5725909", "0.5725674", "0.5723908", "0.5721332", "0.5721332", "0.5721332", "0.57196945", "0.5719193", "0.5718347", "0.5718237", "0.5716808", "0.5716769", "0.5714582", "0.57095414", "0.57095414", "0.5709228", "0.5708797", "0.5708765", "0.5705797", "0.5705102", "0.5703011", "0.5702547" ]
0.75078803
0
Use callbacks to share common setup or constraints between actions.
def set_fraction @fraction = Fraction.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
Never trust parameters from the scary internet, only allow the white list through.
def fraction_params params.require(:fraction).permit(:fraction) 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
GET /framedp_summaries/1 GET /framedp_summaries/1.json
def show @framedp_summary = FramedpSummary.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @framedp_summary } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @framedp_summary = FramedpSummary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @framedp_summary }\n end\n end", "def show\n @summaries = Summary.all \n end", "def summary\n response = get \"summary\", {}\n Hashie::Mash.new(response)\n end", "def create\n @framedp_summary = FramedpSummary.new(params[:framedp_summary])\n\n respond_to do |format|\n if @framedp_summary.save\n format.html { redirect_to @framedp_summary, notice: 'Framedp summary was successfully created.' }\n format.json { render json: @framedp_summary, status: :created, location: @framedp_summary }\n else\n format.html { render action: \"new\" }\n format.json { render json: @framedp_summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\r\n @frames = Frame.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @frames }\r\n end\r\n end", "def index\n @summaries = Summary.where(player_id: params[:player_id]).paginate(page: params[:page], per_page: 5)\n @summaries ||= Summary.paginate(page: params[:page], per_page: 5)\n end", "def show\n @summary = Summary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @summary }\n end\n end", "def status_summary(statuspage_id)\n request :method => :get,\n :url => @url + 'status/summary/' + statuspage_id\n end", "def destroy\n @framedp_summary = FramedpSummary.find(params[:id])\n @framedp_summary.destroy\n\n respond_to do |format|\n format.html { redirect_to framedp_summaries_url }\n format.json { head :no_content }\n end\n end", "def index\n @frames = Frame.all\n end", "def index\n @frames = Frame.all\n end", "def index\n @frames = Frame.all\n end", "def index\n @frames = Frame.all\n end", "def summary(workspace_id, params={})\n get_report('summary', workspace_id, params)\n end", "def index\n @summaries = Summary.all\n @summary = Summary.new\n end", "def index\n @time_frames = TimeFrame.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_frames }\n end\n end", "def show\n @frame = Frame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @frame }\n end\n end", "def show\n @frame = Frame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @frame }\n end\n end", "def show\r\n @frame = Frame.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @frame }\r\n end\r\n end", "def call\n url = URI(\"https://api.covid19api.com/summary\")\n https = Net::HTTP.new(url.host, url.port);\n https.use_ssl = true\n\n request = Net::HTTP::Get.new(url)\n response = https.request(request).read_body\n\n data_hash = JSON.parse(response)\n end", "def index\n @traces = Trace.all\n\n render json: @traces\n end", "def episodes_summary_report show_id, date_range, date_grouping, format\n \n params = {\n :show_id => show_id,\n :date_range => date_range,\n :date_grouping => date_grouping,\n :format => format\n }\n \n response = connection.do_get(construct_url(\"analytics\", \"request_episodes_summary_report\"), params)\n \n # Convert to a hash\n return parse_token_response(response)\n end", "def index\n @lab_flows = LabFlow.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lab_flows }\n end\n end", "def show\n @test_summary = TestSummary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_summary }\n end\n end", "def summary\n @data['summary']\n end", "def show\n @updates = Summary.where(number: @summary.number)\n end", "def summary\n authenticated_post(\"summary\").body\n end", "def index\n @group_stats = GroupStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @group_stats }\n end\n end", "def index\n @patient_samples = PatientSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patient_samples }\n end\n end", "def show\n render json: Frame.find(params[:id])\n end", "def single_response_summary(id)\n get(\"/response/#{id}\")\n end", "def show\n @trading_time_frame = TradingTimeFrame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trading_time_frame }\n end\n end", "def index\n @bill_summaries = BillSummary.all\n end", "def summary(id)\n connection.get do |req|\n req.url \"job/#{id}/summary\"\n end\n end", "def summary\n \n end", "def index\n @points_histories = PointsHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @points_histories }\n end\n end", "def summary\n # TODO\n end", "def queries_summary(project_id)\n get \"projects/#{project_id}/queries/summary\"\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 @captures = Capture.all\n\n render json: @captures\n end", "def show\n @daily_statistic = DailyStatistic.find(params[:id])\n\n render json: @daily_statistic\n end", "def idsr_monthly_report_summary\n date = params[:year_month].split('-')\n @start_date = Date.new(date[0].to_i,date[1].to_i)\n\n @end_date = @start_date + 1.month - 1.day\n @disaggregated_diagnosis = {}\n\n idsr_monthly_set = ConceptName.where([\"name IN (?)\",[\"Idsr Monthly Summary\"]]).map(&:concept_id)\n\n\n idsr_monthly_set_members = ConceptSet.where([\"concept_set IN (?)\",idsr_monthly_set]).map(&:concept_id)\n\n concept_ids = ConceptName.where([\"concept_name.concept_id IN (?)\",\n idsr_monthly_set_members]).map(&:concept_id)\n\n observation = Observation.where([\"obs.obs_datetime >= ? AND obs.obs_datetime <= ?\n AND obs.value_coded IN (?)\",@start_date, @end_date,concept_ids]).includes({:person=>{}})\n\n observation.each do | obs|\n next if obs.person.blank?\n next if obs.answer_concept.blank?\n previous_date = obs.obs_datetime.strftime('%Y-%m-%d').to_date\n sex = obs.person.gender\n age = PatientService.age(obs.person, previous_date)\n diagnosis_name = obs.answer_concept.fullname rescue ''\n\n @disaggregated_diagnosis[diagnosis_name]={\n \"=<4\" =>0,\n \"=>5\" =>0\n }\n\n # if @disaggregated_diagnosis[diagnosis_name] != nil\n if age.to_i < 5\n @disaggregated_diagnosis[diagnosis_name][\"=<4\"]+=1\n else\n @disaggregated_diagnosis[diagnosis_name][\"=>5\"]+=1\n end\n # end\n # end\n @diaggregated_paginated = []\n @disaggregated_diagnosis.each { | diag, value |\n @diaggregated_paginated << [diag, value]\n }\n end\n #raise @diaggregated_paginated.inspect\n render :json=> @diaggregated_paginated\n end", "def summary\n end", "def summary\n end", "def summary\n {}\n end", "def show\n @patient_history = PatientHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_history }\n end\n end", "def index\n @analysis_responses = AnalysisResponse.all\n end", "def getPullRequestSummary(id)\n jsonHash = getJson(@url_pullrequests + \"/\" + id.to_s)\n return Summary.new(jsonHash, @options)\n end", "def index\n @local_cpu_summaries = LocalCpuSummary.orderByParms('id desc',params).paginate(:page=>params[:page], :per_page => config.itemsPerPageHTML)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @local_cpu_summaries }\n end\n end", "def index\n respond_to do |format|\n format.html do\n @recent_objects = Descriptor.recent_from_project_id(sessions_current_project_id)\n .order(updated_at: :desc).limit(10)\n render '/shared/data/all/index'\n end\n format.json {\n @descriptors = ::Queries::Descriptor::Filter.new(params).all\n .page(params[:page])\n .per(params[:per])\n .order('descriptors.name')\n }\n end\n end", "def attendance_result\n history_id = params[\"history_id\"]\n Net::HTTP.get(URI.parse(\"#{ENV['PY_SERVER_URL']}/image_matching/history/#{history_id}\"))\n history_student = HistoryStudent.where(history_id: history_id)\n render json: history_student\n end", "def update\n @framedp_summary = FramedpSummary.find(params[:id])\n\n respond_to do |format|\n if @framedp_summary.update_attributes(params[:framedp_summary])\n format.html { redirect_to @framedp_summary, notice: 'Framedp summary was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @framedp_summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @speaking_histories = SpeakingHistory.all\n end", "def get_file_summary(file_path)\n response = HTTParty.get(\"https://#{accountName}.azuredatalakestore.net\" +\n \"/webhdfs/v1/#{file_path}?op=GETCONTENTSUMMARY\", {\n body: \"grant_type=client_credentials&client_id=#{clientId}\"+\n \"&client_secret=#{clientSecret}\"+\n \"&resource=https%3A%2F%2Fmanagement.azure.com%2F\",\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Accept\" => \"*/*\",\n \"Cache-Control\" => 'no-cache',\n \"Host\" => \"#{accountName}.azuredatalakestore.net\",\n \"Connection\" => 'keep-alive',\n \"cache-control\" => 'no-cache'\n },\n verify: true,\n })\n \n return JSON.parse response.read_body\n end", "def index\n @recorded_broadcasts = RecordedBroadcast.where(broadcast_set_id: params[:broadcast_set_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recorded_broadcasts }\n end\n end", "def index\n @dis_additive_frequencies = DisAdditiveFrequency.all\n respond_to do |format|\n format.html\n format.json { render json:DisAdditiveFrequencieDatatable.new(view_context) }\n end\n end", "def index\n @fundamental_daily_position_stats = Fundamental::DailyPositionStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamental_daily_position_stats }\n end\n end", "def show\n @db_sequence = DbSequence.find(params[:id])\n @hmm_result_rows = @db_sequence.hmm_result_rows\n @db_entries = @db_sequence.db_entries\n dsbps = @db_sequence.db_sequence_best_profiles(:include => [:hmm_profile, :sequence_source])\n @best_profiles = dsbps.map{ |dsbp| [dsbp.sequence_source, dsbp.hmm_profile] }\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @db_sequence }\n end\n end", "def summary (view_id, options = nil)\n\t\t\trr = ReportRequest.new\n\t\t\trr.view_id = view_id\n\t\t\t# rr.filters_expression=\"ga:pagePath==/\"\n\t\t\trr.metrics = [set_metric(options)]\n\t\t\trr.date_ranges = [set_date_range(options)]\n\n\t\t\treport(rr)\n\t\tend", "def show\n respond_to do |f| \n f.json {\n render :json => { \n :activity_log => @activity_log,\n :snapshots => @activity_log.snapshots.order(\"id ASC\")\n }\n }\n end\n end", "def get_summary_details( session_key)\n response_xml = self.call( :get_summary_details, message: {\n arg0: session_key\n })\n response = IssueCentre::Response.parse( response_xml)\n end", "def index\n @dashboards = current_user.dashboards\n if !params[:detail]\n render json: @dashboards, each_serializer: DashboardSummarySerializer \n else\n render json: @dashboards\n end\n end", "def index\n @pds_patient_prev_med_histories = PdsPatientPrevMedHistory.all\n end", "def index\n @live_stream_series = LiveStreamSeries.all\n respond_with(@live_stream_series)\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @summary }\n end\n end", "def show\n @sample = Sample.find(params[:id])\n @stats = @sample.stats\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sample }\n format.json { render :json => @sample }\n end\n end", "def index\n @medical_histories = MedicalHistory.all\n end", "def index\n @medical_histories = MedicalHistory.all\n end", "def show\n @analysis = Analysis.find(params[:id])\n\n # Get all the relevant rows from the view stack\n estimates = execute <<-SQL\n select * from estimate_factors_analyses_categorized\n where analysis_name='#{@analysis.analysis_name}';\n SQL\n\n # Turn them into a map for handy fetching\n @estimates = {}\n @used_estimates = {}\n estimates.each do |estimate|\n @estimates[estimate['input_zone_id']+'@'+estimate['analysis_year']] = estimate\n @used_estimates[estimate['input_zone_id']] = true\n end\n\n respond_to do |format|\n format.html {\n render layout: 'fullscreen'\n }\n format.json { render json: @analysis }\n end\n end", "def get_labels_summary\n response = connection.get(get_labels_summary_url) do |request|\n request.params[:adminDeviceSpaceId] = \"1\"\n end\n if response.success?\n LabelsSummaryResponse.new(response.body)\n end\n end", "def index\n @lab_details = LabDetail.all\n end", "def index\n @pod_reports = PodReport.all\n end", "def index\n @settlement_histories = Settlement::History.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @settlement_histories }\n end\n end", "def wallet_summary\n get 'walletSummary'\n end", "def index\n @payloads = Payload.all\n end", "def index\n @notification_counts = NotificationCount.all\n\n render json: @notification_counts\n end", "def view_stats_all\n data = {\n :name => \"Company Views\",\n :pointInterval => 1.day * 1000,\n :pointStart => 1.weeks.ago.at_midnight.to_i * 1000,\n :data => (1.weeks.ago.to_date..Date.today).map{ |date|\n Impression.where(\n \"created_at > ? AND created_at < ? AND action_name = ? AND controller_name = ?\",\n date.at_beginning_of_day,\n date.tomorrow.at_beginning_of_day,\n 'stat_show',\n 'companies'\n ).select{ |impression| impression.action_name == \"stat_show\"}.count\n }\n }\n respond_with data\n end", "def summary\n ret = pending\n\n items = { UPCOMING: ret.response.items,\n CURRENT: ongoing.response.items }\n\n ret.response.items = items\n ret\n end", "def index\n @pediatric_histories = PediatricHistory.all\n end", "def index\n @monthly_summaries = MonthlySummary.all.order(:begin_at)\n end", "def index\n @jira_issue_summaries = JiraIssueSummary.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jira_issue_summaries }\n end\n end", "def index\n @disponibles = Disponible.take(50)\n\n render json: @disponibles, include: '**'\n end", "def get_sections_summary_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.get_sections_summary ...'\n end\n if @api_client.config.client_side_validation && opts[:'source'] && !['realtime', 'cached'].include?(opts[:'source'])\n fail ArgumentError, 'invalid value for \"source\", must be one of realtime, cached'\n end\n # resource path\n local_var_path = '/firewall/sections/summary'\n\n # query parameters\n query_params = {}\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FirewallSectionsSummaryList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#get_sections_summary\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_webhook_log_summaries_with_http_info(webhook_oid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WebhookApi.get_webhook_log_summaries ...'\n end\n # verify the required parameter 'webhook_oid' is set\n if @api_client.config.client_side_validation && webhook_oid.nil?\n fail ArgumentError, \"Missing the required parameter 'webhook_oid' when calling WebhookApi.get_webhook_log_summaries\"\n end\n # resource path\n local_var_path = '/webhook/webhooks/{webhookOid}/logs'.sub('{' + 'webhookOid' + '}', webhook_oid.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?\n query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?\n query_params[:'_since'] = opts[:'_since'] if !opts[:'_since'].nil?\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'WebhookLogSummariesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WebhookApi#get_webhook_log_summaries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n past_histories = PastHistory.where(user_id: params[:user_id])\n render json: past_histories.as_json(include: :recipe, only: :created_at)\n end", "def show\n @medhistory = Medhistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @medhistory }\n end\n end", "def index\n respond_to do |format|\n format.html { }\n format.json { render json: CaptureDatatable.new(view_context) }\n end\n end", "def show\n @historical = Historical.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historical }\n end\n end", "def index\n @web_service_logs = WebServiceLog.limit(20).order(\"id desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @web_service_logs }\n end\n end", "def group_activity_stream_summary(group_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"group_id is required\" if group_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :group_id => group_id\n )\n\n # resource path\n path = path_replace(\"/v1/groups/{group_id}/activity_stream/summary\",\n :group_id => group_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end", "def index\n @studies = Study.all\n #render json: @studies\n end", "def stats\n @server.make_json_request('show.stats', tvdbid: @tvdbid)['data']\n end", "def index\n @aframes = Aframe.all\n end", "def show\n @lab_flow = LabFlow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_flow }\n end\n end", "def show\n @points_history = PointsHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @points_history }\n end\n end", "def show\n @breadcrumb = 'read'\n @ratio_group = RatioGroup.find(params[:id])\n @ratios = @ratio_group.ratios.paginate(:page => params[:page], :per_page => per_page).order(:code)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ratio_group }\n end\n end", "def recent\n @calls = Call.where(\"audio_id IS NOT NULL\").order(\"start ASC\").limit(50).map do |call|\n { :id => call.id,\n :start => call.start,\n :end => call.end,\n :frequency => call.frequency,\n :group_full_name => call.group.full_name,\n :group_name => call.group.name }\n end\n \n respond_to do |format|\n format.html { render \"index\" }\n format.json { render json: @calls }\n end\n end", "def show\n render json: @service_history\n end", "def show\n authorize @bgg_publisher\n results = WithGameSummaries::SearchAndPaginate.call(params: params,\n initial_scope: @bgg_publisher.game_summaries,\n init_search: { game_summary_summaries_bgg_summary_id_in_all: [@bgg_publisher.id]}\n )\n\n @q = results.q\n @game_summaries = results.game_summaries\n\n end", "def index \n misses = Miss.all.order(created_at: :desc)\n render json: misses \n end" ]
[ "0.672472", "0.6032978", "0.598185", "0.59406495", "0.5869434", "0.58512163", "0.5845019", "0.5838353", "0.5756592", "0.5709459", "0.5709459", "0.5709459", "0.5709459", "0.5646136", "0.56455547", "0.5639625", "0.56332684", "0.56332684", "0.5599149", "0.5577415", "0.55582815", "0.55448604", "0.5523545", "0.55070865", "0.54913175", "0.548048", "0.54746497", "0.5470848", "0.5467727", "0.5466409", "0.54653066", "0.54466397", "0.5444363", "0.5428701", "0.5422284", "0.540586", "0.5402663", "0.5398903", "0.53988886", "0.53927267", "0.5352081", "0.53487426", "0.53221035", "0.53221035", "0.53220314", "0.5315557", "0.5306484", "0.52762055", "0.52624404", "0.5249374", "0.5248665", "0.52448434", "0.52388054", "0.522949", "0.5227578", "0.5226672", "0.52191126", "0.52167374", "0.5214009", "0.5212787", "0.52107394", "0.52096456", "0.52091855", "0.5207123", "0.5206317", "0.52046853", "0.5200177", "0.5200177", "0.5196526", "0.517267", "0.5170981", "0.5157762", "0.5153341", "0.514444", "0.51426417", "0.5141134", "0.5135198", "0.51339555", "0.5127776", "0.51276815", "0.51263964", "0.51238894", "0.5123107", "0.51207834", "0.5118171", "0.51175106", "0.5107076", "0.51066065", "0.51064867", "0.5103357", "0.51027155", "0.51015514", "0.5101189", "0.50982815", "0.509791", "0.5097534", "0.50967675", "0.5096495", "0.5093023", "0.5091949" ]
0.73398685
0
GET /framedp_summaries/new GET /framedp_summaries/new.json
def new @framedp_summary = FramedpSummary.new respond_to do |format| format.html # new.html.erb format.json { render json: @framedp_summary } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @framedp_summary = FramedpSummary.new(params[:framedp_summary])\n\n respond_to do |format|\n if @framedp_summary.save\n format.html { redirect_to @framedp_summary, notice: 'Framedp summary was successfully created.' }\n format.json { render json: @framedp_summary, status: :created, location: @framedp_summary }\n else\n format.html { render action: \"new\" }\n format.json { render json: @framedp_summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @summary }\n end\n end", "def new\n @test_summary = TestSummary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_summary }\n end\n end", "def new\n @frame = Frame.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @frame }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @general_frame }\n end\n end", "def new\n @points_history = PointsHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @points_history }\n end\n end", "def new\n @patient_history = PatientHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_history }\n end\n end", "def new\n @historical = Historical.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historical }\n end\n end", "def new\n @title = t('view.flows.new_title')\n @flow = Flow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flow }\n end\n end", "def new\n @history_study = HistoryStudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @history_study }\n end\n end", "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def new\n @query_history = QueryHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @query_history }\n end\n end", "def create\n @summary = Summary.new(summary_params)\n\n respond_to do |format|\n if @summary.save\n format.html { redirect_to @summary }\n format.json { render :show, status: :created, location: @summary }\n else\n format.html { render :new }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @stable = Stable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stable }\n end\n end", "def new\n @fundamentals_history = FundamentalsHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundamentals_history }\n end\n end", "def new\n @trading_time_frame = TradingTimeFrame.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trading_time_frame }\n end\n end", "def new\n @story = Story.find(params[:story_id])\n @frame = @story.frames.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @frame }\n end\n end", "def new\n @pdb = Pdb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pdb }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_frame }\n end\n end", "def new\n @analysis = Analysis.new\n\n respond_to do |format|\n format.html\n format.json { render json: @analysis }\n end\n end", "def new\n @experience_history = ExperienceHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experience_history }\n end\n end", "def new\n @operation_history = OperationHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @operation_history }\n end\n end", "def new\n @statusreport = Statusreport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @statusreport }\n end\n end", "def new\n @observation = Observation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation }\n end\n end", "def new\n @observation = Observation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation }\n end\n end", "def create\n @summary = Summary.new(summary_params)\n\n respond_to do |format|\n if @summary.save\n format.html { redirect_to @summary, notice: 'Summary was successfully created.' }\n format.json { render :show, status: :created, location: @summary }\n else\n format.html { render :new }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @quality_history = QualityHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quality_history }\n end\n end", "def new\n @dummy_table = DummyTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dummy_table }\n end\n end", "def new\n @census_count = CensusCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @census_count }\n end\n end", "def new\n @status_record = StatusRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_record }\n end\n end", "def new\n @stage_population = StagePopulation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stage_population }\n end\n end", "def new\n \n respond_to do |format|\n format.html # new.html.erb\n # format.json { render json: @sample }\n end\n end", "def new\n @lab_flow = LabFlow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_flow }\n end\n end", "def new\n @annual_stat = AnnualStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @annual_stat }\n end\n end", "def new\n @timeline = Timeline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timeline }\n end\n end", "def new\n @medhistory = Medhistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @medhistory }\n end\n end", "def new\n @activity = Activity.new\n @series = get_series('activities')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end", "def new\n @document_history = DocumentHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_history }\n end\n end", "def new\n @story_status = StoryStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story_status }\n end\n end", "def new\n @capture = Capture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capture }\n end\n end", "def new\n @record_status = RecordStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @record_status }\n end\n end", "def new\n @table = Table.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @table }\n end\n end", "def new\n @table = Table.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @table }\n end\n end", "def new\n @heat_source = HeatSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heat_source }\n end\n end", "def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end", "def new\n @processed_datum = ProcessedDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @processed_datum }\n end\n end", "def new\n @family_history = FamilyHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_history }\n end\n end", "def new\n @leader_history = LeaderHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @leader_history }\n end\n end", "def new\n @distribution_audit = DistributionAudit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @distribution_audit }\n end\n end", "def new\n @recent_activity = RecentActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recent_activity }\n end\n end", "def new\n @repuestum = Repuestum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repuestum }\n end\n end", "def new\r\n @frame = Frame.new\r\n @random_text = generate_password(15)\r\n @pad = Pad.find(:first, :conditions => [\"id=?\", params[:pad_id]])\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @frame }\r\n end\r\n end", "def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end", "def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end", "def new\n @category_history = CategoryHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category_history }\n end\n end", "def new\n @trend = Trend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trend }\n end\n end", "def new\n @term_count = TermCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @term_count }\n end\n end", "def new\n @patient_sample = PatientSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_sample }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rulebook }\n end\n end", "def new\n @precinct = Precinct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @precinct }\n end\n end", "def new\n @study = Study.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @study }\n end\n end", "def new\n @settlement_history = Settlement::History.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @settlement_history }\n end\n end", "def new\n @calculated_data_assessment = CalculatedDataAssessment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calculated_data_assessment }\n end\n end", "def for_new\n # @question_summary = Question.find_summary(:first, :conditions => ['questions.id=?',params[:question_id]], :auth => true, :unscoped => true)\n # @answer_summaries = @question_summary.answers.find(:all, answer_filters(:summary => true)) if @question_summary\n @question_summary = Question.find_summary(:first, :conditions => ['questions.id=?',params[:question_id]], :unscoped => true)\n @answer_summaries = @question_summary.answers.order(answer_filters[:order]).paginate(:page => params[:page]) if @question_summary\n end", "def new\n @asset_allocation_history = AssetAllocationHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asset_allocation_history }\n end\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dataset }\n end\n end", "def new\n fetch_data\n @payment = Payment.new(:payment_date => Date.today)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment }\n end\n end", "def new\n @issue = Issue.new\n\n @new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def new\n @call_history = CallHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @call_history }\n end\n end", "def new\n @military_history = MilitaryHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @military_history }\n end\n end", "def new\n @new_review = NewReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_review }\n end\n end", "def create\n daily_summary = current_user.daily_summaries.build(daily_summary_params)\n\n if daily_summary.save\n render json: daily_summary, status: 201\n else\n render json: {errors: daily_summary.errors}, status: 402\n end\n end", "def new\n @notebook = Notebook.new\n render json: @notebook\n end", "def new\n @healthrecord = Healthrecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @healthrecord }\n end\n end", "def new\n @nlp = Nlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nlp }\n end\n end", "def new\n @evaluationstatus = Evaluationstatus.new\n @title = 'New Evaluation Status'\n @description = 'Add a new evaluation status to the system'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @evaluationstatus }\n end\n end", "def new\n @pst = Pst.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @pst }\n end\n end", "def new\n @table = Table.new\n if Table.last.blank?\n @table.number = 1\n else\n @table.number = Table.last.number+1\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @table }\n end\n end", "def new\n @historial = Historial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial }\n end\n end", "def new\n @group_stat = GroupStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_stat }\n end\n end", "def new\n get_sources\n @stg_source = StgSource.all\n @report = Report.find(params[:report_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @source }\n end\n end", "def new\n @series = Series.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @series }\n end\n end", "def new\n @historial_odt = HistorialOdt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial_odt }\n end\n end", "def new\n @trend = Trend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @trend }\n end\n end", "def new\n @ptrack = Ptrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ptrack }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stat }\n end\n end", "def new\n @study = Study.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @study }\n end\n end", "def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end", "def new\n @match_stat = MatchStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match_stat }\n end\n end", "def new\n @scoring_method = ScoringMethod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scoring_method }\n end\n end", "def new\n @title = \"New Resources Periods\"\n @resource_period = ResourcePeriod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @resource_period }\n end\n end", "def new\n @planned_event = PlannedEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @planned_event }\n end\n end", "def new\n expire_page :action => :index\n expire_page :action => :show\n \n @jira_issue_summary = JiraIssueSummary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @jira_issue_summary }\n end\n end", "def new\n @desc = Desc.new\n @phase_collection = Desc.phase_hashes\n @star_collection = Desc.star_hashes\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @desc }\n end\n end", "def new\n @word_count = WordCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word_count }\n end\n end", "def new\n @congestion = Congestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @congestion }\n end\n end", "def new\n @audit = current_user.audits.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @audit }\n end\n end", "def create\n @monthly_summary = MonthlySummary.new(monthly_summary_params)\n\n respond_to do |format|\n if @monthly_summary.save\n format.html { redirect_to @monthly_summary, notice: 'Monthly summary was successfully created.' }\n format.json { render :show, status: :created, location: @monthly_summary }\n else\n format.html { render :new }\n format.json { render json: @monthly_summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @heat_log = HeatLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heat_log }\n end\n end", "def new\n @performance_test = PerformanceTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @performance_test }\n end\n end" ]
[ "0.7236628", "0.71282554", "0.6664434", "0.6633187", "0.661516", "0.65543383", "0.653464", "0.6522222", "0.65004045", "0.64370763", "0.6396831", "0.63895905", "0.634813", "0.6339417", "0.6336515", "0.6326113", "0.6310421", "0.6301756", "0.6294988", "0.6292946", "0.6289391", "0.62759346", "0.62746626", "0.6268591", "0.6268591", "0.6266485", "0.626471", "0.6261708", "0.6260388", "0.62577343", "0.6256484", "0.6252735", "0.6252448", "0.62477463", "0.62383986", "0.62355685", "0.62341845", "0.62298673", "0.6213878", "0.6212187", "0.6204571", "0.62044", "0.62044", "0.6191047", "0.61659604", "0.61605656", "0.61554575", "0.61393416", "0.61392736", "0.6132122", "0.61251134", "0.6123389", "0.6121198", "0.6121198", "0.6120121", "0.61164695", "0.61160487", "0.6115425", "0.61088353", "0.6108248", "0.6107679", "0.6107612", "0.61041445", "0.61030835", "0.6097489", "0.6093722", "0.6083665", "0.6082088", "0.6082067", "0.6079286", "0.6075731", "0.60752016", "0.60740554", "0.6071871", "0.6063846", "0.6062584", "0.606205", "0.60583156", "0.60577583", "0.6057331", "0.60547787", "0.605441", "0.60520345", "0.60502076", "0.60498786", "0.60484874", "0.6040115", "0.60382503", "0.6034937", "0.6031944", "0.60310596", "0.6029374", "0.6026374", "0.6024822", "0.6024617", "0.6020442", "0.6019795", "0.60174453", "0.6016532", "0.60141253" ]
0.7755582
0
POST /framedp_summaries POST /framedp_summaries.json
def create @framedp_summary = FramedpSummary.new(params[:framedp_summary]) respond_to do |format| if @framedp_summary.save format.html { redirect_to @framedp_summary, notice: 'Framedp summary was successfully created.' } format.json { render json: @framedp_summary, status: :created, location: @framedp_summary } else format.html { render action: "new" } format.json { render json: @framedp_summary.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @framedp_summary = FramedpSummary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @framedp_summary }\n end\n end", "def show\n @framedp_summary = FramedpSummary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @framedp_summary }\n end\n end", "def create\n daily_summary = current_user.daily_summaries.build(daily_summary_params)\n\n if daily_summary.save\n render json: daily_summary, status: 201\n else\n render json: {errors: daily_summary.errors}, status: 402\n end\n end", "def create\n @summary = Summary.new(summary_params)\n\n respond_to do |format|\n if @summary.save\n format.html { redirect_to @summary, notice: 'Summary was successfully created.' }\n format.json { render :show, status: :created, location: @summary }\n else\n format.html { render :new }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @summary = Summary.new(summary_params)\n\n respond_to do |format|\n if @summary.save\n format.html { redirect_to @summary }\n format.json { render :show, status: :created, location: @summary }\n else\n format.html { render :new }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @framedp_summary = FramedpSummary.find(params[:id])\n @framedp_summary.destroy\n\n respond_to do |format|\n format.html { redirect_to framedp_summaries_url }\n format.json { head :no_content }\n end\n end", "def dump_summary(duration, example_count, failure_count, pending_count)\n end", "def dump_summary(duration, example_count, failure_count, pending_count)\n end", "def summary\n authenticated_post(\"summary\").body\n end", "def index\n @summaries = Summary.all\n @summary = Summary.new\n end", "def summary\n \n end", "def create\n @monthly_summary = MonthlySummary.new(monthly_summary_params)\n\n respond_to do |format|\n if @monthly_summary.save\n format.html { redirect_to @monthly_summary, notice: 'Monthly summary was successfully created.' }\n format.json { render :show, status: :created, location: @monthly_summary }\n else\n format.html { render :new }\n format.json { render json: @monthly_summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def summary_params\n params.require(:summary).permit(:name, :number, :ic, :management_organization, :start_date, \n :size, :percent_complete, :incident_type, :cause, :suppression_strategy, \n :complexity, :report_date, :prepared_by, :approved_by, :primary_agency, \n :state, :county, :city, :jurisdiction, :ownership, :latitude, :longitude, \n :area_description, :fire_behavior, :narrative, :fuel_type, :damage_assessment, \n :injuries, :threat_remark, :weather, :projected_spread_12, :projected_spread_24, \n :projected_spread_48, :projected_spread_72, :projected_spread_after, :stragetic_objectives, \n :threat_12, :threat_24, :threat_48, :threat_72, :threat_after, :critical_needs_12, \n :critical_needs_24, :critical_needs_48, :critical_needs_72, :critical_needs_after, \n :strategic_discussion, :tomorrows_plan, :anticipated_completion, :cost, :remarks, \n :resources, :cooperators, :date, :parent_id)\n end", "def create_release_card summary\n # build post object\n url = 'https://api.github.com/projects/columns/%s/cards' % RELEASE\n uri = URI url\n post = Net::HTTP::Post.new uri, HEADERS\n post.body = { 'note' => summary }.to_json\n\n # create connection and send post\n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = 'https' == uri.scheme\n response = http.request post\n log 'release.log', \"#{response.inspect}: #{response.body}: #{response.uri}\" if response.code >= '400'\nend", "def create\n @summary = Summary.new(summary_params)\n\n respond_to do |format|\n if @summary.save\n format.html { redirect_to user_path(current_user.username), notice: 'Summary was successfully created.' }\n format.json { render :show, status: :created, location: @summary }\n else\n format.html { render :new }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @framedp_summary = FramedpSummary.find(params[:id])\n\n respond_to do |format|\n if @framedp_summary.update_attributes(params[:framedp_summary])\n format.html { redirect_to @framedp_summary, notice: 'Framedp summary was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @framedp_summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def idsr_monthly_report_summary\n date = params[:year_month].split('-')\n @start_date = Date.new(date[0].to_i,date[1].to_i)\n\n @end_date = @start_date + 1.month - 1.day\n @disaggregated_diagnosis = {}\n\n idsr_monthly_set = ConceptName.where([\"name IN (?)\",[\"Idsr Monthly Summary\"]]).map(&:concept_id)\n\n\n idsr_monthly_set_members = ConceptSet.where([\"concept_set IN (?)\",idsr_monthly_set]).map(&:concept_id)\n\n concept_ids = ConceptName.where([\"concept_name.concept_id IN (?)\",\n idsr_monthly_set_members]).map(&:concept_id)\n\n observation = Observation.where([\"obs.obs_datetime >= ? AND obs.obs_datetime <= ?\n AND obs.value_coded IN (?)\",@start_date, @end_date,concept_ids]).includes({:person=>{}})\n\n observation.each do | obs|\n next if obs.person.blank?\n next if obs.answer_concept.blank?\n previous_date = obs.obs_datetime.strftime('%Y-%m-%d').to_date\n sex = obs.person.gender\n age = PatientService.age(obs.person, previous_date)\n diagnosis_name = obs.answer_concept.fullname rescue ''\n\n @disaggregated_diagnosis[diagnosis_name]={\n \"=<4\" =>0,\n \"=>5\" =>0\n }\n\n # if @disaggregated_diagnosis[diagnosis_name] != nil\n if age.to_i < 5\n @disaggregated_diagnosis[diagnosis_name][\"=<4\"]+=1\n else\n @disaggregated_diagnosis[diagnosis_name][\"=>5\"]+=1\n end\n # end\n # end\n @diaggregated_paginated = []\n @disaggregated_diagnosis.each { | diag, value |\n @diaggregated_paginated << [diag, value]\n }\n end\n #raise @diaggregated_paginated.inspect\n render :json=> @diaggregated_paginated\n end", "def episodes_summary_report show_id, date_range, date_grouping, format\n \n params = {\n :show_id => show_id,\n :date_range => date_range,\n :date_grouping => date_grouping,\n :format => format\n }\n \n response = connection.do_get(construct_url(\"analytics\", \"request_episodes_summary_report\"), params)\n \n # Convert to a hash\n return parse_token_response(response)\n end", "def dump_summary *args; end", "def create\n @bill_summary = BillSummary.new(bill_summary_params)\n\n respond_to do |format|\n if @bill_summary.save\n format.html { redirect_to @bill_summary, notice: 'Bill summary was successfully created.' }\n format.json { render :show, status: :created, location: @bill_summary }\n else\n format.html { render :new }\n format.json { render json: @bill_summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @pad = Pad.find(:first, :conditions => [\"id=?\", params[:frame][:pad_id]])\r\n @frame = Frame.new\r\n @frame.name = params[:frame][:name]\r\n @frame.pad_id = params[:frame][:pad_id]\r\n @frame.descr = params[:frame][:descr]\r\n @frame.image = params[:frame][:image]\r\n respond_to do |format|\r\n @pad.frames << @frame\r\n format.html { redirect_to @frame, notice: 'Frame was successfully created.' }\r\n format.json { render json: @frame, status: :created, location: @frame }\r\n end\r\n end", "def create\n @summary = Summary.new(summary_params)\n user = current_user\n @summary.user = user\n\n respond_to do |format|\n if @summary.save\n format.html { redirect_to @summary, notice: 'Summary was successfully created.' }\n format.json { render :show, status: :created, location: @summary }\n else\n format.html { render :new }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @summary }\n end\n end", "def dump_summary(summary_notification)\n #super(summary_notification)\n\n duration = summary_notification.duration\n example_count = summary_notification.examples.size\n failure_count = summary_notification.failed_examples.size\n pending_count = summary_notification.pending_examples.size\n\n failed_examples = summary_notification.failed_examples\n\n error_count = 0\n\n failed_examples.each do |e|\n if RSpec::Expectations::ExpectationNotMetError === e.exception\n #failure_count += 1\n else\n failure_count -= 1\n error_count += 1\n end\n end\n\n passing_count = example_count - failure_count - error_count - pending_count\n\n doc = {\n 'type' => 'final',\n 'time' => duration,\n 'counts' => {\n 'total' => example_count,\n 'pass' => passing_count,\n 'fail' => failure_count,\n 'error' => error_count,\n 'omit' => 0,\n 'todo' => pending_count\n }\n }\n return doc\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 summary\n # TODO\n end", "def make_summaries\n if @data.key?(\"Global\") && @data.key?(\"Countries\") && @data.key?(\"Date\")\n global_data = @data[\"Global\"]\n global_data[\"Date\"] = @data[\"Date\"]\n global_data[\"Country\"] = \"Global\"\n\n # Clean up global_data with the parser method\n global_hash = parser(global_data)\n\n # Create the Summary object for global info\n CovidTracking::Summary.new(global_hash)\n\n @data[\"Countries\"].each {|ctry_info| CovidTracking::CountrySummary.new(parser(ctry_info))}\n else\n raise DataError\n end\n\n end", "def summary\n end", "def summary\n end", "def create\n @frame = Frame.new(params[:frame])\n\n respond_to do |format|\n if @frame.save\n format.html { redirect_to @frame, notice: 'Frame was successfully created.' }\n format.json { render json: @frame, status: :created, location: @frame }\n else\n format.html { render action: \"new\" }\n format.json { render json: @frame.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @summary_phase = SummaryPhase.new(summary_phase_params)\n\n respond_to do |format|\n if @summary_phase.save\n format.html { redirect_to @summary_phase, notice: 'Summary phase was successfully created.' }\n format.json { render :show, status: :created, location: @summary_phase }\n else\n format.html { render :new }\n format.json { render json: @summary_phase.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @annual_summary_report = AnnualSummaryReport.new(annual_summary_report_params)\n\n #create default questions\n questions = Question.all\n @annual_summary_report.user_id = current_user.id\n @annual_summary_report.status = 1\n\n respond_to do |format|\n if @annual_summary_report.save\n for question in questions\n answer = Answer.new\n answer.question = question.question\n answer.question_id = question.id\n answer.answer = '';\n answer.section_id = question.section_id\n answer.annual_summary_report_id = @annual_summary_report.id\n answer.save\n end\n\n format.html { redirect_to @annual_summary_report }\n format.json { render :show, status: :created, location: @annual_summary_report }\n else\n format.html { render :new }\n format.json { render json: @annual_summary_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def draw_summary_table\n header = [\"Date\", \"Issue Number\", \n \"Total Subscribers\", \"Change in Subscribers\"]\n\n body = report.table(:date,:number,:count,:delta)\n\n document.table([header]+body) do |t|\n t.header = true\n t.style(t.columns(1..-1)) { |c| c.align = :right }\n end\n end", "def summary_params\n params.require(:summary).permit(:username, :post_title, :summary_entry, :user_id)\n end", "def new\n @test_summary = TestSummary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_summary }\n end\n end", "def summary_params\n params.require(:summary).permit(:text, :player_id, :user_id)\n end", "def summarise days = 7, debug = nil\n days = days.to_i\n data = [ ]\n file = self.get_summary_file.gsub 'summary', 'daily'\n daily = self.class.get_json file\n start_date = 0\n d = nil\n last = 0\n prev = 0\n cut_off_date = ( DateTime.now - days ).to_s\n File.open( self.get_log_file, 'r' ).each_line do | line |\n begin\n line = JSON.parse line\n rescue\n line = nil\n end\n if line and line['timestamp'] and ( last != line['message']['usage'] )\n next if ( cut_off_date > line['timestamp'] )\n new_line = []\n d = line['timestamp'][2..3] + line['timestamp'][5..6] + line['timestamp'][8..9] # compact version of date\n ts = Time.parse( line['timestamp'] ).strftime '%s'\n ts = ts.to_i\n ts = ts - start_date\n if start_date == 0\n # start_date = ts # can't get this delta working\n end\n new_line << ts\n smoothedUsage = line['message']['usage'].to_i\n if last != 0 and prev != 0\n smoothedUsage = ( smoothedUsage + last + prev ) / 3 # average of last 3 readings\n end\n new_line << smoothedUsage\n if line['message']['annotation'] and line['message']['annotation']['title'] and line['message']['annotation']['text']\n new_line << line['message']['annotation']['title']\n new_line << line['message']['annotation']['text']\n end\n data << new_line\n if (( ! daily[d] ) or ( line['message']['today'].to_i > daily[d]['today'].to_i ))\n daily[d] = line['message']\n daily[d].delete 'usage'\n end\n prev = last\n last = line['message']['usage'].to_i\n end\n end\n if data and data.first\n if data.first.first != start_date\n data.first[0] += start_date\n end\n end\n summary_file = self.get_summary_file\n File.open( summary_file, 'w' ) do |file|\n file.write( JSON.pretty_generate( data ))\n end\n File.open( summary_file.gsub( 'summary', 'daily' ), 'w' ) do | file |\n file.write daily.to_json.to_s\n end\n File.open( summary_file.gsub( 'summary', 'daily.' + d ), 'w' ) do | file |\n file.write daily.select { |key| key == daily.keys.last }.to_json.to_s\n end\n end", "def new\n # 1. Get Frame from Kafka (encoded in base64)\n frame_encoded = Kafka::GetAttendanceFrameService.new(topic_name).execute\n frame_encoded_base64 = 'data:image/jpeg;base64,' + frame_encoded\n # 2. Send Frame to Attendance MicroService along with group students\n group_students = @lecture_instance.group.students.pluck(:student_id)\n params = { image: frame_encoded, ids: group_students }\n results = Attendance::GetAttendanceService.new(params).execute\n\n face_boxes = JSON.parse(JSON.parse(results.body))['face_boxes']\n face_boxes.each do |face_box|\n face_box['boundaries'] = face_box['boundaries'].join(',')\n end\n\n # 3. Return Frame and the Returned Face Boxes\n render json: { image: frame_encoded_base64, face_boxes: face_boxes }, status: :ok\n end", "def summary\n {}\n end", "def display_scores\n score_frames, total_values = {}, []\n total_score = total_frames_score.last\n total_frames_score.pop\n total_frames_score.each_with_index do |value, index|\n score_frames[\"frame#{index+1}\"] = value\n end\n score_frames[\"total_score\"] = total_score\n score_frames[\"created_at\"] = Time.now.strftime(\"%d-%m-%Y %I:%M%p\")\n total_values << score_frames if score_frames.present?\n end", "def summary\n response = get \"summary\", {}\n Hashie::Mash.new(response)\n end", "def show\n @summaries = Summary.all \n end", "def index\n @summaries = Summary.where(player_id: params[:player_id]).paginate(page: params[:page], per_page: 5)\n @summaries ||= Summary.paginate(page: params[:page], per_page: 5)\n end", "def create_summary_average_report\n setup_summary_report\n @data = PppamsCategoryBaseRef.indicator_summary_between(@show_from, @show_to, summary_query_options)\n render_report('summary_average')\n end", "def table_summary(summary_hash)\n header = [\n 'label', 'tps', 'error_percent', 'mean', 'median', '75th', '95th', '99th'\n ]\n data_rows = []\n labels = summary_hash.keys\n labels.delete('ALL')\n labels << 'ALL'\n labels.each do |label|\n row = []\n header.each do |key|\n if key == 'error_percent'\n error_perc = summary_hash[label][key]\n error_perc = error_perc.to_s.red if error_perc > 0\n row << error_perc\n elsif key == 'label'\n final_label = label\n final_label = label.green if label == 'ALL'\n row << final_label\n else\n row << summary_hash[label][key]\n end\n end\n data_rows << row\n end\n puts Terminal::Table.new headings: header, rows: data_rows\n return data_rows\nend", "def create\n @summary_report = SummaryReport.new(params[:summary_report])\n\n respond_to do |format|\n if @summary_report.save\n flash[:notice] = 'SummaryReport was successfully created.'\n format.html { redirect_to(@summary_report) }\n format.xml { render :xml => @summary_report, :status => :created, :location => @summary_report }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @summary_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @story = Story.find(params[:story_id])\n @frame = @story.frames.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @frame }\n end\n end", "def summary_params\n params.require(:summary).permit(:sales, :services, :cash, :unpaid_bills, :bills_paid, :employees)\n end", "def parse_from_summary(data)\n # \n end", "def raw_summary\n report = { \"version\" => { \"config\" => configuration_version, \"puppet\" => Puppet.version } }\n\n @metrics.each do |name, metric|\n key = metric.name.to_s\n report[key] = {}\n metric.values.each do |name, label, value|\n report[key][name.to_s] = value\n end\n report[key][\"total\"] = 0 unless key == \"time\" or report[key].include?(\"total\")\n end\n (report[\"time\"] ||= {})[\"last_run\"] = Time.now.tv_sec\n report\n end", "def process_tb_screened\n tb_screened_data = find_tb_screened_data\n tb_screened_data.each do |patient|\n age_group = patient['age_group']\n next unless pepfar_age_groups.include?(age_group)\n\n gender = patient['gender'].to_sym\n metrics = @report[age_group][gender]\n enrollment_date = patient['enrollment_date']\n tb_status = patient['tb_status'].downcase\n tb_confirmed_date = patient['tb_confirmed_date']\n\n if new_on_art(enrollment_date)\n metrics[:sceen_pos_new] << patient['patient_id'] if ['tb suspected', 'sup'].include?(tb_status)\n metrics[:sceen_neg_new] << patient['patient_id'] if ['tb not suspected', 'nosup'].include?(tb_status)\n metrics[:started_tb_new] << patient['patient_id'] if tb_confirmed_date.present?\n else\n metrics[:sceen_pos_prev] << patient['patient_id'] if ['tb suspected', 'sup'].include?(tb_status)\n metrics[:sceen_neg_prev] << patient['patient_id'] if ['tb not suspected', 'nosup'].include?(tb_status)\n metrics[:started_tb_prev] << patient['patient_id'] if tb_confirmed_date.present?\n end\n end\n end", "def build_summary_data(start_time, end_time, response)\n build_enphase_summary(response.body) \n build_data_harvest(start_time, end_time, response)\n \n total_end_time = Time.now.to_f\n build_job(start_time, total_end_time)\n end", "def summary (view_id, options = nil)\n\t\t\trr = ReportRequest.new\n\t\t\trr.view_id = view_id\n\t\t\t# rr.filters_expression=\"ga:pagePath==/\"\n\t\t\trr.metrics = [set_metric(options)]\n\t\t\trr.date_ranges = [set_date_range(options)]\n\n\t\t\treport(rr)\n\t\tend", "def index\n @bill_summaries = BillSummary.all\n end", "def new_wall_summary\n \trender \"new_wall_summary\"\n end", "def create_html_summary\r\n puts \"Creating HTML...\"\r\n @dmds = @lists.last\r\n @html = '<html>'\r\n @html += '<head><link rel=\"stylesheet\" href=\"styles.css\"></head>'\r\n @html += '<body>'\r\n @html += \"<h3>Actions</h3>\\n<ul>\"\r\n @html += actions_html\r\n @html += \"</ul>\\n\"\r\n #@html += \"<h3>Prios diff</h3>\\n<ul>\"\r\n #@html += prio_diff_html\r\n #@html += \"</ul>\\n\"\r\n #@html += \"<h3>Closed DMD</h3>\\n<ul>\"\r\n #@html += closed_dmd_html\r\n #@html += \"</ul>\\n\"\r\n @html += \"<h3>Open DM</h3>\"\r\n ano, evo = sas_report\r\n @html += \"<table><tr><td>Nature of changes</td><td>P0</td><td>P1</td><td>P2/P3</td><td>Total</td></tr>\r\n <tr><td>Anomalies</td><td>#{ano['0']}</td><td>#{ano['1']}</td><td>#{ano['2']+ano['3']}</td><td>#{ano['0']+ano['1']+ano['2']+ano['3']}</td></tr>\r\n <tr><td>Evolutions</td><td>#{evo['0']}</td><td>#{evo['1']}</td><td>#{evo['2']+evo['3']}</td><td>#{evo['0']+evo['1']+evo['2']+evo['3']}</td></tr>\r\n <tr><td>Total</td><td>#{ano['0']+evo['0']}</td><td>#{ano['1']+evo['1']}</td><td>#{ano['2']+ano['3']+evo['2']+evo['3']}</td><td>#{ano['0']+evo['0']+ano['1']+evo['1']+ano['2']+ano['3']+evo['2']+evo['3']}</td></tr>\r\n <table>\"\r\n count = prios_hash\r\n @html += \"<h3>Non analysed DMD, by priority</h3><ul>\\n\"\r\n @html += \"<b>Stats</b><ul>TBD: #{count['TBD']}<br/>P0: #{count['0']}<br/>P1: #{count['1']}<br/>P2: #{count['2']}<br/>P3: #{count['3']}<br/></ul>\\n\"\r\n @html += \"#{priority_html(priority_dmd)}</ul>\\n\"\r\n @html += \"<h3>Evo</h3>\\n<ul>#{priority_html(priority_evo)}</ul>\\n\"\r\n @html += \"<h3>Analysed but not batched DMD</h3>\\n<ul>#{analysed_html(analysed_dmd)}</ul>\\n\"\r\n @html += \"<h3>Has workload but not 'analysed' DMD</h3>\\n<ul>#{analysed_html(workload_dmd)}</ul>\\n\"\r\n @html += \"<h3>Decided DMD</h3>\\n<ul>#{decided_html(decided_dmd)}</ul>\\n\"\r\n @html += \"<h3>Last updated</h3>\\n<ul>#{last_updated_html(last_updated_dmd)}</ul>\\n\"\r\n @html += '</body>'\r\n @html += '</html>'\r\n end", "def create\n @trading_time_frame = TradingTimeFrame.new(params[:trading_time_frame])\n\n respond_to do |format|\n if @trading_time_frame.save\n format.html { redirect_to @trading_time_frame, notice: 'Trading time frame was successfully created.' }\n format.json { render json: @trading_time_frame, status: :created, location: @trading_time_frame }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trading_time_frame.errors, status: :unprocessable_entity }\n end\n end\n end", "def summary(workspace_id, params={})\n get_report('summary', workspace_id, params)\n end", "def create\n @local_cpu_summary = LocalCpuSummary.new(params[:local_cpu_summary])\n\n respond_to do |format|\n if @local_cpu_summary.save\n format.html { redirect_to @local_cpu_summary, :notice => 'Local cpu summary was successfully created.' }\n format.json { render :json => @local_cpu_summary, :status => :created, :location => @local_cpu_summary }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @local_cpu_summary.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_summary\r\n puts \"Creating a summary...\"\r\n #@lists.disp_summary\r\n create_html_summary\r\n file = File.open('test.html','w')\r\n file << @html\r\n file.close\r\n end", "def summary; end", "def summary; end", "def summary; end", "def summary; end", "def new\n @frame = Frame.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @frame }\n end\n end", "def summary\n @data['summary']\n end", "def create\n#render :text => params[:test_summary][:file].inspect and return\n @test_summary = TestSummary.new(params[:test_summary])\n\t@test_summary.test_date = change_date_format(params[:test_summary][:test_date]) if !params[:test_summary][:test_date].blank?\n\t@test_summary.user = current_user\n\t@test_summary.organization = current_user.organization\n#render :text => params[:test_summary] and return\n respond_to do |format|\n if @test_summary.save\n\n format.html { redirect_to @test_summary, notice: 'Test summary was successfully created.' }\n format.json { render json: @test_summary, status: :created, location: @test_summary }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @villagesummaryreport = Villagesummaryreport.new(villagesummaryreport_params)\n\n respond_to do |format|\n if @villagesummaryreport.save\n format.html { redirect_to @villagesummaryreport, notice: 'Villagesummaryreport was successfully created.' }\n format.json { render action: 'show', status: :created, location: @villagesummaryreport }\n else\n format.html { render action: 'new' }\n format.json { render json: @villagesummaryreport.errors, status: :unprocessable_entity }\n end\n end\n end", "def summary_params\n params.require(:summary).permit(:bank_id)\n end", "def index\n @summary_phases = SummaryPhase.all\n end", "def status_summary(statuspage_id)\n request :method => :get,\n :url => @url + 'status/summary/' + statuspage_id\n end", "def dump_payloads\n\ttbl = Rex::Ui::Text::Table.new(\n\t\t'Indent' => 4,\n\t\t'Header' => \"Framework Payloads (#{$framework.stats.num_payloads} total)\",\n\t\t'Columns' =>\n\t\t\t[\n\t\t\t\t\"Name\",\n\t\t\t\t\"Description\"\n\t\t\t])\n\n\t$framework.payloads.each_module { |name, mod|\n\t\ttbl << [ name, mod.new.description ]\n\t}\n\n\t\"\\n\" + tbl.to_s + \"\\n\"\nend", "def score_summary_params\n params.require(:score_summary).permit(:score, :reachedby, :u)\n end", "def setup_summary_report\n assign_to_from_dates\n @filter = @filter.remove_blanks_in_arrays\n @filter_name = @filter[:name]\n assign_grouping_type\n assign_facilities\n end", "def create\n @frame = Frame.new(params[:frame])\n\n if @frame.save\n respond_to do |format|\n format.html {\n render :json => [@frame.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json {\n render :json => [@frame.to_jq_upload].to_json\n }\n end\n else\n render :json => [{:error => \"custom_failure\"}], :status => 304\n end\n end", "def annual_summary_report_params\n params.require(:annual_summary_report).permit(:user_id, :title, :year, :status)\n end", "def report_metrics\n metadata = {\n 'sourcetype' => 'json',\n 'source' => 'chef-handler',\n 'host' => node.hostname,\n 'index' => @index,\n 'check-index' => false\n }\n\n # We're creating a new Hash b/c 'node' and 'all_resources' in run_status\n # are just TOO large.\n event = {\n :failed => run_status.failed?,\n :start_time => run_status.start_time,\n :end_time => run_status.end_time,\n :elapsed_time => run_status.elapsed_time,\n :exception => run_status.formatted_exception\n }.to_json\n\n splunk_post(event, metadata)\n end", "def validation_test(lst = @hits)\n\n rfs = lst.map{ |x| x.hsp_list.map{ |y| y.query_reading_frame}}.flatten\n frames_histo = Hash[rfs.group_by { |x| x }.map { |k, vs| [k, vs.length] }]\n\n answ = BlastRFValidationOutput.new(frames_histo)\n\n end", "def create\n megam_rest.post_billedhistories(to_hash)\n end", "def label_tests_summary(path:) \n json = File.read(path.to_s)\n data = JSON.parse(json)\n data[\"tests_summary_messages\"].each { |message| \n if !message.empty?\n message.insert(1, \"**📢 [\" + read_platform_from_file(path: path) + \"]**\")\n end\n }\n File.open(path.to_s,\"w\") do |f|\n f.puts JSON.pretty_generate(data)\n end \n end", "def create\n @post_spam_report = PostSpamReport.new(params[:post_spam_report])\n\n if @post_spam_report.save\n render json: @post_spam_report, status: :created, location: @post_spam_report\n else\n render json: @post_spam_report.errors, status: :unprocessable_entity\n end\n end", "def create\n expire_page :action => :index\n expire_page :action => :show\n \n @jira_issue_summary = JiraIssueSummary.new(params[:jira_issue_summary])\n\n respond_to do |format|\n if @jira_issue_summary.save\n format.html { redirect_to(@jira_issue_summary, :notice => 'Jira issue summary was successfully created.') }\n format.xml { render :xml => @jira_issue_summary, :status => :created, :location => @jira_issue_summary }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @jira_issue_summary.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\r\n @frames = Frame.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @frames }\r\n end\r\n end", "def index\n @traces = Trace.all\n\n render json: @traces\n end", "def create_summaries(obj, base_time)\n base_start = base_time\n base_end = base_time + 40.hours\n summaries = {\n :all => obj.summary,\n :all_constrained => obj.summary(base_start ... base_end),\n :wide => obj.summary(base_start - 1.hours ... base_end + 1.hours),\n #TODO: push this farther forward?\n :clipped => obj.summary(base_start + 30.minutes ... base_start + 25.hours),\n :empty => obj.summary(base_start ... base_start),\n }\n\n #TODO: move?\n if obj.respond_to?(:by_command_name)\n summaries[:all_filtered] = obj.by_command_name('vi').summary(base_start ... base_end)\n end\n\n summaries\n end", "def create\n @weekly_histogram = WeeklyHistogram.new(weekly_histogram_params)\n\n respond_to do |format|\n if @weekly_histogram.save\n format.html { redirect_to @weekly_histogram, notice: 'Weekly histogram was successfully created.' }\n format.json { render :show, status: :created, location: @weekly_histogram }\n else\n format.html { render :new }\n format.json { render json: @weekly_histogram.errors, status: :unprocessable_entity }\n end\n end\n end", "def push_fabrication_stats\n data = Tools::TestResourceDataProcessor.resources.flat_map do |resource, values|\n values.map { |v| fabrication_stats(resource: resource, **v) }\n end\n return if data.empty?\n\n write_api.write(data: data)\n log(:debug, \"Pushed #{data.length} resource fabrication entries to influxdb\")\n rescue StandardError => e\n log(:error, \"Failed to push fabrication stats to influxdb, error: #{e}\")\n end", "def save\n response = send_calendar_request(\"/\", :post, {:summary => @summary}.to_json) \n update_after_save(response)\n end", "def create\n @summary_vote = SummaryVote.new(params[:summary_vote])\n \n respond_to do |format|\n if @summary_vote.save\n flash[:notice] = 'SummaryVote was successfully created.'\n format.html { redirect_to(@summary_vote.summary.document) }\n format.xml { render :xml => @summary_vote, :status => :created, :location => @summary_vote }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @summary_vote.errors, :status => :unprocessable_entity }\n end\n end\n end", "def dump_summary *args\n return unless iterm?\n\n if args.count == 4\n notification = Struct.new(:duration, :example_count, :failure_count, :pending_count).new *args\n else\n notification = args.first\n end\n _dump_summary notification\n p @error_message if @error_message\n end", "def year_amount_summary\n render json: Year.year_amount_summary(params[:year]), each_serializer: YearsAmountSummarySerializer, :callback => params[:callback]\n end", "def print_summary(dsobj)\n dshash = get_dshash(dsobj)\n ds_pollint_m = dshash['pollint_s'].to_i / 60\n dp_alert_count = 0.to_i\n\n # iterate over each datapoint\n dshash['datapoints'].each { |datapoint|\n dphash = get_dphash(datapoint)\n\n # is the alert trigger set on this datapoint\n if ( dphash['alert_trigger'].size > 0 )\n # yes, increment the alert count var\n dp_alert_count += 1\n end\n\n }\n\n puts \"Summary:\\n\"\n\n puts \" - datasource name:\\t\" + dshash['name'] + \"\\n\"\n puts \" - display name:\\t\" + dshash['dname'] + \"\\n\"\n puts \" - applies to:\\t\\t\" + dshash['applies'] + \"\\n\"\n puts \" - search keywords:\\t\" + dshash['tags'] + \"\\n\"\n puts \" - polling interval:\\t\" + ds_pollint_m.to_s + \"m\\n\"\n puts \" - multi instance:\\t\" + dshash['multi'] + \"\\n\"\n puts \" - datapoints:\\t\\t\" + dshash['datapoints'].size.to_s + \"\\n\"\n puts \" - datapoint alerts:\\t\" + dp_alert_count.to_s + \"\\n\"\n puts \" - graphs:\\t\\t\" + dshash['graphs'].size.to_s + \"\\n\"\n puts \" - overview graphs:\\t\" + dshash['ographs'].size.to_s + \"\\n\"\n puts \"=====================\\n\"\n end", "def get_webhook_log_summaries_with_http_info(webhook_oid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WebhookApi.get_webhook_log_summaries ...'\n end\n # verify the required parameter 'webhook_oid' is set\n if @api_client.config.client_side_validation && webhook_oid.nil?\n fail ArgumentError, \"Missing the required parameter 'webhook_oid' when calling WebhookApi.get_webhook_log_summaries\"\n end\n # resource path\n local_var_path = '/webhook/webhooks/{webhookOid}/logs'.sub('{' + 'webhookOid' + '}', webhook_oid.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?\n query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?\n query_params[:'_since'] = opts[:'_since'] if !opts[:'_since'].nil?\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'WebhookLogSummariesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WebhookApi#get_webhook_log_summaries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n\n respond_to do |format|\n if @time_frame.save\n format.html { redirect_to time_frames_path, notice: 'Time frame was successfully created.' }\n format.json { render json: @time_frame, status: :created, location: @time_frame }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_frame.errors, status: :unprocessable_entity }\n end\n end\n end", "def bill_summary_params\n params.require(:bill_summary).permit(:Title, :PaymentDate, :Description, :Amount)\n end", "def post_params\n params.require(:post).permit(:summary,)\n end", "def create\n @sensory_analysis = @sample.sensory_analyses.build(sensory_analysis_params)\n\n @metric = Metric.find( @sensory_analysis.metric.id)\n respond_to do |format|\n if @sensory_analysis.save\n flash[:success] = 'Sensory analysis was successfully created.'\n format.html { redirect_to action: 'index', metric_id: @metric}\n format.json { render :show, status: :created, location: @sensory_analysis }\n else\n format.html { render :new }\n format.json { render json: @sensory_analysis.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n redirect_to pod_reports_url\n end", "def create_table(payload)\n make_request(payload, 'post')\n [status, body]\n end", "def create\n @game_id = params[:game_id]\n @players = User.where(:id => Game.find(@game_id).score_board.keys)\n @frame = Frame.new(frame_params.merge!(game_id: @game_id))\n respond_to do |format|\n if @frame.save\n format.html { redirect_to game_frames_url, notice: 'Frame was successfully created.' }\n format.json { render :index, status: :created, location: @frame }\n else\n format.html { render :new }\n format.json { render json: @frame.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6450295", "0.57815194", "0.56836575", "0.5571657", "0.554901", "0.55406606", "0.5516639", "0.5516639", "0.530029", "0.52817714", "0.5275705", "0.525951", "0.524886", "0.523936", "0.52131325", "0.52118635", "0.51829076", "0.5126057", "0.5103483", "0.5094349", "0.50934595", "0.5093045", "0.5078654", "0.50751793", "0.5063411", "0.49806705", "0.49728495", "0.49711305", "0.49711305", "0.49591687", "0.49427545", "0.49337992", "0.49317905", "0.49298087", "0.4919411", "0.49125418", "0.49047247", "0.4866661", "0.4866314", "0.486577", "0.48078135", "0.47900492", "0.47816145", "0.47787064", "0.47742093", "0.4755092", "0.4754027", "0.47526032", "0.47519058", "0.47426277", "0.47295246", "0.47290358", "0.47137514", "0.4712154", "0.47074917", "0.4702712", "0.46981156", "0.46792036", "0.4673741", "0.46710512", "0.46623465", "0.46623465", "0.46623465", "0.46623465", "0.46613988", "0.46483204", "0.46463558", "0.46453202", "0.46419737", "0.4641511", "0.46413895", "0.4639921", "0.4638503", "0.46351358", "0.46259347", "0.46253306", "0.46187195", "0.46137038", "0.4611713", "0.4597515", "0.45932162", "0.45930555", "0.45928767", "0.45899764", "0.45889965", "0.45882434", "0.45817542", "0.45777506", "0.45768178", "0.45760337", "0.4573371", "0.4565397", "0.45623904", "0.455558", "0.4552013", "0.45519063", "0.45510146", "0.4549096", "0.4539083", "0.4534379" ]
0.70963943
0
PUT /framedp_summaries/1 PUT /framedp_summaries/1.json
def update @framedp_summary = FramedpSummary.find(params[:id]) respond_to do |format| if @framedp_summary.update_attributes(params[:framedp_summary]) format.html { redirect_to @framedp_summary, notice: 'Framedp summary was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @framedp_summary.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @framedp_summary = FramedpSummary.new(params[:framedp_summary])\n\n respond_to do |format|\n if @framedp_summary.save\n format.html { redirect_to @framedp_summary, notice: 'Framedp summary was successfully created.' }\n format.json { render json: @framedp_summary, status: :created, location: @framedp_summary }\n else\n format.html { render action: \"new\" }\n format.json { render json: @framedp_summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @framedp_summary = FramedpSummary.find(params[:id])\n @framedp_summary.destroy\n\n respond_to do |format|\n format.html { redirect_to framedp_summaries_url }\n format.json { head :no_content }\n end\n end", "def update\n respond_to do |format|\n if @summary.update(summary_params)\n format.html { redirect_to @summary }\n format.json { render :show, status: :ok, location: @summary }\n else\n format.html { render :edit }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @framedp_summary = FramedpSummary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @framedp_summary }\n end\n end", "def update\n respond_to do |format|\n if @summary.update(summary_params)\n format.html { redirect_to @summary, notice: 'Summary was successfully updated.' }\n format.json { render :show, status: :ok, location: @summary }\n else\n format.html { render :edit }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @summary.update(summary_params)\n format.html { redirect_to @summary, notice: 'Summary was successfully updated.' }\n format.json { render :show, status: :ok, location: @summary }\n else\n format.html { render :edit }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @summary.update(summary_params)\n format.html { redirect_to @summary, notice: 'Summary was successfully updated.' }\n format.json { render :show, status: :ok, location: @summary }\n else\n format.html { render :edit }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @framedp_summary = FramedpSummary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @framedp_summary }\n end\n end", "def update\n @summary = Summary.find(params[:id])\n\n respond_to do |format|\n if @summary.update_attributes(params[:summary])\n format.html { redirect_to @summary, notice: 'Summary was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @summary = Summary.find(session[:id])\n #Give each study a timeout for security\n if Experiment.find(session[:exp]).still_valid?\n if !params[:summary][:Sent].blank?\n #Save summarization annotation\n if @summary.update_attributes(params[:summary])\n redirect_to :action => 'show', :control => 'label'\n else\n redirect_to :action => 'show', :control => 'sum'\n end\n else\n if !params[:summary][:Label].blank?\n #Save label annotation\n if @summary.update_attribute(:Label, params[:summary][:Label])\n redirect_to :action => 'selectSums'\n else\n redirect_to :action => 'show', :control => 'label'\n end\n else\n flash[:error] = 'You did not select any labels.'\n redirect_to :action => 'show', :control => 'label'\n end\n end\n else\n flash[:error] = 'This experiment cannot be changed anymore.'\n redirect_to :action => 'show', :control => 'sum'\n end\n end", "def set_summary\n @summary = Summary.find(params[:id])\n end", "def set_summary\n @summary = Summary.find(params[:id])\n end", "def set_summary\n @summary = Summary.find(params[:id])\n end", "def set_summary\n @summary = Summary.find(params[:id])\n end", "def set_summary\n @summary = Summary.find(params[:id])\n end", "def update\n respond_to do |format|\n if @annual_summary_report.update(annual_summary_report_params)\n format.html { redirect_to @annual_summary_report }\n format.json { render :show, status: :ok, location: @annual_summary_report }\n else\n format.html { render :edit }\n format.json { render json: @annual_summary_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @story = Story.find(params[:story_id])\n\n @frame = @story.frames.find(params[:id])\n\n respond_to do |format|\n if @frame.update_attributes(frame_params)\n format.html { redirect_to story_path(@story), notice: 'Frame was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @frame.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @monthly_summary.update(monthly_summary_params)\n format.html { redirect_to @monthly_summary, notice: 'Monthly summary was successfully updated.' }\n format.json { render :show, status: :ok, location: @monthly_summary }\n else\n format.html { render :edit }\n format.json { render json: @monthly_summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @summary_phase.update(summary_phase_params)\n format.html { redirect_to @summary_phase, notice: 'Summary phase was successfully updated.' }\n format.json { render :show, status: :ok, location: @summary_phase }\n else\n format.html { render :edit }\n format.json { render json: @summary_phase.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @frame_perdoc = args[:frame_perdoc] if args.key?(:frame_perdoc)\n end", "def create\n @summary = Summary.new(summary_params)\n\n respond_to do |format|\n if @summary.save\n format.html { redirect_to @summary }\n format.json { render :show, status: :created, location: @summary }\n else\n format.html { render :new }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @summary = Summary.new(summary_params)\n\n respond_to do |format|\n if @summary.save\n format.html { redirect_to @summary, notice: 'Summary was successfully created.' }\n format.json { render :show, status: :created, location: @summary }\n else\n format.html { render :new }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @summary = Summary.find(params[:id])\n if @summary.update(summary_params)\n redirect_back(fallback_location: homepage_path)\n\n end\n end", "def update\n @frame = Frame.find(params[:id])\n\n respond_to do |format|\n if @frame.update_attributes(params[:frame])\n format.html { redirect_to @frame, notice: 'Frame was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @frame.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @frame = Frame.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @frame.update_attributes(params[:frame])\r\n format.html { redirect_to @frame, notice: 'Frame 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: @frame.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @frame.update(frame_params)\n format.html { redirect_to @frame, notice: \"Frame was successfully updated.\" }\n format.json { render :show, status: :ok, location: @frame }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @frame.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @summaries = Summary.all\n @summary = Summary.new\n end", "def create\n daily_summary = current_user.daily_summaries.build(daily_summary_params)\n\n if daily_summary.save\n render json: daily_summary, status: 201\n else\n render json: {errors: daily_summary.errors}, status: 402\n end\n end", "def update\n\tDesignDetailDataPoint.save_data_point_info(params[:study_id], params)\n\t#DesignDetailDataPoint.save_data_point_totals(params[:study_id], params)\n respond_to do |format|\n end\n end", "def update\n respond_to do |format|\n if @frame.update(frame_params)\n format.html { redirect_to @frame, notice: 'Frame was successfully updated.' }\n format.json { render :show, status: :ok, location: @frame }\n else\n format.html { render :edit }\n format.json { render json: @frame.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @frame.update(frame_params)\n format.html { redirect_to @frame, notice: 'Frame was successfully updated.' }\n format.json { render :show, status: :ok, location: @frame }\n else\n format.html { render :edit }\n format.json { render json: @frame.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill_summary.update(bill_summary_params)\n format.html { redirect_to @bill_summary, notice: 'Bill summary was successfully updated.' }\n format.json { render :show, status: :ok, location: @bill_summary }\n else\n format.html { render :edit }\n format.json { render json: @bill_summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def summary_params\n params.require(:summary).permit(:name, :number, :ic, :management_organization, :start_date, \n :size, :percent_complete, :incident_type, :cause, :suppression_strategy, \n :complexity, :report_date, :prepared_by, :approved_by, :primary_agency, \n :state, :county, :city, :jurisdiction, :ownership, :latitude, :longitude, \n :area_description, :fire_behavior, :narrative, :fuel_type, :damage_assessment, \n :injuries, :threat_remark, :weather, :projected_spread_12, :projected_spread_24, \n :projected_spread_48, :projected_spread_72, :projected_spread_after, :stragetic_objectives, \n :threat_12, :threat_24, :threat_48, :threat_72, :threat_after, :critical_needs_12, \n :critical_needs_24, :critical_needs_48, :critical_needs_72, :critical_needs_after, \n :strategic_discussion, :tomorrows_plan, :anticipated_completion, :cost, :remarks, \n :resources, :cooperators, :date, :parent_id)\n end", "def create\n @summary = Summary.new(summary_params)\n user = current_user\n @summary.user = user\n\n respond_to do |format|\n if @summary.save\n format.html { redirect_to @summary, notice: 'Summary was successfully created.' }\n format.json { render :show, status: :created, location: @summary }\n else\n format.html { render :new }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n response = send_calendar_request(\"/\", :post, {:summary => @summary}.to_json) \n update_after_save(response)\n end", "def update\n respond_to do |format|\n if @male_shot_put_head.update(male_shot_put_head_params)\n format.html { redirect_to @male_shot_put_head, notice: 'Male shot put head was successfully updated.' }\n format.json { render :show, status: :ok, location: @male_shot_put_head }\n else\n format.html { render :edit }\n format.json { render json: @male_shot_put_head.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_annual_summary_report\n @annual_summary_report = AnnualSummaryReport.find(params[:id])\n end", "def update\n expire_page :action => :index\n expire_page :action => :show\n \n @jira_issue_summary = JiraIssueSummary.get(params[:id])\n\n respond_to do |format|\n if @jira_issue_summary.update(params[:jira_issue_summary])\n format.html { redirect_to(@jira_issue_summary, :notice => 'Jira issue summary was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @jira_issue_summary.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_score_summary\n @score_summary = ScoreSummary.find(params[:id])\n end", "def update!(**args)\n @summary_skipped_reasons = args[:summary_skipped_reasons] if args.key?(:summary_skipped_reasons)\n @summary_text = args[:summary_text] if args.key?(:summary_text)\n end", "def create\n @summary = Summary.new(summary_params)\n\n respond_to do |format|\n if @summary.save\n format.html { redirect_to user_path(current_user.username), notice: 'Summary was successfully created.' }\n format.json { render :show, status: :created, location: @summary }\n else\n format.html { render :new }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @metrics = args[:metrics] if args.key?(:metrics)\n @metrics_schema_uri = args[:metrics_schema_uri] if args.key?(:metrics_schema_uri)\n @model_explanation = args[:model_explanation] if args.key?(:model_explanation)\n @name = args[:name] if args.key?(:name)\n @slice = args[:slice] if args.key?(:slice)\n end", "def update\n @trading_time_frame = TradingTimeFrame.find(params[:id])\n\n respond_to do |format|\n if @trading_time_frame.update_attributes(params[:trading_time_frame])\n format.html { redirect_to @trading_time_frame, notice: 'Trading time frame was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trading_time_frame.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_summaries\n if self.is_certified?\n PlaceSummary.update_certified_summaries(self.place_id, self.id)\n else\n PlaceSummary.update_summaries(self.place_id, self.id)\n end\n end", "def summary_params\n params.require(:summary).permit(:text, :player_id, :user_id)\n end", "def update\n\n respond_to do |format|\n if @time_frame.update_attributes(params[:time_frame])\n format.html { redirect_to time_frames_path, notice: 'Time frame was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_frame.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @docid = args[:docid] if args.key?(:docid)\n @frame_identifier = args[:frame_identifier] if args.key?(:frame_identifier)\n @regions = args[:regions] if args.key?(:regions)\n @starburst_features_v4 = args[:starburst_features_v4] if args.key?(:starburst_features_v4)\n @starburst_tokens_v4 = args[:starburst_tokens_v4] if args.key?(:starburst_tokens_v4)\n @thumbnail_type = args[:thumbnail_type] if args.key?(:thumbnail_type)\n end", "def update\n respond_to do |format|\n if @sensory_analysis.update(sensory_analysis_params)\n @metric = Metric.find( @sensory_analysis.metric.id)\n flash[:success] = 'Sensory analysis was successfully updated.' \n \n format.html { redirect_to action: 'index', metric_id: @metric }\n format.json { render :show, status: :created, location: @sensory_analysis }\n else\n format.html { render :new }\n format.json { render json: @sensory_analysis.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @summary = Summary.find(params[:id])\n @summary.destroy\n\n respond_to do |format|\n format.html { redirect_to summaries_url }\n format.json { head :ok }\n end\n end", "def destroy\n @summary.destroy\n respond_to do |format|\n format.html { redirect_to summaries_url }\n format.json { head :no_content }\n end\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def metric_update(statuspage_id, metric_id, day_avg, day_start, day_dates, day_values,\n week_avg, week_start, week_dates, week_values,\n month_avg, month_start, month_dates, month_values)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['metric_id'] = metric_id\n data['day_avg'] = day_avg\n data['day_start'] = day_start\n data['day_dates'] = day_dates\n data['day_values'] = day_values\n data['week_avg'] = week_avg\n data['week_start'] = week_start\n data['week_dates'] = week_dates\n data['week_values'] =week_values\n data['month_avg'] = month_avg\n data['month_start'] = month_start\n data['month_dates'] = month_dates\n data['month_values'] = month_values\n\n request :method => :post,\n :url => @url + 'metric/update',\n :payload => data\n end", "def create\n @monthly_summary = MonthlySummary.new(monthly_summary_params)\n\n respond_to do |format|\n if @monthly_summary.save\n format.html { redirect_to @monthly_summary, notice: 'Monthly summary was successfully created.' }\n format.json { render :show, status: :created, location: @monthly_summary }\n else\n format.html { render :new }\n format.json { render json: @monthly_summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @updates = Summary.where(number: @summary.number)\n end", "def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def update\n respond_to do |format|\n if @past_history.update(past_history_params)\n format.html { redirect_to @past_history, notice: 'Past history was successfully updated.' }\n format.json { render :show, status: :ok, location: @past_history }\n else\n format.html { render :edit }\n format.json { render json: @past_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @timeframe.update(timeframe_params)\n format.html { redirect_to @timeframe, notice: 'Timeframe was successfully updated.' }\n format.json { render :show, status: :ok, location: @timeframe }\n else\n format.html { render :edit }\n format.json { render json: @timeframe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @action_metrics = args[:action_metrics] if args.key?(:action_metrics)\n @overall_metrics = args[:overall_metrics] if args.key?(:overall_metrics)\n end", "def summary\n \n end", "def update\n respond_to do |format|\n if @historical_source.update(historical_source_params)\n format.html { redirect_to @historical_source, notice: 'Historical source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @historical_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_release_card summary\n # build post object\n url = 'https://api.github.com/projects/columns/%s/cards' % RELEASE\n uri = URI url\n post = Net::HTTP::Post.new uri, HEADERS\n post.body = { 'note' => summary }.to_json\n\n # create connection and send post\n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = 'https' == uri.scheme\n response = http.request post\n log 'release.log', \"#{response.inspect}: #{response.body}: #{response.uri}\" if response.code >= '400'\nend", "def summary_params\n params.require(:summary).permit(:username, :post_title, :summary_entry, :user_id)\n end", "def update!(**args)\n @frame_identifier = args[:frame_identifier] if args.key?(:frame_identifier)\n @perdoc = args[:perdoc] if args.key?(:perdoc)\n @timestamp_msec = args[:timestamp_msec] if args.key?(:timestamp_msec)\n end", "def update!(**args)\n @history_id = args[:history_id] unless args[:history_id].nil?\n @id = args[:id] unless args[:id].nil?\n @internal_date = args[:internal_date] unless args[:internal_date].nil?\n @label_ids = args[:label_ids] unless args[:label_ids].nil?\n @payload = args[:payload] unless args[:payload].nil?\n @raw = args[:raw] unless args[:raw].nil?\n @size_estimate = args[:size_estimate] unless args[:size_estimate].nil?\n @snippet = args[:snippet] unless args[:snippet].nil?\n @thread_id = args[:thread_id] unless args[:thread_id].nil?\n end", "def update\n @capture = Capture.find(params[:id])\n\n if @capture.update(capture_params)\n head :no_content\n else\n render json: @capture.errors, status: :unprocessable_entity\n end\n end", "def update\n @summary_vote = SummaryVote.find(params[:id])\n\n respond_to do |format|\n if @summary_vote.update_attributes(params[:summary_vote])\n flash[:notice] = 'SummaryVote was successfully updated.'\n format.html { redirect_to(@summary_vote) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @summary_vote.errors, :status => :unprocessable_entity }\n end\n end\n end", "def dump_summary(duration, example_count, failure_count, pending_count)\n end", "def dump_summary(duration, example_count, failure_count, pending_count)\n end", "def update\n @aggregate = Aggregate.find(params[:id])\n=begin\n keys = params[\"aggregate\"][\"metrics\"] \n\n metrics = @aggregate.metrics\n\n keys.each_value { |key|\n metric = Metric.find(:first, :conditions => [\"key = ?\", key])\n metrics << metric unless metrics.include? metric\n }\n=end\n\n respond_to do |format|\n if @aggregate.update_attributes(params[:aggregate])\n format.html { redirect_to(@aggregate, :notice => 'Aggregate was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @aggregate.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_summary_phase\n @summary_phase = SummaryPhase.find(params[:id])\n end", "def set_frame\n @frame = Frame.find(params[:id])\n end", "def set_summary_attendance\n @summary_attendance = SummaryAttendance.find(params[:id])\n end", "def update\n @service_history = ServiceHistory.find(params[:id])\n\n if @service_history.update(service_history_params)\n head :no_content\n else\n render json: @service_history.errors, status: :unprocessable_entity\n end\n end", "def update\n @metric = Metric.find(params[:id])\n\n if @metric.update(params[:metric])\n head :no_content\n else\n render json: @metric.errors, status: :unprocessable_entity\n end\n end", "def show\n @summaries = Summary.all \n end", "def set_bill_summary\n @bill_summary = BillSummary.find(params[:id])\n end", "def status_summary(statuspage_id)\n request :method => :get,\n :url => @url + 'status/summary/' + statuspage_id\n end", "def set_trading_summary\n @trading_summary = TradingSummary.find(params[:id])\n end", "def update\n respond_to do |format|\n if @api_v1_outcome.update(api_v1_outcome_params)\n format.html { redirect_to @api_v1_outcome, notice: 'Outcome was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_outcome }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_outcome.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @frame_starburst_data = args[:frame_starburst_data] if args.key?(:frame_starburst_data)\n end", "def update\n @daily_statistic = DailyStatistic.find(params[:id])\n\n if @daily_statistic.update(params[:daily_statistic])\n head :no_content\n else\n render json: @daily_statistic.errors, status: :unprocessable_entity\n end\n end", "def update\n @local_cpu_summary = LocalCpuSummary.find(params[:id])\n\n respond_to do |format|\n if @local_cpu_summary.update_attributes(params[:local_cpu_summary])\n format.html { redirect_to @local_cpu_summary, :notice => 'Local cpu summary was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @local_cpu_summary.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @overall.update(overall_params)\n format.html { redirect_to @overall, notice: 'Overall was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @overall.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_frame\n @frame = Frame.find_by!(number: params[:id])\n end", "def update\n @stage = Stage.find(params[:id])\n\n if @stage.update_attributes(params[:stage])\n head :no_content\n else\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end", "def update!(**args)\n @confidence = args[:confidence] if args.key?(:confidence)\n @display_name = args[:display_name] if args.key?(:display_name)\n @frames = args[:frames] if args.key?(:frames)\n @id = args[:id] if args.key?(:id)\n @time_segment_end = args[:time_segment_end] if args.key?(:time_segment_end)\n @time_segment_start = args[:time_segment_start] if args.key?(:time_segment_start)\n end", "def update\n @historical = Historical.find(params[:id])\n\n respond_to do |format|\n if @historical.update_attributes(params[:historical])\n format.html { redirect_to @historical, notice: 'Historical was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historical.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @frame_similarity = args[:frame_similarity] if args.key?(:frame_similarity)\n @frames_end_timestamp_ms = args[:frames_end_timestamp_ms] if args.key?(:frames_end_timestamp_ms)\n @frames_starburst_start_index = args[:frames_starburst_start_index] if args.key?(:frames_starburst_start_index)\n @frames_start_timestamp_ms = args[:frames_start_timestamp_ms] if args.key?(:frames_start_timestamp_ms)\n end", "def summary\n # TODO\n end", "def create_or_update_summary!(*arg); service_module ? service_module.create_or_update_summary!(*arg) : nil; end", "def update!(**args)\n @dlp_scan_summary = args[:dlp_scan_summary] if args.key?(:dlp_scan_summary)\n @warn_acknowledged = args[:warn_acknowledged] if args.key?(:warn_acknowledged)\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @summary }\n end\n end", "def update!(**args)\n @annotation_source = args[:annotation_source] if args.key?(:annotation_source)\n @create_time = args[:create_time] if args.key?(:create_time)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @payload = args[:payload] if args.key?(:payload)\n @payload_schema_uri = args[:payload_schema_uri] if args.key?(:payload_schema_uri)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update_timeframe\n # params['data_gatherer']['timeframe']\n if request.xhr?\n\n begin\n @data_gatherer.timeframe = params['data_gatherer']['timeframe'].to_i\n head :ok\n rescue ArgumentError\n head :error # return an error to the xhr call\n end\n\n end\n\n end", "def set_voting_summary\n @voting_summary = VotingSummary.find(params[:id])\n end", "def destroy\n @summary.destroy\n respond_to do |format|\n format.html { redirect_to summaries_url, notice: 'Summary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @summary.destroy\n respond_to do |format|\n format.html { redirect_to summaries_url, notice: 'Summary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def summary\n authenticated_post(\"summary\").body\n end", "def update\n respond_to do |format|\n if @metric_source.update(metric_source_params)\n format.html { redirect_to @metric_source, notice: 'Metric source was successfully updated.' }\n format.json { render :show, status: :ok, location: @metric_source }\n else\n format.html { render :edit }\n format.json { render json: @metric_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rest\n @page_usage_event = PageUsageEvent.find(params[:id])\n\n respond_to do |format|\n if @page_usage_event.update_attributes(params[:page_usage_event])\n flash[:notice] = 'PageUsageEvent was successfully updated.'\n format.html { redirect_to(@page_usage_event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page_usage_event.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.64135617", "0.5950805", "0.5858234", "0.5852816", "0.58208823", "0.58208823", "0.58208823", "0.5786521", "0.5749176", "0.5700257", "0.533353", "0.533353", "0.533353", "0.533353", "0.53335214", "0.5329445", "0.5320898", "0.53115624", "0.5306827", "0.5278408", "0.527586", "0.52672017", "0.52401555", "0.5216841", "0.5195351", "0.5177566", "0.51566267", "0.5131809", "0.51210994", "0.5117171", "0.5117171", "0.511526", "0.5054394", "0.5018532", "0.5016422", "0.5005669", "0.49844363", "0.4980267", "0.49567723", "0.49412882", "0.49308786", "0.4925648", "0.4923148", "0.4921608", "0.49191123", "0.49191", "0.4911481", "0.48979342", "0.48895714", "0.48847866", "0.48830473", "0.48758703", "0.48560083", "0.4853047", "0.48520178", "0.48365188", "0.48233286", "0.48198566", "0.4813801", "0.48072374", "0.47973797", "0.47963694", "0.47771826", "0.47679022", "0.47586083", "0.4757101", "0.47557208", "0.47557208", "0.475097", "0.4750185", "0.47481596", "0.4746227", "0.47321263", "0.47291517", "0.4727072", "0.47261444", "0.4726042", "0.47224867", "0.47169116", "0.47168005", "0.47149318", "0.4704467", "0.47026584", "0.47026095", "0.4699988", "0.46926862", "0.46898085", "0.46824545", "0.46813017", "0.46769312", "0.4668768", "0.46675673", "0.466708", "0.4661688", "0.4658291", "0.46526143", "0.46526143", "0.46496797", "0.46480244", "0.46465445" ]
0.6763906
0
DELETE /framedp_summaries/1 DELETE /framedp_summaries/1.json
def destroy @framedp_summary = FramedpSummary.find(params[:id]) @framedp_summary.destroy respond_to do |format| format.html { redirect_to framedp_summaries_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @summary.destroy\n respond_to do |format|\n format.html { redirect_to summaries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @summary = Summary.find(params[:id])\n @summary.destroy\n\n respond_to do |format|\n format.html { redirect_to summaries_url }\n format.json { head :ok }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @summary.destroy\n respond_to do |format|\n format.html { redirect_to summaries_url, notice: 'Summary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @summary.destroy\n respond_to do |format|\n format.html { redirect_to summaries_url, notice: 'Summary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_summary = TestSummary.find(params[:id])\n @test_summary.destroy\n\n respond_to do |format|\n format.html { redirect_to test_summaries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @annual_summary_report.destroy\n respond_to do |format|\n format.html { redirect_to annual_summary_reports_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @monthly_summary.destroy\n respond_to do |format|\n format.html { redirect_to monthly_summaries_url, notice: 'Monthly summary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @frame = Frame.find(params[:id])\n @frame.destroy\n\n respond_to do |format|\n format.html { redirect_to frames_url }\n format.json { head :ok }\n end\n end", "def destroy\r\n @frame = Frame.find(params[:id])\r\n @frame.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to frames_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @summary_phase.destroy\n respond_to do |format|\n format.html { redirect_to summary_phases_url, notice: 'Summary phase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pod_report.destroy\n respond_to do |format|\n format.html { redirect_to pod_reports_url }\n format.json { head :no_content }\n end\n end", "def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end", "def destroy\n @bill_summary.destroy\n respond_to do |format|\n format.html { redirect_to bill_summaries_url, notice: 'Bill summary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @summary.destroy\n \n end\n end", "def destroy\n @lab_flow = LabFlow.find(params[:id])\n @lab_flow.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_flows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @overview.destroy\n respond_to do |format|\n format.html { redirect_to overviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sample_metadata_numerical.destroy\n respond_to do |format|\n format.html { redirect_to sample_metadata_numericals_url, notice: 'Sample metadata numerical was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @trading_time_frame = TradingTimeFrame.find(params[:id])\n @trading_time_frame.destroy\n\n respond_to do |format|\n format.html { redirect_to trading_time_frames_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @experiment_raw_dataset.destroy\n respond_to do |format|\n format.html { redirect_to experiment_raw_datasets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n TimeframeLog.destroy_all(timeframe_id: @timeframe.id)\n @timeframe.destroy\n respond_to do |format|\n format.html { redirect_to timeframes_url, notice: 'Timeframe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_series.destroy\n\n respond_to do |format|\n format.html { redirect_to time_series_index_url(@owner), flash: {success: t('app.msgs.success_deleted', :obj => t('mongoid.models.time_series.one'))} }\n format.json { head :no_content }\n end\n end", "def delete_snapshot(snapshot_id)\n end", "def destroy\n @aggregate_metadatum = AggregateMetadatum.find(params[:id])\n @aggregate_metadatum.destroy\n\n respond_to do |format|\n format.html { redirect_to aggregate_metadata_url }\n format.json { head :no_content }\n end\n end", "def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @patient_sample = PatientSample.find(params[:id])\n @patient_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_samples_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @overall.destroy\n respond_to do |format|\n format.html { redirect_to overalls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @villagesummaryreport.destroy\n respond_to do |format|\n format.html { redirect_to villagesummaryreports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @metric_source.destroy\n respond_to do |format|\n format.html { redirect_to metric_sources_url, notice: 'Metric source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @weekly_histogram.destroy\n respond_to do |format|\n format.html { redirect_to weekly_histograms_url, notice: 'Weekly histogram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dataset_datum.destroy\n respond_to do |format|\n format.html { redirect_to dataset_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @snapshot.destroy\n\n respond_to do |format|\n format.html { redirect_to(snapshots_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @time_frame.destroy\n\n respond_to do |format|\n format.html { redirect_to time_frames_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product_summary.destroy\n respond_to do |format|\n format.html { redirect_to product_summaries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @metric = Metric.find(params[:id])\n @metric.destroy\n\n head :no_content\n end", "def destroy\n @unified_history.destroy\n respond_to do |format|\n format.html { redirect_to unified_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @day_statistics = @patient.day_statistics.all\n @day_statistics.delete_all\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Данные пациента удалены.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @health_record.destroy\n respond_to do |format|\n format.html { redirect_to health_records_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @frame.destroy\n respond_to do |format|\n format.html { redirect_to frames_url, notice: 'Frame was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @frame.destroy\n respond_to do |format|\n format.html { redirect_to frames_url, notice: 'Frame was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dataset.destroy\n respond_to do |format|\n format.html { redirect_to study_path(@dataset.study), notice: 'Dataset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @male_shot_put_head.destroy\n respond_to do |format|\n format.html { redirect_to male_shot_put_heads_url, notice: 'Male shot put head was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n Audit.find(params[:id]).destroy\n head :no_content\n end", "def destroy\n @local_cpu_summary = LocalCpuSummary.find(params[:id])\n @local_cpu_summary.destroy\n\n respond_to do |format|\n format.html { redirect_to local_cpu_summaries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @frame.destroy\n respond_to do |format|\n format.html { redirect_to frames_url, notice: \"Frame was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @sumbar_content = SumbarContent.find(params[:id])\n @sumbar_content.destroy\n\n respond_to do |format|\n format.html { redirect_to sumbar_contents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @throughput_metric.destroy\n respond_to do |format|\n format.html { redirect_to throughput_metrics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @historical_source.destroy\n respond_to do |format|\n format.html { redirect_to historical_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @patient_history = PatientHistory.find(params[:id])\n @patient_history.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unsigned_columns_test = UnsignedColumnsTest.find(params[:id])\n @unsigned_columns_test.destroy\n\n respond_to do |format|\n format.html { redirect_to unsigned_columns_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_history.destroy\n\n head :no_content\n end", "def destroy\n @column_sample.destroy\n respond_to do |format|\n format.html { redirect_to column_samples_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @health_record = HealthRecord.find(params[:id])\n @health_record.destroy\n\n respond_to do |format|\n format.html { redirect_to health_records_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @healthrecord = Healthrecord.find(params[:id])\n @healthrecord.destroy\n\n respond_to do |format|\n format.html { redirect_to indexhealthrecord_path(current_member) }\n format.json { head :no_content }\n end\n end", "def destroy\n @stadium.destroy\n respond_to do |format|\n format.html { redirect_to stadia_url, notice: 'Stadium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @performance_test = PerformanceTest.find(params[:id])\n @performance_test.destroy\n\n respond_to do |format|\n format.html { redirect_to performance_tests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @formatoventum = Formatoventum.find(params[:id])\n @formatoventum.destroy\n\n respond_to do |format|\n format.html { redirect_to formatoventa_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @operation_history = OperationHistory.find(params[:id])\n @operation_history.destroy\n\n respond_to do |format|\n format.html { redirect_to operation_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @history_study = HistoryStudy.find(params[:id])\n @history_study.destroy\n\n respond_to do |format|\n format.html { redirect_to history_studies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_statistic = DailyStatistic.find(params[:id])\n @daily_statistic.destroy\n\n head :no_content\n end", "def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @visit_stat = VisitStat.find(params[:id])\n @visit_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to(scaffold_visit_stats_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @red_packet_history.destroy\n respond_to do |format|\n format.html { redirect_to admin_red_packet_histories_url, notice: 'Red packet history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n collection = Collection.find(@mlog_entry[:collection_id])\n @mlog_entry.destroy\n respond_to do |format|\n format.html { redirect_to collection}\n format.json { head :no_content }\n end\n end", "def destroy\n @medusa_premis_representation_object = MedusaPremis::RepresentationObject.find(params[:id])\n @medusa_premis_representation_object.destroy\n\n respond_to do |format|\n format.html {\n query_params = session[:search] ? session[:search].dup : {}\n query_params.delete :counter\n query_params.delete :total\n link_url = url_for(query_params)\n redirect_to(link_url, notice: 'Representation object was successfully deleted.') }\n format.json { head :no_content }\n end\n end", "def destroy\n @pds_patient_prev_med_history.destroy\n respond_to do |format|\n format.html { redirect_to pds_patient_prev_med_histories_url, notice: 'Pds patient prev med history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @statistic.destroy\n respond_to do |format|\n format.html { redirect_to statistics_url }\n format.json { head :no_content }\n end\n end", "def delete(payload = {})\n request! do\n options = {payload: to_payload(payload)}\n api(options)[url.path].delete(API_HEADERS)\n end\n end", "def destroy\n @backend_tutorial_stat = Backend::TutorialStat.find(params[:id])\n @backend_tutorial_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to backend_tutorial_stats_url }\n format.json { head :ok }\n end\n end", "def destroy\n @raw_datum = RawDatum.find(params[:id])\n @raw_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to raw_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @historial_odt = HistorialOdt.find(params[:id])\n @historial_odt.destroy\n\n respond_to do |format|\n format.html { redirect_to historial_odts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @why_sumbar = WhySumbar.find(params[:id])\n @why_sumbar.destroy\n\n respond_to do |format|\n format.html { redirect_to why_sumbars_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @analysis = Analysis.find(params[:id])\n @analysis.destroy\n\n respond_to do |format|\n format.html { redirect_to analyses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @historical = Historical.find(params[:id])\n @historical.destroy\n\n respond_to do |format|\n format.html { redirect_to historicals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @analytics_used_analysable.destroy\n respond_to do |format|\n format.html { redirect_to analytics_used_analysables_url, notice: 'Analytics used analysable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fmr_dataset.destroy\n respond_to do |format|\n format.html { redirect_to fmr_datasets_url, notice: 'Fmr dataset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tcpdump_log.destroy\n respond_to do |format|\n format.html { redirect_to tcpdump_logs_url, notice: 'Tcpdump log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @calculated_data_assessment = CalculatedDataAssessment.find(params[:id])\n @calculated_data_assessment.destroy\n\n respond_to do |format|\n format.html { redirect_to calculated_data_assessments_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 @lab_detail.destroy\n respond_to do |format|\n format.html { redirect_to lab_details_url, notice: 'Lab detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @census_count = CensusCount.find(params[:id])\n @census_count.destroy\n\n respond_to do |format|\n format.html { redirect_to census_counts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :manage, @vspec\n metric = @vspec.metric\n @vspec.destroy\n respond_to do |format|\n format.html { redirect_to [metric.service, metric] }\n format.json { head :no_content }\n end\n end", "def destroy\n @observations.destroy\n respond_to do |format|\n format.html { redirect_to observations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recent_alumn.destroy\n respond_to do |format|\n format.html { redirect_to recent_alumni_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payload.destroy\n respond_to do |format|\n format.html { redirect_to payloads_url, notice: 'Payload was successfully destroyed.' }\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 @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @top_standing_entry.destroy\n respond_to do |format|\n format.html { redirect_to top_standing_entries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fixturestat = Fixturestat.find(params[:id])\n @fixturestat.destroy\n\n respond_to do |format|\n format.html { redirect_to fixturestats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @document_history = DocumentHistory.find(params[:id])\n @document_history.destroy\n\n respond_to do |format|\n format.html { redirect_to document_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_outcome.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_outcomes_url, notice: 'Outcome was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # @sample = Sample.find(params[:id])\n # @sample.destroy\n\n# respond_to do |format|\n# format.html { redirect_to samples_url }\n# format.json { head :no_content }\n# end\n end", "def destroy\n @annual_stat = AnnualStat.find(params[:id])\n @annual_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to annual_stats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sumit.destroy\n respond_to do |format|\n format.html { redirect_to sumits_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aspect = Aspect.find(params[:id])\n @aspect.destroy\n\n respond_to do |format|\n format.html { redirect_to(aspects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group_stat = GroupStat.find(params[:id])\n @group_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to group_stats_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 @datapoint.destroy\n respond_to do |format|\n format.html { redirect_to datapoints_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.6990364", "0.67791474", "0.6769124", "0.66883564", "0.66883564", "0.6684811", "0.64169574", "0.6364307", "0.63125694", "0.62874836", "0.6266948", "0.6266192", "0.61698157", "0.61542654", "0.6138919", "0.61344963", "0.61334956", "0.6116587", "0.61095464", "0.60976297", "0.6091712", "0.60864294", "0.60814315", "0.60806346", "0.6070083", "0.60507697", "0.6048931", "0.60382545", "0.6027317", "0.6018067", "0.6016774", "0.60088784", "0.6004463", "0.60022944", "0.6000735", "0.5998702", "0.59970933", "0.59967816", "0.5994772", "0.59931564", "0.59931564", "0.5990651", "0.5990253", "0.59888816", "0.5984842", "0.59822875", "0.59821016", "0.5980856", "0.5979228", "0.59772193", "0.596904", "0.59676707", "0.59614706", "0.59609324", "0.59600085", "0.59578425", "0.59573466", "0.5956121", "0.5953391", "0.5948794", "0.5944899", "0.5944814", "0.5944814", "0.5938449", "0.59369546", "0.5934692", "0.59298337", "0.59275925", "0.59236246", "0.5921109", "0.59190303", "0.59181404", "0.59098434", "0.5909106", "0.59049565", "0.5904759", "0.59041804", "0.5903873", "0.590272", "0.5892362", "0.58860743", "0.58846843", "0.5880515", "0.58786947", "0.58761615", "0.5873557", "0.5872878", "0.58694565", "0.5868463", "0.5863751", "0.5861608", "0.58589834", "0.5857345", "0.58563656", "0.58534384", "0.58510286", "0.5849601", "0.58490694", "0.5847026", "0.58469146" ]
0.76653886
0
Only allow a list of trusted parameters through.
def order_params params.require(:order).permit! 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
Returns the requested node.
def requested_node scope = current_site.nodes.with_attributes.with_variant # If we have no path, use the first root page. Otherwise, find the page by # the requested URI. if node_uri.blank? home_page = scope.sorted.roots.first raise ActiveRecord::RecordNotFound.new if home_page.blank? home_page else scope.find_by_uri!(node_uri) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node\n return @node\n end", "def get_node(node)\n\t\t\t@nodes[node]\n\t\tend", "def get_node\n # @@neo = Neography::Rest.new\n begin\n # qur = \"MATCH (n {object_id: \"+self.id.to_s+\", object_type: \\'\"+self.class.to_s+\"\\' }) RETURN n LIMIT 1\"\n # response = @@neo.execute_query(qur)\n # node_id = response[\"data\"].flatten.first[\"metadata\"][\"id\"]\n node_id = self.get_node_id\n node = (node_id ? Neography::Node.load(node_id, @@neo) : nil)\n return node\n rescue Exception\n return nil\n end\n end", "def node\n @node\n end", "def node\n @node\n end", "def node\n attributes['node']\n end", "def node\n attributes['node']\n end", "def node(name)\n return node_manager.find(name)\n end", "def node(node_name)\n nodes(node_name).first\nend", "def node\n @node ||= args.dig(:node)\n end", "def node\n @context.node\n end", "def get_node(fqn)\n node = @nodes.get_node(fqn)\n node if context?(node)\n end", "def node\n datasource.document.xpath(xpath).first\n end", "def get_node(id)\n get_object('node', id)\n end", "def lookup_node(request_path)\n\t\t\tname = request_path.last\n\t\t\tname_xnode = name.to_s + XNODE_EXTENSION\n\n\t\t\tnode_path = File.join(@root, request_path.dirname.components, name_xnode)\n\n\t\t\tif File.exist? node_path\n\t\t\t\treturn Node.new(self, request_path.dirname + name, request_path, node_path)\n\t\t\tend\n\n\t\t\treturn nil\n\t\tend", "def node(klass = nil)\n return @context[:node] if !klass\n @context[:node].get(klass)\n end", "def node\n items_node[:node]\n end", "def node(name)\n nodes[name]\n end", "def node\n scope.node\n end", "def node\n RDF::Node.new(namer.get_sym)\n end", "def node\n retract[:node]\n end", "def get_node(id)\n @nodes[id.to_i]\n end", "def node\n RDF::Node.new(namer.get_sym)\n end", "def node_get(node)\n nodes.fetch prepare_key(node), nil\n end", "def node\n publish[:node]\n end", "def get_node(fqn)\n @database.all_nodes.find { |node| node.fqn == fqn }\n end", "def fetch_node(key)\n node = fetch_node_nt(key)\n raise unless node\n node\n end", "def my_node(allow_caching = true)\n graph = SourceClass.class_graph(allow_caching)\n graph.get_node(@uri_s) || OntologyGraph::ClassNode.new(@uri_s)\n end", "def node\n run_context.node\n end", "def get\n if @position.access\n data = @node.send(@position.access) \n else\n data = @node\n end\n end", "def node_at(line, column)\n tree_at(line, column).first\n end", "def fetchNode(name)\n n = @node_def_list[name.to_sym]\n n ? n : raise(TypeCheckError, BAD_NODE_NAME + name.to_s)\n end", "def fetchNode(name)\n n = @node_def_list[name.to_sym]\n n ? n : raise(TypeCheckError, BAD_NODE_NAME + name.to_s)\n end", "def find_node(*args)\n node = @nodes.find_node(*args)\n node if context?(node)\n end", "def node\n run_context.node\n end", "def node\n run_context.node\n end", "def get_node(letter)\n @node_pointers[letter.to_sym]\n end", "def find_node(nd_name)\n chef_nodes.find{|nd| nd.name == nd_name }\n end", "def get_node(object)\n @nodes.each do |node|\n return node if node.object == object\n end\n end", "def node()\n self.root.node()\n end", "def find_node(value)\n met_resp = find_node_support(value)\n return nil if met_resp[:node].nil?\n\n met_resp[:node]\n end", "def find_node(value)\n met_resp = find_node_support(value)\n return nil if met_resp[:node].nil?\n\n met_resp[:node]\n end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def get_node_by_name(name, options={})\n options[:exactget] ||= {}\n options[:exactget][:name] = name\n ret = get_nodes(options)\n if ret.empty?\n warn \"Cannot find node #{name}\"\n ret = nil\n elsif ret.values.size == 1\n ret = ret.values[0]\n else\n raise \"Multiple nodes returned for #{name}\"\n end\n ret \n end", "def get_node(key); end", "def getNode(name)#name is the int for the vertice\n\t\t@graph.select {|nodes| nodes.node == name }[0] \n\tend", "def node\n subscription_node[:node]\n end", "def get_node_value(node)\n node\n end", "def value_of_node(node_name)\n value_of_nodes(node_name).first\nend", "def get_node(state, name)\n machines = state[:machines]\n if (machines.include?(name))\n chef_server = Cheffish::CheffishServerAPI.new(Cheffish.enclosing_chef_server)\n nodes = chef_server.get(\"/nodes\")\n node_url = nodes[name]\n chef_server.get(node_url)\n else\n nil\n end\n end", "def get_node(node)\n return nil unless node[:name]\n\n #Convert the node into a Key string and fetch the corresponding data\n key = Keyify.node(node)\n value = @db.n_get(key)\n\n if value\n new_node = Marshal.load(value)\n new_node[:name] = node[:name]\n new_node[:type] = node[:type] || Config::DEFAULT_TYPE\n new_node\n end\n end", "def pull_node(xn)\n # nothing to do with node\n end", "def getNode(*args)\n if(args.size == 1)\n return retNode(args[0])\n else\n if (@nodeValues.size > @INDEX)\n tmp = @nodeValues[@INDEX]\n #puts \"----------------\\nSearch For #{@node}\\n#{tmp}\\n--------------------------\"\n retStr = @xmlTool.searchForValue(tmp, @node)\n #puts \"----------------\\nSearch For #{@node}\\n#{retStr}\\n--------------------------\"\n return retStr\n else\n return \"\"\n end\n end\n end", "def find_node(*args)\n nodes = find_all_nodes(*args)\n raise AmbiguousNode if nodes.size > 1\n nodes.first\n end", "def node\n Chef.run_context.node\n end", "def find_node(node_number)\n @_node_map[node_number]\n end", "def node(x, y)\n @nodes[y][x]\n end", "def entity_node(node_id=nil)\n node = nil\n if node_id\n node = get_node(node_id)\n else\n begin\n node = Neography::Node.find(\"actionables_nodes_index\", \"class#id\", \"#{self.class.name}##{self.id}\")\n rescue\n end\n unless node\n node = get_node(self.entity_node_id)\n end\n end\n return node\n end", "def get_node(id)\n CloudLB::Node.new(self,id)\n end", "def find_node\n return unless params[:id].present? && controller_model.respond_to?(:is_content_node?) && controller_model.is_content_node?\n @node = current_site.self_and_descendants.accessible.include_content.where([ 'content_type = ? AND content_id = ?', controller_model.base_class.name, params[:id].to_i ]).first!\n end", "def node\r\n\t\t\tparent\r\n\t\tend", "def Node(node_id)\n return group(\"node#{node_id}\")\n end", "def [](uri)\n @nodes[uri]\n end", "def node()\n return SearchNodes.new(:node => self, :return_many => false)\n end", "def get_node(name, environment:, configured_environment: nil, transaction_uuid: nil)\n headers = add_puppet_headers('Accept' => get_mime_types(Puppet::Node).join(', '))\n\n response = @client.get(\n with_base_url(\"/node/#{name}\"),\n headers: headers,\n params: {\n environment: environment,\n configured_environment: configured_environment || environment,\n transaction_uuid: transaction_uuid,\n }\n )\n\n process_response(response)\n\n [response, deserialize(response, Puppet::Node)]\n end", "def get_node(name, environment:, configured_environment: nil, transaction_uuid: nil)\n headers = add_puppet_headers('Accept' => get_mime_types(Puppet::Node).join(', '))\n\n response = @client.get(\n with_base_url(\"/node/#{name}\"),\n headers: headers,\n params: {\n environment: environment,\n configured_environment: configured_environment || environment,\n transaction_uuid: transaction_uuid,\n }\n )\n\n process_response(response)\n\n [response, deserialize(response, Puppet::Node)]\n end", "def find_node_by_name(name)\n @nodes[name]\n end", "def node\n @node ||= ArkEcosystem::Client::API::Node.new(@client)\n end", "def get_node_id\n # @@neo = Neography::Rest.new\n begin\n qur = \"MATCH (n {object_id: \"+self.id.to_s+\", object_type: \\'\"+self.class.to_s+\"\\' }) RETURN n LIMIT 1\"\n response = @@neo.execute_query(qur)\n node_id = response[\"data\"].flatten.first[\"metadata\"][\"id\"]\n return node_id\n rescue Exception\n return nil\n end\n end", "def [](n)\n if n.class == String\n ret = @lookup_name[n]\n ret = @lookup_mac[n] if !ret\n return ret\n end\n @nodes[n]\n end", "def node_for(relation)\n self[relation.name.to_sym]\n end", "def node_entry\n \"node #{name}\"\n end", "def node(key)\n @network.node(@values[key])\n end", "def peek\n @nodes[0]\n end" ]
[ "0.7991362", "0.7929335", "0.76970583", "0.7645739", "0.7645739", "0.76057637", "0.76057637", "0.76047325", "0.7593304", "0.74801105", "0.7387379", "0.73391944", "0.73084265", "0.7210616", "0.7207596", "0.7156161", "0.7093469", "0.70868737", "0.7012948", "0.6994086", "0.6983486", "0.69805586", "0.6945415", "0.69347274", "0.69205093", "0.69178", "0.69016963", "0.68985224", "0.6870543", "0.6856138", "0.6853103", "0.6848471", "0.6848471", "0.6789283", "0.6784311", "0.6784311", "0.67716515", "0.67632943", "0.6733737", "0.6715763", "0.66773015", "0.66773015", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66728646", "0.66722596", "0.6660116", "0.6623844", "0.6569894", "0.65579844", "0.6535884", "0.65267634", "0.6507037", "0.6504353", "0.6483763", "0.64590913", "0.64481854", "0.6447694", "0.64433956", "0.6435089", "0.6434672", "0.6429341", "0.6424219", "0.6421445", "0.6419931", "0.6417792", "0.64131635", "0.64131635", "0.63968325", "0.63967174", "0.6395956", "0.639408", "0.6391228", "0.63726115", "0.6367755", "0.6359164" ]
0.7435003
10
Overridden in PostBodyRequest and PostFileRequest
def make_request false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_request(object)\n end", "def post_data; end", "def multipart; end", "def set_request_body!(request); end", "def post_data=(_arg0); end", "def set_up_post_request(uri, data, headers, binary_key = nil)\n if !binary_key.nil?\n binary_data = data[binary_key]\n\n if binary_data.is_a?(StringIO)\n data[binary_key] = UploadIO.new(\n binary_data, \"text/plain\", \"local.path\"\n )\n else\n data[binary_key] = UploadIO.new(\n File.open(binary_data), \"text/plain\"\n )\n end\n\n req = Net::HTTP::Post::Multipart.new(uri.path, data)\n else\n req = Net::HTTP::Post.new(uri.path, headers)\n req.body = data.to_json\n end\n req\n end", "def httppostfile(url, corpNum, form, files, userID, isBinary = false)\n headers = {\n \"x-pb-version\" => BaseService::POPBILL_APIVersion,\n \"Content-Type\" => \"multipart/form-data;boundary=\" + BaseService::BOUNDARY,\n \"Accept-Encoding\" => \"gzip,deflate\",\n \"Connection\" => \"Keep-Alive\"\n }\n\n if corpNum.to_s != ''\n headers[\"Authorization\"] = \"Bearer \" + getSession_Token(corpNum)\n end\n\n if userID.to_s != ''\n headers[\"x-pb-userid\"] = userID\n end\n\n post_body = []\n\n if form.to_s != ''\n post_body << \"--#{BaseService::BOUNDARY}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"form\\\"\\r\\n\"\n post_body << \"Content-Type: Application/json;\\r\\n\\r\\n\"\n post_body << form.to_json + \"\\r\\n\"\n end\n if isBinary\n files.each do |fileData|\n fileName = fileData[\"fileName\"]\n post_body << \"\\r\\n--#{BaseService::BOUNDARY}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"file\\\"; filename=\\\"#{fileName}\\\"\\r\\n\"\n post_body << \"Content-Type: Application/octet-stream\\r\\n\\r\\n\"\n post_body << fileData[\"fileData\"].force_encoding(\"UTF-8\")\n end\n else\n files.each do |filePath|\n begin\n fileName = File.basename(filePath)\n post_body << \"\\r\\n--#{BaseService::BOUNDARY}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"file\\\"; filename=\\\"#{fileName}\\\"\\r\\n\"\n post_body << \"Content-Type: Application/octet-stream\\r\\n\\r\\n\"\n post_body << File.read(filePath)\n rescue\n raise PopbillException.new(-99999999, \"Failed to reading filedata from filepath\")\n end\n end\n end\n\n post_body << \"\\r\\n--#{BaseService::BOUNDARY}--\\r\\n\"\n # Add the file Data\n\n uri = URI(getServiceURL() + url)\n\n https = Net::HTTP.new(uri.host, 443)\n https.use_ssl = true\n Net::HTTP::Post.new(uri)\n\n res = https.post(uri.request_uri, post_body.join.encode(\"UTF-8\"), headers)\n\n if res.code == \"200\"\n if res.header['Content-Encoding'].eql?('gzip')\n JSON.parse(gzip_parse(res.body))\n else\n JSON.parse(res.body)\n end\n else\n raise PopbillException.new(JSON.parse(res.body)[\"code\"],\n JSON.parse(res.body)[\"message\"])\n end\n\n end", "def multipart_upload\n end", "def file_add_keywords(files=nil,keywords=nil)\n \n #1.validate class types\n #Looking for File objects or an array of File objects\n unless files.is_a?(Files) || (files.is_a?(Array) && files.first.is_a?(Files))\n warn \"Argument Error: Invalid type for first argument in \\\"file_add_keywords\\\" method.\\n\" +\n \" Expected one the following:\\n\" +\n \" 1. Single Files object\\n\" +\n \" 2. Array of Files objects\\n\" +\n \" Instead got => #{files.inspect}\"\n return false \n end \n\n unless keywords.is_a?(Keywords) || (keywords.is_a?(Array) && keywords.first.is_a?(Keywords))\n warn \"Argument Error: Invalid type for second argument in \\\"file_add_keywords\\\" method.\\n\" +\n \" Expected one the following:\\n\" +\n \" 1. Single Keywords object\\n\" +\n \" 2. Array of Keywords objects\\n\" +\n \" Instead got => #{keywords.inspect}\"\n return false \n end \n \n #2.build file json array for request body\n #There are four acceptable combinations for the arguments.\n \n if files.is_a?(Files) \n if keywords.is_a?(Keywords) #1. Two Single objects\n uri = URI.parse(@uri + \"/Files/#{files.id}/Keywords/#{keywords.id}\")\n post(uri,{})\n else #2. One File object and an array of Keywords objects\n #loop through keywords objects and append the new nested keyword to the file\n keywords.each do |keyword|\n files.keywords << NestedKeywordItems.new(keyword.id)\n end \n uri = URI.parse(@uri + \"/Files\")\n put(uri,files)\n end\n else \n if keywords.is_a?(Array) #3. Two arrays\n keywords.each do |keyword|\n uri = URI.parse(@uri + \"/Keywords/#{keyword.id}/Files\")\n data = files.map { |files_obj| {:id => files_obj.id} }\n post(uri,data)\n end\n else #4. Files array and a single Keywords object\n uri = URI.parse(@uri + \"/Keywords/#{keywords.id}/Files\")\n data = files.map { |files_obj| {:id => files_obj.id} }\n post(uri,data)\n end\n end\n \n end", "def process_put_and_post_requests(request, data)\n content_type = request['Content-Type'] ||= 'application/x-www-form-urlencoded'\n case content_type\n when 'application/x-www-form-urlencoded'; request.form_data = data\n when 'application/json'; request.body = (data.is_a?(Hash) or data.is_a?(Array)) ? JSON.generate(data) : data\n else\n #data = data.to_s unless request.body.is_a?(String)\n request.body = data\n end\n process_request(request)\n end", "def request_data\n {\n file: File.new(@upload_path, \"rb\"),\n data: @data.to_json\n }\n end", "def request_body required, media_type, data: { }, **options\n desc = options.delete(:desc) || ''\n self[:requestBody] = RequestBodyObj.new(required, desc) unless self[:requestBody].is_a?(RequestBodyObj)\n self[:requestBody].add_or_fusion(media_type, { data: data , **options })\n end", "def process\n # Fix body\n unless @data[:request][:body]._blank?\n # Make sure 'content-type' is set if we have a body\n @data[:request][:headers].set_if_blank('content-type', 'application/x-amz-json-1.1' )\n # Fix body if it is a Hash instance\n if @data[:request][:body].is_a?(Hash)\n @data[:request][:body] = Utils::contentify_body(@data[:request][:body], @data[:request][:headers]['content-type'])\n end\n # Calculate 'content-md5' when possible (some API calls wanna have it set)\n if @data[:request][:body].is_a?(String)\n @data[:request][:headers]['content-md5'] = Base64::encode64(Digest::MD5::digest(@data[:request][:body])).strip\n end\n end\n # Set date\n @data[:request][:headers].set_if_blank('x-amz-date', Time::now.utc.httpdate)\n # Set path\n @data[:request][:path] = Utils::join_urn(@data[:connection][:uri].path, @data[:request][:relative_path], @data[:request][:params])\n # Sign a request\n Utils::AWS::sign_v4_signature(\n @data[:credentials][:aws_access_key_id],\n @data[:credentials][:aws_secret_access_key],\n @data[:connection][:uri].host,\n @data[:request]\n )\n end", "def multipart?; end", "def post_upload(original_params,\n original_payload)\n\n call_tapi('POST',\n '/',\n original_params,\n original_payload,\n do_upload: true)\n end", "def post_file_request(client, post_information_hash, additional_hash = nil)\n new_hash = {}\n additional_hash ||= {} \n new_hash.merge!(additional_hash)\n\n begin\n client.post(post_information_hash, new_hash)\n rescue OpenSSL::SSL::SSLError => e\n raise \"SSLError occurred when calling REST service; #{e}\"\n rescue RestClient::Exception => e # if the request failed, RestClient will throw an error. We want to retrieve that error and the response within\n puts \"RestClient::Exception hit when calling REST service\"\n puts e\n puts e.response\n return e.response\n rescue => e\n raise \"Unexpected error occurred when calling REST service; #{e}\"\n end\n end", "def build_request_body(header_params, body, files)\n partCount = 0\n if files\n partCount += files.length\n end\n if body\n partCount += 1\n end\n if partCount > 1\n boundary = \"7d70fb31-0eb9-4846-9ea8-933dfb69d8f1\"\n header_params['Content-Type'] = \"multipart/form-data; boundary=#{boundary}\"\n data = \"\"\n if body\n put_multipart!(data, boundary, 0, body)\n end \n files.each_with_index do |val, index|\n put_multipart!(data, boundary, index + 1, val)\n end\n data << \"\\r\\n--#{boundary}--\\r\\n\"\n elsif partCount == 1\n if body\n header_params['Content-Type'] = \"text/json\"\n data = body.is_a?(String) ? body : body.to_json\n else\n header_params['Content-Type'] = \"application/octet-stream\"\n data = files[0]\n end\n else\n data = nil\n end\n data\n end", "def request_body required, media_type, data: { }, desc: '', **options\n (self[:requestBody] ||= RequestBodyObj.new(required, desc)).absorb(media_type, { data: data , **options })\n end", "def post_reader; end", "def post_file_params\n params.require(:post_file).permit(:name, :item, :type, :image_dimensions,\n :remove_item, :item_cache)\n end", "def multipart_fake_request(env = {}, params = {})\n if params.empty?\n fake_request(env)\n else\n m = Post.new(params)\n body, head = m.to_multipart\n fake_request(env.merge( :content_type => head, \n :content_length => body.length), :post_body => body)\n end\n end", "def raw_post; end", "def multipart_request_body( body )\n request_body = []\n body.files.each do |k, v|\n request_body.push :content => v.content,\n 'Content-Type' => v.content_type,\n 'Content-Disposition' => \"form-data; name=\\\"#{k}\\\"; filename=\\\"#{v.file_name}\\\"\",\n 'Content-Transfer-Encoding' => 'binary'\n end\n\n body.values.each do |k, v|\n request_body << { :content => v,\n 'Content-Disposition' => \"form-data; name=\\\"#{k}\\\"\" }\n end\n request_body\n end", "def POST; end", "def options_to_multipart_request(options)\n file = options[:file]\n @request_method = :post\n {image: HTTP::FormData::File.new(file, filename: File.basename(file), mime_type: mime_type(File.basename(file)))}\n end", "def add_file_info!(request, body)\n #add content length\n request.content_length = body.respond_to?(:lstat) ? body.lstat.size : body.size \n \n #Add filename to Content-Disposition\n request['Content-Disposition'] ||= body.respond_to?(:path) ? \"filename=#{File.basename(body.path).to_s}\" : \"\"\n \n #If content type header not set, assume binary/octet-stream, since this is a file\n request['Content-Type'] ||= 'binary/octet-stream'\n end", "def client_side_multipart_upload\n end", "def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path, real_params = {}, {\"rack.input\" => rack_input}\nend", "def request_data; end", "def request_params; end", "def perform\n add_request_if_new do |request|\n self.class.notify_if_cookies_cleared request do\n multipart_set!(request) unless multipart?(request)\n escaped_arguments = escape_or_warn_of_escape_sequences(arguments)\n escaped_arguments.each_slice 2 do |name, value|\n if value =~ /^file:/\n request.multipart[name] = FilePart.new(name,value.gsub(/^file:/,\"\")) \n else\n request.multipart[name] = StringPart.new(name,value) \n end\n end\n request.body_update\n request\n end\n end\n end", "def POST\r\n@env[\"action_dispatch.request.request_parameters\"] ||= (normalize_encode_params(super) || {})\r\nrescue TypeError => e\r\nraise ActionController::BadRequest.new(:request, e)\r\nend", "def post; end", "def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path, real_params = {}, 'rack.input' => rack_input\nend", "def set_upload_body(request, data)\n if data.respond_to? :read\n request.body_stream = data\n if data.respond_to? :size\n request.content_length = data.size\n else\n request[\"Transfer-encoding\"] = \"chunked\"\n end\n else\n request.body = data\n end\n end", "def files_post_with_http_info(api_key, file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FilesApi.files_post ...\"\n end\n # verify the required parameter 'api_key' is set\n fail ArgumentError, \"Missing the required parameter 'api_key' when calling FilesApi.files_post\" if api_key.nil?\n # verify the required parameter 'file' is set\n fail ArgumentError, \"Missing the required parameter 'file' when calling FilesApi.files_post\" if file.nil?\n # resource path\n local_var_path = \"/files\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'api_key'] = api_key\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[\"file\"] = file\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'File')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#files_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def post(request, response)\n NotImplemented\n end", "def post(request, response)\n NotImplemented\n end", "def upload\n permitted_params = params[:attachment]\n file = permitted_params.delete(:file)\n attr = {file: file, user: current_user}\n\n if permitted_params[:attachmentable_type].present? && permitted_params[:attachmentable_id].present?\n attachmentable_type = permitted_params[:attachmentable_type]\n attachmentable_id = permitted_params[:attachmentable_id]\n attr = attr.merge(attachmentable_type: attachmentable_type, attachmentable_id: attachmentable_id)\n end\n\n attachment = Attachment.new(attr)\n if attachment.savee\n render json:{\n code: 0,\n data: AttachmentSerializer.new(attachment)\n }\n else\n render json:{\n code: -1,\n data: {\n message: attachment.errors.full_messages,\n }\n }\n end\n\n end", "def post_params\n ActiveModelSerializers::Deserialization.jsonapi_parse!(params, only: [:content] )\n end", "def request_parameters; end", "def rest_post_upload(uri,filepath)\n response = RestClient::Request.execute(method: :post, \n url: uri,\n user: @rest_user, \n password: @rest_passwd,\n payload: {:multipart => true, :file => File.new(filepath)}, \n headers: {content_type: @rest_cont_type, accept: @rest_accept_type}\n )\n @resp_headers=response.headers\n @resp_code=response.code\n @resp_body=response.body \n return response\n end", "def test_post_composition_requiring_multipart_with_arrays_warns_the_noble_developer_and_everyone_stays_happy\n assert_raise(Mosquito::SageAdvice) do\n @req.post_params = {:hello => \"welcome\", :name => \"john\", :arrayed => [1, 2, 3], :somefile => MockUpload.new(\"pic.jpg\") }\n end\n \n assert_nothing_raised do\n @req.post_params = {:hello => \"welcome\", :name => \"john\", :arrayed => [1, 2, 3], :not_a_file => \"shtaink\" }\n end\n end", "def post_attachment_params\n json = params.require(:post_attachment)\n { posting_id: JSON.parse(json).permit(:posting_id), image: JSON.parse(json).permit(:original_filename)}\n #params.require(:post_attachment).permit(:posting_id, :image, :description )\n end", "def loaded_body\n @loaded_body ||= case ctype = request.content_type\n when /json/\n json_body\n when /x-www-form-urlencoded/\n request.params.dup\n when /multipart\\/form-data/\n file = params[:file]\n file_body file, Path(file[:filename]).extname\n else\n unsupported_media_type_error!(ctype)\n end\n end", "def upload_simple\r\n \r\n end", "def endpoint_params\n params.require(:data).permit(:type, {\n attributes: [:verb, :path, response: [:code, :body, headers: {}]]\n })\n end", "def post_with_binary_response(relative_path, request_headers, request_parameters, request_body, context)\n connection = @session.connection\n request_parameter_list = request_parameters &&\n request_parameters.to_request_parameters\n uri = to_absolute_uri(relative_path, request_parameter_list)\n request_headers = [] if request_headers.nil?\n\n body = nil\n if request_body.is_a? MultipartFormDataObject\n request_headers.push(RequestHeader.new('Content-Type', request_body.content_type))\n body = request_body\n elsif request_body.is_a? MultipartFormDataRequest\n multipart = request_body.to_multipart_form_data_object\n request_headers.push(RequestHeader.new('Content-Type', multipart.content_type))\n body = multipart\n elsif !request_body.nil?\n request_headers.push(RequestHeader.new('Content-Type', 'application/json'))\n body = @marshaller.marshal(request_body)\n else\n # Set the content-type, even though there is no body, to prevent the httpClient from\n # adding a content-type header after authentication has been generated.\n request_headers.push(RequestHeader.new('Content-Type', 'text/plain'))\n end\n add_generic_headers('POST', uri, request_headers, context)\n\n response_status_code, response_headers, response_body = nil\n connection.post(uri, request_headers, body) do |status_code, headers, content|\n response_status_code = status_code\n response_headers = headers\n response_body = process_binary_response(status_code, content, headers, context) do |h, c|\n yield h, c\n end\n end\n throw_exception_if_necessary(response_body, response_status_code, response_headers, relative_path)\n end", "def create\n @post = Post.new(post_params)\n headers['Content-Type'] = \"application/json; charset=UTF-8\"\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: request.request_method }\n format.json { render :json => @post.to_json(:include => [:comments]) }\n print 'request_method: '\n puts request.request_method\n print 'request_method_symbol: '\n puts request.request_method_symbol\n print 'method: '\n puts request.method\n print 'patch: '\n puts request.patch?\n print 'head: '\n puts request.head?\n print 'headers: '\n puts request.headers\n print 'original_fullpath: '\n puts request.original_fullpath\n print 'fullpath: '\n puts request.fullpath\n print 'original_url: '\n puts request.original_url\n print 'media_type: '\n puts request.media_type\n print 'content_length: '\n puts request.content_length\n print 'ip: '\n puts request.ip\n print 'remote_ip: '\n puts request.remote_ip\n print 'uuid: '\n puts request.uuid\n print 'raw_post: '\n puts request.raw_post\n print 'body: '\n puts request.body\n print 'form_data: '\n puts request.form_data?\n print 'body_stream: '\n puts request.body_stream\n print 'local: '\n puts request.local?\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def map_type_import_body(uploaded_file)\n { 'fileUpload' => UploadIO.new(uploaded_file, uploaded_file.content_type, uploaded_file.original_filename) }\n end", "def post(relative_path, request_headers, request_parameters, request_body, response_type, context)\n connection = @session.connection\n request_parameter_list = request_parameters &&\n request_parameters.to_request_parameters\n uri = to_absolute_uri(relative_path, request_parameter_list)\n request_headers = [] if request_headers.nil?\n\n body = nil\n if request_body.is_a? MultipartFormDataObject\n request_headers.push(RequestHeader.new('Content-Type', request_body.content_type))\n body = request_body\n elsif request_body.is_a? MultipartFormDataRequest\n multipart = request_body.to_multipart_form_data_object\n request_headers.push(RequestHeader.new('Content-Type', multipart.content_type))\n body = multipart\n elsif !request_body.nil?\n request_headers.push(RequestHeader.new('Content-Type', 'application/json'))\n body = @marshaller.marshal(request_body)\n else\n # Set the content-type, even though there is no body, to prevent the httpClient from\n # adding a content-type header after authentication has been generated.\n request_headers.push(RequestHeader.new('Content-Type', 'text/plain'))\n end\n\n add_generic_headers('POST', uri, request_headers, context)\n\n response_status_code, response_headers, response_body = nil\n connection.post(uri, request_headers, body) do |status_code, headers, content|\n response_status_code = status_code\n response_headers = headers\n response_body = content.read.force_encoding('UTF-8')\n end\n process_response(response_body, response_status_code, response_headers, response_type, relative_path, context)\n end", "def post_request(url, boundary=nil)\n request = Net::HTTP::Post.new(url) # , header\n content_type_str = \"multipart/form-data\"\n request['accept'] = '*/*'\n\n if boundary != nil\n content_type_str << \", boundary=#{boundary}\"\n end\n request['content-type'] = content_type_str\n\n return request\nend", "def file_upload(criteria = T.unsafe(nil)); end", "def raw_post(path, body, options = {})\n # Allow format override\n format = options.delete(:format) || @format\n # Clear cache\n expire_matching \"#{raw_path(path)}.*\"\n # Create POST request\n post = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", \n :verbose => DEBUG,\n :method => \"post\",\n :body => body,\n :headers => { :'Content-type' => options[:content_type] || content_type(format) }\n )\n\n # Send request\n do_request(post, format)\n end", "def post!\n request! :post\n end", "def post(path, **args); end", "def multipart_requestify(parameters, boundary, prefix=nil)\n if Hash === parameters\n return nil if parameters.empty?\n parameters.map { |k,v| \n multipart_requestify(v, boundary, name_with_prefix(prefix, k)) \n }\n elsif Array === parameters\n parameters.map { |v| \n multipart_requestify(v, boundary, name_with_prefix(prefix, \"\")) \n }\n elsif ActionController::TestUploadedFile === parameters\n file_to_multipart(prefix, parameters.original_filename, \n parameters.content_type, parameters.read)\n elsif parameters.nil? # use nil to mimic an empty file upload field\n file_to_multipart(prefix, '', 'application/octet-stream', '')\n elsif prefix.nil?\n parameters\n else\n text_to_multipart(prefix, parameters.to_s)\n end\n end", "def http_post_request(req_body)\n\t\t#New http request (uri library deals with port and host on its own when parsing the url)\n\t\thttp = Net::HTTP.new(@uri.host, @uri.port)\n\t\t#Original api url get does not need SSL (bad solution but any other way would not seem to work properly)\n\t\tif caller[1][/`.*'/].nil? or not (caller[1][/`.*'/][1..-2] == \"initialize\")\n\t\t\t#Https security stuff (don't need security when getting initial api url)\n\t\t\thttp.use_ssl = true\n\t\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\tend\n\t\t#Post request using uri\n\t\trequest = Net::HTTP::Post.new(@uri.request_uri)\n\t\t#Sets request to use basic authentication using the given username and api_key\n\t\trequest.basic_auth(@username, @api_key)\n\t\t#Sets request to use json content type\n\t\trequest.content_type = \"application/json\"\n\t\t#Sets request body to json file passed\n\t\trequest.body = req_body\n\t\t#Executes setup request and returns body\n\t\thttp.request(request).body\n\tend", "def userfiles_post_with_http_info(upload_file, data_provider_id, userfile_group_id, file_type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_post ...'\n end\n # verify the required parameter 'upload_file' is set\n if @api_client.config.client_side_validation && upload_file.nil?\n fail ArgumentError, \"Missing the required parameter 'upload_file' when calling UserfilesApi.userfiles_post\"\n end\n # verify the required parameter 'data_provider_id' is set\n if @api_client.config.client_side_validation && data_provider_id.nil?\n fail ArgumentError, \"Missing the required parameter 'data_provider_id' when calling UserfilesApi.userfiles_post\"\n end\n # verify the required parameter 'userfile_group_id' is set\n if @api_client.config.client_side_validation && userfile_group_id.nil?\n fail ArgumentError, \"Missing the required parameter 'userfile_group_id' when calling UserfilesApi.userfiles_post\"\n end\n # verify the required parameter 'file_type' is set\n if @api_client.config.client_side_validation && file_type.nil?\n fail ArgumentError, \"Missing the required parameter 'file_type' when calling UserfilesApi.userfiles_post\"\n end\n # resource path\n local_var_path = '/userfiles'\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(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['upload_file'] = upload_file\n form_params['data_provider_id'] = data_provider_id\n form_params['userfile[group_id]'] = userfile_group_id\n form_params['file_type'] = file_type\n form_params['_do_extract'] = opts[:'_do_extract'] if !opts[:'_do_extract'].nil?\n form_params['_up_ex_mode'] = opts[:'_up_ex_mode'] if !opts[:'_up_ex_mode'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['BrainPortalSession']\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 => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserfilesApi#userfiles_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def add_multipart_data(req,params, mime)\r\n boundary = Time.now.to_i.to_s(16)\r\n req[\"Content-Type\"] = \"multipart/form-data; boundary=#{boundary}\"\r\n body = \"\"\r\n params.each do |key,value|\r\n esc_key = CGI.escape(key.to_s)\r\n body << \"--#{boundary}#{CRLF}\"\r\n if value.respond_to?(:read)\r\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"; filename=\\\"teamicon-#{rand(100000)}\\\"#{CRLF}\"\r\n body << \"Content-Type: #{mime}#{CRLF*2}\"\r\n body << value.read\r\n else\r\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"#{CRLF*2}#{value}\"\r\n end\r\n body << CRLF\r\n end\r\n body << \"--#{boundary}--#{CRLF*2}\"\r\n req.body = body\r\n req[\"Content-Length\"] = req.body.size\r\nend", "def files_remote_post_with_http_info(file_type, title, item_type, item_id, remote_location, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FilesApi.files_remote_post ...\"\n end\n # verify the required parameter 'file_type' is set\n if @api_client.config.client_side_validation && file_type.nil?\n fail ArgumentError, \"Missing the required parameter 'file_type' when calling FilesApi.files_remote_post\"\n end\n # verify the required parameter 'title' is set\n if @api_client.config.client_side_validation && title.nil?\n fail ArgumentError, \"Missing the required parameter 'title' when calling FilesApi.files_remote_post\"\n end\n # verify the required parameter 'item_type' is set\n if @api_client.config.client_side_validation && item_type.nil?\n fail ArgumentError, \"Missing the required parameter 'item_type' when calling FilesApi.files_remote_post\"\n end\n # verify the required parameter 'item_id' is set\n if @api_client.config.client_side_validation && item_id.nil?\n fail ArgumentError, \"Missing the required parameter 'item_id' when calling FilesApi.files_remote_post\"\n end\n # verify the required parameter 'remote_location' is set\n if @api_client.config.client_side_validation && remote_location.nil?\n fail ArgumentError, \"Missing the required parameter 'remote_location' when calling FilesApi.files_remote_post\"\n end\n # resource path\n local_var_path = \"/files/remote\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n form_params[\"file_type\"] = file_type\n form_params[\"title\"] = title\n form_params[\"item_type\"] = item_type\n form_params[\"item_id\"] = item_id\n form_params[\"remote_location\"] = remote_location\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#files_remote_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end", "def _request_body_agent media_type, data: { }, **options\n request_body (@method_name['!'] ? :req : :opt), media_type, data: data, **options\n end", "def add_body_type_headers; 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 file_uploads; end", "def _upload(io, delete: delete_raw?, **options)\n super(io, delete: delete, **options)\n end", "def file_operation_params\n params.require(:file_operation).permit(:file_path, :status, :job_class, :user_type, :user_id, :info)\n end", "def post_job_content_sample(client)\n job_multipart = {\n :file => File.new($full_path),\n 'num copies' => 10\n }\n\n response = client['jobs'].post job_multipart\n\n p ''\n p 'Submit a new job'\n p response\nend", "def post(uri, options = {})\n if options[:multipart]\n form_input = build_multipart_data(options)\n build_response(request.post(uri, build_request_options({\"CONTENT_TYPE\" => \"multipart/form-data, boundary=Mack-boundary\", \"CONTENT_LENGTH\" => form_input.size, :input => form_input})))\n else\n build_response(request.post(uri, build_request_options({:input => options.to_params})))\n end\n end", "def json_params\n params.require(:json).permit(:file1,:file,:filename,:filename1,:content_type1,:content_type,:file_contents,:file_contents1,:objekt,:objekt1)\n end", "def add_multipart_data(req, params)\n crlf = \"\\r\\n\"\n boundary = Time.now.to_i.to_s(16)\n req[\"Content-Type\"] = \"multipart/form-data; boundary=#{boundary}\"\n body = \"\"\n params.each do |key,value|\n esc_key = CGI.escape(key.to_s)\n body << \"--#{boundary}#{crlf}\"\n if value.respond_to?(:read)\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"; filename=\\\"#{File.basename(value.path)}\\\"#{crlf}\"\n body << \"Content-Type: image/jpeg#{crlf*2}\"\n body << value.read\n else\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"#{crlf*2}#{value}\"\n end\n body << crlf\n end\n body << \"--#{boundary}--#{crlf*2}\"\n req.body = body\n req[\"Content-Length\"] = req.body.size\n end", "def post(path = '/files/', params = {})\n request :post, path, params\n end", "def request_params\n params.require(:request).permit(:payload, :reference)\n end", "def convert_fcgi_post(params, args = nil)\n post_hash = {}\n \n params.each do |key, realval|\n val = realval.first\n classn = val.class.name\n \n #Sometimes uploaded files are given as StringIO's.\n if classn == \"StringIO\" or classn == \"Tempfile\"\n val = Hayabusa::Http_session::Post_multipart::File_upload.new(\n :fname => val.original_filename,\n :data => val\n )\n end\n \n post_hash[key] = val\n end\n \n post_ret = {}\n post_hash.each do |varname, value|\n Knj::Web.parse_name(post_ret, varname, value)\n end\n \n return post_ret\n end", "def create_upload_request\n call(:post, upload_path)\n end", "def post_multipart(url, data={}, headers={}, http_options=@options)\n # determine the http options\n redirect_limit = http_options[:max_redirects] || max_redirects\n gateway_retries = http_options[:gateway_retry_limit] || gateway_retry_limit\n gateway_delay = http_options[:gateway_retry_delay] || gateway_retry_delay\n\n # the Content-Type header is handled automoatically by Net::HTTP::Post::Multipart\n headers.delete_if { |k,v| k.to_s.downcase == \"content-type\" }\n\n @logger.debug(\"POST #{url} #{headers.inspect} multi-part form content\")\n\n # parse the URL\n uri = URI.parse(url)\n\n # prepare the payload\n payload = data.inject({}) do |h,(k,v)| \n if v.class == File\n h[k] = UploadIO.new(v, mimetype(v).first, File.basename(v))\n elsif v.class == Array\n h[k] = v.inject([]) do |files, part|\n if part.class == File\n files << UploadIO.new(part, mimetype(part).first, File.basename(part))\n end\n end\n else\n h[k] = v\n end\n h\n end\n\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Post::Multipart.new(uri.request_uri, payload)\n headers.each { |k,v| request.add_field(k, v) }\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n if redirect_limit == -1\n @logger.info(\"HTTP response code: #{response.code}\") unless @logger.debug?\n KineticHttpResponse.new(response)\n elsif redirect_limit == 0\n raise Net::HTTPFatalError.new(\"Too many redirects\", response)\n else\n post_multipart(response['location'], data, headers, http_options.merge({\n :max_redirects => redirect_limit - 1\n }))\n end\n # handle 502, 503, 504\n when Net::HTTPBadGateway, Net::HTTPServiceUnavailable, Net::HTTPGatewayTimeOut then\n if gateway_retries == -1\n KineticHttpResponse.new(response)\n elsif gateway_retries == 0\n @logger.info(\"HTTP response: #{response.code} #{response.message}\") unless @logger.debug?\n raise Net::HTTPFatalError.new(\"#{response.code} #{response.message}\", response)\n else\n @logger.info(\"#{response.code} #{response.message}, retrying in #{gateway_delay} seconds\")\n sleep(gateway_delay)\n post_multipart(url, data, headers, http_options.merge({\n :gateway_retry_limit => gateway_retries - 1\n }))\n end\n when Net::HTTPUnknownResponse, NilClass then\n @logger.info(\"HTTP response code: 0\") unless @logger.debug?\n e = Net::HTTPFatalError.new(\"Unknown response from server\", response)\n KineticHttpResponse.new(e)\n else\n @logger.info(\"HTTP response code: #{response.code}\") unless @logger.debug?\n KineticHttpResponse.new(response)\n end\n rescue Net::HTTPBadResponse => e\n @logger.info(\"HTTP bad response: #{e.inspect}\") unless @logger.debug?\n KineticHttpResponse.new(e)\n rescue StandardError => e\n @logger.info(\"HTTP error: #{e.inspect}\") unless @logger.debug?\n KineticHttpResponse.new(e)\n end\n end", "def files_post_with_http_info(file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FilesApi.files_post ...\"\n end\n # verify the required parameter 'file' is set\n if @api_client.config.client_side_validation && file.nil?\n fail ArgumentError, \"Missing the required parameter 'file' when calling FilesApi.files_post\"\n end\n # resource path\n local_var_path = \"/files\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n form_params[\"file\"] = file\n form_params[\"deal_id\"] = opts[:'deal_id'] if !opts[:'deal_id'].nil?\n form_params[\"person_id\"] = opts[:'person_id'] if !opts[:'person_id'].nil?\n form_params[\"org_id\"] = opts[:'org_id'] if !opts[:'org_id'].nil?\n form_params[\"product_id\"] = opts[:'product_id'] if !opts[:'product_id'].nil?\n form_params[\"activity_id\"] = opts[:'activity_id'] if !opts[:'activity_id'].nil?\n form_params[\"note_id\"] = opts[:'note_id'] if !opts[:'note_id'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#files_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end", "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end", "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end", "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end", "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end", "def test_attach_file\n# post :upload, \"note\"=>{\"title\"=>\"my note\"}, \"courseid\"=>\"806350272748085520\",\n# \"processor\"=>{\"id\"=>\"1000001\"}, \"success\"=>\"/course/806350272748085520/ACMA-320/share_notes\", \n# \"upload_id\"=>\"1169944954\", \n# \"failure\"=>\"/course/806350272748085520/ACMA-320/share_notes\"\n \n post :upload, \"noteid\"=>\"816717565610925385\", \"processor\"=>{\"id\"=>\"1000001\"}\n \n end", "def upload_request(*args)\n UploadRequest.new(self).request(*args)\n end", "def test_client_can_put_multipart_responses\n url = \"http://some.endpoint/some.json\"\n stub_request(:put, url)\n .with(headers: { \"Content-Type\" => %r{multipart/form-data; boundary=----RubyFormBoundary\\w+} }) { |request|\n request.body =~ %r{------RubyFormBoundary\\w+\\r\\nContent-Disposition: form-data; name=\"a\"\\r\\n\\r\\n123\\r\\n------RubyFormBoundary\\w+--\\r\\n}\n }.to_return(body: '{\"b\": \"1\"}', status: 200)\n\n response = @client.put_multipart(\"http://some.endpoint/some.json\", \"a\" => \"123\")\n assert_equal \"1\", response[\"b\"]\n end", "def post_data\n @request[\"postData\"]\n end", "def add_multipart_data(req,params)\n boundary = Time.now.to_i.to_s(16)\n req[\"Content-Type\"] = \"multipart/form-data; boundary=#{boundary}\"\n body = \"\"\n params.each do |key,value|\n esc_key = CGI.escape(key.to_s)\n body << \"--#{boundary}#{CRLF}\"\n if value.respond_to?(:read)\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"; filename=\\\"#{File.basename(value.path)}\\\"#{CRLF}\"\n body << \"Content-Type: #{mime_type(value.path)}#{CRLF*2}\"\n body << value.read\n else\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"#{CRLF*2}#{value}\"\n end\n body << CRLF\n end\n body << \"--#{boundary}--#{CRLF*2}\"\n req.body = body\n req[\"Content-Length\"] = req.body.size\n end", "def post(path, body, headers: {})\n path = \"#{API_PATH}#{path}\"\n return super(path, body, headers: admin_headers(path, body.to_json, 'POST').merge(headers))\n end", "def get_body\n request_object.body\n end", "def requested_file(request_line)\r\n # ... implementation details to be discussed later ...\r\nend", "def upload_file\n #TODO\n end", "def upload_shipped\n end", "def update_params\n super.tap do |params|\n params[:request_format] = :json\n params[:expected_response] = Net::HTTPOK\n end\n end", "def upload_file(folder_id, file_url) \n\tputs \"Uploading file: \" + file_url + \" to folder: \" + folder_id\n\tfile = {\n\t\t:url => file_url, \n\t\t:name => \"Ruby_File.pdf\", \n\t\t:notes => \"This was uploaded using Ruby\", \n\t\t:copies => 1, \n\t\t:folderId => folder_id,\n\t\t# :flow => \"Flow ezName\" # The flow value is either the easy submit name of the flow or the _id property from get_flows()\n\t}\n\tdata = JSON.generate(file)\n\tresponse = request_post('/api/partner/file', data)\n\tputs response.body\nend", "def http_post(path, request)\n @http.post(\n :body => JSON(:request => request.to_hash),\n :headers => headers,\n :path => \"/api/v2/#{path}\",\n :expects => [200, 201, 202]\n )\n end", "def post_request(client,path,header,request_file,sink)\n # Post via stream\n req = Net::HTTP::Post.new(path,header)\n req.body_stream = request_file\n sink.binmode\n resp = client.request(req) do |res|\n res.read_body do |b|\n sink.write(b)\n end\n sink.rewind\n sink.size\n sink\n end\n resp\n end", "def convert()\n @helper.post(@fields, @files, @raw_data)\n end", "def post_recording_batchrequests_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.post_recording_batchrequests ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling RecordingApi.post_recording_batchrequests\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/recording/batchrequests\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BatchDownloadJobSubmissionResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#post_recording_batchrequests\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def batch_file_params\n params.require(:batch_file).permit(:name, :file)\n end", "def post_attachment(file_s)\n setup\n @req = Net::HTTP::Post.new(\"/uploads.json\")\n auth\n @req[\"Content-Type\"] = \"application/octet-stream\"\n @req[\"Content-Length\"] = file_s.length\n @req.body = file_s\n res = @http.request(@req)\n\n if res.code.to_i == 201\n return [true, JSON.load(res.body)[\"upload\"][\"token\"]]\n else\n return [false, JSON.load(res.body)[\"errors\"].first]\n end\n end", "def post(uri, request_headers, body)\n raise NotImplementedError\n end", "def read_rack_input(body)\n fmt = request.media_type ? mime_types[request.media_type] : options[:default_format]\n\n throw :error, status: 415, message: \"The provided content-type '#{request.media_type}' is not supported.\" unless content_type_for(fmt)\n parser = Grape::Parser.parser_for fmt, **options\n if parser\n begin\n body = (env[Grape::Env::API_REQUEST_BODY] = parser.call(body, env))\n if body.is_a?(Hash)\n env[Grape::Env::RACK_REQUEST_FORM_HASH] = if env.key?(Grape::Env::RACK_REQUEST_FORM_HASH)\n env[Grape::Env::RACK_REQUEST_FORM_HASH].merge(body)\n else\n body\n end\n env[Grape::Env::RACK_REQUEST_FORM_INPUT] = env[Grape::Env::RACK_INPUT]\n end\n rescue Grape::Exceptions::Base => e\n raise e\n rescue StandardError => e\n throw :error, status: 400, message: e.message, backtrace: e.backtrace, original_exception: e\n end\n else\n env[Grape::Env::API_REQUEST_BODY] = body\n end\n end" ]
[ "0.6750536", "0.6492899", "0.6247419", "0.6195176", "0.61451447", "0.61445546", "0.6132749", "0.61242837", "0.6123576", "0.609281", "0.6086141", "0.6047472", "0.5963688", "0.5949453", "0.5889414", "0.58756244", "0.58436054", "0.5790417", "0.57813287", "0.5767067", "0.5757175", "0.57279855", "0.5673328", "0.56623286", "0.56515557", "0.56363624", "0.56319994", "0.5626402", "0.56203574", "0.5607682", "0.56056887", "0.55958253", "0.55933136", "0.55919325", "0.5577042", "0.5574144", "0.55715775", "0.55715775", "0.55633783", "0.556169", "0.5557155", "0.5552464", "0.55440176", "0.5528915", "0.5526865", "0.55249894", "0.5519395", "0.5519092", "0.5515158", "0.5514307", "0.5509788", "0.5507164", "0.5502724", "0.5500351", "0.5497963", "0.5475767", "0.5474379", "0.5458381", "0.54580945", "0.5456134", "0.5450724", "0.5449138", "0.54472214", "0.54455334", "0.5444277", "0.5437215", "0.5435865", "0.54172313", "0.54032874", "0.5398197", "0.5393051", "0.5389235", "0.53879344", "0.5385723", "0.53819495", "0.53778243", "0.5377391", "0.53682405", "0.53682405", "0.53682405", "0.53682405", "0.53519005", "0.5350693", "0.5349021", "0.5347982", "0.53433657", "0.53428966", "0.5342503", "0.5342256", "0.5341432", "0.5341292", "0.53408283", "0.5340628", "0.533679", "0.53357834", "0.53355896", "0.5335043", "0.5332321", "0.5329321", "0.53260493", "0.53258765" ]
0.0
-1
Get root nodes count/array for explorer tree
def x_get_tree_roots(_count_only, _options) resolve = {} CustomButton.button_classes.each { |db| resolve[db] = ui_lookup(:model => db) } @sb[:target_classes] = resolve.invert resolve = Array(resolve.invert).sort resolve.collect do |typ| {:id => "ab_#{typ[1]}", :text => typ[0], :image => buttons_node_image(typ[1]), :tip => typ[0]} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def x_get_tree_roots\n count_only_or_objects(false, PxeServer.all, \"name\")\n end", "def x_get_tree_roots\n count_only_or_objects(false, StorageCluster.all)\n end", "def x_get_tree_roots\n count_only_or_objects(false, MiqPolicySet.all, :description)\n end", "def get_number_of_root_elements(elements)\n num = 0\n parent_field = @db_fields[:parent]\n elements.each do |e|\n num += 1 if e.send(parent_field) == 0\n end\n num\n end", "def nodeCount\n count = 1\n\n if @children.size\n @children.each do |key, val|\n count += val.nodeCount\n end\n end\n\n count\n end", "def x_get_tree_roots(count_only, _options)\n objects = []\n objects.push(:id => \"asrv\",\n :text => _(\"Active Services\"),\n :icon => \"pficon pficon-folder-close\",\n :load_children => true,\n :tip => _(\"Active Services\"))\n objects.push(:id => \"rsrv\",\n :text => _(\"Retired Services\"),\n :icon => \"pficon pficon-folder-close\",\n :load_children => true,\n :tip => _(\"Retired Services\"))\n count_only_or_objects(count_only, objects)\n end", "def x_get_tree_roots\n objects = []\n objects << {:id => \"compliance\", :text => _(\"Compliance Policies\"), :icon => \"pficon pficon-history\", :tip => _(\"Compliance Policies\")}\n objects << {:id => \"control\", :text => _(\"Control Policies\"), :icon => \"fa fa-shield\", :tip => _(\"Control Policies\")}\n\n # Push folder node ids onto open_nodes array\n objects.each { |o| open_node(\"xx-#{o[:id]}\") }\n\n count_only_or_objects(false, objects)\n end", "def num_tree_levels\n level = 0\n num_nodes= all_node_values_with_nil.length # considers tree as 'complete\n num_nodes_in_full_tree = 2**level\n until num_nodes_in_full_tree >= num_nodes\n level += 1\n num_nodes_in_full_tree += 2**level\n end\n num_tree_levels = level + 1 # (started count at 0)\n num_tree_levels = 0 if @root.nil?\n return num_tree_levels\n end", "def size\n return @tree.size\n end", "def x_get_tree_roots\n objects = []\n objects.push(configured_systems)\n count_only_or_objects(false, objects + FILTERS.values)\n end", "def count_nodes(node = @root)\n node.children.map do |child_node|\n @node_count +=1\n # binding.pry if child_node.is_word\n count_nodes(child_node)\n end\n @node_count\n end", "def length\n @tree.length\n end", "def x_get_tree_roots(count_only, _options)\n objects = Rbac.filtered(VmdbDatabase.my_database.evm_tables).to_a\n # storing table names and their id in hash so they can be used to build links on summary screen in top 5 boxes\n @sb[:vmdb_tables] = {}\n objects.each do |o|\n @sb[:vmdb_tables][o.name] = o.id\n end\n count_only_or_objects(count_only, objects, \"name\")\n end", "def size\n @root and @root.size or 0\n end", "def x_get_tree_roots(count_only, _options)\n objects = Rbac.filtered(Dialog.all).sort_by { |a| a.label.downcase }\n count_only_or_objects(count_only, objects)\n end", "def total_count\n object.nodes.size\n end", "def TreeView_GetCount(hwnd) send_treeview_message(hwnd, :GETCOUNT) end", "def leaf_count\n @leaf_count\n end", "def num_children\n `#@native.numChildren()`\n end", "def TreeView_GetSelectedCount(hwnd) send_treeview_message(hwnd, :GETSELECTEDCOUNT) end", "def current_num_nodes() ; info[:current_num_nodes] ; end", "def _num_of_children(root)\n return [ 0, nil, nil ] if root.nil?\n #\n n = root.lnode.nil? ? 0 : 1\n n += root.rnode.nil? ? 0 : 1\n [n, root.lnode, root.rnode]\n end", "def count_child_nodes(hash = self)\n count = 0\n walk_tree(hash) do\n count += 1\n end\n count\n end", "def render_child_count(node = @tree.root)\n @stack.push(node)\n child_count = 0\n until @stack.empty?\n current_node = @stack.pop\n current_node.children.each do |child|\n @stack.push(child)\n child_count += 1\n end\n end\n child_count\n end", "def size(root)\n leftCount = root.left ? size(root.left) : 0\n rightCount = root.right ? size(root.right) : 0\n return 1 + leftCount + rightCount\n end", "def fulltree_count(*args)\n fulltree_rels(*args).size\n end", "def top\r\n top = root.children\r\n top.map { |i| [i, top_level_count(i)] }.sort_by { |i| i.last }.reverse\r\n end", "def x_get_tree_roots(count_only, _options)\n count_only_or_objects(count_only,\n Rbac.filtered(ManageIQ::Providers::AnsibleTower::ConfigurationManager.order(\"lower(name)\"),\n :match_via_descendants => ConfigurationScript), \"name\")\n end", "def TreeView_GetVisibleCount(hwnd) send_treeview_message(hwnd, :GETVISIBLECOUNT) end", "def count_nodes\n @page.xpath(\"//*\").count\n end", "def orbit_count\n return 0 unless @root\n sum_of_depths = 0\n nodes_to_traverse = [{ node: @root, depth: 0 }]\n until nodes_to_traverse.empty?\n node_pair = nodes_to_traverse.shift\n node = node_pair[:node]\n depth = node_pair[:depth]\n sum_of_depths += depth\n node.children.each { |child| nodes_to_traverse << { node: child, depth: depth + 1 } }\n end\n sum_of_depths\n end", "def full_tree_node_count(min_capacity)\n full_tree_leaf_count(min_capacity) * 2 - 1\n end", "def children_size\n leaf? ? 0 : children.map(&:size).reduce(:+)\n end", "def num_children\n @children.size\n end", "def getNodeElementCount\n return @nodeElements.size\n end", "def size\n @nodes.length\n end", "def size\n @nodes.length\n end", "def total\n object.nodes.size\n end", "def number_of_children\n @children.size\n end", "def size\n @nodes.size\n end", "def num_documents_include_tree_children\n num_documents_include_tree_children_rec( self )\n end", "def size\n all_nodes.length\n end", "def full_nodes_count(root)\n if root.nil?\n puts 'Empty tree'\n return\n end\n full_nodes_count = 0\n queue = QueueWithLinkedList.new\n queue.enqueue(root)\n while !queue.isEmpty?\n node = queue.dequeue\n full_nodes_count += 1 if node.left && node.right\n queue.enqueue(node.left) if node.left\n queue.enqueue(node.right) if node.right\n end\n full_nodes_count\n end", "def size\n count = 0\n visit_nodes do\n count += 1\n end\n count\n end", "def size\n counter = 0\n each { |node| counter += 1 }\n return counter\n end", "def getCount\n return @nodeValues.size\n end", "def nodes()\n self.root.nodes()\n end", "def nodes\n @graph.keys.length\n end", "def level\n root? ? 0 : ancestors.count\n end", "def top_level_section_count\n @top_level.items.size\n end", "def height_nodes(root)\n return 0 if root == nil\n\n left = height_nodes(root.left)\n right = height_nodes(root.right)\n\n if left > right\n h = 1 + left\n else\n h = 1 + right\n end\n\n return h\n\nend", "def render_child_type_count(node = @tree.root)\n @stack.push(node)\n result_hash = {}\n tag_count = 0\n content_count = 0\n until @stack.empty?\n current_node = @stack.pop\n current_node.children.each do |child|\n @stack.push(child)\n child.data.each do |key, value|\n if result_hash[key].nil?\n result_hash[key] = 1\n else\n result_hash[key] += 1\n end\n end\n\n end\n end\n result_hash[:total_nodes] = render_child_count(node)\n result_hash.delete(:type)\n result_hash\n end", "def subtree_count(*args)\n subtree_rels(*args).size\n end", "def total_child_count\n count = 0\n self.apply_to_children { |e| count += 1 }\n count\n end", "def returned_nodes_count\n @traversal_position.returnedNodesCount\n end", "def children_count(id)\n wait_for_ajax do\n page.driver.browser.execute_script(<<-JS)\n return Ext.ComponentQuery.query('treepanel')[0].getStore().getNodeById('#{id}').childNodes.length;\n JS\n end\n end", "def num_children\n count = 0\n self.children.each do |child|\n count = count + child.num_children\n end\n\n return self.children.size + count\n end", "def node_count\n @nodes.length - 1\n end", "def x_get_tree_roots(_count_only, _options)\n resolve = {}\n CustomButton.button_classes.each { |db| resolve[db] = ui_lookup(:model => db) }\n @sb[:target_classes] = resolve.invert\n resolve = Array(resolve.invert).sort\n resolve.collect do |typ|\n {:id => \"ab_#{typ[1]}\", :text => typ[0], :tip => typ[0]}.merge(buttons_node_image(typ[1]))\n end\n end", "def count\n count = 0\n\n each do |node|\n count += 1\n end\n\n return count\n end", "def size\n @children.size\n end", "def size\n size_helper(@root)\n end", "def level\n length = 0\n cursor = self\n while cursor.parent_document\n length += 1\n cursor = cursor.parent_document\n end\n length\n end", "def number_of_nodes(node_name)\n nodes(node_name).count\nend", "def num_documents_include_tree_children_rec(parent_cluster) \n num_total = parent_cluster.num_documents\n\n parent_cluster.tree_children.each do |child|\n num_total += child.num_documents_include_tree_children\n end\n\n return num_total\n end", "def height\n count = 0\n if @root != nil\n count = height_helper(@root)\n end\n return count\n end", "def size(tree)\n if isEmpty?(tree)\n 0\n else\n 1 + size(tree.left) + size(tree.right)\n end\nend", "def num_clusters_include_tree_children\n num_clusters_include_tree_children_rec( self )\n end", "def test_list_root_items\n elfinder = ElFinder::Connector.new({\n :root => @vroot,\n :url => '/elfinder',\n :tree_sub_folders => false,\n :original_filename_method => lambda {|file| File.basename(file.path)}\n })\n\n h, r = elfinder.run(:cmd => 'open', :init => 'true', :target => '', :tree => true)\n assert_equal 0, r[:tree][:dirs].count\n end", "def rowCount(parent)\n if info = info_from_index(parent)\n info.children.size\n else 0\n end\n end", "def node_count(type = nil)\n if type\n value = @db.m_get(\"node#{type}\")\n if value\n value.to_i\n end\n else\n @db.m_get(\"n\").to_i\n end\n end", "def length\n @children.length\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 ll_size()\n return @num_nodes\n end", "def child_element_count\n num = 0\n self.each_child_node do |n|\n if n.node_type == ELEMENT_NODE then\n num += 1\n end\n end\n return num\n end", "def children_count\n 0 if @left.nil? && @right.nil?\n 1 if @left.nil? || @right.nil?\n 2\n end", "def all_children_count(scope = nil)\n return all_children(scope).length if scope.is_a?(Hash)\n return (self[right_col_name] - self[left_col_name] - 1)/2\n end", "def node_size\n @results.size\n end", "def parent_count(*args)\n parent_rels(*args).size\n end", "def children_count\n return (self[nested_set_right] - self[nested_set_left] - 1) / 2\n end", "def size_without_recursion\n count = 0\n return 0 unless @root\n q = QueueWithLinkedList.new\n q.enqueue(@root)\n while !q.isEmpty?\n node = q.dequeue\n count += 1\n q.enqueue(node.left) if node.left\n q.enqueue(node.right) if node.right\n end\n count\n end", "def x_get_tree_roots\n objects = []\n objects.push(:id => \"xx-system\",\n :text => _(\"Examples (read only)\"),\n :icon => \"pficon pficon-folder-close\",\n :tip => _(\"Examples (read only)\"))\n PxeImageType.all.sort.each do |item, _idx|\n objects.push(item)\n end\n objects\n end", "def depth\n crumbs.size\n end", "def count_children\n count = children.count\n if count\n children.each { |child| count += child.count_children }\n end\n count\n end", "def print_tree_size()\n\t\tputs \"Total size for #{@folder_walker.folder} is #{commify(@folder_walker.total_size)}\"\n\tend", "def node_count\n raise NotImplementedError\n end", "def node_depths(root)\n sum_of_depths = 0\n stack = [{\"node\"=> root, \"depth\"=> 0}]\n\n while stack.length > 0\n node_info = stack.pop()\n node, depth = node_info[\"node\"], node_info[\"depth\"]\n if node.nil?\n next\n end\n sum_of_depths += depth\n stack.append({\"node\"=> node.left, \"depth\"=> depth + 1})\n stack.append({\"node\"=> node.right, \"depth\"=> depth + 1})\n end\n return sum_of_depths\n\nend", "def segment_count\n children.map(&:segment_count).inject(:+).to_i + 2\n end", "def height\n height_recursive(@root)\n end", "def challenge4\n\t@size = length(@rootNode)\n\tputs \"Challenge #4 solution: \"\n\tputs \"Number of nodes in tree: \" + @size.to_s\n\tputs \"-----------------------------------\"\nend", "def calculate_num_children\n for x in @lattice do\n for c in @lattice.lower_covers[x] do\n if @irreducibles.contain?(c) then\n @num_children[x] += 1\n end\n end\n end\n end", "def count_all\n # map all nodes into enumerable\n # then add them all together (reduce :+)\n self.map { |node| node.count }.reduce(:+)\n end", "def height\n return 0 if @root.nil?\n return [height_helper(@root.left), height_helper(@root.right)].max + 1\n end", "def size\n size_support(self.root)\n end", "def children_count\n return (self[acts_as_nested_set_options[:right_column]] - self[acts_as_nested_set_options[:left_column]] - 1)/2\n end", "def total_parent_collections\n parent_collections.nil? ? 0 : parent_collections.response['numFound']\n end", "def depth\n depth_support(self.root)\n end", "def num_nests\n my_nests.length\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 depth()\n #This is a stub, used for indexing\n end" ]
[ "0.769075", "0.7564679", "0.7150569", "0.7135373", "0.7068182", "0.7036481", "0.7035818", "0.70299476", "0.69325095", "0.6925408", "0.69242346", "0.6908054", "0.6880502", "0.68336684", "0.6818326", "0.681651", "0.6807408", "0.68010336", "0.6789652", "0.67728794", "0.67718107", "0.67703456", "0.67613065", "0.6671822", "0.66699576", "0.66507417", "0.66108227", "0.65878266", "0.65830976", "0.65827036", "0.65443605", "0.6536968", "0.6532643", "0.6511422", "0.64990234", "0.64804804", "0.64804804", "0.64712787", "0.6470115", "0.64573663", "0.64276356", "0.6422379", "0.6412075", "0.6388406", "0.6387613", "0.63791186", "0.6378864", "0.6371331", "0.6346769", "0.6338521", "0.6326998", "0.63247776", "0.631943", "0.6306374", "0.62981904", "0.6296424", "0.62774974", "0.62599486", "0.62484", "0.62304753", "0.6215268", "0.62135565", "0.61991847", "0.61738545", "0.61620057", "0.61386234", "0.6126918", "0.61056083", "0.61014986", "0.6081794", "0.607273", "0.60690624", "0.6040663", "0.6024505", "0.6004131", "0.60013074", "0.6000525", "0.5992614", "0.59906244", "0.5988884", "0.5982875", "0.59716576", "0.5955717", "0.59521645", "0.5951636", "0.59484", "0.5939753", "0.59375775", "0.5930354", "0.5923584", "0.59223574", "0.5916262", "0.58954597", "0.58827937", "0.5879963", "0.58706874", "0.58615917", "0.5860413", "0.5853033", "0.58476615" ]
0.6326881
51
before_action :authenticate_user! GET /posts GET /posts.json
def index @posts = Post.user_posts current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n if user_signed_in?\n\n @post = current_user.posts.find(params[:id])\n \n if @post.user_id == current_user.id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n else\n redirect_to action: 'index'\n end\n else\n redirect_to action: 'index'\n end \n end", "def show\n @post = Post.find(params[:id])\n\n if !authenticated? && !@post.status\n redirect_to posts_path\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end\n end", "def index\n # Once someone signs in, hand things over to the angular page\n if current_user && user_signed_in?\n #@post = Post.all\n respond_to do |format|\n format.json { render json: Post.all }\n format.html\n end\n\n else\n redirect_to new_user_session_path\n end\n end", "def index\n\n # We display the posts be cronological inverted order\n if authenticated?\n @posts = Post.order('created_at DESC').page(params[:page])\n else\n @posts = Post.order('created_at DESC').where(:status => :true).page(params[:page])\n end\n \n respond_to do |format|\n format.html { render html: @posts }\n format.json { render json: @posts }\n end\n end", "def user_post\n @posts = Post.where(user_id: current_user.id)\n\n if @posts.nil?\n render :json => {message: \"Cannot find post\" }\n end\n\n render :index\n end", "def show\n if (!@isLogin || !@isValidUser)\n return\n end\n @posts = @user.posts\n end", "def show\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end", "def index\n if authenticated?\n @posts = Post.first(7)\n else\n redirect_to '/login'\n end\n end", "def authorize\n if !current_user\n flash[:alert] = \"Sign in to access that feature.\"\n redirect_to '/posts'\n end\n end", "def index\n @posts = current_user.posts\n\n end", "def index\n @posts = current_user.posts\n end", "def index\n @bad_login = params[:bad_login]\n @user_session = current_user_session\n @user_session ||= UserSession.new\n @posts = Post.order(\"created_at DESC\").page(params[:page]).per(5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = @current_user.posts\n end", "def index\n if !( user_signed_in? && current_user.admin? )\n redirect_to root_path\n flash[:notice] = 'insufficient privilege' \n return \n end\n @posts = Post.all\n end", "def index\n @posts = Post.all\n @user = current_user\n end", "def index\n #@posts = Post.all\n# @posts = Post.order(\"created_at\").page(params[:page]).per(10)\n if admin_signed_in?\n @posts = Post.find(:all, :conditions => [\"activate = ?\", true], :order => \"created_at\")\n @posts = Kaminari.paginate_array(@posts).page(params[:page]).per(20)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n else\n raise 'Please sign in!'\n end\n end", "def show\n \tif(logged_in)\n \t\t@posts = User.find(@user.id).posts\n \telse\n \t\treturn\n \tend\n end", "def posts\n @user = User.find(params[:id])\n redirect_to posts_path if !current_user.admin? && !@user.activated?\n @posts = @user.posts.order(\"created_at DESC\")\n end", "def show\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n render json: @post\n end", "def index\n if params[:user_id]\n @posts = Post.where(user_id: params[:user_id])\n else\n @posts = current_user.posts\n end\n end", "def auth\n\n @user = current_user\n render json: @user\n \n end", "def index\n @posts = Post.all\n @posts = paginate(@posts)\n authorize @posts\n\n render json: @posts, each_serializer: Api::V1::PostSerializer, meta: meta_attributes(@posts)\n end", "def create\n @post = Post.new(params[:post])\n @post.user = User.find_by_auth_token!(cookies[:auth_token])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @posts = Post.where(user_id: current_user)\n end", "def authenticate!\n\t\t# :authenticate_user!\n\n\t\t# if u are trying to access any pages other than the sign in page and you are not a user, you are redirected to the login page\n\t\tif current_user.nil? && protected_routes\n\t\t\tredirect_to new_user_session_path, alert: \"Must sign in to proceed\" and return\n\t\tend\n\t\tif params[:controller] == 'posts' && params[:id] && !params[:commit] == 'Search'\n\t\t\tcurrent_post = Post.find(params[:id])\n\t\t\tif (params[:action] == 'edit' || params[:action] == 'update' || params[:action] == 'destroy')\n\t\t\t if current_post.user == current_user\n\t\t\t # when you return from authentication!, the program continues to requested page\n\t\t\t return\n\t\t\t else\n\t\t\t # by redirecting here, we are preventing the user from visiting the requested page\n\t\t\t redirect_to root_url, notice: \"Record not found\" and return\n\t\t\t end\n\t\t\tend\n\t\tend\n\t\tif params[:controller] == 'answers' && params[:id] \n\t\t\tcurrent_answer = Answer.find(params[:id])\n\t\t\tif (params[:action] == 'edit' || params[:action] == 'update' || params[:action] == 'destroy')\n\t\t\t if current_answer.user == current_user\n\t\t\t # when you return from authentication!, the program continues to requested page\n\t\t\t return\n\t\t\t else\n\t\t\t # by redirecting here, we are preventing the user from visiting the requested page\n\t\t\t redirect_to root_url, notice: \"Record not found\" and return\n\t\t\t end\n\t\t\tend\n\t\tend\n\tend", "def authenticate\n respond_to do |format|\n format.js { render nothing: true, status: 401 if current_user.nil? }\n format.html { redirect_to root_url if current_user.nil? }\n end\n end", "def showPosts\n @user = User.find_by_id(params[:id])\n respond_to do |format|\n format.html{render action: \"show\"}\n end\n end", "def index\n # @posts = Post.all\n # we want to scope the posts to the current user only\n @posts = current_user.posts\n end", "def show\n @user = User.find(params[:id])\n @posts = @user.posts\n\n respond_to do |format|\n format.json { render json: {user: User._build(@user), posts: Post.build_posts(@posts)}, location: root_path }\n end\n end", "def show\n @post = Post.find(params[:id])\n @post_comments = @post.comments.order('created_at DESC')\n if user_signed_in? \n @comment = @post.comments.new(user_id: current_user.id)\n end\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @posts = Post.all\n #authorize! if can? :read, @post\n @title = @post.title\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def authenticate_current_user\n render json: {}, status: :unauthorized if get_current_user.nil?\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 show\n\t\tpost = Post.find_by(id: params[:id])\n\t\tif post\n\t\trender json: {success: true, auth_token: @current_user.authentication_token, post_desc: post.description}\n\t\telse\n\t\trender json: {success: false, message: \"Not found\"}, status: 404\n\t\tend\n\tend", "def authenticate\n# byebug\n return true if public_action?\n if request.format.json?\n authenticate_token || render_json_unauthorized\n else\n authenticate_user!\n end\n end", "def authenticate_posting_author\n return unless load_posting\n \n unless current_user.wrote?(@posting)\n flash[:warning] = '포스팅을 올린 사람만 삭제할 수 있습니다'\n respond_to do |format|\n format.js { render 'layouts/redirect' }\n format.html { redirect_to root_url }\n end\n end\n \n end", "def index\n render json: current_user.posts.all\n # TODO order posts alphabetically\n end", "def authenticate\n return true if public_action?\n if request.format.json?\n render_json_unauthorized unless authenticate_token\n else\n authenticate_user!\n end\n end", "def posts\n @user = User.find(params[:id])\n end", "def is_login?\n @post = Post.where(:id => params[:id]).first\n unless current_user.present?\n respond_to do |format|\n format.js { \n @comments = @post.comments.created_at_order\n flash[:error] = \"You need to sign in or sign up before continuing.\" \n render action: :create and return true \n }\n end\n end\n end", "def authenticate_user\n\t\trender_unauthorized unless current_user\n\tend", "def before_request\n @post = Post.find(params[:post])\n end", "def index\n puts \"\\n******* post/index *******\"\n puts \"** session[:user_id], #{session[:user_id]}\"\n @user = User.where(id: session[:user_id]).first\n @posts = Post.where(user_id: session[:user_id])\n end", "def ensure_authenticated_user\r\n head :unauthorized unless current_user\r\n end", "def is_authenticated\n render json:{}, status:204\n end", "def show\n @post = current_user.posts.find_by_id(params[:id])\n redirect_to root_path, :alert => 'An error has occured.' unless @post\n end", "def index\n if @user.nil?\n redirect_message\n # @posts = Post.all\n else\n @posts = @user.posts\n end\n \n end", "def index\n @posts = Post.all.order_by([:date_published, :desc]).page(params[:page]).per(20)\n #authorize! if cannot? :read, @posts\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n if(!current_user.is_super_admin && !current_user.is_admin)\n redirect_to posts_path\n return\n end\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n #para mostrar solo los post del usuario actual\n @posts = Post.where(usuario_id: current_usuario.id).all\n puts \"USUARIOOOO\"\n puts current_usuario.to_json\n\n #@posts = Post.all\n end", "def show\n \n # Pass through the specified user, making sure that it exists\n if !@user = User.find_by_login(params[:user_login])\n raise ActiveRecord::RecordNotFound\n end\n \n # Pass through all posts by the specified user, except for empty ones\n @posts = Post.paginate(:page => params[:page], \n :conditions => empty_post_filter + \" and user_id = #{@user.id}\",\n :order => 'created_at DESC', :per_page => 5)\n end", "def authenticate_user!\n unless @current_user\n head :unauthorized\n end\n end", "def ensure_authenticated_user\n render json: {message: 'Unauthorized'}, status: 401 unless current_user\n # head :unauthorized unless current_user\n end", "def authenticate_user!\n unless current_user\n render :json => {'error' => 'authentication error'}, :status => 401\n end\n end", "def index\n render json: { posts: current_user.posts.all.map(&:to_h) }\n end", "def show\n @user = User.find_by(id: params[:id])\n @posts = @user.posts\n end", "def show\n @sites = current_user.sites\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def index\n @posts = Post.all\n # authorize @posts\n puts \"current project is: #{@current_project.name}\"\n end", "def authenticate\n render json: { error: 'Access Denied' }, status: 401 unless current_user\n end", "def only_current_user_posts\n\t\t\t@user = User.find( params[:user_id] )\n\t\t\tredirect_to(root_url) unless @user == current_user\n\t\tend", "def new\n if user_signed_in?\n\n @post = current_user.posts.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n format.js { render json: @post}\n end\n else\n redirect_to action: 'index'\n end\n end", "def create\n post = @current_user.posts.create(post_params)\n\n if post.save\n render json: post\n else\n render json: { errors: post.errors.full_messages }, status: :forbidden\n end\n end", "def show\n @posts = @user.posts\n end", "def index\n@posts = Post.get_posts(current_user)\n success_post_index\n end", "def check_post_owner\n json_response({ error: 'Not authorized' }, :unauthorized) unless @post.user_id == current_user.id\n end", "def logged_in_user\n unless logged_in?\n render json: { error: 'Log in to access this page'}, status: :unauthorized\n end\n end", "def show\n @usuario = Usuario.find(params[:id])\n @posts = Post.where(:usuario_id => @usuario.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n end", "def authenticate_user!\n \tunless current_user?\n \trender status: :unauthorized\n \tend\n end", "def create\n \tif logged_in?\n params[:post][:user_id] = current_user.id\n @post = Post.new(post_params)\n if @post.save\n puts @post.published\n render json: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { \n if user_signed_in? and current_user.can_post\n redirect_to posts_url\n else\n redirect_to root_url\n end\n }\n format.json { head :ok }\n end\n end", "def authenticate_user!(options = {})\n head :unauthorized unless signed_user_in?\n end", "def index\n @posts = Post.order(\"created_at DESC\").includes(:user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @user = User.find(params[:user_id])\n if @user.auth_token == params[:auth_token]\n @posts = @user.posts.reverse_order\n start = params[:start].to_i\n count = params[:count].to_i\n @posts = @posts[start, count]\n render json: @posts, meta: { status: :ok, count: @posts.count }, meta_key: 'result'\n else\n render json: 'Permission Denied'\n end\n end", "def authenticate_with_token!\n render json: { errors: \"Not authenticated\" }, status: :unauthorized unless user_signed_in?\n end", "def show\n @post = Post.find(params[:id])\n @user = current_user\n end", "def show \n \n #if @post \n render jsonapi: @post, serializer: Api::V1::PostSerializer\n #else\n # render jsonapi: \"User not found\", status: 404\n #end\n end", "def authenticate_with_token!\n renders json: {errors: \"Not authenticated\"},\n status: :unauthorized unless user_signed_in?\n end", "def authenticate_user!\n return if current_user\n render json: json_message(errors: 'Acceso denegado. Por favor ingresa.'), status: 401\n end", "def index\n posts = Post.all\n @posts = posts.where('user_id in (?)', current_user.id) if current_user.admin?\n @posts = posts\n end", "def show\n # @post = Post.find(params[:id])\n user = User.find(params[:user_id])\n @post = Post.find(params[:post_id], :conditions => { :user_id => user })\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n authorize @user\n render json: @user\n end", "def authenticate_user!(options = {})\n head :unauthorized unless signed_in?\n end", "def create\n if current_user\n @post = Post.new(post_params)\n respond_to do |format|\n if @post.save\n flash[:success] = 'Post was successfully created.'\n format.html { redirect_to @post }\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 else\n flash[:alert] = 'Sing up or Log in'\n redirect_to posts_path \n end\n end", "def authenticate\n unauthorized unless current_user\n end", "def authenticate_user!\n render :json => { error: \"please log in\" }, :status => 401 unless current_user.id\n end", "def authenticate_user!\n unless current_user?\n render status: :unauthorized\n end\n end", "def authenticate_user\n case request.format\n when /text\\/html/\n redirect_to new_session_path unless current_user\n when /application\\/json/\n head :unauthorized unless current_user\n end\n\n end", "def show\n @posts = Post.find(params[:id])\n render json: @posts\n end", "def index\n @posts = Post\n if user_session[:tags].present?\n @posts = @posts.tagged_with(user_session[:tags])\n end\n @posts = @posts.by_creation.decorate\n\n respond_to do |format|\n format.html\n format.json { render json: @posts }\n format.js\n end\n end", "def authenticate_with_token!\n render json: { errors: 'Acesso não autorizado!' }, status: 401 unless user_logged_in?\n end", "def authenticate!\n\t\t@current_user = AuthorizeApiRequest.call(request.headers).result\n\t\t# If unauthorized return an error to the front end\n\t\trender json: {error: 'Not Authorized'}, status: 401 unless @current_user\n\tend", "def show\n @post_category = current_user.post_categories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post_category }\n end\n end", "def authenticate\n redirect_to '/login' unless current_user\n end", "def create\n @post = current_user.posts.new(post_params)\n\n if @post.save\n render json: {\n data: @post\n }\n else\n render json: {\n errors: @post.errors\n }\n end\n end", "def after_sign_in_path_for(_resource)\n posts_path\n end", "def protected\n auth = request.headers['HTTP_AUTHORIZATION']\n\n if auth =~ /sekret/\n render json: {success: \"You're in!\"}\n else\n render json: {error: 'Unauthorized'}, status: 401\n end\n end", "def require_auth\n head :unauthorized unless current_user\n end", "def authenticated_user\n\t \tauthenticated\n\t \terror!('401 Unauthorized', 401) unless current_user\n\t end", "def index\n @posts = Post.where(:user_id => current_user.id).order(\"created_at DESC\")\n #@posts = Post.all.order(\"created_at DESC\")\n #this post also saves lives\n #https://stackoverflow.com/questions/25831594/devise-how-to-show-users-post\n \n end", "def index\n\n res_posts = Post.select(\"id, title, author_id, left(content,#{MAX_CONTENT_LENGTH}) as content, created_at, published\").order( created_at: :desc )\n\n a_parms = get_params()\n\n @author_id = nil\n\n if( a_parms[:author_id] ) #filter posts by author\n parm_author_id = a_parms[:author_id].to_i\n\n raise ApplicationController::NotAuthorized, 'Access denied' if !user_signed_in?\n raise ApplicationController::NotAuthorized, \"Access denied to resources from another author\" if( current_author_id != parm_author_id )\n @author_id = parm_author_id \n res_posts = res_posts.where(author_id: @author_id)\n else\n res_posts = res_posts.published\n end\n\n\n @posts = res_posts.paginate(page: params[:page], per_page: POSTS_PER_PAGE)\n end" ]
[ "0.72160757", "0.71537083", "0.7028036", "0.69634265", "0.6919625", "0.6865617", "0.68592584", "0.6849146", "0.6845703", "0.6809406", "0.67830193", "0.6704709", "0.6677335", "0.66742533", "0.6649936", "0.66110575", "0.6540277", "0.6530715", "0.6502842", "0.6497177", "0.6490924", "0.6464281", "0.64618707", "0.64587665", "0.6455908", "0.64428854", "0.644069", "0.6410104", "0.6400213", "0.63954854", "0.6387453", "0.63871235", "0.6378494", "0.63749385", "0.6370032", "0.6368032", "0.6367053", "0.63484347", "0.6339149", "0.63185537", "0.6317652", "0.6310487", "0.6303371", "0.62978965", "0.6294445", "0.6287308", "0.62771803", "0.6269842", "0.6269185", "0.62686414", "0.62648743", "0.6263491", "0.6263374", "0.6247503", "0.62449527", "0.6242147", "0.62237763", "0.6223296", "0.62133557", "0.6207839", "0.62023556", "0.61930823", "0.6192897", "0.61894995", "0.6180793", "0.61806774", "0.6174742", "0.61660063", "0.61653084", "0.61650956", "0.6159968", "0.6146664", "0.61449856", "0.6136368", "0.61283684", "0.6122734", "0.6119899", "0.6118109", "0.6114397", "0.609782", "0.60957783", "0.60851496", "0.60816437", "0.60774326", "0.60755765", "0.6071647", "0.6068823", "0.6060303", "0.60549927", "0.60527974", "0.6052111", "0.6051892", "0.60480356", "0.60281515", "0.6025053", "0.60238487", "0.60237014", "0.60172457", "0.6013979", "0.60133994" ]
0.6599342
16
GET /posts/1 GET /posts/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @posts = Post.find(params[:id])\n render json: @posts\n end", "def show\n render json: Post.find(params[\"id\"])\n end", "def show\r\n post = Post.find(params[:id])\r\n render json: post\r\n end", "def show\n @post = Post.find(params[:id])\n\n render json: @post\n end", "def show\n \trender json: Post.find(params[:id])\n end", "def show\n post = Post.find(params[:id])\n render json: post\n end", "def show\n\t \trender json: Post.find(params[:id])\n\t end", "def show\n @post = Post.where(:id => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end", "def index\n @posts = Post.all\n render json: @posts\n end", "def index\n @posts = Post.all\n\n render json: @posts\n end", "def index\n @posts = Post.all\n\n render json: @posts\n end", "def index\n @posts = Post.all\n render json: @posts\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def show\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n render json: @post\n end", "def index\n @posts = Post.all\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @posts}\n end\n end", "def index\n\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end", "def show\n \n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end", "def index\n render json: { posts: Post.all }\n end", "def show\n @post ||= Mist::Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end", "def index\n @posts = Post.order(\"created_at DESC\").includes(:user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def show\n # when you go to http://localhost:3000/posts/1, rails interprets this\n # as a call to the show action for the resource and passes 1 to the \n # :id paramater. Using this blog app you can do that by clicking the \n # show link for a post on the index page.\n\n @post = Post.find(params[:id])\n # The show action uses Post.find to search for a single record \n # in the database by its id value. After finding the record, Rails \n # displays it by using app/views/posts/show.html.erb\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n post = Post.find_by(id: params[:id])\n if post \n render json: post\n else\n render json: {errors: 'Not found'}\n end\n end", "def index\n render json: Post.all\n end", "def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end", "def index\n @posts = Post.all.order(created_at: :asc)\n json_response(@posts)\n end", "def index\n @posts = Post.all\n \n render json: @posts\n end", "def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html { render 'application/index' }\n format.json { render :json => { :post => @post.as_json } }\n end\n end", "def show\n render json: @post, serializer: Api::V1::PostSerializer\n end", "def show\n render json: @post\n end", "def show\r\n @post = root_post_of(Post.find(params[:id]))\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @post }\r\n end\r\n end", "def show\n @api_v2_post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_v2_post }\n end\n end", "def show\n render json: @post\n end", "def index\n @posts = Post.paginate(:page => params[:page], :per_page => 10).order('id DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.atom\n end\n end", "def index\n render json: Post.all.order(id: :desc), each_serializer: V1::Posts::PostSerializer\n end", "def show\n render :json => @post\n end", "def index\n # @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @posts }\n end\n end", "def index\n @api_v1_posts = Api::V1::Post.all\n end", "def show\n @post = Post.find(params[:id])\n render json: @post, meta: { status: :ok }, meta_key: 'result'\n end", "def show\n respond_to do |format|\n format.html\n format.json { render jsonapi: @post }\n end\n end", "def show\n @posts = @game.posts.order(created_at: :desc).paginate(page: params[:page], per_page: 5)\n respond_to do |format|\n format.json { render template: 'api/games/game.json' }\n end\n end", "def show\n @post = PostsService.getPostById(params[:id])\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end", "def index\n #@posts = Post.all\n @posts = Post.paginate( :page => params[:page],\n :per_page => 2\n )\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = Post.all\n # Post.all returns all of the posts currently in the \n # database as an array of Post records that we store \n # in an instance variable called @posts.\n # http://guides.rubyonrails.org/active_record_querying.html\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n # The respond_to block handles both HTML and JSON calls \n # to this action. If you browse to \n # http://localhost:3000/posts.json, you’ll see a JSON \n # containing all of the posts. \n end", "def index\n\n # We display the posts be cronological inverted order\n if authenticated?\n @posts = Post.order('created_at DESC').page(params[:page])\n else\n @posts = Post.order('created_at DESC').where(:status => :true).page(params[:page])\n end\n \n respond_to do |format|\n format.html { render html: @posts }\n format.json { render json: @posts }\n end\n end", "def show\n @user = User.find(params[:id])\n @posts = @user.posts\n\n respond_to do |format|\n format.json { render json: {user: User._build(@user), posts: Post.build_posts(@posts)}, location: root_path }\n end\n end", "def index\n\t\tgon.posts = Post.all.as_json\n\tend", "def index\n @posts = Post.order(\"created_at DESC\").where(:published => true).limit(5)\n @title = \"Home\"\n @description = \"the blog and website of bassist and programmer Johnny Grubb. no baseball information here.\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml\n end\n end", "def display_posts\n begin\n response = RestClient.get \"#{@@DOMAIN}/api/posts.json?all\", authorization_hash\n\n puts \"Response code: #{response.code}\"\n puts \"Response cookies:\\n #{response.cookies}\\n\\n\"\n puts \"Response headers:\\n #{response.headers}\\n\\n\"\n puts \"Response content:\\n #{response.to_str}\"\n\n js = JSON response.body\n js.each do |item_hash|\n item_hash.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end", "def show\n #@post = Post.find(params[:id])\n\n #respond_to do |format|\n # format.html # show.html.erb\n #format.json { render json: @post }\n #end\n end", "def index\n @posts = Post.all\n @posts = paginate(@posts)\n authorize @posts\n\n render json: @posts, each_serializer: Api::V1::PostSerializer, meta: meta_attributes(@posts)\n end", "def index\n @posts = Post.find(:all)\n end", "def show\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end", "def index\n render json: { posts: current_user.posts.all.map(&:to_h) }\n end", "def show\n @feed = Feed.find(params[:id])\n @posts = @feed.posts.order(\"published desc\").paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end", "def index\n\t@posts = list_posts\n end", "def show\n #GET a single post by ID\n @post = Post.find(params[:id])\n end", "def posts(opts)\n response = get(\"posts\", opts)\n response\n end", "def show\n @post = Post.find(params[:id])\n @title = @post.title\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end", "def index\n # TODO: implement listing all posts\n end", "def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml { render xml: @posts }\n end\n end", "def show\n @blogpost = Blogpost.published.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blogpost }\n end\n end", "def show\n # @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @post }\n end\n end", "def post(postid)\n request(:id => postid).posts.first\n end", "def show\n Rails.logger.debug(\"Inside show \")\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @posto = Posto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @posto }\n end\n end", "def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @post }\n format.json do\n render :json => @post.to_json(:only => [:id, :title, :text, :lat, :lng, :created_at, :post_type, :likes], \n :methods => [:image_url, :video_url], \n :include => [:comments])\n end\n end\n end", "def display_post\n begin\n # asks the user for the post id\n print \"Enter the post ID: \"\n id = STDIN.gets.chomp\n response = RestClient.get \"#{@@DOMAIN}/api/posts/#{id}.json\", authorization_hash\n\n js = JSON response.body\n js.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end", "def index\n @posts = Post.all.reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n @posts = PostService.getAllPosts\n end", "def show\n render json: {\n data: @post\n }\n end", "def show\n @post = Post.find(params[:id])\n @videos = Video.get_for @post #where([\"post_id = ?\", params[:id]]).all\n @background = get_background_for @post #Background::DEFAULT #Background.where([\"post_id = ?\", params[:id]])\n @nav = get_navigation :for => 'post', :current => @post\n @menu = get_menu :for => 'post'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def index\n @posts = Post.order(created_at: :desc)\n respond_to do |format|\n format.html { render }\n format.text { render }\n format.xml { render xml: @posts }\n format.json { render json: @posts.to_json }\n end\n end", "def get(options = {})\n response= handle_errors { self.class.get('/get', :query => options)}\n if response[\"posts\"][\"post\"].is_a?(Hash)\n Rubycious::Post.new response[\"posts\"][\"post\"]\n elsif response[\"posts\"][\"post\"].is_a?(Array)\n response[\"posts\"][\"post\"].collect{|i| Rubycious::Post.new(i)}\n else\n nil\n end\n end", "def show\n if !params[:id]\n @post = Post.find_by_title('Welcome')\n elsif params[:id] =~ /^[a-zA-Z ]+$/\n @post = Post.find_by_title(params[:id])\n else\n @post = Post.find(params[:id].to_i)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def show\n @blogpost = Blogpost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blogpost }\n end\n end", "def show\n @blog_post = BlogPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blog_post }\n end\n end", "def index\n @post = Post.find_by_id(params[:post_id])\n if @post.nil?\n return render json: { error: \"Post not found\" }, status: :not_found\n end\n render json: @post.comments,status: 200\n end", "def show\n @post2 = Post2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post2 }\n end\n end" ]
[ "0.77108145", "0.73538285", "0.73431885", "0.7337658", "0.73228896", "0.72930473", "0.7276023", "0.72562623", "0.716107", "0.7158095", "0.71544594", "0.71544594", "0.7118771", "0.70939285", "0.70939285", "0.70939285", "0.7093431", "0.7070624", "0.70599306", "0.70444286", "0.7032445", "0.7019999", "0.7019999", "0.7019999", "0.7019999", "0.7019999", "0.7019999", "0.7019999", "0.7019999", "0.7019999", "0.7019999", "0.7019999", "0.7019999", "0.7019999", "0.7019999", "0.6989478", "0.69554466", "0.69554466", "0.69537485", "0.69363", "0.69359845", "0.69254535", "0.69179887", "0.69005764", "0.6900194", "0.68941504", "0.6893076", "0.6875535", "0.6860274", "0.68527454", "0.6852577", "0.68477577", "0.6835684", "0.6823253", "0.68082154", "0.68038636", "0.6761489", "0.6742676", "0.672216", "0.6720239", "0.6714554", "0.6713371", "0.6699782", "0.6692977", "0.6679741", "0.665484", "0.66448486", "0.6639956", "0.66283834", "0.6619194", "0.66181064", "0.6612015", "0.660917", "0.6601521", "0.6596458", "0.65936553", "0.6590904", "0.6585078", "0.6582685", "0.6582531", "0.6576189", "0.65728945", "0.6568014", "0.6565694", "0.65558", "0.65367657", "0.6526375", "0.6513002", "0.6512247", "0.64973944", "0.6496808", "0.64931977", "0.6490084", "0.64726406", "0.64715016", "0.64674306", "0.6455366", "0.6452004", "0.6447577", "0.64454186", "0.64275676" ]
0.0
-1
POST /posts POST /posts.json
def create user_post_param respond_to do |format| if @post.save format.html do redirect_to @post, notice: "Post was successfully created." end format.json { render :show, status: :created, location: @post } else format.html { render :new } format.json do render json: @post.errors, status: :unprocessable_entity end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n render json: Post.create(params[\"post\"])\n end", "def create\n respond_with Post.create(params[:posts])\n end", "def create\n @post = Post.create(post_params)\n render json: @post, serializer: PostSerializer\n end", "def create\n @post = Post.new(post_params)\n @post.user = current_user\n\n if @post.save\n render json: @post, status: :created, location: api_v1_post_path(@post), serializer: Api::V1::PostSerializer\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "def create\n @post = current_user.posts.new(post_params)\n\n if @post.save\n render json: {\n data: @post\n }\n else\n render json: {\n errors: @post.errors\n }\n end\n end", "def create\n post = @current_user.posts.create(post_params)\n\n if post.save\n render json: post\n else\n render json: { errors: post.errors.full_messages }, status: :forbidden\n end\n end", "def create\n title = params[:title]\n body = params[:body]\n\n @post = current_user.posts.create(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end", "def create\n @post = Post.new({ :title => params[:post][:title] })\n \n respond_to do |format|\n if @post.save\n format.json { render :json => { :post => @post.as_json}, :status => :created, :location => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.find(params[:user_id])\n @post = @user.posts.new(post_params)\n\n if @post.save\n render json: @post, status: :created, location: [@user, @post]\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "def create\n @post = Post.new(post_params)\n\n if @post.save\n render json: {\n message: 'Post was successfully created.'\n }, status: :created\n else\n render json: {\n errors: @post.errors,\n message: 'Post could not be created.'\n }, status: :unprocessable_entity\n end\n end", "def post(id, opts = {})\r\n uri = url_for(\"posts/#{id}\", opts)\r\n response = RestClient.get(uri)\r\n JSON.parse response\r\n end", "def create\n\n\n @post = current_user.posts.build(post_params)\n\n if @post.save\n\n render json: \"Posted successfully\", status: 201\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "def create\n @post = Post.new(params[:post])\n respond_to do |format|\n if @post.save\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with Post.create(params[:post])\n end", "def create\n\t\tpost = @current_user.posts.create(post_params) \n\t\tif post.save\n\t\trender json: {success: true, auth_token: @current_user.authentication_token, post_id: post.id}\n\t else\n\t render json: {success: false, errors: post.errors.full_messages, message: \"Validation failed\"}, status: 422\n\t\tend \n\tend", "def create_posts\n end", "def create_posts\n end", "def create_post\n begin\n #asks the user for the title, body, and whether it should be anonymous\n print \"Title: \"\n title = STDIN.gets.chomp\n print \"Body: \"\n body = STDIN.gets.chomp\n print \"Post as Anonymous? (y/n): \"\n anonymous = STDIN.gets.chomp.upcase == 'Y' ? true : false\n # check user information from login\n\n # Rails will reject this unless you configure the cross_forgery_request check to\n # a null_session in the receiving controller. This is because we are not sending\n # an authenticity token. Rails by default will only send the token with forms /users/new and\n # /users/1/edit and REST clients don't get those.\n # We could perhaps arrange to send this on a previous\n # request but we would then have to have an initial call (a kind of login perhaps).\n # This will automatically send as a multi-part request because we are adding a\n # File object.\n response = RestClient.post \"#{@@DOMAIN}/api/posts.json\",\n\n {\n post: {\n title: title,\n body: body,\n anonymous: anonymous\n },\n }, authorization_hash\n\n if (response.code == 201)\n puts \"Created successfully\"\n end\n puts \"URL for new resource: #{response.headers[:location]}\"\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end", "def create\n @api_post = Api::Post.new(api_post_params)\n\n if @api_post.save\n render json: @api_post, status: :created, location: @api_post\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.json { render :show, status: :created, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \tif logged_in?\n params[:post][:user_id] = current_user.id\n @post = Post.new(post_params)\n if @post.save\n puts @post.published\n render json: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end\n end", "def create\n respond_with Post.create(post_params)\n end", "def posts(opts)\n response = get(\"posts\", opts)\n response\n end", "def post(*args)\n request(:post, *args)\n end", "def post(*args)\n request :post, *args\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @api_post = current_user.posts.new(api_post_params)\n if @api_post.save\n render :show\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end", "def create\n authenticated\n\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new post_params\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n if @post.save\n render :show, status: :created, location: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "def create\n puts \"create post: #{post_params.inspect}\"\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n @title = \"Create New Post\"\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, :notice => 'Post was successfully created.' }\n format.json { render :json => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end", "def create\n post_service = PostService.new(current_user, params)\n post_service.create_post\n #post_service.create\n respond_to do |format|\n if post_service.save?\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { redirect_to new_post_url, alert: post_service.errors }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.json { render json: @post, status: :created, location: @post }\n format.xml { render xml: @post, status: :created, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #raise params.inspect\n \n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @posts = Post.page(params[:page]).order('created_at desc')\n @post = Post.new(post_params)\n @user = User.where('account_id == ?', current_account.id)[0]\n respond_to do |format|\n if @post.save\n format.html { redirect_to '/posts' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :index }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\t\t\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @api_v1_post = Api::V1::Post.new(api_v1_post_params)\n\n respond_to do |format|\n if @api_v1_post.save\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_post }\n else\n format.html { render :new }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = current_user.posts.new(params[:post])\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n @post.user_id = current_user.id\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { redirect_to posts_path, flash: { error: @post.errors.full_messages } }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(path, data = {})\n request 'POST', path, body: data.to_json\n end", "def new\n post = Post.new\n render json: post\n end", "def create\n @user = current_user\n @post = @user.posts.build(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save?\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @post = Post.new(params[:post])\r\n\r\n respond_to do |format|\r\n if @post.save\r\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\r\n format.json { render json: @post, status: :created, location: @post }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @post = Post.create(post_params)\n set_posts\n respond_to do |format|\n format.js\n format.html\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, :notice => \"slam\" }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { redirect_to posts_path }\n flash[:alert] = \"shit.\"\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n post\n end", "def create\n @post = Post.new(content: params[:post][:content], user_id: @user.id)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @user }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { redirect_to @user }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @post = Post.new(post_params)\n @post.user_id = params[:user_id]\n if @post.save\n render json: @post, meta: { status: :created }, meta_key: 'result', status: :created\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "def create\n @post = current_user.posts.new(post_params.merge(writter: current_user.name))\n\n if @post.save\n render json: {status: 1, id: @post.id.to_s, notice: \"新增成功,标题是:#{@post.title.capitalize}\", number: @post.number, errors: []}\n else\n render json: {status: -1, notice: \"新增失败,请先登录\", errors: @post.errors.full_messages}\n end\n end", "def create\n puts \"Trying to Create New Post\"\n # Creates new post with given content tied to given userid\n @post = Post.new(post_params) \n if @post.save\n puts \"Post successfully created\"\n response.status=(201)\n render json: {status: \"Success\", message: [\"Post created!\"]}\n else\n # Error handling\n puts \"Something went wrong while creating new Post\"\n puts(@Post.errors.full_messages)\n response.status=(422)\n render json: { status: \"Error\", message: [@post.errors.full_messages]}\n end\n end", "def create\n @post = current_user.posts.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to list_of_posts_post_path(@post.user), notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(*args)\n execute(:post, *args)\n end", "def create\n redirect_to posts_path and return unless Mist.authorized?(:create_post, self)\n coerce_date(params[:post], 'published_at')\n @post = Mist::Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, :notice => 'Post was successfully created.' }\n format.json { render :json => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = current_user.posts.build(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to new_post_successful_posts_path, notice: 'Anúncio criado com sucesso.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end", "def create\n redirect_to login_path unless session[:user_id]\n message = 'Post was successfully created.'\n @post = Post.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: message }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n @post.user = User.find_by_auth_token!(cookies[:auth_token])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = current_user.posts.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(post_params)\n if @post.save\n redirect_to find_redirect(@post.page)\n else\n render :new\n render json: @post.errors, status: :unprocessable_entity\n end\n end" ]
[ "0.74463975", "0.73221767", "0.73072433", "0.7123966", "0.7015686", "0.701327", "0.69841874", "0.6939327", "0.69313824", "0.69053805", "0.68196476", "0.6812792", "0.6793222", "0.6792862", "0.6779654", "0.6779654", "0.67625546", "0.67602354", "0.67515427", "0.6735786", "0.66983837", "0.6694823", "0.6676922", "0.6648634", "0.6618174", "0.6609208", "0.6576672", "0.6567517", "0.6535031", "0.65248317", "0.6517826", "0.6512526", "0.6512526", "0.65004253", "0.64875203", "0.6482612", "0.64796066", "0.6479418", "0.64762664", "0.64762664", "0.64762664", "0.64762664", "0.64762664", "0.64762664", "0.64762664", "0.6452396", "0.64413923", "0.6439579", "0.6431225", "0.6411242", "0.64027417", "0.6402409", "0.63972473", "0.63956606", "0.6388207", "0.6388207", "0.6380103", "0.63764375", "0.6374259", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.63714516", "0.6369631", "0.6361449", "0.6350474", "0.6349784", "0.6345706", "0.6312865", "0.63084143", "0.630361", "0.63009614", "0.62957925", "0.6295694", "0.62955", "0.6294854", "0.62942207", "0.628781", "0.62877417", "0.6283785", "0.6282612", "0.6263583" ]
0.6443543
46
PATCH/PUT /posts/1 PATCH/PUT /posts/1.json
def update respond_to do |format| if @post.update(post_params) format.html do redirect_to @post, notice: "Post was successfully updated." end format.json { render :show, status: :ok, location: @post } else format.html { render :edit } format.json do render json: @post.errors, status: :unprocessable_entity end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end", "def update\n respond_with Post.update(params[:id], params[:posts])\n end", "def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with Post.update(params[:id], params[:post])\n end", "def update\n respond_with post.update(params[:id], params[:post])\n end", "def update\n respond_with Post.update(params[:id],post_params)\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @post.update({\n title: post_params[:title],\n content: post_params[:content],\n })\n render json: Post.all.as_json\n else\n render json: {errors: @post.errors.full_messages}, status: :unprocessable_entity\n end\n end", "def update\n id = Post.find(params[:id])._id\n \n respond_to do |format|\n if ((@post.update_attributes(params[:post])) && (@post._id = id))\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n @post.update_attributes(params[:post])\n format.html { redirect_to posts_url, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n end \n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n respond_to do |format|\n if @api_v1_post.update(api_v1_post_params)\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_post }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to posts_path, notice: 'Post was successfully updated.' }\n format.json { render json: @post }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n authenticated\n\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "def update\n @api_post = Api::Post.find(params[:id])\n\n if @api_post.update(api_post_params)\n head :no_content\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end", "def update\n if @post.update(post_params)\n render json: {\n data: @post\n }\n else\n render json: {\n errors: @post.errors\n }\n end\n end", "def update\n @post = Post.find(params[:id])\n\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @api_v2_post = Post.find(params[:id])\n\n respond_to do |format|\n if @api_v2_post.update_attributes(params[:api_v2_post])\n format.html { redirect_to @api_v2_post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v2_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @post\n\n if @post.save\n render json: @post\n else\n render json: @post.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@post = post.find(params[:id])\n\t\t@post.update_attributes(post_params)\n\t\trespond_to do |format|\n\t\t\tformat.html {redirect_to post_path(@post)}\n\t\t\tformat.json {render json: @post}\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.json { render :show, status: :ok, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n @title = \"EDIT\"\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\tif @post.update(post_params)\n\t\t\trender json: @post, status: :success\n\t\telse\n\t\t\trender json: @post.errors, status: :unprocessable_entity #422\n\t\tend\n\tend", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'slam updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "def update\n @post.update_attributes(params[:post])\n respond_with(@post)\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: '' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end", "def update\n title = params[:title]\n body = params[:body]\n\n @post.update!(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end", "def update\r\n @post = Post.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @post.update_attributes(params[:post])\r\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @user = current_user\n @post = @user.posts.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to :action => 'index', notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if (@post.update(params.permit(:title, :content)))\n render json: @post, status: :ok\n else\n render json: @post.errors, status: 422\n end\n end", "def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to post_path, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n #disable edit for now\n redirect_to posts_path\n return\n \n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to magazine_post_path(@post.short_url), notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"editor\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @post.update(post_params)\n render action: \"show.json.jbuilder\"\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to post_path(@post), notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\t\n\t\tpost = @current_user.role == \"admin\" ? Post.find_by(id: params[:id]) : @current_user.posts.find_by(id: params[:id]) \n\t\tif post && post.update_attributes(post_params)\n\t\trender json: {success: true, auth_token: @current_user.authentication_token, post_id: post.id, post_desc: post.description}\n\t else\n\t render json: {success: false, message: \"not found or validation failed\"}, status: 422\n\t\tend \n\tend", "def update\n post = Post.find_by(id: params[:id])\n # byebug\n\n post.assign_attributes(update_params)\n if post.valid?\n post.save\n render json: post, status: :created\n else\n render json: {errors: post.errors.full_messages}, status: 422\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find_by_slug(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@post = Post.find(params[:id])\n\n #respond_to do |format|\n # if @post.update_attributes(params[:post])\n # format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n # format.json { head :no_content }\n #else\n # format.html { render action: \"edit\" }\n # format.json { render json: @post.errors, status: :unprocessable_entity }\n #end\n #end\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n #this works largely the same, \n @post = Post.find(params[:id])\n @post.created_at = params[:created_at] if !!params[:created_at]\n if @post.update_attributes(params[:post])\n render \"show\", handlers: [:rabl]\n else\n render :json => @post.errors.full_messages, status: 422\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to \"/#{session[:username]}\", notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update?(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n delete_caches\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n update_resource_response(@post, blog_post_params)\n end", "def update\n \n @previous_content = @post[:content]\n respond_to do |format|\n if @post.update_attributes(params[:post])\n \t\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n \n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n verify_owner_or_admin(@post)\n \n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: \"Post was successfully updated.\" }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @update = Update.find(params[:id])\n @post = @update.post\n\n respond_to do |format|\n if @update.update_attributes(params[:update])\n format.html { redirect_to @post, notice: 'Update was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @post.update(post_params)\n render json: {status: 1, id: @post.id.to_s, notice: \"修改成功,标题是:#{@post.title.capitalize}\", errors: []}\n else\n render json: {status: -1, notice: \"修改失败\", errors: @post.errors.fall_message}\n end\n end", "def update\n params[:post][:tag_ids] ||= []\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to [@post.user, @post], notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @post = Post.find(params[:id])\r\n @root_post = root_post_of(@post)\r\n\r\n respond_to do |format|\r\n if @post.update_attributes(params[:post])\r\n @root_post.touch(:updated_at)\r\n update_child_posts(@post)\r\n\r\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @post.short_body = post_params[:body].split('</p>')[0] + '</p>'\n @post.tags.delete_all\n set_tags\n\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render_forbidden and return unless can_edit?\n @post = Post.friendly.find(params[:id])\n \n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n redirect_to root_path\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.71867543", "0.7042899", "0.6774105", "0.67672604", "0.6669961", "0.6649129", "0.657972", "0.6556958", "0.6551495", "0.6549005", "0.6535034", "0.6531995", "0.6497553", "0.64958835", "0.6468818", "0.64319825", "0.6428907", "0.64275557", "0.64273673", "0.64193714", "0.64193666", "0.6413534", "0.6401499", "0.6401499", "0.63909745", "0.63825583", "0.63711846", "0.63711846", "0.63711846", "0.63711846", "0.63711846", "0.63711846", "0.63711846", "0.63711846", "0.63711846", "0.63711846", "0.63711846", "0.63711846", "0.63711846", "0.63711846", "0.63711846", "0.63711846", "0.6371097", "0.63611764", "0.6360867", "0.63598454", "0.63573265", "0.63573265", "0.63573265", "0.63573265", "0.6348769", "0.6339638", "0.63390875", "0.633172", "0.63293755", "0.63204026", "0.63095254", "0.62960684", "0.6289831", "0.62780434", "0.6271677", "0.62716043", "0.6271454", "0.6261652", "0.62530375", "0.62426263", "0.6228117", "0.621697", "0.6215017", "0.6206318", "0.6204175", "0.6204175", "0.6204175", "0.6204175", "0.6204175", "0.6204175", "0.6204175", "0.6204175", "0.6204175", "0.6204175", "0.62031627", "0.61977786", "0.61819714", "0.61774534", "0.61740726", "0.6168681", "0.6159861", "0.61563087", "0.61456937", "0.61456937", "0.614226", "0.6122881", "0.6116053", "0.61133987", "0.6110099", "0.6107206", "0.6105214", "0.60997695", "0.60986936", "0.6094729", "0.60945" ]
0.0
-1
DELETE /posts/1 DELETE /posts/1.json
def destroy @post.destroy respond_to do |format| format.html do redirect_to posts_url, notice: "Post was successfully destroyed." end format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n post = Post.find(params[:id])\n if post.destroy\n render json: {status: \"success\", data: {id: params[:id]}}, status: :ok\n end\n end", "def destroy\n @post.destroy\n render json: {}, status: :ok\n end", "def destroy\n if @post.destroy\n render json: {\n post: @post\n }, status: :ok\n else\n render status: :bad_request\n end\n end", "def destroy\n @api_v2_post = Post.find(params[:id])\n @api_v2_post.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v2_posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_post.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_posts_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authenticated\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @post = Post.find(params[:id])\n # @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @post.destroy\n\n json_response(@post)\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_with Post.destroy(params[:id])\n end", "def destroy\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n r.delete @post\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end", "def destroy\n @api_post.destroy\n\n head :no_content\n end", "def destroy\n @post.destroy\n render json: {\n data: {\n post: { key: @post.id },\n status: @post.status,\n }\n }\n end", "def destroy\n\t\tpost = Post.find(params[:id])\n\t\t# byebug\n \tpost.destroy\n\t posts = Post.all\n \trender json: posts\n end", "def destroy\r\n @post = Post.find(params[:id])\r\n @post.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to posts_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_path, notice: \"Post removed.\" }\n format.json { render 'destroy' }\n end\n end", "def delete\n @post = Post.find(params[:id])\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_path(client_id:current_user.client.id, per_page:5), notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_with Post.destroy(params[:id])\n end", "def destroy\r\n @post = Post.find(params[:id])\r\n @post.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to root_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @post.destroy\n\n head :no_content\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/posts' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n\n render json: Post.all.as_json\n end", "def destroy\n @post.destroy\n head :no_content\n end", "def destroy\n @post.destroy\n head :no_content\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to blog_posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n @title = \"Kill Post\"\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to all_user_posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n head :no_content\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html {redirect_to posts_url, notice: 'Post was successfully destroyed.'}\n format.json {head 200}\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_path, notice: 'Post was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_with post.destroy(params[:id])\n end", "def destroy\n @post.destroy\n \n respond_to do |format|\n format.html { redirect_to post_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n Post.find(params[:id]).delete\n\n redirect_to '/'\n end", "def destroy\n # @post = Post.find(params[:id])\n #@post.destroy\n\n #respond_to do |format|\n # format.html { redirect_to posts_url }\n #format.json { head :no_content }\n #end\n end", "def delete(url)\n raise Error, \"Missing URL\" unless url\n get('posts/delete?uri=' << u(url))\n nil\n end", "def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to news_url }\n format.json { head :ok }\n end\n end", "def destroy\n @post = Post.find_by_slug(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url, notice: \"Anúncio removido com sucesso.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @post = Post.friendly.find(params[:id])\n @post.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Story deleted' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: \"Postitus edukalt kustutatud!\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Postagem excluida com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Postagem excluída com sucesso!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mural_post.destroy\n respond_to do |format|\n format.html { redirect_to mural_posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @posto = Posto.find(params[:id])\n @posto.destroy\n\n respond_to do |format|\n format.html { redirect_to postos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_post.destroy\n end" ]
[ "0.8046884", "0.76902676", "0.7583626", "0.75803024", "0.7568048", "0.75047046", "0.75031126", "0.74750155", "0.74671036", "0.74650854", "0.746482", "0.74589694", "0.74589694", "0.74589694", "0.74589694", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7428427", "0.7423174", "0.74059606", "0.73990285", "0.73928183", "0.7389498", "0.7371715", "0.7371117", "0.7349121", "0.7344524", "0.7342226", "0.7338908", "0.7313371", "0.73123556", "0.731156", "0.73095584", "0.7299751", "0.7298017", "0.7298017", "0.7282874", "0.7277125", "0.7266815", "0.7260945", "0.72549784", "0.7254856", "0.7239102", "0.7238946", "0.7229726", "0.7227931", "0.7221013", "0.721375", "0.7211237", "0.72097856", "0.7190222", "0.71850675", "0.7171746", "0.71533066", "0.71457464", "0.71434635", "0.7142048", "0.7139985", "0.7137574" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_post @post = Post.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
Never trust parameters from the scary internet, only allow the white list through.
def post_params params.require(:post).permit(:subject, :description) 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
Use this boolean method to determine whether this customer_file can be used to collect a payment. Checks all of the following: The "authorized" flag is true. There is a minimum authorized amount. Customer and user records are attached, i.e., neither has been deleted.
def customer_has_authorized_payment? authorized and authorized_amount.try(:>, 0) and has_customer_account? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charge_is_allowed?\n\t\tif not customer_has_authorized_payment?\n\t\t\terrors.add :base, I18n.t('views.customer_file.new_charge.you_are_not_authorized')\n\t\t\tfalse\n\t\telsif valid? and charge_amount.present? and authorized_amount and charge_amount.to_i <= authorized_amount\n\t\t\ttrue\n\t\telse\n\t\t\terrors.add :charge_amount, I18n.t('views.customer_file.new_charge.invalid', amount: charge_amount_usd) if errors.empty?\n\t\t\tfalse\n\t\tend\n\tend", "def authorizable_cc_payment?\n adyen_cc_payment? && amount != 0\n end", "def collect_payment?\n true\n end", "def can_credit?(payment)\n payment.completed? && payment.credit_allowed > 0\n end", "def can_credit?(payment)\n payment.completed? && payment.credit_allowed > 0\n end", "def authorize_payment\n if !self.pending_purchase_order && self.payment_object\n order, payment = self.purchase_and_authorize\n if payment && payment.success?\n# self.payment_object = nil # remove payment object so we can re-validate\n self.purchase_orders.reload\n return payment.success?\n end\n end\n false\n end", "def file_download_access?\n if license_delivery_contact == 'Yes'\n true\n end\n end", "def validic_user_provisioned?\n return (!self.validic_id.nil? && !self.validic_access_token.nil?)\n end", "def confirm_authorized_amount(customer_file)\n\t\t@customer_file = customer_file\n\t\t@user = customer_file.customer.user\n\t\t@provider_profile = customer_file.provider.profile\n\t\tsendgrid_category :confirm_authorized_amount\n\t\t@show_logo = true\n\t\tsubject = \"You've authorized payments via Kinstantly\"\n\t\tmail to: @user.email, subject: subject\n\tend", "def payment_authorized?(payment_id)\n check_payment = get_payment_intent_info(payment_id)\n status = check_payment['status']\n puts \"Current Payment Status: #{status}\"\n case status\n when 'Authorized', 'Card Verified'\n puts 'Payment has been authorized'\n return true\n # when 'Declined'\n # puts \"Reason for Decline: #{check_payment['response_summary']}\"\n # abort 'Payment has been declined so exiting this program'\n end\n puts \"3DS Flow hasn't been completed\"\n false\n end", "def succeeded?\n authorized? || paid?\n end", "def payment_cadence_allowed?\n begin\n config_payment_cadence = SystemConfiguration::Variable.get_value('booking.payment_cadence').to_i\n _date_from_str = \"#{self.date_from.strftime('%Y-%m-%d')}T#{self.time_from}:00#{self.date_from.strftime(\"%:z\")}\"\n _date_from = DateTime.strptime(_date_from_str,'%Y-%m-%dT%H:%M:%S%:z')\n diff_in_hours = ((_date_from.to_time - self.creation_date.to_time).to_f * 24).to_i\n allowed = diff_in_hours > 0 && (diff_in_hours >= config_payment_cadence)\n allowed || force_allow_payment\n rescue => error\n p \"Error #{id} #{date_from} #{time_from} #{date_to} #{time_to} #{driver_date_of_birth} #{driver_driving_license_date}\"\n return false\n end\n end", "def xml_authorized?\n self.documento.digital == true\n end", "def can_activate?\n self.authorize_payment\n end", "def can_credit?(payment)\n return false unless payment.completed?\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end", "def can_credit?(payment)\n return false unless payment.completed?\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end", "def has_an_approved_account_set?\n all_monetary_processor_accounts.was_verified.any?\n end", "def credit_card_needed?\n credit_card_required?\n end", "def can_credit?(payment)\n return false unless payment.state == 'completed'\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end", "def claim_amount_required?\n @full_repayment_of_ads != 'Y'\n end", "def accounts_receivable?\n type == 'ACCREC'\n end", "def pain_generation_enabled?\n creditor_detail.present?\n end", "def accounts_receivable?\n type == 'ACCRECCREDIT'\n end", "def can_supply?\n payment_received? || payment_on_account?\n end", "def store_credit_card?\n paid?\n end", "def check_agreement\n if (!@customer.affiliate?)\n redirect_to(:action => :agreement)\n return false\n end\n end", "def verify_card_present(customer, plan, subscription, params={})\n return if customer[:default_source]\n return if customer[:invoice_settings][:default_payment_method]\n return if customer[:trial_end]\n return if params[:trial_end]\n return if params[:payment_behavior] == 'default_incomplete'\n return if subscription[:default_payment_method]\n\n plan_trial_period_days = plan[:trial_period_days] || 0\n plan_has_trial = plan_trial_period_days != 0 || plan[:amount] == 0 || plan[:trial_end]\n return if plan && plan_has_trial\n\n return if subscription && subscription[:trial_end] && subscription[:trial_end] != 'now'\n\n if subscription[:items]\n trial = subscription[:items][:data].none? do |item|\n plan = item[:plan]\n (plan[:trial_period_days].nil? || plan[:trial_period_days] == 0) &&\n (plan[:trial_end].nil? || plan[:trial_end] == 'now')\n end\n return if trial\n end\n\n return if params[:billing] == 'send_invoice'\n\n raise Stripe::InvalidRequestError.new('This customer has no attached payment source', nil, http_status: 400)\n end", "def authorized?\n true\n end", "def payment_success?\n @fields['decision'] == 'ACCEPT'\n end", "def invoice_agreement_required?\n !self.billable? && !self.invoice_agreement_accepted?\n end", "def authorize(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_address(post, options)\n add_customer_data(post, options)\n add_duplicate_window(post)\n\n commit('AUTH_ONLY', money, post)\n end", "def accounts_payable?\n type == 'ACCPAY'\n end", "def can_access?(kase)\n ca = self.access_to?(kase)\n ca || (!ca && (self.total_contacts_count > 0 || self.can_purchase_flex_contacts? || self.unlimited_premium_contacts?))\n end", "def can_purchase_flex_contacts?\n !self.premium_contact_transactions.active.empty?\n end", "def is_authorized?\n @authorized\n end", "def is_authorized?\n @authorized\n end", "def proceed_for_pdf_generation?\n\t\t((any_report_just_verified? && (self.organization.generate_partial_order_reports == YES)) || (all_reports_verified? && any_report_just_verified?) || (!self.force_pdf_generation.blank?))\n\tend", "def accounts_payable?\n type == 'ACCPAYCREDIT'\n end", "def require_receipt?\n !!(self.registered_download.require_receipt?)\n end", "def accepted_agreement?\n return license != DEFAULT_LICENSE\n end", "def authorize(amount, card_number, card_expiry, cvv, reference, customer_ip)\n\t\t\traise \"Sorry we haven't compelted this functionality yet.\"\n\t\tend", "def authorizedToFile(devfile)\n \n # If file is private, everyone is authorized for it\n if devfile.privatefile == false\n return true\n end\n \n ## Check user rights to devfile\n # Is user signed in\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 \n # Find the user\n user = User.find_by_username(username) \n if user != nil\n \n # If user is the owner of context\n if user.id == devfile.device.user_id\n return true\n \n # Is user in a group that is authorized for the context\n elsif\n \n # Groups that user is in\n uigroups = Usersingroup.find_all_by_user_id(user.id)\n if uigroups == nil\n return false\n end\n \n # Is group autohorized for the context\n uigroups.each do |uigroup|\n \n group = DevfileAuthGroup.find_by_group_id_and_devfile_id(uigroup.group_id, devfile.id)\n \n # If group is authorized for the context, return true\n if group != nil\n return true\n end\n end\n \n end\n end\n end\n return false\n \n end", "def account_customer_info?\n !current_customer.nil?\n end", "def daf_retrial_combo_ignorable\n @record.claim.case_type.requires_retrial_dates? && !@record.claim.editable?\n rescue StandardError\n false\n end", "def charges?\n true\n end", "def can_cash?\n self.capture_and_cash\n end", "def charged?\n stripe_charge_id.present?\n end", "def payment_allowed?(acct_no, amount)\n if DB[:Account].where(AcctNo: acct_no).first[:Balance].to_i <\n amount.to_i.fdiv(100)\n return false\n end\n true\n end", "def can_pay_deposit?\n\n conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n conf_payment_deposit = (['deposit','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit')))\n\n if self.status == :pending_confirmation\n (conf_payment_enabled or force_allow_payment) and conf_payment_deposit and self.total_paid == 0 and ((!expired? and payment_cadence_allowed?) or force_allow_payment)\n elsif self.status == :confirmed # Confirmed in the back-office without payment\n (conf_payment_enabled or force_allow_payment) and conf_payment_deposit and self.total_paid == 0 and self.total_pending > 0\n else\n return false\n end\n\n end", "def locked?\n self.invoiced? && self.invoice.issued?\n end", "def subscription_data_valid?\n # empty credential file\"s size is about 50-55.\n # 65 is when you have a very short email, password, and save_path.\n # So when you filled in data, probably will > 65.\n if CREDENTIAL_FILE.size < 65\n abort \"Did you fill in your subscription data in #{CREDENTIAL_FILE}?\"\n return false\n end\n\n credential_data_valid?(get_validate load_credential_data)\n end", "def valid_to_process?\n #TODO\n # available money to transfer\n persisted? ? true : false\n end", "def to_be_performed?\n self.research_billing_qty > 0\n end", "def can_create_showing?\n profile.valid? && valid_credit_card? && !blocked?\n end", "def can_capture?(payment)\n logger.debug \"\\n----------- #{self.invoice_number} -----------\\n\"\n ['checkout', 'pending', 'processing'].include?(payment.state) && !self.invoice_number.blank?\n end", "def donatable?\n show_donation_basket? && has_an_approved_account_set? && money_approved?\n end", "def cc_pay?\n plan&.direct_pay && id != 3744\n end", "def votable?\n # NOTE: it was requested by NCID staff to make all registrations automatically votable\n # regardless of certification status\n return true\n# return self.certification.present?\n end", "def daf_trial_length_ignorable?\n daf_retrial_combo_ignorable || @record.claim.hardship?\n end", "def credit?\n (payment_method == CREDIT)\n end", "def guard_process_payment_from_created; true; end", "def guard_process_payment_from_created; true; end", "def in_payment?\n @in_payment\n end", "def can_capture?(payment)\n payment.pending? || payment.checkout?\n end", "def can_capture?(payment)\n payment.pending? || payment.checkout?\n end", "def can_capture?(payment)\n payment.pending? || payment.checkout?\n end", "def can_capture?(payment)\n payment.pending? || payment.checkout?\n end", "def can_capture?(payment)\n payment.pending? || payment.checkout?\n end", "def has_available_payment_source?\n stripe_customer.sources.count > 0\n end", "def can_be_approved?\n self.applied?\n end", "def credit_card_editable?\n # HACK: HACK HACK\n return false if master?\n provider_account.payment_gateway_configured? && provider_account.billing_strategy.try!(:charging_enabled?)\n end", "def checkout_allowed?\n line_items.count > 0\n end", "def renewal_or_review_mandatory?\n existing_agreement? && waste_producer_water_discount?\n end", "def payment_confirmation_required?\n true\n end", "def is_authorized\n (!current_user.nil? and auth_types.include? current_user.user_attributes[:bor_type])\n end", "def license_allows_download?(document)\n document[:license_ss] =~ /(Creative Commons|No known restrictions)/\n end", "def money_approved?\n true\n end", "def authorize_customer\n unless @reservation.customer == current_customer\n redirect_to reservations_url, notice: 'No touchy!'\n # edit this?\n end\n end", "def payments_in_use?\n active_payment_types.present?\n end", "def approvable?(obj)\n \tif is_pending?(obj.release_status)\n \t\tif is_section_head?\n \t\t\tif obj.uploader_role == 'Normal' && uploader_from_same_section(obj.uploaded_by_section)\n \t\t\t\ttrue\n \t\t\tend\n \t\telsif is_department_head?\n \t\t\tif obj.uploader_role == 'Sectionhead'\n \t\t\t\ttrue\n \t\t\tend\n \t\tend\n \tend\n end", "def pre_bill_can_be_confirmed?(pre_bill)\n pre_bill_reading_not_billed?(pre_bill) && bills_with_this_attributes(pre_bill).count <= 0\n end", "def can_accept_showing?\n profile.valid? && valid_bank_token? && !blocked?\n end", "def is_per_device_acceptance_required\n return @is_per_device_acceptance_required\n end", "def payed?\n !payment_entry.nil?\n end", "def payments?\n user_record? || payment_admin? || super_admin?\n end", "def export_tool_authorized?\n authorized_for?(:action => :read)\n end", "def checkout_allowed?\n order_items.count > 0\n end", "def user_and_community_ready_for_payments?(person_id, community_id)\n community = Community.find(community_id)\n person = Person.find(person_id)\n\n community.stripe_in_use? && person.stripe_connected_and_tranfers_enabled?\n end", "def locked?\n\t\t\t\t\treturn payment_in_progress? || paid?\n\t\t\t\tend", "def line_count_authorized?\n return true if current_user.is_an_admin_or_operator?\n return false\nend", "def cfe_call_required?\n return false if draft_selected? || legal_aid_application.provider_entering_merits?\n\n true\n end", "def payment_required?\n billing_total.to_f > 0.0\n end", "def refunded_with_active_certificates?\n refunded_at.present? && daily_deal_certificates.active.try(:size) == quantity\n end", "def cms_voucher_request?\n false\n end", "def managed?\n stripe_account_type == 'managed'\n end", "def charged?\n compliance_data[:charge].to_f > 0.0\n end", "def paid_with_card?\n order.payment_method == 'credit_card'\n end", "def authorized?\n !auth.nil?\n end", "def can_capture?(payment)\n payment.checkout?\n end", "def authorized?\n true\n end" ]
[ "0.71722645", "0.6657813", "0.6450728", "0.64218915", "0.64218915", "0.6343719", "0.6315825", "0.62663573", "0.6225009", "0.6186739", "0.61811507", "0.6180229", "0.61707926", "0.6163278", "0.6146223", "0.6146223", "0.6138449", "0.6123721", "0.6106551", "0.60813814", "0.60368454", "0.5994065", "0.59624213", "0.5958843", "0.59393764", "0.5886671", "0.5874561", "0.58687747", "0.58414716", "0.58190274", "0.58179873", "0.58047754", "0.57883215", "0.57877886", "0.5786398", "0.5786398", "0.5781016", "0.577304", "0.57456625", "0.5730303", "0.5705698", "0.57009465", "0.5694914", "0.5691876", "0.5674556", "0.56653076", "0.5652389", "0.56470245", "0.56395125", "0.5631587", "0.56222963", "0.56197345", "0.5613623", "0.5596701", "0.55859977", "0.5573073", "0.5564658", "0.5555255", "0.55463064", "0.55417484", "0.5533382", "0.5533382", "0.55321723", "0.5529721", "0.5529721", "0.5529721", "0.5529721", "0.5529721", "0.5527768", "0.55229867", "0.5517846", "0.55144763", "0.5513493", "0.5509051", "0.5506634", "0.5505497", "0.55023587", "0.5499959", "0.5497748", "0.549766", "0.54934865", "0.54903865", "0.5490211", "0.54626375", "0.546204", "0.5460089", "0.54513943", "0.54464775", "0.54462636", "0.5444164", "0.54408896", "0.543763", "0.5431879", "0.54264855", "0.5414273", "0.54118776", "0.54095775", "0.5407666", "0.5403059", "0.5402625" ]
0.7491831
0
Use this boolean method to determine whether the charge_amount can be collected. Also ensures that the customer still exists and has authorized payment to this provider.
def charge_is_allowed? if not customer_has_authorized_payment? errors.add :base, I18n.t('views.customer_file.new_charge.you_are_not_authorized') false elsif valid? and charge_amount.present? and authorized_amount and charge_amount.to_i <= authorized_amount true else errors.add :charge_amount, I18n.t('views.customer_file.new_charge.invalid', amount: charge_amount_usd) if errors.empty? false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charge?\n false\n end", "def charges?\n true\n end", "def needs_handling_charge?\n true\n end", "def charged?\n stripe_charge_id.present?\n end", "def charge_credit_card(amount)\n true\n end", "def charge_credit_card(amount)\n true\n end", "def charged?\n compliance_data[:charge].to_f > 0.0\n end", "def authorizable_cc_payment?\n adyen_cc_payment? && amount != 0\n end", "def charge_donor\n return true unless (self.amount and (self.amount > 0))\n\n begin\n Stripe::Charge.create({\n # amount is in dollars, stripe takes cents\n :amount => self.amount * 100,\n :currency => \"usd\",\n :card => self.stripe_token,\n :description => \"Donation to #{participation.volunteer.name} for #{participation.event.name}\"\n }, self.participation.event.organization.stripe_token)\n return true\n rescue Stripe::StripeError => e\n # Something went wrong. Report that billing failed.\n errors.add(:billing, \"Failed: #{e.message}\")\n return false\n end\n end", "def collect_payment?\n true\n end", "def chargeable?; true; end", "def charge!\n unless charged || canceled\n return true unless order.price.cents > 50\n begin\n result = Stripe::Charge.create(\n customer: billing.customer_id,\n amount: order.price.cents,\n currency: order.price.currency\n )\n\n update charged: true, trans_id: result.id\n rescue Stripe::CardError => e\n e.message\n end\n end\n end", "def customer_has_authorized_payment?\n\t\tauthorized and authorized_amount.try(:>, 0) and has_customer_account?\n\tend", "def claim_amount_required?\n @full_repayment_of_ads != 'Y'\n end", "def charge_paypal_account(amount)\n true\n end", "def charge_paypal_account(amount)\n true\n end", "def misc_charge(amount)\r\n if amount == 0 || (@response = gateway.purchase((amount.to_f * 100).to_i, billing_id)).success?\r\n subscription_payments.create(:subscriber => subscriber, :amount => amount, :transaction_id => @response.authorization, :misc => true)\r\n true\r\n else\r\n errors.add(:base, @response.message)\r\n false\r\n end\r\n end", "def can_charge_subscription?\n # * cannot charge subscription until trial period is running\n # * can only charge with a valid shipped_at or panic event\n !order.blank? && !subscription_deferred? && ( senior.any_panic_received? || !shipped_at.blank?)\n end", "def is_charge_card?\n return true if @lending_type == \"Charge\"\n false\n end", "def ensure_sufficient_credit\n if user.store_credits_total < store_credit_amount\n # user's credit does not cover all adjustments.\n adjustments.store_credits.destroy_all\n update!\n updater.update_payment_state\n update!\n end\n end", "def charge(amount)\n charge_rec = charge!(amount)\n gateway_response = charge_rec.gateway_response\n\n if gateway_response\n gateway_response.instance_eval do\n @success\n end\n else\n false\n end\n end", "def auth_charge\n @charge = nil\n @billing_success = false\n\n @remaining_cost = calculate_amount_to_charge\n return unless Invoice.milli_to_cents(@remaining_cost) >= Invoice::MIN_CHARGE_AMOUNT\n\n @charge = prepare_charge_on_payment_gateway\n rescue Stripe::StripeError => e\n ErrorLogging.new.track_exception(e, extra: { current_user: user, source: 'CreateServerTask' })\n user.account.create_activity(\n :auth_charge_failed,\n owner: user,\n params: {\n card: card.id,\n amount: Invoice.milli_to_cents(@remaining_cost),\n reason: e.message\n }\n )\n @build_errors.push(\"Could not authorize charge using the card you've selected, please try again\")\n raise ServerWizard::WizardError\n end", "def ensure_sufficient_credit\n if user.store_credits_total < store_credit_amount\n # user's credit does not cover all adjustments.\n adjustments.store_credits.destroy_all\n\n update!\n end\n end", "def calculate_amount_to_charge\n # First calculate how much this server is going to cost for the rest of the month\n @invoice = Invoice.generate_prepaid_invoice([self], user.account)\n\n # Then we need to know if the user has any spare credit notes that will reduced the amount of the\n # billing card charge we're about to make.\n credit_notes = user.account.credit_notes.with_remaining_cost\n # Deduct any unused value from the user's credit notes\n @notes_used = CreditNote.charge_account(credit_notes, @invoice.total_cost)\n # Make a note of this for posterity\n unless @notes_used.empty?\n user.account.create_activity(\n :charge_credit_account,\n owner: user,\n params: { notes: @notes_used }\n )\n end\n # Now, we finally have an amount to charge the billing card\n calculate_remaining_cost(@invoice.total_cost, @notes_used)\n end", "def can_credit?(payment)\n payment.completed? && payment.credit_allowed > 0\n end", "def can_credit?(payment)\n payment.completed? && payment.credit_allowed > 0\n end", "def minimal_charge_enabled?\n minimal_charge != 0\n end", "def can_supply?\n payment_received? || payment_on_account?\n end", "def credit_unlimited?\n #if prepaid?\n # raise \"Prepaid users do not have credit\"\n credit == -1\n end", "def credit_card_needed?\n credit_card_required?\n end", "def fully_paid?\n amount_owed <= 0\n end", "def store_credit_card?\n paid?\n end", "def payment_allowed?(acct_no, amount)\n if DB[:Account].where(AcctNo: acct_no).first[:Balance].to_i <\n amount.to_i.fdiv(100)\n return false\n end\n true\n end", "def valid_to_process?\n #TODO\n # available money to transfer\n persisted? ? true : false\n end", "def handle_successful_charge(charge)\n\t\tbegin\n\t\tinvoice_id = charge.invoice\n\t\tinvoice = Stripe::Invoice.retrieve(invoice_id)\n\t\tsubscription = Subscription.find_by_stripe_customer_token(invoice.customer)\n\t\t### Track that user was billed successfully - KM\n\t\tuser = subscription.user\n\t\tplan = user.plan\n\t\tsubscription_amount = format_amount(invoice.total)\n\t\tDelayedKiss.alias(user.full_name, user.email)\n DelayedKiss.record(user.email, 'Billed', {'Billing_Amount' => \"#{subscription_amount}\", \n \t\t\t\t\t\t\t\t\t\t\t 'Plan_Name' => \"#{plan.name}\",\n 'Plan_Identifier' => \"#{plan.identifier}\", })\n\t\tif subscription.status_info.present?\n\t\t\tif subscription.status_info == 'trialing' \n\t\t\t\treturn false\n\t\t\telse\n\t\t\t\tsubscription.status = true\n\t\t\t\tsubscription.save!\n\t\t\t\t\n\t\t\t\tuser = subscription.user\n\t\t\t\tNotifyMailer.delay.successfully_charged(invoice, user)\n\t\t\tend\n\t\tend\n\n\t\trescue => e\n\t\t\tputs \"#{e.message}\"\n\t\tend\n\tend", "def free?\n cost == 0.0 || payment_not_required\n end", "def charge!\n self.class.transaction do\n return if used_comp?\n if subscriber.blank?\n # something happened where the attached user no longer exists....\n # do not do anything, but log it so the admin can decide what to do?\n Freemium.log_subscription_msg(self, \"Subscriber (id: #{subscriber_id}, type: #{subscriber_type}) is no longer found. Deleting this subscription (id: #{self.id}).\")\n self.destroy\n return\n end\n \n if billing_key.blank?\n expire_after_grace! #if self.expires_on.blank? || self.expires_on <= Date.today\n return \n end\n # attempt to bill (use gateway)\n transaction = Freemium.gateway.charge(billing_key, subscription_plan.rate)\n Freemium.log_subscription_msg(self, transaction)\n transaction.success? ? receive_payment!(transaction.amount) : expire_after_grace!\n end\n end", "def cheque_or_card_payment_not_excessive\n\t\t\n\t\tself.errors.add(:amount,\"payment is excessive\") if payment_excessive? && (is_cheque? || is_card?) && !refund\n\tend", "def charge\r\n if paypal?\r\n if (@response = paypal.get_profile_details(billing_id)).success?\r\n next_billing_date = Time.parse(@response.params['next_billing_date'])\r\n if next_billing_date > Time.now.utc\r\n update_attributes(:next_renewal_at => next_billing_date, :state => 'active')\r\n subscription_payments.create(:subscriber => subscriber, :amount => amount) unless amount == 0\r\n true\r\n else\r\n false\r\n end\r\n else\r\n errors.add(:base, @response.message)\r\n false\r\n end\r\n else\r\n if amount == 0 || (@response = gateway.purchase(amount_in_pennies, billing_id)).success?\r\n update_attributes(:next_renewal_at => self.next_renewal_at.advance(:months => self.renewal_period), :state => 'active')\r\n subscription_payments.create(:subscriber => subscriber, :amount => amount, :transaction_id => @response.authorization) unless amount == 0\r\n true\r\n else\r\n errors.add(:base, @response.message)\r\n false\r\n end\r\n end\r\n end", "def payment_cadence_allowed?\n begin\n config_payment_cadence = SystemConfiguration::Variable.get_value('booking.payment_cadence').to_i\n _date_from_str = \"#{self.date_from.strftime('%Y-%m-%d')}T#{self.time_from}:00#{self.date_from.strftime(\"%:z\")}\"\n _date_from = DateTime.strptime(_date_from_str,'%Y-%m-%dT%H:%M:%S%:z')\n diff_in_hours = ((_date_from.to_time - self.creation_date.to_time).to_f * 24).to_i\n allowed = diff_in_hours > 0 && (diff_in_hours >= config_payment_cadence)\n allowed || force_allow_payment\n rescue => error\n p \"Error #{id} #{date_from} #{time_from} #{date_to} #{time_to} #{driver_date_of_birth} #{driver_driving_license_date}\"\n return false\n end\n end", "def check_total_charges_limit\n check_charges_limit([validate_total_limit])\n end", "def charge!(token = nil)\n return nil if !structure.can_receive_payments?\n\n customer = user.stripe_customer || user.create_stripe_customer(token)\n return nil if customer.nil?\n\n charge = Stripe::Charge.create({\n amount: amount.to_i * 100,\n currency: GiftCertificate::CURRENCY,\n customer: customer.id,\n destination: structure.stripe_managed_account\n })\n\n self.stripe_charge_id = charge.id\n self.save\n\n send_emails\n self.delay.retrieve_fees\n\n charge\n end", "def paid_in_full?\n !payment_outstanding?\n end", "def chargeable? listing\n listing.seller?(@user) && listing.new? \n end", "def can_cash?\n self.capture_and_cash\n end", "def payment_required?\n billing_total.to_f > 0.0\n end", "def credit_card_missing?\n credit_card_needed? && !credit_card_stored?\n end", "def free?\n self.setupFee == 0 && self.laborFee == 0 && self.oneTimeFee == 0 && self.recurringFee == 0 && self.hourlyRecurringFee == 0\n end", "def can_credit?(payment)\n return false unless payment.completed?\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end", "def can_credit?(payment)\n return false unless payment.completed?\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end", "def technically_paid?\n unconfirmed_value_paid >= value_needed\n end", "def collectible?\n !collected? && (unanimously_accepted? || !in_dispute_period?) && !contested?\n end", "def can_credit?(payment)\n return false unless payment.state == 'completed'\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end", "def is_purchasing_credit?\n sku_type.to_s == Product::SKU_TYPE_PURCHASING_CREDIT && self.internal?\n end", "def credit_card_editable?\n # HACK: HACK HACK\n return false if master?\n provider_account.payment_gateway_configured? && provider_account.billing_strategy.try!(:charging_enabled?)\n end", "def charge(cent_amount:, currency:, card:, email:, delay_charge: false)\n transaction_api.charge(preferences[:access_token], location_id, {\n idempotency_key: SecureRandom.uuid,\n buyer_email_address: email,\n amount_money: { amount: cent_amount, currency: currency },\n customer_id: card.gateway_customer_profile_id,\n customer_card_id: card.gateway_payment_profile_id,\n billing_address: map_address(card.address),\n delay_capture: delay_charge\n })\n end", "def refund_is_allowed?\n\t\terrors.add :base, I18n.t('payment.contact_support') if api_charge_id.blank?\n\t\tvalid?(:create_refund) and errors.empty?\n\tend", "def charge_privileges_denied?\n parse_fixed_boolean 0\n end", "def paid_up?\n if payment_item.is_a? GeneralPaymentItem\n outstanding_amount <= 0.0\n else\n nil\n end\n end", "def refunded_with_active_certificates?\n refunded_at.present? && daily_deal_certificates.active.try(:size) == quantity\n end", "def charge(billing_key, amount, options = {})\n raise MethodNotImplemented\n end", "def charge!(cents, idempotency_key)\n # we are not charging anything - customer pays via bank transfer\n { paymentmethod: payment_info }\n end", "def payment_possible_for?(listing)\n listing.price && listing.price > 0 && stripe_in_use?\n end", "def can_purchase_flex_contacts?\n !self.premium_contact_transactions.active.empty?\n end", "def charge!(params)\n params = {\n :amount => amount,\n :currency => currency,\n :invoice_text => invoice_text,\n :options => options\n }.merge(params)\n\n if initial_recurring?\n params = {\n :recurring_typ => 'initial',\n :recurring_frequency => 28, # monthly\n :recurring_expiry => 10.years.from_now.strftime(\"%Y/%m/%d\"), # some future date, get's autocorrected to cc expiry date by recurring_allow_expiry_correction\n :recurring_allow_expiry_correction => 1\n }.merge(params)\n elsif recurring?\n params = {\n :recurring_typ => 'sequencial'\n }.merge(params)\n end\n result = @service.reauth(params)[0]\n \n if result.status == \"SUCCESS\"\n @transaction_number = result.successDetails.retTrxNumber\n @successful = true\n return true\n else\n return false\n end\n end", "def deal_with_payment\n if human_amount_due <= 0\n update_attributes!(active: false)\n lease.mark_next_active_from_date(self.due_date)\n else\n true\n end\n end", "def payment_outstanding?\n balance > BigDecimal(0)\n end", "def can_transfer?\n return if sender.balance >= amount\n errors.add(:amount, INSUFFICIENT_FUNDS_MESSAGE)\n end", "def can_deliver?(cur, amount)\n amount > 0.01 && amount <= available_balance(cur)\n end", "def allows?\n !(coupable_countries - restricted_countries).empty?\n end", "def credit?\n (payment_method == CREDIT)\n end", "def accounts_receivable?\n type == 'ACCREC'\n end", "def paid?\n rate.present? && rate.cents > 0\n end", "def check_paid\n self.paid_amount = 0\n self.paid = false\n payments.each do |payment|\n self.paid_amount += payment.amount\n end\n \n if self.paid_amount - self.gross_amount >= 0\n self.paid = true\n end\n end", "def money_approved?\n true\n end", "def amount_is_valid_for_outstanding_balance_or_credit\n end", "def cancelled_by_customer?\n @cancelled_by_customer\n end", "def collect_billing_info\n return if self.class.to_s.match(/^Devise/) # Don't prevent logins, etc.\n return if request.path.match(/^\\/saas_admin/) # Admins don't need to pay\n return unless account = current_account # Nothing to do if there is no account\n return if !(sub = account.subscription) || sub.state.nil?\n return if sub.state == 'active' && sub.current? && !sub.needs_payment_info?\n return if sub.state == 'trial' && (!Saas::Config.require_payment_info_for_trials || !sub.needs_payment_info?)\n redirect_to billing_account_path\n end", "def charge!(automatic = true)\n ensure_payable_state!\n\n unless chargeable?\n logger.info \"Not charging invoice #{id} (buyer #{buyer_account_id}), reason: #{reason_cannot_charge}\"\n cancel! unless positive?\n return\n end\n\n if buyer_account.charge!(cost, :invoice => self)\n provider.billing_strategy&.info(\"Invoice #{id} (buyer #{buyer_account_id}) for period #{period} was charged, marking as paid\", buyer)\n pay!\n else\n logger.info(\"Invoice #{id} (buyer #{buyer_account_id}) was not charged\")\n false\n end\n rescue Finance::Payment::CreditCardError, ActiveMerchant::ActiveMerchantError\n provider.billing_strategy&.error(\"Error when charging invoice #{id} (buyer #{buyer_account_id})\", buyer)\n\n if automatic\n self.charging_retries_count += 1\n self.last_charging_retry = Time.now.utc.to_date\n\n # REFACTOR: Move the logic to InvoiceMessenger\n if charging_retries_count < MAX_CHARGE_RETRIES\n if unpaid?\n logger.info(\"Invoice #{id} (buyer #{buyer_account_id}) remains unpaid after #{charging_retries_count} attempts, will be retried\")\n save!\n else\n logger.info(\"Marking invoice #{id} (buyer #{buyer_account_id}) as unpaid, will be retried\")\n mark_as_unpaid!\n end\n\n InvoiceMessenger.unsuccessfully_charged_for_buyer(self).deliver\n\n # do not send email if provider's using new notification system\n unless provider_account.provider_can_use?(:new_notification_system)\n InvoiceMessenger.unsuccessfully_charged_for_provider(self).deliver\n end\n\n event = Invoices::UnsuccessfullyChargedInvoiceProviderEvent.create(self)\n Rails.application.config.event_store.publish_event(event)\n else\n logger.info(\"Marking invoice #{id} (buyer #{buyer_account_id}) as failed (too many retries)\")\n fail!\n # TODO: Decouple the notification to observer and delete the IF\n InvoiceMessenger.unsuccessfully_charged_for_buyer_final(self).deliver\n\n # do not send email if provider's using new notification system\n unless provider_account.provider_can_use?(:new_notification_system)\n InvoiceMessenger.unsuccessfully_charged_for_provider_final(self).deliver\n end\n\n event = Invoices::UnsuccessfullyChargedInvoiceFinalProviderEvent.create(self)\n Rails.application.config.event_store.publish_event(event)\n end\n end\n end", "def reverse_charge_applies\n as_stripe_customer.tax_exempt == 'reverse'\n end", "def free?\n\t\t\t\tnot(fee?)\n\t\t\tend", "def managed?\n stripe_account_type == 'managed'\n end", "def credit_account\n if @invoice.amount\n result = @invoice.bank_account.credit_account(seller_amount) rescue false\n else\n false\n end\n end", "def cc_purchase (person, cc_number, amount)\r\n\t\tif @bank_listing[person.id_number][:cc_spent] < @bank_listing[person.id_number][:cc_limit] && cc_number == @bank_listing[person.id_number][:cc_number]\r\n\t\t\t@bank_listing[person.id_number][:cc_spent]+=amount\r\n\t\t\tputs \"#{@bank_name}: Card accepted.\"\r\n\t\telse\r\n\t\t\tputs \"#{@bank_name}: Card has been declined.\"\r\n\t\tend\r\n\tend", "def cc_pay?\n plan&.direct_pay && id != 3744\n end", "def is_being_suppressed?\n\t\treturn false if !suppressed?\n\t\tif DateTime.now.to_f - suppressed.to_f > 30 * 60\n\t\t\tself.suppressed = nil\n\t\t\tself.save\n\t\t\treturn false\n\t\tend\n\t\ttrue\n\tend", "def can_request_purchase?\n true # TODO: Should this be !virginia_borrower? ?\n end", "def recharge!\n if charged && !canceled\n refund!\n charge!\n end\n end", "def reconcile_charge(charge)\n recon_status=true if status.in?(%w(paid dispatched)) and charge.paid==true and charge.refunded!=true\n recon_status=true if status.in?(%w(cancelled)) and charge.refunded==true\n recon_status||=false\n Hash(\n currency: charge.currency.upcase==currency.iso_code.upcase,\n cost: charge.amount==cost,\n status: recon_status\n )\n end", "def pre_bill_can_be_confirmed?(pre_bill)\n pre_bill_reading_not_billed?(pre_bill) && bills_with_this_attributes(pre_bill).count <= 0\n end", "def premium?\n \t! free?\n end", "def collectable?\n can_supply? && collection? && !(on_hold? || fully_shipped?)\n end", "def is_current?\n self.charge.has_result\n end", "def supporter?\n !values[:stripe_customer_id].nil?\n end", "def charge!\n # get the credit card details submitted by the form\n # create the charge on Stripe's servers - this will charge the user's card\n currency = Selfstarter::Application::CURRENCY\n\n charge = Stripe::Charge.create({\n :amount => @campaign_level.price_to_cents, # amount in cents\n :currency => currency,\n :card => @card_id,\n :description => @campaign_level.title,\n :application_fee => @campaign_level.application_fee_cents # amount in cents\n },\n @campaign_level.campaign.user.stripe_token # user's access token from the Stripe Connect flow\n )\n\n charge['id']\n end", "def charge(customer_to_be_charged)\n payments.create(:customer => customer_to_be_charged)\n end", "def can_cash?\n if self.tier && self.tier.piggy_bank\n if rate = find_bonus_rate\n # transfer cents\n if rate.cents.to_i > 0 && rate.funding_source.piggy_bank &&\n cashed_events_limit_not_reached?(rate.max_events_per_month)\n result = rate.funding_source.piggy_bank.transfer(self.receiver.piggy_bank, \n Money.new(rate.cents, rate.default_currency))\n if result.success?\n self.description = result.message \n return true\n end\n end\n end\n end\n false\n end", "def validate_amount\n errors.add(:claiming_amount, :ads_amount) if claim_amount_required? && ads_amount.to_i < claiming_amount.to_i\n end", "def has_available_payment_source?\n stripe_customer.sources.count > 0\n end", "def may_purchase?(_company)\n false\n end" ]
[ "0.76029074", "0.74639976", "0.7239608", "0.70875794", "0.7015584", "0.7015584", "0.68862283", "0.6858936", "0.6799953", "0.6784267", "0.6779929", "0.6715737", "0.66347224", "0.66147065", "0.6591362", "0.6591362", "0.6519883", "0.6464177", "0.64519244", "0.6433467", "0.64117545", "0.640348", "0.6347938", "0.6315936", "0.6308974", "0.6308974", "0.63007", "0.62854344", "0.62369573", "0.62266487", "0.6209107", "0.62086624", "0.6168656", "0.6153096", "0.61497694", "0.6145308", "0.61437404", "0.61378765", "0.6136823", "0.61098784", "0.61003846", "0.60825914", "0.60710144", "0.60680455", "0.6059665", "0.6024604", "0.6017198", "0.600566", "0.59979033", "0.59979033", "0.5984956", "0.5983353", "0.59490025", "0.59453064", "0.59417903", "0.5938912", "0.59252656", "0.59064865", "0.5899073", "0.58781564", "0.58519864", "0.5843464", "0.58423567", "0.58297443", "0.5828333", "0.5828083", "0.5799862", "0.5794816", "0.5789167", "0.57884645", "0.5771985", "0.57572955", "0.5754378", "0.57477856", "0.5742463", "0.5741209", "0.57043093", "0.57038796", "0.56917834", "0.56886", "0.56814504", "0.5678492", "0.56779635", "0.5674771", "0.5674129", "0.5668969", "0.5665325", "0.5661715", "0.5659816", "0.56564146", "0.5655315", "0.56518835", "0.56511855", "0.5650304", "0.56501395", "0.56491566", "0.5646217", "0.56457585", "0.56449753", "0.5642801" ]
0.8083334
0
GET /term_counts/1 GET /term_counts/1.xml
def show @term_count = TermCount.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @term_count } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 get_document_frequency(term)\n\t\t\t@term_hash[term]\n\t\tend", "def index\n @tags = Tag.counts\n\n respond_to do |format|\n format.html # index.rhtml\n# format.xml { render :xml => @tags.to_xml }\n end\n end", "def count( args={} )\n args.merge!({ :count => \"1\" })\n result = request( :method => 'post', :url => @url, :query => generate_xml(args) )\n return result.to_i\n end", "def new\n @term_count = TermCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term_count }\n end\n end", "def get_lookup_count(word, *args)\n http_method = :get\n path = '/word/{word}/lookupCount'\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 counts\n reply.documents[0][COUNTS]\n end", "def counts\r\n @counts\r\n end", "def alltags\n tag_context = params[:context] # tag context\n @tags = TagsService.tag_counts_on(SurveyRespondent, tag_context)\n \n respond_to do |format|\n format.xml\n end\n end", "def destroy\n @term_count = TermCount.find(params[:id])\n @term_count.destroy\n\n respond_to do |format|\n format.html { redirect_to(term_counts_url) }\n format.xml { head :ok }\n end\n end", "def count; info['doc_count']; end", "def count( query )\n data = index_request({ \"q\" => query })\n return data[\"response\"][\"numFound\"]\n end", "def index_info(params={})\n params[:numTerms]||=0\n send_request @opts[:luke_path], params\n end", "def index\n c = DisAdditiveFrequency.paginate(:page => params[:page], :per_page => 20)\n v = DisAdditiveFrequency.query(c)\n respond_with v\n end", "def get_frequency(*args)\n http_method = :get\n path = '/words/frequency'\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 fetch_count_for(id)\n @result_terms.fetch(id.to_s.downcase, 0)\n end", "def new\n @term_count = TermCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @term_count }\n end\n end", "def index\n @search = Influencer.search(params[:q])\n @influencers = @search.result\n .alphabetically\n .page(params[:page])\n @count = get_total_count\n end", "def summary_site\n \t\tAPI.get_site_wordcount\n \tend", "def tags\n @tags = User.tag_counts_on(:tags, :conditions => \"name LIKE '\" + (params[:query] || \"\") + \"%'\").limit(50).order('count desc')\n respond_to do |format|\n format.html # tags.html.erb\n format.json { render json: @tags }\n format.xml { render xml: @tags }\n end\n end", "def counts\n @counts = UserCounts.new(@company, params)\n respond_to do |format|\n format.json { render json: @counts.user_counts }\n end\n end", "def api_count(args)\n query_str = args[:query]\n object_name = args[:entity].pluralize\n my_response = HTTParty.get(\"https://api.rechargeapps.com/#{object_name}/count?#{query_str}\",\n headers: HEADER)\n my_count = my_response['count'].to_i\n Resque.logger.info \"#{my_count} #{object_name}'s on Recharge API\"\n Resque.logger.info my_response\n my_count\n end", "def get_listed_in_count(word, *args)\n http_method = :get\n path = '/word/{word}/listedInCount'\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 @term = Term.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @term }\n end\n end", "def show\n @term = Term.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @term }\n end\n end", "def create\n @term_count = TermCount.new(params[:term_count])\n\n respond_to do |format|\n if @term_count.save\n flash[:notice] = 'TermCount was successfully created.'\n format.html { redirect_to(@term_count) }\n format.xml { render :xml => @term_count, :status => :created, :location => @term_count }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @term_count.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n reader = inject( Java::pl.goldmann.confitura.beans.TweetReader )\n \n @tweets = reader.read\n @total = reader.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tweets }\n end\n end", "def index\n @terms = Term.all\n end", "def index\n @search_counts = SearchCount.all\n end", "def index\n @tags = Movie.tag_counts_on(:genre)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def count(params = {})\n @api.get(\"api/count.json\", params)\n end", "def destroy\n @term_count = TermCount.find(params[:id])\n @term_count.destroy\n\n respond_to do |format|\n format.html { redirect_to term_counts_url }\n format.json { head :no_content }\n end\n end", "def index\n @term_item_terms = TermItemTerm.all\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_word_frequency(word, *args)\n http_method = :get\n path = '/word/{word}/frequency'\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 calculate_term_frequencies\n results = []\n \n @data.each do |document|\n document_result = {}\n \n document.each do |term|\n if document_result.key?(term)\n document_result[term] += 1.0\n else\n document_result[term] = 1.0\n end\n end\n \n # Normalize the count\n document_result.each_key do |term|\n document_result[term] /= document.size\n end\n \n results << document_result\n end\n \n results\n end", "def index\n #Limit and offset is set in application_controller\n tags = Tag.limit(@limit).offset(@offset)\n \n count_tags = Tag.distinct.count(:id)\n @response = {tags: tags, nrOfTags: count_tags}\n respond_with @response, include: [:restaurants], status: :ok\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 get_favorite_count(word, *args)\n http_method = :get\n path = '/word/{word}/favoriteCount'\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 get_tag_count_on_word(word, *args)\n http_method = :get\n path = '/word/{word}/tagCount'\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 document_counts\n @document_count ||= solr_response.facet_queries.each_with_object({}) do |(k, v), h|\n h[k.split(/:/).first] = v\n end\n end", "def count\n self.at('/RETS/COUNT')['Records'].to_i\n end", "def index\n @books = Book.find(:all)\n\t\t\n @book_counts = BooksOrders.count(:all, :group=> :book_id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end", "def fetch_thesauri\n doc = create_doc('gaz-thesauri/administrativeThesaurus.xml')\n ## loop through each <term> element in the thesaurus\n vocabs=[]\n (doc/\"thesaurus/root/term\").each do |term|\n STDOUT << puts \n STDOUT << term.inspect\n STDOUT << puts \n\n end\n vocabs\n end", "def index\n if !params[:format]\n @scope = @scope.paginate :page => params[:page] , :order => 'name ASC' if !params[:format]\n\t else\n @scope = @scope.all\n\t end\n\t @occurrences = @scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @occurrences }\n format.kml\n format.csv\n end\n end", "def term_map\n\t\t\tterm_set = Hash.new(0)\n\t\t\tself.to_terms.each do |term|\n\t\t\t\tterm_set[term] = term_set[term] + 1\n\t\t\tend\n\t\t\tterm_set\n\t\tend", "def total_terms\n return original_query_offset if normalized_page == 0\n (hits_requested * normalized_page) + original_query_offset\n end", "def index\n @view_counts = ViewCount.all\n end", "def index\n @tags = Contact.tag_counts_on(:tags)\n\tend", "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 ri_counts(*args)\n resources, opts = ri_opts(args)\n counts = {}\n threads = []\n resources.each do |res|\n next unless res.populated?\n threads << Thread.new do\n counts[res.acronym] = res.concept_count(self.xxhash, opts)\n end\n end\n threads.each(&:join)\n counts\n end", "def index\n @frequency_vocabularies = FrequencyVocabulary.all\n end", "def index\n @term_relationships = TermRelationship.all\n end", "def get_terms(params)\n send_get \"get_terms\", params\n end", "def stats\n\t\t@counts\n\tend", "def count_page\n num_pages = current_cookbook.num_pages\n render json: {num_pages: num_pages}\n end", "def index\n @twitter_crawler_hash_tags = TwitterCrawlerHashTag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @twitter_crawler_hash_tags }\n end\n end", "def count(index, types, query, options=nil)\n query = {'q' => query} if query.is_a?(String)\n resp = get do |req|\n req.url \"#{index}/#{types}/_count\", query\n req.body = options if options\n end\n resp.body\n end", "def get_counts(args = {})\r\n Net::Flickr.instance().request('flickr.photos.getCounts', args).at('photocounts')\r\n end", "def get_array_counts_for_tenant(args = {}) \n get(\"/tenants.json/backoffice/arrays/summary/#{args[:tenantId]}\", args)\nend", "def index\n @bundle_content_count = BundleContent.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bundle_content_count }\n end\n end", "def create\n @term_count = TermCount.new(params[:term_count])\n\n respond_to do |format|\n if @term_count.save\n format.html { redirect_to @term_count, notice: 'Term count was successfully created.' }\n format.json { render json: @term_count, status: :created, location: @term_count }\n else\n format.html { render action: \"new\" }\n format.json { render json: @term_count.errors, status: :unprocessable_entity }\n end\n end\n end", "def stats\n request :get, \"_stats\"\n end", "def stats\n request :get, \"_stats\"\n end", "def search_all_terms\n render json: Article.with_all_terms(params[:query]).map(&:title)\n end", "def get_total_results( xml_doc )\n return xml_doc.xpath('//atom:feed/opensearch:totalResults', ATOM_NAMESPACE.merge(OPENSEARCH_NAMESPACE)).text.to_i\n end", "def index\n @frequencia_setores = Frequencia::Setor.order('updated_at ASC').paginate :page => params[:page], :per_page => 10\n @total = Frequencia::Setor.all.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @frequencia_setores }\n end\n end", "def call\n uids = dataset ? grouped_uids_dataset : grouped_uids_corpus\n uids_to_term_counts(uids)\n end", "def calculate_term_frequencies\n results = []\n\n @tokenized_documents.each do |tokens|\n document_result = {}\n tokens[:words].each do |term, count|\n document_result[term] = (count/tokens[:total_count].to_f).round(6)\n end\n\n results << document_result\n end\n\n results\n end", "def count()\n if @count == -1\n params = @params.clone\n params['count'] = 1\n\n res = @api.do_request(\"GET\", @path, params)\n @count = res['count'].to_i\n end\n @count\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 total_words\n @page = Page.find(params[:id])\n @word_count = @page.title.length + @page.content.length\n\n respond_to do |format|\n format.json {render json: @word_count}\n format.xml {render xml: @word_count}\n end\n end", "def index\n @searchterms = Searchterm.all\n end", "def total_results\n opensearch_totalResults\n end", "def count\n @params[:rettype] = 'count'\n self\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 @common_terms = CommonTerm.all\n end", "def index\n @admin_terms = Admin::Term.search(params[:query]).order('lower(title) ASC').page(params[:page]).per(32)\n #@admin_terms = Admin::Term.all\n end", "def offense_counts; end", "def offense_counts; end", "def show\n @permitted_params = params.permit(Search::RESULTS_PARAMS +\n Search::SIMPLE_SEARCH_PARAMS)\n @start = [@permitted_params[:start].to_i.abs, MAX_START].min\n @window = window_size\n q = \"%#{@permitted_params[:q]&.downcase}%\"\n @terms = @vocabulary.vocabulary_terms.\n where(\"LOWER(displayed_value) LIKE ? OR LOWER(stored_value) LIKE ?\", q, q).\n order(:displayed_value)\n @count = @terms.count\n @terms = @terms.limit(@window).offset(@start)\n @current_page = ((@start / @window.to_f).ceil + 1 if @window > 0) || 1\n\n if request.xhr?\n render partial: \"terms\"\n else\n render \"show\"\n end\n end", "def terms\n @term_hash.values\n end", "def response_counts!(start_date = Time.parse('2000-1-1'), end_date = Time.now.utc)\n time_fmt = '%Y-%m-%d'\n response = get 'getResponseCountsBySurvey', 'StartDate' => start_date.strftime(time_fmt), \n 'EndDate' => end_date.strftime(time_fmt)\n @response_counts = json_result(response)\n end", "def index\r\n if !params[:query].nil?\r\n @products = Product.find_like(params[:query], false) #, \"name\", \"ASC\", @limit)\r\n @total_count = Product.count_by_like(params[:query], false)\r\n else\r\n @products = Product.find(:all, :offset => @offset, :limit => @limit,\r\n :order => @sort.to_s+\" \"+@order.to_s)\r\n @total_count = Product.count\r\n end\r\n\r\n if !params[:category_id].nil?\r\n category = Category.find(params[:category_id])\r\n @products = category.products.find(:all, :offset => @offset, :limit => @limit)\r\n @total_count = category.products.count\r\n end\r\n\r\n @products_xml = @products.to_xml(:methods => [:customer_price, :business_price,\r\n :wholesale_price, :length1]) do |xml|\r\n xml.totalCount(@total_count)\r\n end\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @products_xml }\r\n format.json { render :json => {:products => @products } }\r\n end\r\n end", "def term_frequency(document, term)\n tf = document.term_count(term)\n if @function == :bm25\n (tf * 2.2) / (tf + 0.3 + 0.9 * documents.size / @model.average_document_size)\n else\n sqrt(tf)\n end\n end", "def genre_count(term)\n #count the genres in object.get_genres\n genres = Hash.new(0)\n object.get_genres(term).each do |genre|\n case\n when genre.include?(\"rap\")\n genres[:rap]+=1\n when genre.include?(\"pop\")\n genres[:pop]+=1\n when genre.include?(\"country\")\n genres[:country]+=1\n when genre.include?(\"indie\")\n genres[:indie]+=1\n when genre.include?(\"hip\")\n genres[\"hip hop\"]+=1\n when genre.include?(\"rock\")\n genres[:rock]+=1\n when genre.include?(\"jazz\")\n genres[:jazz]+=1\n when genre.include?(\"instrumental\")\n genres[:instrumental]+=1\n when genre.include?(\"r&b\")\n genres[\"r&b\"]+=1\n else\n genres[:misc] +=1\n end\n end\n genres\n end", "def get_trending_hits(*args)\n http_method = :get\n path = '/analytics/trending'\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 get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end", "def terms\n\n end", "def terms\n\n end", "def index\n @count_wants = CountWant.all\n end", "def start_stream \n @client.track(@search_terms.each {|term| print \"'#{term} ',\"}) do |status|\n count = REDIS.incr(\"#{status.created_at}\")\n # puts \"#{status.created_at}: #{status.text} #{count}\"\n end\n end", "def uids_to_term_counts(uids)\n ret = {}\n total = uids.size\n\n uids.each_with_index do |(key, arr), i|\n ret[key] = 0\n\n arr.each do |uid|\n doc = Document.find(uid, term_vectors: true)\n vec = doc.term_vectors[@term]\n\n ret[key] += vec[:tf] if vec\n end\n\n progress&.call(50 + (i.to_f / total.to_f * 50.0).to_i)\n end\n\n progress&.call(100)\n\n zero_intervening(ret)\n end", "def index\n #@tags = Entry.author_counts\n\t@filter = params[:filter]\n\t@sort_by = params[:sort_by]\n\t\n\tif (@filter)\n\t\t@entries = Entry.tagged_with(params[:filter], :order => @sort_by)\n\telse\n\t\t@entries = Entry.find(:all, :order => @sort_by)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n\t format.rss { render :rss => @entries }\n end\n end", "def count\n call_client(:count)\n end", "def count_documents rdf_type, allowed_groups = nil\n sparql_query = <<SPARQL\n SELECT (COUNT(?doc) AS ?count) WHERE {\n ?doc a <#{rdf_type}>\n }\nSPARQL\n\n log.debug \"Counting documents for #{allowed_groups}\"\n\n query_result =\n if allowed_groups\n authorized_query sparql_query, allowed_groups\n else\n request_authorized_query sparql_query\n end\n\n documents_count = query_result.first[\"count\"].to_i\n\n log.info \"Found #{documents_count} documents for #{allowed_groups}.\"\n\n documents_count\nend", "def accumulate term, docid, frequency, index\n @doc_count += 1\n @tot_freq += frequency.to_i\n end", "def dor_resource_count\n public_xml_doc.xpath('//contentMetadata/resource').count\n end", "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 @shorts = Short.page(params[:page])\n @view_count = Visit.count(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shorts }\n end\n end" ]
[ "0.65998244", "0.64372104", "0.6348661", "0.60904974", "0.60649526", "0.59661585", "0.59277576", "0.5901891", "0.5875368", "0.57677156", "0.5746671", "0.57270795", "0.5712348", "0.57084346", "0.57039905", "0.5695749", "0.5694083", "0.5687324", "0.5687266", "0.56584513", "0.5637697", "0.5633563", "0.56224036", "0.560614", "0.560614", "0.5604255", "0.5598459", "0.55930126", "0.5576377", "0.556135", "0.5560802", "0.5536977", "0.5526125", "0.5509971", "0.5509164", "0.55067456", "0.54977", "0.549653", "0.5487288", "0.5467685", "0.5456697", "0.5452665", "0.54418063", "0.5432429", "0.5427027", "0.5424031", "0.54215544", "0.5414367", "0.54126555", "0.5408263", "0.5390667", "0.53634965", "0.5363464", "0.53627425", "0.53537774", "0.5347187", "0.5346197", "0.5342582", "0.53419554", "0.53369206", "0.53334266", "0.5325002", "0.53219515", "0.53219515", "0.5321249", "0.53202397", "0.53186524", "0.5317147", "0.5313433", "0.5312105", "0.5297306", "0.52949184", "0.5294442", "0.5291814", "0.52909935", "0.52837414", "0.52775526", "0.5276638", "0.5265112", "0.5265112", "0.52593017", "0.525192", "0.5249076", "0.52424306", "0.52420324", "0.5240476", "0.52329844", "0.5232865", "0.52299666", "0.52299666", "0.522444", "0.52219504", "0.521763", "0.5216443", "0.5212822", "0.5200453", "0.51961607", "0.51953906", "0.51929635", "0.51867974" ]
0.6985498
0
GET /term_counts/new GET /term_counts/new.xml
def new @term_count = TermCount.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @term_count } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @term_count = TermCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @term_count }\n end\n end", "def create\n @term_count = TermCount.new(params[:term_count])\n\n respond_to do |format|\n if @term_count.save\n flash[:notice] = 'TermCount was successfully created.'\n format.html { redirect_to(@term_count) }\n format.xml { render :xml => @term_count, :status => :created, :location => @term_count }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @term_count.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\n end", "def new\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\n end", "def new\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\n end", "def create\n @term_count = TermCount.new(params[:term_count])\n\n respond_to do |format|\n if @term_count.save\n format.html { redirect_to @term_count, notice: 'Term count was successfully created.' }\n format.json { render json: @term_count, status: :created, location: @term_count }\n else\n format.html { render action: \"new\" }\n format.json { render json: @term_count.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @search_term = SearchTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @search_term }\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.xml { render :xml => @term_count }\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 @event = Event.find(params[:event_id])\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\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(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 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 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 @transaction_term = TransactionTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction_term }\n end\n end", "def new\n @word_count = WordCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word_count }\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 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 new\n @seo_search_term = Seo::SearchTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @seo_search_term }\n end\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 new\n @twitter_crawler_hash_tag = TwitterCrawlerHashTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @twitter_crawler_hash_tag }\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 @frequentmag = Frequentmag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @frequentmag }\n end\n end", "def new\n @sales_term = SalesTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sales_term }\n end\n end", "def new\n @occurence = Occurence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @occurence }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end", "def new\n @taxonomy_category = TaxonomyCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxonomy_category }\n end\n end", "def new\n @vocab = Vocab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vocab }\n end\n end", "def new\n @prizecount = Prizecount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prizecount }\n end\n end", "def new\n @gene_ontology = GeneOntology.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end", "def new\n @search_tweet = SearchTweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @search_tweet }\n end\n end", "def new\n @breadcrumb = 'create'\n @inventory_count_type = InventoryCountType.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_count_type }\n end\n end", "def new\n @taxonomy = Taxonomy.new(:taxonomy_type => params[:taxonomy_type].presence || 'category')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxonomy }\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 @county = County.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @county }\n end\n end", "def new\n @keyword = Keyword.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @keyword }\n end\n end", "def destroy\n @term_count = TermCount.find(params[:id])\n @term_count.destroy\n\n respond_to do |format|\n format.html { redirect_to(term_counts_url) }\n format.xml { head :ok }\n end\n end", "def new\n @frequent_set = FrequentSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @frequent_set }\n end\n end", "def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end", "def new\n @vocabtype = Vocabtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vocabtype }\n end\n end", "def new\n @search_phrase = SearchPhrase.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @search_phrase }\n end\n end", "def new\n @tax_rate = TaxRate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tax_rate }\n end\n end", "def create\n @transaction_term = TransactionTerm.new(params[:transaction_term])\n\n respond_to do |format|\n if @transaction_term.save\n format.html { redirect_to(@transaction_term, :notice => 'Transaction terms was successfully created.') }\n format.xml { render :xml => @transaction_term, :status => :created, :location => @transaction_term }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction_term.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @who_prefix_factor = WhoPrefixFactor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @who_prefix_factor }\n end\n end", "def new\r\n @keyword = Keyword.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @keyword }\r\n end\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 count( args={} )\n args.merge!({ :count => \"1\" })\n result = request( :method => 'post', :url => @url, :query => generate_xml(args) )\n return result.to_i\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 new\n @document_term_matrix = DocumentTermMatrix.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_term_matrix }\n end\n end", "def new\n @node_index = NodeIndex.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node_index }\n end\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 new\n @tax_computation = TaxComputation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tax_computation }\n end\n end", "def index_info(params={})\n params[:numTerms]||=0\n send_request @opts[:luke_path], params\n end", "def new\n @retain_node_selector = RetainNodeSelector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retain_node_selector }\n end\n end", "def new\n @twitterfeed = Twitterfeed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @twitterfeed }\n end\n end", "def new\n @index = Indice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @index }\n end\n end", "def new\n @namespace = Namespace.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @namespace }\n end\n end", "def new\n @corpus = Corpus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @corpus }\n end\n end", "def new\n @shipping_term = ShippingTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shipping_term }\n end\n end", "def new\n @title = \"NUEVO WMI NAMESPACE\"\n @wmi_namespace = WmiNamespace.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wmi_namespace }\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 destroy\n @term_count = TermCount.find(params[:id])\n @term_count.destroy\n\n respond_to do |format|\n format.html { redirect_to term_counts_url }\n format.json { head :no_content }\n end\n end", "def counts\n @counts = UserCounts.new(@company, params)\n respond_to do |format|\n format.json { render json: @counts.user_counts }\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 @tag = @category.tags.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tag }\n end\n end", "def new\n @taxband = Taxband.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @taxband }\n end\n end", "def new\n @clenum = Clenum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clenum }\n end\n end", "def new\n @suggestion_history = SuggestionHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @suggestion_history }\n end\n end", "def new\n get_status\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tag }\n end\n end", "def index\n @tags = Tag.counts\n\n respond_to do |format|\n format.html # index.rhtml\n# format.xml { render :xml => @tags.to_xml }\n end\n end", "def new\n @entry = @resource_finder.new\n initialize_new_resource\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end", "def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @search }\n end\n end", "def new\n @noun = Noun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @noun }\n end\n end", "def get_document_frequency(term)\n\t\t\t@term_hash[term]\n\t\tend", "def new\n @lookup_scantask = LookupScantask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end", "def 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 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 new\n @bookmark = Bookmark.new(:tags => [Tag.new])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bookmark }\n end\n end", "def new\n @lookup_truthtable = LookupTruthtable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_truthtable }\n end\n end", "def new\n @quotetags = Quotetags.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quotetags }\n end\n end", "def new\n @taxon = Taxon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxon }\n end\n end", "def new\n @taxon = Taxon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxon }\n end\n end", "def new\n @wordlist = Wordlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wordlist }\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 new\n @search_log = SearchLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @search_log }\n end\n end", "def new\n @explain = Explain.new\n @page = 'new-explain'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @explain }\n end\n end", "def new\n @thing_list = ThingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing_list }\n end\n end", "def new\n @tax_type = TaxType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tax_type }\n end\n end", "def new\n @prd_threshold = PrdThreshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_threshold }\n end\n end", "def get_new_term(new_term, num_of_terms)\n\tif new_term % 2 == 0\n\t\tnew_term /= 2\n\t\tnum_of_terms += 1\n\telse\n\t\tnew_term = 3 * new_term + 1\n\t\tnum_of_terms += 1\t\t\n\tend\n\n\treturn new_term, num_of_terms\nend", "def update\n @term_count = TermCount.find(params[:id])\n\n respond_to do |format|\n if @term_count.update_attributes(params[:term_count])\n flash[:notice] = 'TermCount was successfully updated.'\n format.html { redirect_to(@term_count) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @term_count.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @document_status = DocumentStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document_status }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @term = VocabularyTerm.new\n authorize @term, policy_class: VocabularyPolicy\n render partial: \"form\", locals: { vocabulary: @vocabulary,\n term: @term }\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 new\n @index = Index.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @index }\n end\n end", "def new\n @taxon_attribute = TaxonAttribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxon_attribute }\n end\n end", "def new\n @node = Node.new\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @regiment = Regiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @regiment }\n end\n end", "def new\n @tagsearch = Tagsearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tagsearch }\n end\n end" ]
[ "0.7337316", "0.6986773", "0.6798613", "0.6798613", "0.6798613", "0.6700379", "0.64070505", "0.6358499", "0.634079", "0.6280353", "0.6235569", "0.61859065", "0.61798096", "0.61019623", "0.6041338", "0.6019147", "0.60190517", "0.60175043", "0.59731585", "0.59415734", "0.5898808", "0.58823806", "0.5868584", "0.5847904", "0.58399063", "0.57985544", "0.5765262", "0.57117116", "0.5703685", "0.56933826", "0.56869704", "0.5658186", "0.5655549", "0.56391966", "0.5615958", "0.5613803", "0.5595387", "0.55916756", "0.5586319", "0.5570299", "0.55529016", "0.55263495", "0.5526193", "0.5525084", "0.552425", "0.5523545", "0.5522043", "0.55061066", "0.5504447", "0.5497449", "0.54962057", "0.5481123", "0.547827", "0.544843", "0.5428765", "0.542687", "0.5426531", "0.5426023", "0.54210925", "0.5410181", "0.54074866", "0.54063267", "0.5402183", "0.53997594", "0.5395717", "0.53939265", "0.53920394", "0.5378944", "0.5372896", "0.5367309", "0.5360296", "0.53517777", "0.5345844", "0.5342502", "0.53362656", "0.53322357", "0.53280205", "0.53276", "0.53271735", "0.53264415", "0.5323034", "0.5323034", "0.53227305", "0.53170264", "0.5316936", "0.5314107", "0.53137517", "0.5308492", "0.5297561", "0.5294373", "0.5291772", "0.52878344", "0.5285133", "0.5272351", "0.5272223", "0.52714586", "0.5269674", "0.5268866", "0.52663505", "0.5265753" ]
0.76714236
0
POST /term_counts POST /term_counts.xml
def create @term_count = TermCount.new(params[:term_count]) respond_to do |format| if @term_count.save flash[:notice] = 'TermCount was successfully created.' format.html { redirect_to(@term_count) } format.xml { render :xml => @term_count, :status => :created, :location => @term_count } else format.html { render :action => "new" } format.xml { render :xml => @term_count.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @term_count = TermCount.new(params[:term_count])\n\n respond_to do |format|\n if @term_count.save\n format.html { redirect_to @term_count, notice: 'Term count was successfully created.' }\n format.json { render json: @term_count, status: :created, location: @term_count }\n else\n format.html { render action: \"new\" }\n format.json { render json: @term_count.errors, status: :unprocessable_entity }\n end\n end\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 update_count\n self.term_taxonomies.update_column('count', self.term_taxonomies.posts.published.size) if self.term_taxonomies.present? && !self.term_taxonomies.try(:posts).nil?\n end", "def count( args={} )\n args.merge!({ :count => \"1\" })\n result = request( :method => 'post', :url => @url, :query => generate_xml(args) )\n return result.to_i\n end", "def get_document_frequency(term)\n\t\t\t@term_hash[term]\n\t\tend", "def new\n @term_count = TermCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term_count }\n end\n end", "def calculate_term_frequencies\n results = []\n \n @data.each do |document|\n document_result = {}\n \n document.each do |term|\n if document_result.key?(term)\n document_result[term] += 1.0\n else\n document_result[term] = 1.0\n end\n end\n \n # Normalize the count\n document_result.each_key do |term|\n document_result[term] /= document.size\n end\n \n results << document_result\n end\n \n results\n end", "def destroy\n @term_count = TermCount.find(params[:id])\n @term_count.destroy\n\n respond_to do |format|\n format.html { redirect_to(term_counts_url) }\n format.xml { head :ok }\n end\n end", "def new\n @term_count = TermCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @term_count }\n end\n end", "def uids_to_term_counts(uids)\n ret = {}\n total = uids.size\n\n uids.each_with_index do |(key, arr), i|\n ret[key] = 0\n\n arr.each do |uid|\n doc = Document.find(uid, term_vectors: true)\n vec = doc.term_vectors[@term]\n\n ret[key] += vec[:tf] if vec\n end\n\n progress&.call(50 + (i.to_f / total.to_f * 50.0).to_i)\n end\n\n progress&.call(100)\n\n zero_intervening(ret)\n end", "def term_map\n\t\t\tterm_set = Hash.new(0)\n\t\t\tself.to_terms.each do |term|\n\t\t\t\tterm_set[term] = term_set[term] + 1\n\t\t\tend\n\t\t\tterm_set\n\t\tend", "def destroy\n @term_count = TermCount.find(params[:id])\n @term_count.destroy\n\n respond_to do |format|\n format.html { redirect_to term_counts_url }\n format.json { head :no_content }\n end\n end", "def calculate_term_frequencies\n results = []\n\n @tokenized_documents.each do |tokens|\n document_result = {}\n tokens[:words].each do |term, count|\n document_result[term] = (count/tokens[:total_count].to_f).round(6)\n end\n\n results << document_result\n end\n\n results\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(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 @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 accumulate term, docid, frequency, index\n @doc_count += 1\n @tot_freq += frequency.to_i\n end", "def update\n @term_count = TermCount.find(params[:id])\n\n respond_to do |format|\n if @term_count.update_attributes(params[:term_count])\n flash[:notice] = 'TermCount was successfully updated.'\n format.html { redirect_to(@term_count) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @term_count.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_terms(params)\n send_get \"add_terms\", params\n end", "def counts\n @counts = UserCounts.new(@company, params)\n respond_to do |format|\n format.json { render json: @counts.user_counts }\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.xml { render :xml => @term_count }\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 process\n tokenize(text).each do |word|\n token = TfIdfSimilarity::Token.new word\n if token.valid?\n @term_counts[token.lowercase_filter.classic_filter.to_s] += 1\n end\n end\n @size = term_counts.values.reduce(:+)\n end", "def update\n @term_count = TermCount.find(params[:id])\n\n respond_to do |format|\n if @term_count.update_attributes(params[:term_count])\n format.html { redirect_to @term_count, notice: 'Term count was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @term_count.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 terms_post(opts = {})\n data, _status_code, _headers = terms_post_with_http_info(opts)\n data\n end", "def index\n @tags = Tag.counts\n\n respond_to do |format|\n format.html # index.rhtml\n# format.xml { render :xml => @tags.to_xml }\n end\n end", "def counts\r\n @counts\r\n end", "def sum_counts(term,counts,labels)\n positive = counts.map.with_index { |e, i| e if i % 2 == 0 }.compact.inject(0) { |e, s| e + s }\n negative = counts.map.with_index { |e, i| e if i % 2 != 0 }.compact.inject(0) { |e, s| e + s }\n report do |reporter|\n if positive > 0\n labels = labels.map{|name| \"#{name}:%i/%i\" }.join(\",\")\n count_string = \" %-20s #{labels} -> %i/%i/%.1f\" %\n [term.to_ruby, *counts, positive, positive+negative, (positive/(positive+negative).to_f*100)]\n reporter.call(count_string.hl(:green))\n else\n reporter.call(\" #{term.to_ruby}\".hl(:red))\n end\n end\n return positive, negative\n end", "def genre_count(term)\n #count the genres in object.get_genres\n genres = Hash.new(0)\n object.get_genres(term).each do |genre|\n case\n when genre.include?(\"rap\")\n genres[:rap]+=1\n when genre.include?(\"pop\")\n genres[:pop]+=1\n when genre.include?(\"country\")\n genres[:country]+=1\n when genre.include?(\"indie\")\n genres[:indie]+=1\n when genre.include?(\"hip\")\n genres[\"hip hop\"]+=1\n when genre.include?(\"rock\")\n genres[:rock]+=1\n when genre.include?(\"jazz\")\n genres[:jazz]+=1\n when genre.include?(\"instrumental\")\n genres[:instrumental]+=1\n when genre.include?(\"r&b\")\n genres[\"r&b\"]+=1\n else\n genres[:misc] +=1\n end\n end\n genres\n end", "def call\n uids = dataset ? grouped_uids_dataset : grouped_uids_corpus\n uids_to_term_counts(uids)\n end", "def track term\n @term = term\n if @term\n send_request @term\n end\n end", "def terms\n\n end", "def terms\n\n end", "def counts\n reply.documents[0][COUNTS]\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 search_count_post(type, opts = {})\n data, _status_code, _headers = search_count_post_with_http_info(type, opts)\n return data\n end", "def alltags\n tag_context = params[:context] # tag context\n @tags = TagsService.tag_counts_on(SurveyRespondent, tag_context)\n \n respond_to do |format|\n format.xml\n end\n end", "def term_frequency(document, term)\n tf = document.term_count(term)\n if @function == :bm25\n (tf * 2.2) / (tf + 0.3 + 0.9 * documents.size / @model.average_document_size)\n else\n sqrt(tf)\n end\n end", "def index\n @term_item_terms = TermItemTerm.all\n end", "def document_counts\n @document_count ||= solr_response.facet_queries.each_with_object({}) do |(k, v), h|\n h[k.split(/:/).first] = v\n end\n end", "def create_taxonomy(rid, add_params = nil)\n params = {\n uid: uid,\n rid: rid,\n }\n api_call('/stores/:uid/taxonomies/:rid(.:format)',:post,params,add_params)\n end", "def index\n @terms = Term.all\n end", "def terms\n end", "def renumber_terms(doc)\n logger.info(\"Renumbering terms\")\n\n doc.xpath('//a:term', a: NS).each_with_index do |term, i|\n term['id'] = \"trm#{i}\"\n end\n end", "def total_terms\n return original_query_offset if normalized_page == 0\n (hits_requested * normalized_page) + original_query_offset\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 term_frequency(document, term)\n tf = document.term_count(term)\n sqrt(tf)\n end", "def terms\n\tend", "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 save_tweets_for(term)\n @client.search(term).each do |tweet|\n @tweets_found += 1\n tweet_doc = tweet.to_h\n tweet_doc[:tags] = term\n tweet_doc[:_id] = tweet_doc[:id]\n @tweets.insert_one(tweet_doc)\n end\n end", "def index_info(params={})\n params[:numTerms]||=0\n send_request @opts[:luke_path], params\n end", "def index\n @tags = Contact.tag_counts_on(:tags)\n\tend", "def <<(term)\n raise \"No document defined\" unless defined? @document\n unless @terms.include? term\n @terms[term] = @terms.length\n end\n i = @terms[term]\n @index[@document] ||= 0\n @index[@document] |= 1 << i\n end", "def count\n @params[:rettype] = 'count'\n self\n end", "def termfreq_query(ocr_search_terms)\n search_terms = if ocr_search_terms.match?(/\\A\"[\\s\\S]*\"\\z/) # phrase search\n [ocr_search_terms.delete('\"')]\n else\n ocr_search_terms.delete('\"').split(' ')\n end\n if search_terms.length == 1\n \"term_freq:termfreq(#{blacklight_config.ocr_search_field},\\\"#{search_terms.first}\\\")\"\n else\n termfreq_array = search_terms.map { |v| \"termfreq(#{blacklight_config.ocr_search_field},\\\"#{v}\\\")\" }\n \"term_freq:sum(#{termfreq_array.join(',')})\"\n end\n end", "def get_tag_count_on_word(word, *args)\n http_method = :get\n path = '/word/{word}/tagCount'\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 counter_params\n params.require(:counter).permit(:count, :crawler_id)\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 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 posts_count_by_tag(tags)\n tags = clean_tags(tags)\n if self.class::OLD_API\n do_request('post/index.xml', { tags: tags, limit: 1 }, :get, nil, :xml).root['count'].to_i\n else\n do_request('counts/posts.json', tags: tags)['counts']['posts']\n end\n end", "def tags\n @tags = User.tag_counts_on(:tags, :conditions => \"name LIKE '\" + (params[:query] || \"\") + \"%'\").limit(50).order('count desc')\n respond_to do |format|\n format.html # tags.html.erb\n format.json { render json: @tags }\n format.xml { render xml: @tags }\n end\n end", "def index\n @search_counts = SearchCount.all\n end", "def tags_with_counts\n counts = Hash.new(0)\n Tag.all(:id => taggings, :select => 'word').collect(&:word).each{|val|counts[val]+=1}\n counts.sort{|a,b| a[1] <=> b[1]}.reverse\n end", "def tfreq word, labellist\n @tfreq=0\n labellist.each do |doc|\n @tfreq+=doc[word] if doc.has_key?(word)\n end\n @tfreq\nend", "def popular_terms(query, fields, count=10)\n raise \"The class #{self.class.name} must implement the 'popular_terms' method.\"\n end", "def get_tweet_counts_per_frequency(freq, tweet_name, start_time, end_time)\n \n end", "def search_terms=(value)\n @search_terms = value\n end", "def count_tokens()\n @counts = Hash.new(0)\n @tokens.each do |token|\n @counts[token] += 1\n end\n @counts\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 @transaction_term = TransactionTerm.new(params[:transaction_term])\n\n respond_to do |format|\n if @transaction_term.save\n format.html { redirect_to(@transaction_term, :notice => 'Transaction terms was successfully created.') }\n format.xml { render :xml => @transaction_term, :status => :created, :location => @transaction_term }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction_term.errors, :status => :unprocessable_entity }\n end\n end\n end", "def terms\n @term_hash.values\n end", "def search_terms(slug)\n options = {\n slug: slug,\n transaction: \"search-terms\",\n group_by: \"searchKeyword\",\n collect: \"searchUniques:sum\",\n }\n statistics(options)\n end", "def create\n \n @tweet = Tweet.new(params[:tweet])\n \n # write stats\n @keywords.each do |word|\n \n if @tweet.text.downcase.include? word then\n \n stat = WordStatistic.where(:word => word, :day => DateTime.now.beginning_of_day..DateTime.now).first\n if stat.nil? then\n new_stat = WordStatistic.new(:word => word, :day => DateTime.now, :freq => 1)\n new_stat.save\n else\n \n stat.freq += 1\n stat.save\n end\n end\n end # keywords\n\n respond_to do |format|\n if @tweet.save\n format.json { render :json => @tweet, :notice => 'Tweet was successfully created.' }\n format.xml { render :xml => @tweet, :status => :created, :location => @tweet }\n else\n format.xml { render :xml => @tweet.errors, :status => :unprocessable_entity }\n end\n end\n end", "def search_count_params\n params.require(:search_count).permit(:counter)\n end", "def index\n @vocabulary_terms = VocabularyTerm.order(:label)\n end", "def frequency\n counts = Hash.new(0)\n self.words.each { |word| counts[word] += 1 }\n counts\n end", "def offense_counts; end", "def offense_counts; 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 count_frequency(word_list)\n\tcounts = Hash.new(0)\n\tfor word in word_list\n\t\tcounts[word] += 1\n\tend\n\tcounts\nend", "def set_counts\n @category_counts = {}\n @category_counts.default = 0\n @lines.map do |line|\n category = line.split[0]\n @category_counts[category] += 1\n end\n end", "def create\n \t\t@searchterm = current_user.searches.create(:search_term=>params[:searchterm],:type=>\"question\")\n \tend", "def get_lookup_count(word, *args)\n http_method = :get\n path = '/word/{word}/lookupCount'\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 @searchterms = Searchterm.all\n end", "def term_params\n params.require(:term).permit(:name)\n end", "def document_frequency\n @corpus.each_with_object({}) do |doc, df|\n doc.bag_of_words.keys.each do |word|\n df[word] = (df.fetch(word) { 0.0 }) + 1.0\n end\n end\n end", "def count; info['doc_count']; end", "def word_frequency(params={})\n # Set default options\n options = {\n tweets: [@statuses_count, 1000].min,\n include_rts: true,\n exclude_replies: true\n }\n\n # Combine the options the user has set\n options.merge!(params)\n\n result = {}\n\n # Get the tweets which will be in @timeline\n get_timeline(options[:tweets])\n\n # Go through each tweet in the timeline and match words only\n # [key] word => [value] number of times it is used\n @timeline.each do |tweet|\n tweet.text.split.each do |t|\n\n # Some matches come out as null so skip if they are nil\n word = t.downcase.match(/\\w(?<!\\d)[\\w'-]*/)\n next unless word\n word = word[0]\n\n # Check if word has been added to the result, increment count\n if result.has_key?(word)\n result[word] += 1\n else\n result[word] = 1\n end\n end\n end\n\n result = result.sort_by { |key, value| value }.reverse\n print_word_frequency(result)\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 ri_counts(*args)\n resources, opts = ri_opts(args)\n counts = {}\n threads = []\n resources.each do |res|\n next unless res.populated?\n threads << Thread.new do\n counts[res.acronym] = res.concept_count(self.xxhash, opts)\n end\n end\n threads.each(&:join)\n counts\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 update_tag_count(tenant_id,tags)\n @instance_counter.update_tag_count(tenant_id,tags)\n end", "def count_frequency(word_list)\n counts = Hash.new(0)\n for word in word_list\n counts[word] += 1\n end\n counts\nend", "def 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 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 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 delete_term(params)\n send_get \"delete_term\", params\n end", "def index\n #@registrations = Registration.where(batches_id: @batch.id, terms_id:@term.id)\n @terms = Term.all\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" ]
[ "0.6594808", "0.6192454", "0.6025294", "0.6024979", "0.601109", "0.5878424", "0.58438814", "0.58272964", "0.58189905", "0.57945263", "0.57408464", "0.57081825", "0.5697413", "0.5660348", "0.56443745", "0.56002575", "0.55988723", "0.5592685", "0.55294317", "0.5498483", "0.5489211", "0.54793406", "0.5456294", "0.543878", "0.5436595", "0.5432554", "0.5421608", "0.5364205", "0.5338182", "0.53322214", "0.53207684", "0.53167707", "0.5302118", "0.5302118", "0.53012156", "0.5297928", "0.525972", "0.52594787", "0.52511173", "0.52291316", "0.5224643", "0.5217631", "0.5198599", "0.51933885", "0.5188297", "0.5175934", "0.51430345", "0.51328266", "0.51294345", "0.51195484", "0.51186097", "0.5116871", "0.51072645", "0.5106743", "0.5096281", "0.5095287", "0.50745606", "0.5073266", "0.5072616", "0.50672287", "0.5066333", "0.5063642", "0.5062072", "0.5054574", "0.50453055", "0.5040714", "0.503805", "0.50319237", "0.5029621", "0.50273275", "0.5018698", "0.50171876", "0.5012248", "0.50086206", "0.50037867", "0.49963754", "0.49941796", "0.4990317", "0.4990317", "0.49902043", "0.49804524", "0.49767578", "0.49719113", "0.49658847", "0.49631765", "0.49606714", "0.4956754", "0.49512187", "0.49489313", "0.4946585", "0.49447465", "0.49431705", "0.49415487", "0.4935106", "0.49293453", "0.49257115", "0.49232063", "0.4922666", "0.4917633", "0.49172458" ]
0.66856563
0
PUT /term_counts/1 PUT /term_counts/1.xml
def update @term_count = TermCount.find(params[:id]) respond_to do |format| if @term_count.update_attributes(params[:term_count]) flash[:notice] = 'TermCount was successfully updated.' format.html { redirect_to(@term_count) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @term_count.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @term_count = TermCount.find(params[:id])\n\n respond_to do |format|\n if @term_count.update_attributes(params[:term_count])\n format.html { redirect_to @term_count, notice: 'Term count was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @term_count.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 @term.update_attributes(term_params)\n\n render_item @term, :ok\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 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 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_count\n self.term_taxonomies.update_column('count', self.term_taxonomies.posts.published.size) if self.term_taxonomies.present? && !self.term_taxonomies.try(:posts).nil?\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 @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 create\n @term_count = TermCount.new(params[:term_count])\n\n respond_to do |format|\n if @term_count.save\n flash[:notice] = 'TermCount was successfully created.'\n format.html { redirect_to(@term_count) }\n format.xml { render :xml => @term_count, :status => :created, :location => @term_count }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @term_count.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @term_count = TermCount.new(params[:term_count])\n\n respond_to do |format|\n if @term_count.save\n format.html { redirect_to @term_count, notice: 'Term count was successfully created.' }\n format.json { render json: @term_count, status: :created, location: @term_count }\n else\n format.html { render action: \"new\" }\n format.json { render json: @term_count.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @term_count = TermCount.find(params[:id])\n @term_count.destroy\n\n respond_to do |format|\n format.html { redirect_to(term_counts_url) }\n format.xml { head :ok }\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 destroy\n @term_count = TermCount.find(params[:id])\n @term_count.destroy\n\n respond_to do |format|\n format.html { redirect_to term_counts_url }\n format.json { head :no_content }\n end\n end", "def set_term\n @term = Term.find(params[:id])\n end", "def accumulate term, docid, frequency, index\n @doc_count += 1\n @tot_freq += frequency.to_i\n end", "def <<(term)\n raise \"No document defined\" unless defined? @document\n unless @terms.include? term\n @terms[term] = @terms.length\n end\n i = @terms[term]\n @index[@document] ||= 0\n @index[@document] |= 1 << i\n end", "def set_term\n @term = Term.find(params[:id])\n end", "def set_term\n @term = Term.find(params[:id])\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.xml { render :xml => @term_count }\n end\n end", "def renumber_terms(doc)\n logger.info(\"Renumbering terms\")\n\n doc.xpath('//a:term', a: NS).each_with_index do |term, i|\n term['id'] = \"trm#{i}\"\n end\n end", "def get_document_frequency(term)\n\t\t\t@term_hash[term]\n\t\tend", "def update_count(doctype,count)\n verify_doctype(doctype)\n Store.get_store(store_index(doctype)).update_count(docname(doctype), count)\n end", "def update\n respond_to do |format|\n if @vocabulary_term.update(vocabulary_term_params)\n format.html { redirect_to @vocabulary_term, notice: 'Vocabulary term was successfully updated.' }\n format.json { render :show, status: :ok, location: @vocabulary_term }\n else\n format.html { render :edit }\n format.json { render json: @vocabulary_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 update\n @term.update!(term_params)\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 updated\",\n message: \"The vocabulary term \\\"#{@term.displayed_value}\\\" has \"\\\n \"been updated.\")\n render \"shared/reload\"\n end", "def update\n @sales_term = SalesTerm.find(params[:id])\n\n respond_to do |format|\n if @sales_term.update_attributes(params[:sales_term])\n format.html { redirect_to @sales_term, notice: 'Sales term was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_term.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @term_count = TermCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term_count }\n end\n end", "def update\n @taxonomy_term = TaxonomyTerm.find(params[:id])\n\n respond_to do |format|\n if @taxonomy_term.update_attributes(params[:taxonomy_term])\n format.html { redirect_to admin_taxonomy_terms_path , notice: 'Taxonomy term was successfully updated.' }\n format.json { head :no_content }\n else\n \tset_site_entities @taxonomy_term\n format.html { render action: \"edit\" }\n format.json { render json: @taxonomy_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 increment_matrix_counts\n ObservationMatrixRowItem::Dynamic::Tag.where(observation_object_type: 'ControlledVocabularyTerm', observation_object_id: keyword_id).each do |mri|\n mri.update_single_matrix_row(tag_object)\n end\n end", "def new\n @term_count = TermCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @term_count }\n end\n end", "def update_tag_count(tenant_id,tags)\n @instance_counter.update_tag_count(tenant_id,tags)\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 update\n @search_term = SearchTerm.find(params[:id])\n\n respond_to do |format|\n if @search_term.update_attributes(params[:search_term])\n format.html { redirect_to(@search_term, :notice => 'SearchTerm was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @search_term.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @term_item_term.update(term_item_term_params)\n format.html { redirect_to @term_item_term, notice: 'Term item term was successfully updated.' }\n format.json { render :show, status: :ok, location: @term_item_term }\n else\n format.html { render :edit }\n format.json { render json: @term_item_term.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_tweets_for(term)\n @client.search(term).each do |tweet|\n @tweets_found += 1\n tweet_doc = tweet.to_h\n tweet_doc[:tags] = term\n tweet_doc[:_id] = tweet_doc[:id]\n @tweets.insert_one(tweet_doc)\n end\n end", "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 update\n @transaction_term = TransactionTerm.find(params[:id])\n\n respond_to do |format|\n if @transaction_term.update_attributes(params[:transaction_term])\n format.html { redirect_to(@transaction_term, :notice => 'Transaction terms was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction_term.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @word_count = WordCount.find(params[:id])\n\n respond_to do |format|\n if @word_count.update_attributes(params[:word_count])\n format.html { redirect_to @word_count, notice: 'Word count was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @word_count.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 set_vocabulary_term\n @vocabulary_term = VocabularyTerm.find(params[: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(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 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 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 update\n @seo_search_term = Seo::SearchTerm.find(params[:id])\n\n respond_to do |format|\n if @seo_search_term.update_attributes(params[:seo_search_term])\n flash[:notice] = 'Seo::SearchTerm was successfully updated.'\n format.html { redirect_to seo_search_terms_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @seo_search_term.errors, :status => :unprocessable_entity }\n end\n end\n end", "def track term\n @term = term\n if @term\n send_request @term\n end\n end", "def index_info(params={})\n params[:numTerms]||=0\n send_request @opts[:luke_path], params\n end", "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 set_frequency_vocabulary\n @frequency_vocabulary = FrequencyVocabulary.find(params[:id])\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 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 @corpus = Corpus.find(params[:id])\n saved = @corpus.update_attributes(params[:corpus])\n\n @corpus.compile_histogram if saved\n\n respond_to do |format|\n if saved\n format.html { redirect_to @corpus, notice: 'Corpus was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @corpus.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @shards_count = args[:shards_count] if args.key?(:shards_count)\n @vectors_count = args[:vectors_count] if args.key?(:vectors_count)\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!(**args)\n @counts = args[:counts] if args.key?(:counts)\n @instances = args[:instances] if args.key?(:instances)\n end", "def increment(counts)\n counts.keys.each do |word|\n @counts[word] += counts[word]\n end\n end", "def update\n respond_to do |format|\n if @searchterm.update(searchterm_params)\n format.html { redirect_to @searchterm, notice: 'Searchterm was successfully updated.' }\n format.json { render :show, status: :ok, location: @searchterm }\n else\n format.html { render :edit }\n format.json { render json: @searchterm.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @frequency_vocabulary.update(frequency_vocabulary_params)\n format.html { redirect_to @frequency_vocabulary, notice: 'Frequency vocabulary was successfully updated.' }\n format.json { render :show, status: :ok, location: @frequency_vocabulary }\n else\n format.html { render :edit }\n format.json { render json: @frequency_vocabulary.errors, status: :unprocessable_entity }\n end\n end\n end", "def term_map\n\t\t\tterm_set = Hash.new(0)\n\t\t\tself.to_terms.each do |term|\n\t\t\t\tterm_set[term] = term_set[term] + 1\n\t\t\tend\n\t\t\tterm_set\n\t\tend", "def update\n @taxonomy = Taxonomy.find(params[:id])\n\n respond_to do |format|\n if @taxonomy.update_attributes(params[:taxonomy])\n format.html { redirect_to edit_admin_taxonomy_path(@taxonomy), notice: 'Taxonomy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :action => 'edit', alert: 'Updating taxonomy was failed.' }\n format.json { render json: @taxonomy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @read = Read.find(params[:id])\n @read.word_count = countWords(@read.reading);\n \n respond_to do |format|\n if @read.update_attributes(params[:read])\n format.html { redirect_to(@read, :notice => 'Read was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @read.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_count(gram,value)\n @dirty = true\n @frequencies[gram] = value\n end", "def update_category_counter\r\n end", "def update\n @frequent_set = FrequentSet.find(params[:id])\n\n respond_to do |format|\n if @frequent_set.update_attributes(params[:frequent_set])\n format.html { redirect_to @frequent_set, notice: 'Frequent set was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @frequent_set.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_total_dump_count(namespace, count)\n @coll.update({ SolrConfigConst::SOLR_URL_KEY => @solr_loc,\n SolrConfigConst::NS_KEY => namespace\n },\n { \"$set\" => { SolrConfigConst::TOTAL_TO_DUMP_KEY => count }})\n end", "def update\n respond_to do |format|\n if @neglected_term.update(neglected_term_params)\n format.html { redirect_to @neglected_term, notice: 'Neglected term was successfully updated.' }\n format.json { render :show, status: :ok, location: @neglected_term }\n else\n format.html { render :edit }\n format.json { render json: @neglected_term.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end", "def update\n respond_to do |format|\n if @luxire_taxonomy.update(luxire_taxonomy_params)\n format.html { redirect_to @luxire_taxonomy, notice: 'Luxire taxonomy was successfully updated.' }\n format.json { render :show, status: :ok, location: @luxire_taxonomy }\n else\n format.html { render :edit }\n format.json { render json: @luxire_taxonomy.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 calculate_term_frequencies\n results = []\n \n @data.each do |document|\n document_result = {}\n \n document.each do |term|\n if document_result.key?(term)\n document_result[term] += 1.0\n else\n document_result[term] = 1.0\n end\n end\n \n # Normalize the count\n document_result.each_key do |term|\n document_result[term] /= document.size\n end\n \n results << document_result\n end\n \n results\n end", "def update_frequencies(doc_vector)\n\n # Setup the frequencies array\n @frequencies = DocVector.new(doc_vector.length, 0) if @frequencies.length == 0\n\n present_items = doc_vector.get_present_items(false)\n\n present_items.each do |freqitem|\n # For each present item, update the frequencies by one.\n # Even though an item appears 10 times in a doc, it is counted as 1.\n @frequencies[freqitem.freq_item_id] += 1\n end\n end", "def update!(**args)\n @count = args[:count] if args.key?(:count)\n @language = args[:language] if args.key?(:language)\n @score = args[:score] if args.key?(:score)\n @term = args[:term] if args.key?(:term)\n @type = args[:type] if args.key?(:type)\n end", "def increment_word_counts_for_category(category, word_occurrences)\n word_occurrences.each do|word,count|\n @redis.pipelined do\n @redis.hincrby base_category_key + category, word, count\n @redis.incrby sum_key(category), count\n end \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 updateservercount(count)\n url = \"https://discordbots.org/api/bots/#{@id}/stats\"\n json = '{\"server_count\":' + count.to_s + '}'\n RestClient.post(url, json, :Authorization => @api, :'Content-Type' => :json)\n \"Successfully set the server count to #{count}\"\n end", "def uids_to_term_counts(uids)\n ret = {}\n total = uids.size\n\n uids.each_with_index do |(key, arr), i|\n ret[key] = 0\n\n arr.each do |uid|\n doc = Document.find(uid, term_vectors: true)\n vec = doc.term_vectors[@term]\n\n ret[key] += vec[:tf] if vec\n end\n\n progress&.call(50 + (i.to_f / total.to_f * 50.0).to_i)\n end\n\n progress&.call(100)\n\n zero_intervening(ret)\n end", "def set_term_item_term\n @term_item_term = TermItemTerm.find(params[:id])\n end", "def count( args={} )\n args.merge!({ :count => \"1\" })\n result = request( :method => 'post', :url => @url, :query => generate_xml(args) )\n return result.to_i\n end", "def update\n respond_to do |format|\n if @indicate_taxonomy.update(indicate_taxonomy_params)\n format.html { redirect_to @indicate_taxonomy, notice: 'Taxonomy was successfully updated.' }\n format.json { render :show, status: :ok, location: @indicate_taxonomy }\n else\n format.html { render :edit }\n format.json { render json: @indicate_taxonomy.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_term\n @term = UriService.client.find_term_by_internal_id(params[:id])\n raise ActionController::RoutingError, \"Could not find Term with internal_id: #{params[:id]}\" if @term.nil?\n end", "def update_associated_count\n self.update_tier_kases_count\n self.update_topics_kases_count\n self.update_person_kases_count\n end", "def update_terms(old_terms, new_terms)\n delete_terms(*(old_terms - new_terms))\n add_terms(*(new_terms - old_terms))\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 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 set_term\n @term = Term.find(params[:id])\n raise ActiveRecord::RecordNotFound unless @term.user_id == session[:user_id]\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 term_frequency(document, term)\n tf = document.term_count(term)\n if @function == :bm25\n (tf * 2.2) / (tf + 0.3 + 0.9 * documents.size / @model.average_document_size)\n else\n sqrt(tf)\n end\n end", "def update!(**args)\n @taxonomies = args[:taxonomies] if args.key?(:taxonomies)\n end", "def update!(**args)\n @taxonomies = args[:taxonomies] if args.key?(:taxonomies)\n end", "def update!(**args)\n @taxonomies = args[:taxonomies] if args.key?(:taxonomies)\n end", "def index\n @terms = Term.all\n end", "def update!(**args)\n @count = args[:count] if args.key?(:count)\n @indexed_items_count = args[:indexed_items_count] if args.key?(:indexed_items_count)\n @status_code = args[:status_code] if args.key?(:status_code)\n end", "def destroy\n @term.destroy!\n\n head :ok\n end", "def add_terms(params)\n send_get \"add_terms\", params\n end", "def index\n @term_item_terms = TermItemTerm.all\n end", "def update\n logger.debug(\"Update of #{params[:id]}\")\n use_count = application_user.use_counters.find_or_create_by_name(params[:name])\n use_count.count = params[:count].to_i\n if use_count.save\n render :json => 'done'\n else\n render :json => 'failed', :status => 500\n end\n end" ]
[ "0.69729066", "0.6414061", "0.6399268", "0.6270709", "0.62558436", "0.62392956", "0.61575913", "0.6156369", "0.6155693", "0.61327827", "0.60665816", "0.60652447", "0.6032292", "0.59789103", "0.5946453", "0.5768371", "0.57486767", "0.57068497", "0.57019806", "0.57019806", "0.56722736", "0.5651229", "0.5621435", "0.5619871", "0.56197405", "0.5605299", "0.5599708", "0.5571763", "0.55603117", "0.55568546", "0.55336314", "0.5527318", "0.5494205", "0.5483931", "0.54713506", "0.5469873", "0.54423887", "0.54355824", "0.5428786", "0.54268885", "0.5413935", "0.5400357", "0.5371852", "0.5370621", "0.5370621", "0.53649485", "0.53571975", "0.5343394", "0.5341198", "0.5330054", "0.5329603", "0.5306479", "0.5295834", "0.5286236", "0.52858436", "0.52700937", "0.52654904", "0.52349734", "0.5220626", "0.52053124", "0.51989496", "0.5195742", "0.51887566", "0.5187847", "0.5173219", "0.51672447", "0.5134672", "0.51303065", "0.51272315", "0.5114918", "0.5099441", "0.50986695", "0.5094492", "0.509051", "0.5087553", "0.50774556", "0.50749904", "0.50737774", "0.50675625", "0.5053118", "0.5046159", "0.50377196", "0.5035836", "0.5033933", "0.50320154", "0.50297683", "0.5019716", "0.5018572", "0.5013975", "0.5012628", "0.5010074", "0.50078124", "0.5005811", "0.5005811", "0.50026864", "0.5002145", "0.4990082", "0.4986771", "0.49821556", "0.49755836" ]
0.7043425
0
DELETE /term_counts/1 DELETE /term_counts/1.xml
def destroy @term_count = TermCount.find(params[:id]) @term_count.destroy respond_to do |format| format.html { redirect_to(term_counts_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @term_count = TermCount.find(params[:id])\n @term_count.destroy\n\n respond_to do |format|\n format.html { redirect_to term_counts_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 @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 destroy\n @term.destroy!\n\n head :ok\n end", "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\n @transaction_term = TransactionTerm.find(params[:id])\n @transaction_term.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_terms_index_url) }\n format.xml { head :ok }\n end\n end", "def delete_doc_with_unique_term(term)\n writer.delete_document(\"Q#{term}\")\n true\n end", "def delete_term(params)\n send_get \"delete_term\", params\n end", "def destroy\n @search_term = SearchTerm.find(params[:id])\n @search_term.destroy\n\n respond_to do |format|\n format.html { redirect_to(search_terms_url) }\n format.xml { head :ok }\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 @tax.destroy\n\n head :no_content\n end", "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 @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 delete_terms_in_domain(domain)\n before = query(\"MATCH (term:Term) WHERE term.uri =~ '#{domain}.*' RETURN COUNT(term)\")[\"data\"].first.first\n query(\"MATCH (term:Term) WHERE term.uri =~ '#{domain}.*' DETACH DELETE term\")\n after = query(\"MATCH (term:Term) WHERE term.uri =~ '#{domain}.*' RETURN COUNT(term)\")[\"data\"].first.first\n raise \"Not all were deleted (before: #{before}, after: #{after})\" if after.positive?\n before\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def destroy\n @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 @seo_search_term = Seo::SearchTerm.find(params[:id])\n @seo_search_term.destroy\n\n flash[:notice] = 'Seo::SearchTerm was successfully destroyed.'\n respond_to do |format|\n format.html { redirect_to(seo_search_terms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @taxonomy = Taxonomy.find(params[:id])\n taxonomy_type = @taxonomy.taxonomy_type \n @taxonomy.delete_node_keep_sub_nodes\n @taxonomy.reload\n @taxonomy.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_taxonomies_url(:taxonomy_type => taxonomy_type) }\n format.json { head :no_content }\n end\n end", "def destroy\n @sales_term = SalesTerm.find(params[:id])\n @sales_term.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_terms_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 @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 destroy\n @taxonomy_category = TaxonomyCategory.find(params[:id])\n @taxonomy_category.destroy\n\n respond_to do |format|\n format.html { redirect_to taxonomy_categories_url }\n format.json { head :ok }\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 @taxband = Taxband.find(params[:id])\n @taxband.destroy\n\n respond_to do |format|\n format.html { redirect_to(taxbands_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @word_count = WordCount.find(params[:id])\n @word_count.destroy\n\n respond_to do |format|\n format.html { redirect_to word_counts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @term_item_term.destroy\n respond_to do |format|\n format.html { redirect_to term_item_terms_url, notice: 'Term item term was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def unindex(obj)\n XapianDb.database.delete_doc_with_unique_term(obj.xapian_id)\n XapianDb.database.commit\n end", "def destroy\n @luxire_taxonomy.destroy\n respond_to do |format|\n format.html { redirect_to luxire_taxonomies_url, notice: 'Luxire taxonomy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tax_computation = TaxComputation.find(params[:id])\n @tax_computation.destroy\n\n respond_to do |format|\n format.html { redirect_to(tax_computations_url) }\n format.xml { head :ok }\n end\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 delete\n blacklight_items.each do |r|\n solr.delete_by_id r[\"id\"]\n solr.commit\n end\n end", "def destroy\n @document_term_matrix = DocumentTermMatrix.find(params[:id])\n @document_term_matrix.destroy\n\n respond_to do |format|\n format.html { redirect_to document_term_matrices_url }\n format.json { head :no_content }\n end\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 @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 @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 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 @shipping_term = ShippingTerm.find(params[:id])\n @shipping_term.destroy\n\n respond_to do |format|\n format.html { redirect_to(shipping_terms_url) }\n format.xml { head :ok }\n end\n end", "def remove\n valid = parse_valid(params)\n # puts valid\n choose = $db.search(\"//book[\"+valid+\"]\").remove\n size = 0\n for i in choose\n size += 1\n end\n $file = open PATH, \"w\"\n $file.write $db\n $file.close\n render :soap => \"<result>\"+size.to_s+\"</result>\"\n end", "def destroy\n @tax_rate = TaxRate.find(params[:id])\n @tax_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to(tax_rates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete_all(xpath); end", "def destroy\n @occurence = Occurence.find(params[:id])\n @occurence.destroy\n\n respond_to do |format|\n format.html { redirect_to(occurences_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @gene_ontology = GeneOntology.find(params[:id])\n @gene_ontology.destroy\n\n respond_to do |format|\n format.html { redirect_to(gene_ontologies_url) }\n format.xml { head :ok }\n end\n end", "def delete_all\n solr.delete_by_query('*:*')\n solr.commit\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 destroy\n @taxe_value = Taxe::Value.find(params[:id])\n @taxe_value.destroy\n\n respond_to do |format|\n format.html { redirect_to(taxe_values_url) }\n format.xml { head :ok }\n end\n end", "def delete(path)\n exec { index.delete(path) }\n end", "def destroy\n @keyword = Keyword.find(params[:id])\n @keyword.destroy\n\n respond_to do |format|\n format.html { redirect_to(keywords_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @keyword = Keyword.find(params[:id])\n @keyword.destroy\n\n respond_to do |format|\n format.html { redirect_to(keywords_url) }\n format.xml { head :ok }\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 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 @frequency_vocabulary.destroy\n respond_to do |format|\n format.html { redirect_to frequency_vocabularies_url, notice: 'Frequency vocabulary was successfully destroyed.' }\n format.json { head :no_content }\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 @kf_status = Kf::Status.find(params[:id])\n @kf_status.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/kf/statuses?page=#{params[:page]}&relation_id=#{params[:relation_id]}&status_type=#{params[:status_type]}&count_type=#{params[:count_type]}\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxon_attribute = TaxonAttribute.find(params[:id])\n @taxon_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to taxon_attributes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @county = County.find(params[:id])\n @county.destroy\n\n respond_to do |format|\n format.html { redirect_to(counties_url) }\n format.xml { head :ok }\n end\n end", "def delete_tax(id)\n @client.raw('delete', \"/ecommerce/taxes/#{id}\")\n end", "def destory_search_term\n \t\tcurrent_user.searches.and({:search_term =>params[:searchterm]},{:type=>\"question\"}).first.destroy\n \tend", "def destroy\n @vocab = Vocab.find(params[:id])\n @vocab.destroy\n\n respond_to do |format|\n format.html { redirect_to(vocabs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tax_type = TaxType.find(params[:id])\n @tax_type.destroy\n\n respond_to do |format|\n format.html { redirect_to tax_types_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 @frequent_set = FrequentSet.find(params[:id])\n @frequent_set.destroy\n\n respond_to do |format|\n format.html { redirect_to frequent_sets_url }\n format.json { head :ok }\n end\n end", "def destroy\n @index = SHDM::Index.find(params[:id])\n @index.destroy\n\n respond_to do |format|\n format.html { redirect_to(indexes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @docent = Docent.find(params[:id])\n @docent.destroy\n\n respond_to do |format|\n format.html { redirect_to(docents_url) }\n format.xml { head :ok }\n end\n end", "def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end", "def destroy\n @keyword = Keyword.find(params[:id])\n @keyword.destroy\n\n respond_to do |format|\n format.html { redirect_to keywords_url }\n format.xml { head :ok }\n end\n end", "def destroy\n authorize_action_for @tax_category, at: current_store\n track @tax_category\n @tax_category.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_tax_categories_path,\n notice: t('.notice', tax_category: @tax_category) }\n format.json { head :no_content }\n end\n end", "def destroy\n @indicate_taxonomy.destroy\n respond_to do |format|\n format.html { redirect_to indicate_taxonomies_url, notice: 'Taxonomy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @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 # find_article\n @taxi.destroy #or @article.destroy?\n redirect_to taxi_path\n end", "def destroy\n @transaction_goods_taxis = Transaction::Goods::Taxe.find(params[:id])\n @transaction_goods_taxis.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_goods_taxes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @twitter_crawler_hash_tag = TwitterCrawlerHashTag.find(params[:id])\n @twitter_crawler_hash_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(twitter_crawler_hash_tags_url) }\n format.xml { 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 :ok }\n end\n end", "def destroy\n @alfresco = Alfresco.find(params[:id])\n @alfresco.destroy\n\n respond_to do |format|\n format.html { redirect_to(alfrescos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @retain_node_selector = RetainNodeSelector.find(params[:id])\n @retain_node_selector.destroy\n\n respond_to do |format|\n format.html { redirect_to(retain_node_selectors_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @taxi = Taxi.find(params[:id])\n @taxi.destroy\n\n respond_to do |format|\n format.html { redirect_to taxis_url }\n format.json { head :ok }\n end\n end", "def 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 delete_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Delete.new(uri)\n run(uri, req)\n end", "def destroy\n @corpus_positive = CorpusPositive.find(params[:id])\n @corpus_positive.destroy\n\n respond_to do |format|\n format.html { redirect_to corpus_positives_url }\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 :no_content }\n end\n end", "def destroy\n @term.destroy!\n rescue => e\n flash['error'] = \"#{e}\"\n else\n toast!(title: \"Term deleted\",\n message: \"The vocabulary term \\\"#{@term.displayed_value}\\\" has \"\\\n \"been deleted.\")\n ensure\n redirect_back fallback_location: @term.vocabulary\n end", "def destroy\n @node_index = NodeIndex.find(params[:id])\n @node_index.destroy\n\n respond_to do |format|\n format.html { redirect_to node_indices_url }\n format.json { head :no_content }\n end\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @frequentmag = Frequentmag.find(params[:id])\n @frequentmag.destroy\n\n respond_to do |format|\n format.html { redirect_to(frequentmags_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @search_phrase = SearchPhrase.find(params[:id])\n @search_phrase.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_search_phrases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n ImagesIndex.delete params[:id]\n respond_to do |format|\n format.html { redirect_to(\"/images_indices\") }\n format.xml { head :ok }\n end\n end", "def destroy\n @prd_threshold = PrdThreshold.find(params[:id])\n @prd_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(prd_thresholds_url) }\n format.xml { head :ok }\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 @index = Indice.find(params[:id])\n @index.destroy\n\n respond_to do |format|\n format.html { redirect_to(indices_url) }\n format.xml { head :ok }\n end\n end", "def deleteEntityDocument( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/document\",params)\n end", "def destroy\n @vocabtype = Vocabtype.find(params[:id])\n @vocabtype.destroy\n\n respond_to do |format|\n format.html { redirect_to(vocabtypes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @high_level_group_term.destroy\n respond_to do |format|\n format.html { redirect_to high_level_group_terms_url, notice: 'High level group term was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @prizecount = Prizecount.find(params[:id])\n @prizecount.destroy\n\n respond_to do |format|\n format.html { redirect_to(prizecounts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @topic_attribute = TopicAttribute.find(params[:id])\n \n @topic_attribute.opinions.each do |opinion|\n opinion.destroy\n end\n \n @topic_attribute.destroy\n\n respond_to do |format|\n format.html { \n redirect_to(root_path)\n #topic_attributes_url\n }\n format.xml { head :ok }\n end\n end", "def do_remove_from_termination (term)\r\n term.aln_path_id = nil\r\n term.aln_path = nil\r\n term.save\r\n end", "def destroy\n @crawl_result = Crawl.find(params[:id])\n @crawl_result.destroy\n\n respond_to do |format|\n format.html { redirect_to(crawl_results_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @document_status = DocumentStatus.find(params[:id])\n @document_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_document_statuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @catalogs_status.destroy\n index\n end" ]
[ "0.71198714", "0.6885946", "0.6883627", "0.6883627", "0.6785037", "0.6728722", "0.66893494", "0.665326", "0.664966", "0.6646468", "0.65508735", "0.639998", "0.6351535", "0.62913245", "0.62871677", "0.62644607", "0.62591547", "0.6256864", "0.6248882", "0.6244227", "0.6222459", "0.6198133", "0.61710244", "0.61662525", "0.6166225", "0.612972", "0.6128622", "0.61242104", "0.6108004", "0.6101582", "0.60902953", "0.6068536", "0.60547113", "0.60461414", "0.6045549", "0.6035312", "0.6033236", "0.60292286", "0.6025516", "0.6025236", "0.60154873", "0.6002356", "0.59939295", "0.59899926", "0.59868467", "0.5984571", "0.59742707", "0.59601563", "0.5939072", "0.5939072", "0.59374005", "0.5930562", "0.5924589", "0.58907765", "0.5878705", "0.5877432", "0.5870941", "0.58609927", "0.58502656", "0.58496577", "0.58480537", "0.584777", "0.5845759", "0.583753", "0.58366126", "0.5831214", "0.58303297", "0.58302695", "0.5827541", "0.5822331", "0.58164185", "0.58135307", "0.5812442", "0.581179", "0.580571", "0.58056", "0.58003753", "0.57979596", "0.5795245", "0.5793022", "0.57921493", "0.57867444", "0.5785091", "0.5778656", "0.5774164", "0.5769909", "0.5766124", "0.57610404", "0.57568115", "0.57507545", "0.57466775", "0.57390773", "0.57372737", "0.5736796", "0.57354975", "0.5733828", "0.5733824", "0.5730447", "0.5729354", "0.57280207" ]
0.7470937
0
Add a new tab interface backed by source.
def add_tab(host) @tabs.active.hide if tab hv = HostView.new( self, :host => host, :top => 1, :height => Curses.lines - 1 ) hv.on_state_change do |state| @tabs.render end @tabs << hv tab.show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_tab(*args)\n tabs << args\n end", "def add_tab(options = {}, &block)\n id = @tab_options[:id] ? (@tab_options[:id].to_s + \"_\" + (@tabs.size + 1).to_s) : nil\n \n tab = Tab.new({ :id => id, \n :class => @tab_options[:class]\n }.merge(options))\n @tabs << tab\n block.call(tab)\n tab\n end", "def <<\n super\n update_tabs\n end", "def add_tab text, component = nil, aconfig={}, &block\n index = @tabs.size\n tab = insert_tab text, component, index, aconfig, &block\n return tab\n end", "def new_tab(name, klass = RoomPane)\n # Don't do anything if we already have this tab\n @channels.each { |cname,_| return nil if cname == name }\n\n # Add the visual indication of this tab\n @tab_names << FXTabItem.new(@tabs, name, nil)\n empty = FXPacker.new(@tabs)\n empty.padBottom = empty.padTop = empty.padLeft = empty.padRight = 0\n @empties << empty\n\n # Create the content of this channel - probably a RoomPane\n new_channel = klass.new(@switcher, @skin)\n @channels << [ name, new_channel ]\n new_channel.create\n new_channel.on_line(&@on_line_block) # register our callback function\n\n # Show the tabs (if so desired) now that we know we have more than one.\n (@tabs.create ; @tabs.show) if @skin[:show_tabs]\n end", "def create_tabs\n end", "def add_tab\n if params[:tab]\n @tab = Tab.new(params[:tab])\n @tab.share_type = 1\n flash[:notice]= @tab.save ? \"Tab created successfully.\" : \"Tab not created.\"\n redirect_to \"/users/profile/#{@login_user.id}\"\n end\n end", "def insert_tab text, component, index, aconfig={}, &block\n $log.debug \" TAB insert #{text} at #{index} \"\n @tabs[index] = Tab.new(text, self, aconfig, &block)\n tab = @tabs[index]\n tab.component = component unless component.nil?\n tab.index = index # so i can undelete !!!\n fire_event tab, index, :INSERT\n @recreate_buttons = true\n return tab\n end", "def add_tab text, component = nil, aconfig={}, &block\n @tp ||= tabbed_pane\n t = @tp.add_tab text, component, aconfig #, &block # NOTE, not passing block there\n if block_given?\n yield @tp.form(t) \n end\n return t\n end", "def add_admin_tab(*args)\n admin_tabs << args\n end", "def addTab(tName, opts = {}, &initProc)\n MObject.warn('addTab', 'Feature to define graph in experiment script has been disabled')\n end", "def create_workspace_and_options_tabs()\n new_notebook = Wx::Notebook.new(self)\n\n @ws_tab = Wx::Panel.new(new_notebook) # Add workspace tab\n @ws_mvsizer = Wx::BoxSizer.new(Wx::VERTICAL)\n @ws_tab.set_sizer(@ws_mvsizer)\n\n @options_tab = Wx::Panel.new(new_notebook) # Add options tab\n @options_mvsizer = Wx::BoxSizer.new(Wx::VERTICAL)\n @options_tab.set_sizer(@options_mvsizer)\n\n\n new_notebook.add_page(@ws_tab , \"Workspace\")\n new_notebook.add_page(@options_tab , \"Options\")\n evt_notebook_page_changing(new_notebook.get_id()) {|event| on_changing_page(event) }\n end", "def switch_to_tab(name)\n raise(\"Method not implemented for this class: #{@klass}\")\n end", "def insert_before\n super\n update_tabs\n end", "def feed_tabs_panel\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"/tabs/\"), __method__)\n end", "def tab(title, options={}, &block)\n options[:id] = \"tab-#{rand.to_s.split('.').last}\" if options[:id].nil?\n options[:title] = title\n options[:content] = block_given? ? capture(&block) : nil\n @tabinfo[tab_depth][:tabs] << options\n nil\n end", "def add(interface_name)\n model.add(interface_name)\n end", "def switch_tab(tab, title)\n append_to_script \"switch_tab \\\"#{tab}\\\" , \\\"#{title}\\\"\"\n end", "def set_cur_tab\n end", "def tabs=(value)\n @tabs = value\n end", "def createNewInstance(controller, editable)\n AuditTab.new(@callbacks, editable)\n end", "def set_selected_tab\n end", "def set_tab(name, namespace = nil)\n tab_stack[namespace || :default] = name\n end", "def tab a_tab\n content_for :tab, a_tab\n end", "def inherited(source)\n self.sources << source\n end", "def prepare_project_tabs(selected)\n nav_bar(:tabs) do |nb|\n nb.nav_item :overview, project_path(@project)\n nb.nav_item :budget, budget_project_path(@project)\n nb.nav_item :history, history_project_path(@project)\n nb.nav_item :edit, edit_project_path(@project)\n nb.current = selected\n end\n end", "def add_current_tab\n if params[:current_tab]\n site = Tab.find(params[:current_tab][:tab_id])\n site.add_bulk_sites(params[:current_tab][:site_url])\n flash[:notice]=\"Site urls added successfully under #{site.name}.\"\n redirect_to \"/users/profile/#{@login_user.id}\"\n end\n end", "def add(_source, _dest, **_options)\n raise NotImplementedError\n end", "def ubiquo_tab(name)\n look_for = Ubiquo::tab_template(name)\n gsub_file 'app/views/navigators/_main_navtabs.html.erb', /#{Regexp.escape(look_for)}/mi, 'end # Last tab'\n end", "def add(plugin); end", "def tabs(tab_id, &block)\n Tab.new(tab_id, self, block)\n end", "def activate\n tab 'Content' do\n add_item \"Gestion des Slides\", \"/admin/slides\", :after => \"Pages\"\n end\n Page.send :include, HomeSliderTags\n end", "def add_frame(frame)\n end", "def drop_add(id,x, y, source)\n pare = source == current_vc.ui ? current_vc.pane : source.child\n dnd_obj = @dnd_ids[id]\n obj = dnd_obj.new # create the object that we are dragging on\n if @dnd_opts[dnd_obj]\n # TODO: check for other options\n obj.name = @dnd_opts[dnd_obj][:assign_name] if obj.respond_to? :name=\n end\n dcrl = add_designable_control(obj, MousePoint.new(x, y), pare, @dnd_ids[id])\n if @dnd_opts[dnd_obj] && SD::DesignerSupport::Preferences.add_labels\n dcrl.decor_manager.add(Java::dashfx.lib.decorators.LabelDecorator.java_class).label = \"#{File.basename(@dnd_opts[dnd_obj][:assign_name])}: \"\n end\n hide_toolbox\n @clickoff_fnc.call if @clickoff_fnc\n @on_mouse.call(nil) if @on_mouse\n end", "def set_tab\n @tab = :dashboard\n end", "def open_tab(name, &block)\n create_tab(name, 'Default Session', &block)\n end", "def ui_add(component)\n add component\n end", "def add_window(window)\n window.register(self)\n wid = window.id\n @window_stack.add_named(window, wid)\n end", "def new_line\n @source_lines << []\n end", "def add_to_tabu_list(solution)\n @tabu_list.push(solution)\n @tabu_list.shift if @tabu_list.size > @tabu_list_size\n end", "def add_content\n self.link(:id=>\"navigation_create_and_add_link\").fire_event(\"onmouseover\")\n self.link(:text=>\"Add content\").click\n self.wait_until { @browser.text.include? \"Collected items\" }\n self.class.class_eval { include AddContentContainer }\n end", "def add_source(source)\n if has_source?(source)\n raise DuplicateSourceDefined, \"Berksfile contains two sources named '#{source.name}'. Remove one and try again.\"\n end\n @sources[source.to_s] = source\n end", "def _add(plugin); end", "def set_tab\n @tab=\"images\"\n end", "def tab(id, options = {}, &block)\n if request.xhr?\n yield\n else\n @tab = id\n layout = options[:of] ? \"#{options[:of].to_s.pluralize}/\" : ''\n layout << 'tabs'\n\n render :layout => layout, &block\n end\n end", "def remove\n super\n update_tabs\n end", "def cmd_add reference, description = 'TODO description'\n path = reference2path reference\n unless create_if_not_exist reference, path\n return\n end\n puts \"adding content to \" + reference\n open_vim path, :end_of_file, \n :add_line, \n :add_line, \n :append_desc, description, :add_line,\n :append_date,\n :add_line, \n :add_line \n end", "def initialize_duplicate_tab(duplicator, other)\n self.tab = if duplicator.duplicated?(other.tab)\n duplicator.duplicate(other.tab)\n else\n duplicator.options[:destination_course].video_tabs.first\n end\n end", "def configure_tabs\n cname = params[:controller]\n aname = params[:action]\n\n add_tab(\n TabConstants::HOME, root_url,\n cname == 'sessions' && aname == 'new'\n )\n\n add_tab(\n TabConstants::ABOUT, 'dummy',\n cname == 'users' && aname == 'show'\n )\n\n compute_active_tab\n end", "def appears_in_tab\n @container = 'tab'\n end", "def quick_tab(how, what)\n if how == :pos\n if what.is_a? Fixnum\n what = [0, what]\n end\n end\n QuickTab.new(self, how, what, parent_widget, window_id, :tabbutton)\n end", "def tab=(name)\n @params.merge!(\"tab\" => name)\n end", "def button_pressed (source)\n @delegate.tabbarView(WeakRef.new(self), buttonPressed: source) if @delegate.respond_to? 'tabbarView:buttonPressed:'\n end", "def new_tab\n execute_script('window.open();')\n window_handles.last\n end", "def open_tab(options = nil)\n current_terminal.launch_ :session => 'New session'\n end", "def create_tab(name, bookmark=nil, &block)\n @tabs[name] = Tab.new(self, name, bookmark, &block)\n create_tab_convenience_method(name)\n end", "def new_window(type); end", "def mgs_tabs_content_slot\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(div.className(create_ats_regex_string(\"ats-tabs-contentSlot\")).div, __method__)\n\tend", "def add_source(*source)\n unless source.blank?\n what.query.add(:sources) << source.flatten \n changed\n end\n end", "def start_cast_tab_mirroring(name); end", "def set_tab\n @tab=\"food_intake_logs\"\n end", "def add_view(options = {})\n views << WorkbookView.new(options)\n end", "def add_another_asset_link\n expect(focused_element).to eq(find_button('Add another link').native)\n\n focused_element.send_keys(:enter,\n [:shift, :tab],\n [:shift, :tab],\n [:shift, :tab],\n [:shift, :tab])\n end", "def add(file); @actions << Action::AddAction.new(file); end", "def tab(name, options = {})\ns = \"<li\"\ns << \"class = 'current'\" if @current_tab == options[:name] || name.downcase\ns << '>'\ns << link_to(lang, options[:url] || send(\"#{name.downcase}_path\") )\ns << '</li>'\nend", "def add_source(source)\n all << source unless all.any? { |s| s.url == source || s.name == source.name }\n end", "def step_tab(step, path)\n text = I18n.t(\"wizard.#{step}\")\n if !is_current_step?(step)\n text = link_to(text, path)\n end\n content_tag(:li, text, :class => (is_current_step?(step) ? 'active' : ''))\n end", "def call\n self.class.instance_methods(false).each do |method|\n @commands = []\n @title = method\n send(method)\n create_tab\n end\n end", "def add_new_src_dirline(dir_name)\n new_widget = @gui_factory.new_widget('DirLine')\n new_widget.set_dir_name(dir_name)\n @main_widget.add_src_dirline(new_widget)\n # Update the dirline based on our data\n update_dirline(new_widget)\n end", "def create_guest_tab(supplied_guest)\n @bar_tabs[supplied_guest] = 0\n end", "def set_current_tab(tab)\n controller.session[:current_tab] = tab\nend", "def add\n frm.link(:text=>\"Add\").click\n AssignmentAdd.new(@browser)\n end", "def rcm_tab_link\n\t $tracer.trace(__method__)\n\t return ToolTag.new(td.className(create_ats_regex_string(\"ats-rcm-tab\")), __method__, self)\n\tend", "def tabs_html\n raise \"override me\"\n end", "def workTabPane_state_changed( main_model )\n transfer[:working_tab_index] = main_model.working_tab_index # Set details from Main controller\n transfer[:working_tab_name] = main_model.working_tab_name\n transfer[:asset] = main_model.asset\n x = RubyMouseListener.new(self)\n transfer[:headerListener] = x\n signal :workTabPane_state_changed\n end", "def set_current_tab\n \"please override this method in your sub class\"\n # @current_tab = \"home\"\n end", "def add_source (source)\n open('/etc/apt/sources.list', 'a') { |f|\n f.puts source\n }\n end", "def add(filename)\n not_implemented('add')\n end", "def set_tab\n @tab = Tab.find(params[:id])\n end", "def create_header_window\n @header_window = Window_MenuHeader.new(Vocab::LOAD)\n end", "def rename_tab(name)\n if self.respond_to?(\"#{name}_tab_name\")\n n = self.send(\"#{name}_tab_name\")\n n if !n.blank?\n end\n end", "def update_tabs\n return unless @handles\n handles.items = tabs.map { |item| { id: item[:tab_id], title: item[:tab_title] } }.uniq\n return if handles.selected || handles.children.empty?\n handles.select_first\n select_tab\n end", "def rl_add_undo(what, start, _end, text)\r\n temp = alloc_undo_entry(what, start, _end, text)\r\n temp.next = @rl_undo_list\r\n @rl_undo_list = temp\r\n end", "def add_destination(label, style, *params)\n @destinations[label] = PDF::Writer::Object::Destination.new(self, @current_page, style, *params)\n end", "def create\n @tab = Tab.new(params[:tab])\n\n respond_to do |format|\n if @tab.save\n format.html { redirect_to(@tab, :notice => 'Tab was successfully created.') }\n format.xml { render :xml => @tab, :status => :created, :location => @tab }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tab.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_rest_interface(interface)\n @lines ||= []\n @lines.push \"! colspan='5' style='background:#ABE' | #{interface}\"\n @lines.push \"|-\"\n end", "def create\n @source = current_user.sources.new(params[:source])\n @wizard = Wizard.new params[:source], view_context\n\n if @source.save\n if @wizard.active?\n @wizard.append_database @source.id\n redirect_to wizard_step1_path(@wizard.parameters), notice: 'Register was successfully saved.'\n else\n redirect_to source_path(@source), notice: 'Register was successfully saved.'\n end\n else\n render action: \"new\" \n end\n end", "def js_add_new_file(object)\n update_page do |p|\n p.insert_html :bottom, 'files', :partial => 'file', :object => object\n end\n end", "def mountNi(mountString)\n MountTab.instance.add(mountString)\nend", "def create\n @binder=Binder.find(params[:binder_id])\n\n @tab = @binder.tabs.create(tab_params)\n @tab.save\n respond_with(@binder, @tab)\n end", "def set_source_interface(name = 'Vxlan1', opts = {})\n commands = command_builder('vxlan source-interface', opts)\n configure_interface(name, commands)\n end", "def load_page_in_new_tab(options = {})\n screenshoter = File.join Chromeshot.root, 'bin', 'load-screenshot.js'\n tab = `nodejs #{screenshoter} --url='#{options[:url]}' --delay=5 --debugPort=#{self.debug_port}`\n tab.chomp\n end", "def load_info_navigation(tab=0)\n tabbar = UITabBarController.alloc.init\n tabbar.viewControllers = [\n InfoOneController.alloc.initWithNibName(nil, bundle:nil),\n InfoTwoController.alloc.initWithNibName(nil, bundle:nil),\n InfoThreeController.alloc.initWithNibName(nil, bundle:nil),\n InfoFourController.alloc.initWithNibName(nil, bundle:nil)\n ]\n tabbar.selectedIndex = tab\n self.navigationController.pushViewController(tabbar, animated: true)\n end", "def create\n @tab = Tab.new(params[:tab])\n @tab.user_id = current_user.id\n\n respond_to do |format|\n if @tab.save\n flash[:notice] = t'flash.tab_created'\n format.html { redirect_to(@tab) }\n format.xml { render :xml => @tab, :status => :created, :location => @tab }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tab.errors, :status => :unprocessable_entity }\n end\n end\n end", "def execute\n view.add_control target, controller.current_view.instance\n end", "def add_midi_source(source)\n @midi.inputs << source\n end", "def create(source:)\n resp = connection.post do |req|\n req.url workspace_path\n req.params['source'] = source\n end\n raise_exception_based_on_response!(resp, object_identifier) unless resp.success?\n end", "def new_tab\n @session.open_new_window\n rescue Capybara::WindowError => e\n new_tab_via_link\n end", "def create_new_section(title, options={})\n send_audit(:kind => :new_section, :text => title, :category => options[:category])\n end", "def set_current_section title, comment\n @current_section = add_section title, comment\n end" ]
[ "0.6939854", "0.65084684", "0.64965945", "0.62654364", "0.6218769", "0.61266065", "0.59611815", "0.5848245", "0.5809864", "0.5677942", "0.56179726", "0.5610298", "0.55483437", "0.5532572", "0.5496471", "0.53817207", "0.5349773", "0.53313017", "0.5271107", "0.52470094", "0.5246133", "0.5244025", "0.51865774", "0.5124489", "0.5121105", "0.50466233", "0.5039746", "0.5027618", "0.5027101", "0.50227576", "0.5016825", "0.5012729", "0.4991585", "0.4991048", "0.49857804", "0.4975892", "0.4961182", "0.4948316", "0.49451685", "0.49321002", "0.49166384", "0.4912339", "0.49069533", "0.49029908", "0.48880497", "0.4887077", "0.48867306", "0.488401", "0.4867426", "0.48652068", "0.48636657", "0.48613858", "0.48581567", "0.48569068", "0.4849183", "0.48347834", "0.48320302", "0.4829108", "0.48287418", "0.4828109", "0.4825379", "0.4812959", "0.48083183", "0.48059714", "0.47992024", "0.4796118", "0.479184", "0.47874317", "0.47829825", "0.47738284", "0.47727484", "0.4760013", "0.47538054", "0.47467571", "0.47465238", "0.47453105", "0.47395757", "0.47382775", "0.47375247", "0.47289905", "0.47223803", "0.47073352", "0.46934554", "0.46901536", "0.46890965", "0.4679687", "0.4676482", "0.46690544", "0.46638447", "0.46490678", "0.46451434", "0.46417713", "0.46398306", "0.46381906", "0.46345147", "0.46260017", "0.46231332", "0.461963", "0.46149957", "0.4612757" ]
0.6121976
6
Resize to fit display
def resize # We need to nuke ncurses to pick up the new dimensions Curses.def_prog_mode Curses.close_screen Curses.reset_prog_mode height, width = Curses.dimensions # Resize tabs @tabs.resize( :width => width, :height => height ) @tabs.render end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize new_width, new_height\n win.resize new_width, new_height\n end", "def resize(width, height); end", "def resize_to(width, height); end", "def resize(width, height)\n end", "def resize_to_fit width, height\n process :resize_to_fit => [width, height]\n end", "def resize width = max_width, height = max_height\n @form.resize width, height\n self.write Mine::Key.RESIZE\n end", "def resize(w, h, animate=false)\n b = current_bounds\n w = absolutize_size(w, :width)\n h = absolutize_size(h, :height)\n app.windows[0].bounds.set([ b[0], b[1] + height, b[0] + w, b[1] + h + height ])\n end", "def resize width, height\n @widgets[@index].width = width\n @widgets[@index].height = height\n @widgets[@index].repaint\n end", "def resize!\n end", "def resize_to_fit(new_width, new_height)\n width, height = FastImage.size(self.current_path)\n width_ratio = new_width.to_f / width.to_f\n height_when_width_used = height * width_ratio\n if height_when_width_used <= new_height\n new_height = height_when_width_used\n else\n height_ratio = new_height.to_f / height.to_f\n new_width = width * height_ratio\n end\n FastImage.resize(self.current_path, self.current_path, new_width, new_height)\n end", "def resize_to_fit(new_width, new_height)\n manipulate! do |image|\n resize_image(image,new_width,new_height)\n end\n end", "def resize_to_fit(new_width, new_height)\n manipulate! do |image|\n resize_image(image,new_width,new_height)\n end\n end", "def resize(width,height)\n\t\t@buffer=@buffer.scale(width, height, :bilinear)\n\tend", "def resize_to(width, height)\n Selenium::WebDriver::Dimension.new(Integer(width), Integer(height)).tap do |dimension|\n use { @driver.manage.window.size = dimension }\n end\n end", "def maximize_to_screen\n size = execute_script(%(\n return { width: window.screen.width, height: window.screen.height };\n ))\n\n move_window_to(0, 0)\n resize_window_to(size['width'], size['height'])\n end", "def resize_to_fit(width, height)\n manipulate! do |image|\n resize_image image, width, height\n end\n self\n end", "def resize_to_desktop\n page.driver.browser.manage.window.resize_to(1280, 743)\n end", "def resize(width=nil, height=nil)\n config[:width], config[:height] = determine_terminal_size(width, height)\n pager.resize(config[:width], config[:height])\n end", "def resize(ht = 0, w = 0)\n # update sheight and swidth even if reduced, so that pad doesn't overwrite.\n @sheight = ht if ht > 0\n @swidth = w if w > 0\n return if ht < @padheight and w < @padwidth\n @padheight = ht if ht > @padheight\n @padwidth = w if w > @padwidth\n destroy\n $log.debug \" L502 resize, creating newpad with #{@padheight} and #{@padwidth} \"\n @window = Ncurses.newpad(@padheight, @padwidth)\n $log.debug \" L502 resize created #{@window} \"\n return @window\n end", "def setSize(szX,szY,scale,centerp=FALSE)\n @device.setSize(szX,szY,scale,centerp) ;\n end", "def resize\n\t\t@image = Qt::Image.new @parent.width/2, @parent.width/2, 7\n\t\t@image.fill Qt::Color.new \"#ffffff\"\n\tend", "def window_size()\n\t@browser.window.resize_to(x, y)\nend", "def handleResize w, h\n\t# Tell OpenGL how to convert from coordinates pixel values\n\tglViewport(0, 0, w, h)\n\t\n\tglMatrixMode(GL_PROJECTION) # Switch to setting the camera perspective\n\t\n\t# Set the camera perspective\n\tglLoadIdentity() # Reset the camera\n\tgluPerspective(45.0, # the camera angle\n\t\t\t\t\tw/ h,\n\t\t\t\t\t1.0,\n\t\t\t\t\t200.0)\nend", "def handleResize w, h\n\t# Tell OpenGL how to convert from coordinates pixel values\n\tglViewport(0, 0, w, h)\n\t\n\tglMatrixMode(GL_PROJECTION) # Switch to setting the camera perspective\n\t\n\t# Set the camera perspective\n\tglLoadIdentity() # Reset the camera\n\tgluPerspective(45.0, # the camera angle\n\t\t\t\t\tw/ h,\n\t\t\t\t\t1.0,\n\t\t\t\t\t200.0)\nend", "def resize_to_limit(new_width, new_height)\n width, height = FastImage.size(self.current_path)\n if width > new_width || height > new_height\n resize_to_fit(new_width, new_height)\n end\n end", "def set_size(w,h)\n @width = w\n @height = h\n end", "def resize_to_fit_page driver\n width = driver.execute_script(\"return Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);\")\n height = driver.execute_script(\"return Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);\")\n driver.manage.window.resize_to(width, height)\n end", "def scale_to_fit(new_width, new_height, &block)\n squish(*scale_dimensions_to_fit(new_width, new_height), &block)\n end", "def my_resize(width, height)\n manipulate! do |img|\n img.resize \"#{width}x#{height}!\"\n img\n end\n end", "def update_local_window_size(size); end", "def fit_width; end", "def shrink_to_fit(new_width, new_height, &block)\n new_width, new_height = scale_dimensions_to_fit(new_width, new_height)\n return block.call(self) if new_width >= width && new_height >= height\n squish(new_width, new_height, &block)\n end", "def resize_to_fit(cols, rows = nil)\n rows ||= cols\n change_geometry(Geometry.new(cols, rows)) do |ncols, nrows|\n resize(ncols, nrows)\n end\n end", "def resize\n trigger(:_clear_)\n\n trigger(:_refresh_)\n\n true\n end", "def setSize(width, height)\n setWidth(width)\n setHeight(height)\n end", "def resize_window_to(width, height)\n driver.manage.window.resize_to(width, height)\n end", "def resize_to_fit(width, height)\n manipulate! do |img|\n img.resize \"#{width}x#{height}\"\n img = yield(img) if block_given?\n img\n end\n end", "def resize_to_fit width, height\n manipulate! do |image|\n cols = image.width\n rows = image.height\n\n if width != cols or height != rows\n scale = [width/cols.to_f, height/rows.to_f].min\n cols = (scale * (cols + 0.5)).round\n rows = (scale * (rows + 0.5)).round\n image.resize cols, rows do |img|\n yield(img) if block_given?\n img.save current_path\n end\n end\n end\n end", "def resize_to_fit(win, padding=20)\n if(padding.is_a?(Hash))\n w_pad = padding[:width_pad]\n h_pad = padding[:height_pad]\n else\n w_pad = h_pad = padding\n end\n auto_resize(win, h_pad, :height)\n auto_resize(win, w_pad, :width)\n center_window(win)\n end", "def resize_to_fit(width, height)\n manipulate! do |img|\n img.manipulate!(:resize => \"#{width}x#{height}\")\n img = yield(img) if block_given?\n img\n end\n end", "def size_to_fit(opts = { margin: 0 })\n subview_frame = self.frame_for_subviews\n self.frame = subview_frame\n\n # margin = opts[:margin]\n # self.add_margin margin\n\n # TODO reference point is unclear.\n\n self\n end", "def resize_browser(width, heigth)\n $driver.manage.window.resize_to(width, heigth)\nend", "def adapt_design_size \n hits = 0\n while space_factor < Constants::Min_allowed_factor and hits < 3\n if @vertical \n @height /= Constants::Shrink_factor\n @height += @height%20 == 0 ? 0 : 20-@height%20\n elsif not @vertical\n @width /= Constants::Shrink_factor\n @width += @width%20 == 0 ? 0 : 20-@width%20\n end\n composite_main_image_position\n generate_white_spaces\n white_space_area = white_space_w * white_space_h\n hits +=1\n end\n end", "def dynamic_resize_to_fit(size)\n resize_to_fit *(model.class::IMAGE_CONFIG[size])\n end", "def resize_browser(width,heigth)\n $driver.manage.window.resize_to(width,heigth)\nend", "def expand_to_fit(new_width, new_height, &block)\n new_width, new_height = scale_dimensions_to_fit(new_width, new_height)\n return block.call(self) if new_width <= width && new_height <= height\n squish(new_width, new_height, &block)\n end", "def resize!(*args)\n width, height = Geometry.new(*args).dimensions\n resize(\"#{width}x#{height}^\").crop(width, height).repage\n end", "def resize_gl\n\n\t\tview_rectangle = bounds\n\n\t\t# Ensures camera knows size changed :\n\t\tif (@camera.view_height != view_rectangle.size.height) or (@camera.view_width != view_rectangle.size.width)\tthen\n\n\t\t\t@camera.view_height = view_rectangle.size.height\n\t\t\t@camera.view_width = view_rectangle.size.width\n\n\t\t\tglViewport(0, 0, @camera.view_width, @camera.view_height)\n\t\t\tupdate_projection\n\n\t\t\tupdate_info_string\n\n\t\tend\n\n\tend", "def update_size\n @max_x = @glade['drawingarea'].allocation.width - 1\n @max_y = @glade['drawingarea'].allocation.height - 1\n @glade['xvalue'].set_range(1,@max_x)\n @glade['yvalue'].set_range(1,@max_y)\n end", "def set_size(w=nil, h=nil)\n @window_width = w if w.is_a?(Numeric) && w > 0 # TODO: > min_width\n @window_height = h if h.is_a?(Numeric) && h > 0 # TODO: > min_height\n super(@window_width, @window_height)\nend", "def resize_to_mobile\n page.driver.browser.manage.window.resize_to(360, 591)\n end", "def set_size(width = nil, height = nil)\n @window_width = if ptrue?(width)\n # Convert to twips at 96 dpi.\n width.to_i * 1440 / 96\n else\n 16095\n end\n\n @window_height = if ptrue?(height)\n # Convert to twips at 96 dpi.\n height.to_i * 1440 / 96\n else\n 9660\n end\n end", "def resizeCanvas(w,h)\n puts(\"resizing canvas\")\n puts(w,h)\n @canvasHeight = h #Set the canvas height\n @canvasWidth = w #Set the canvas width\n @canvas.resize(w,h)\n @exportImage = FXPNGImage.new(@parentApp, nil, @canvasWidth, @canvasHeight)\n @exportImage.create #initializes the image object.\n @exportImage.resize(@canvasWidth, @canvasHeight) #Sets the image to match canvas width and height\n @layerArray = Array.new #Reset the layer array\n @imageArray = Array.new #Reset the image array\n @dirtyArray = Array.new #Reset the dirty array\n @activeIndex = 0 #Reset the active index\n createImage() #Push a blank image data.\n @activeImage = @imageArray[@activeIndex] #Update active index to default.\n @canvas.update #Update the draw canvas to reflect changes.\n end", "def resize(width)\n @cli_opts[:geometry] = \"#{width}x\"\n self\n end", "def resizable?; true; end", "def resize\n @image.resize \"#{@placement[:a]}x#{OUTER}\\!\"\n end", "def updateSize(x,y)\n x = (@panel.getWidth() > x) ? @panel.getWidth : x\n y = (@panel.getHeight() > y) ? @panel.getHeight : y\n @panel.setPreferredSize(Dimension.new(x,y))\n end", "def resize_to_limit(new_width, new_height)\n manipulate! do |image|\n image = resize_image(image,new_width,new_height) if new_width < image.x_size || new_height < image.y_size\n image\n end\n end", "def setCanvasSize\n if @intTargetX.to_s.to_i > 20 and @intTargetY.to_s.to_i > 20\n puts('setting new dimetions')\n @canvasRefrance.resizeCanvas(@intTargetY.to_s.to_i,@intTargetX.to_s.to_i)\n else \n puts('setting defult dimentions')\n @canvasRefrance.resizeCanvas(@minDimensions,@minDimensions)\n end\n end", "def ensure_browser_size(width = 1280, height = 1280)\n Capybara.current_session.driver.browser.manage.window.resize_to(width, height)\n end", "def resize_async(width, height, use_hints = false)\n flags = use_hints ? XDo::FFILib::Consts::SIZE_U : 0\n XDo::FFILib.xdo_window_setsize @_xdo_pointer, @_window, width, height, flags\n end", "def resize_browser(x,y)\r\n\t\t#resize\r\n\t\t@driver.manage.window.resize_to(x,y)\r\n\t\tsleep 3\r\n\tend", "def resize_to_limit(new_width, new_height)\n manipulate! do |image|\n image = resize_image(image,new_width,new_height) if new_width < image.width || new_height < image.height\n image\n end\n end", "def resize(w, h, resample = true)\n clone.resize!(w, h, resample)\n end", "def refresh_command(resize)\n if resize\n self.height = [self.height, row_max * WLH + 32].max\n end\n create_contents\n refresh\n end", "def display_image\n image.variant(resize_to_limit: [500,500])\n end", "def display_image \r\n self.image.variant(resize_to_limit: [1000, 1000]) \r\n end", "def resize_to_limit(width, height)\n manipulate! do |img|\n img.resize \"#{width}x#{height}>\"\n img = yield(img) if block_given?\n img\n end\n end", "def scale_to_fit(width, height)\n @image = @image.scale_to_fit(width, height)\n self\n end", "def screen_size\n compatible_call :screen_size\n end", "def resize_to_fit(width, height)\n width = dimension_from width\n height = dimension_from height\n manipulate! do |img|\n img.resize_to_fit!(width, height)\n img = yield(img) if block_given?\n img\n end\n end", "def resize(width, height, use_hints = false)\n old_size = self.size\n return_value = resize_async width, height, use_hints\n 100.times do\n break unless self.size == old_size\n sleep 0.01\n end\n return_value\n end", "def resize(w, h)\r\n @x2 = @x1 + w\r\n @y2 = @y1 + h\r\n end", "def scale_to(new_size)\n scale_to(new_size, background:nil)\n end", "def resize_to_fill_and_save_dimensions(new_width, new_height)\n img = ::MiniMagick::Image.from_file(current_path)\n width, height = img['width'], img['height']\n \n resize_to_fill(new_width, new_height)\n \n w_ratio = width.to_f / new_width.to_f\n h_ratio = height.to_f / new_height.to_f\n \n ratio = [w_ratio, h_ratio].min\n \n model.send(\"#{mounted_as}_w=\", ratio * new_width)\n model.send(\"#{mounted_as}_h=\", ratio * new_height)\n model.send(\"#{mounted_as}_x=\", (width - model.send(\"#{mounted_as}_w\")) / 2)\n model.send(\"#{mounted_as}_y=\", (height - model.send(\"#{mounted_as}_h\")) / 2)\n end", "def remake_window\n self.width = window_width\n self.height = window_height\n create_contents\n end", "def update_size(width, height) \n if @vertical\n @height += height\n @width = width if width > @width\n else\n @width += width\n @height = height if height > @height\n end\n end", "def resize_to_limit(width, height)\n manipulate! do |image|\n image = resize_image(image, width, height) if width < image.x_size || height < image.y_size\n image\n end\n self\n end", "def resize_to_limit(width, height)\n manipulate! do |img|\n img.manipulate!(:resize => \"#{width}x#{height}>\")\n img = yield(img) if block_given?\n img\n end\n end", "def track_resize\n @track_resize = true\n d = Terminal.dimensions\n\n @resize_thread = Thread.new {\n while @track_resize\n Terminal.reset!\n t = Terminal.dimensions\n\n if t != d && !shutdown?\n Terminal.resize!\n @on_resize.call if !!@on_resize\n end\n\n d = Terminal.dimensions\n sleep(RESIZE_TIME)\n end\n }\n end", "def display_image\n image.variant(resize_to_limit: [500, 500])\n end", "def display_image\n image.variant(resize_to_limit: [500, 500])\n end", "def display_image\n image.variant(resize_to_limit: [500, 500])\n end", "def display_image\n image.variant(resize_to_limit: [500, 500])\n end", "def display_image\n image.variant(resize_to_limit: [500, 500])\n end", "def display_image\n image.variant(resize_to_limit: [500, 500])\n end", "def set_visible_size(width:, height:)\n {\n method: \"Emulation.setVisibleSize\",\n params: { width: width, height: height }.compact\n }\n end", "def resize_mix_window_yea_abe\n return unless $imported[\"YEA-BattleEngine\"]\n @mix_window.height = @skill_window.height\n @mix_window.width = @skill_window.width\n @mix_window.y = Graphics.height - @item_window.height\n end", "def Pager_RecalcSize(hwnd) send_pager_message(hwnd, :RECALCSIZE) end", "def update_size(x,y)\n @width = x if x > @width\n @height = y if y > @height\n end", "def update_scale\n heightpx = @board.height*@scale\n widthpx = @board.width*@scale\n # Gameboard\n @board_window.height = heightpx\n @board_window.width = widthpx\n # Clue windows\n @clues_windows[:rows].height = heightpx\n @clues_windows[:rows].width = (@scale*@board.clues[:rows].map { |row| row.length }.max)\n @clues_windows[:columns].height = (@scale*@board.clues[:columns].map { |column| column.length }.max)\n @clues_windows[:columns].width = widthpx\n # Clues\n @clues_list.each { |clue| clue[:text_object].delete() }\n @passing.each { |pass| pass.remove() }\n @passing = draw_passing(@board.clues)\n @clues_list = draw_clues(@board.clues)\n # Blocks\n @blocks.each do |block, cell|\n x = block.coords[:x]*@scale\n y = block.coords[:y]*@scale\n cell.coords = [x, y, x+@scale, y+@scale]\n end\n # Guide lines\n @guide_lines.each { |line| line.remove }\n @guide_lines = draw_guide_lines()\n update_highlight()\n end", "def resize_to_limit(width, height)\n width = dimension_from width\n height = dimension_from height\n manipulate! do |img|\n geometry = Magick::Geometry.new(width, height, 0, 0, Magick::GreaterGeometry)\n new_img = img.change_geometry(geometry) do |new_width, new_height|\n img.resize(new_width, new_height)\n end\n destroy_image(img)\n new_img = yield(new_img) if block_given?\n new_img\n end\n end", "def check_for_resize; end", "def resize_and_save_space(resizing)\n { resize: resizing, quality: \"85%\", strip: true, interlace: \"Plane\" }\n end", "def resize_event event\n @widget.size = event.size\n scene.scene_rect =\n Qt::RectF.new(0, 0, event.size.width, event.size.height)\n end", "def size=(width, height)\n end", "def resized!\n self[:resized] = true\n node[:volumes][name][:resized] = true\n end", "def stretch_screen(file)\n bmp = pbBitmap(file)\n self.bitmap = Bitmap.new(self.viewport.width, self.viewport.height)\n self.bitmap.stretch_blt(self.bitmap.rect, bmp, bmp.rect)\n end", "def resize_to_fit\n image = ManagedImage.from_path(params[:image])\n width = params[:width].to_i\n height = params[:height].to_i\n render json: image.resize_to_fit(width, height)\n end", "def fit_within(max_w, max_h)\n w, h = width, height\n\n if w > max_w.to_i or h > max_h.to_i\n\n w_ratio = max_w.quo(w)\n h_ratio = max_h.quo(h)\n\n if (w_ratio < h_ratio)\n h = (h * w_ratio)\n w = (w * w_ratio)\n else\n h = (h * h_ratio)\n w = (w * h_ratio)\n end\n end\n\n if block_given?\n self.resize(w, h) do |image|\n yield image\n end\n else\n self.resize(w, h)\n end\n end" ]
[ "0.7331587", "0.7291365", "0.7209486", "0.6970077", "0.6927916", "0.68964875", "0.688549", "0.66455525", "0.6638066", "0.6615044", "0.6541229", "0.6541229", "0.6514034", "0.6469051", "0.6446277", "0.6443882", "0.64406425", "0.642693", "0.64204687", "0.638633", "0.6354829", "0.6345142", "0.6333816", "0.6333816", "0.63149196", "0.6311019", "0.63055396", "0.6303045", "0.6301118", "0.6297599", "0.6281274", "0.62733704", "0.62702143", "0.62650913", "0.62520903", "0.6237018", "0.62208915", "0.62151206", "0.6212067", "0.6205106", "0.6204635", "0.6195203", "0.61901313", "0.61881375", "0.61754835", "0.61585635", "0.6153739", "0.6144104", "0.6142898", "0.614211", "0.6104596", "0.6085464", "0.60826665", "0.6067476", "0.60603213", "0.60387737", "0.6038157", "0.60178995", "0.60064584", "0.5995033", "0.59745663", "0.596847", "0.59594595", "0.595187", "0.5951699", "0.59384775", "0.59374756", "0.5930489", "0.59202725", "0.59099317", "0.5902832", "0.58926827", "0.5883632", "0.58764654", "0.5862834", "0.58589834", "0.5842706", "0.5821737", "0.5808753", "0.5804556", "0.5801282", "0.5801282", "0.5801282", "0.5801282", "0.5801282", "0.5801282", "0.5801083", "0.57759976", "0.5765156", "0.576333", "0.57339114", "0.57271385", "0.57139397", "0.57059264", "0.5702388", "0.56954813", "0.56850225", "0.5676381", "0.5673282", "0.5671503" ]
0.6716057
7
Switch to a different conversation
def switch(target = nil) if target # Switch to a specific tab @tabs.switch_to_label target else # Switch to the next tab @tabs.scroll end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conversation_start person\n\t\treturn nil if (person.is_not? :person)\n\t\t@mode = :conversation\n\t\t@talking_to = person\n\t\tGAME.window(:conversation).show\n\t\tGAME.window(:input).prompt = :conversation\n\tend", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def handle(time, send, message)\n match(message, \"(join|switch to) (.*)\") do |md|\n new_room_name = md[2]\n \n old_room_name = Robut::Connection.config.room\n \n # nasty gsub of the room name in the room name string\n full_new_room_name = old_room_name.gsub(/[\\d]+_(.*)\\@.*/) { |str| str.gsub($1, new_room_name) }\n \n Robut::Connection.config.room = full_new_room_name\n \n # Reconnect to the new channel.\n # There is a lighter-weight way to accomplish this,\n # but we don't have access to the muc accessor here.\n begin\n Robut::Connection.new.connect\n rescue => e\n $stderr.puts e\n # reply(\"I can't join that room, bro.\")\n \n # reconnect to the original room if we can't connect to the new one\n Robut::Connection.config.room = old_room_name\n Robut::Connection.new.connect\n end\n end\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n\t\t@conversation = Conversation.find(params[:id])\n\tend", "def particular_conversation\n @this_conversation = Conversation.find(params[:id])\n end", "def show\n if @message = Message.find_by_id(params[:id]) and @conversation = @message.conversation\n if @conversation.is_participant?(@user)\n redirect_to conversation_path(@conversation, :box => @box, :anchor => \"message_\" + @message.id.to_s)\n return\n end\n end\n redirect_to conversations_path(:box => @box)\n end", "def assign_conversation\n self.conversation = parent.nil? ? Conversation.create(:sender => sender, :recipient => recipient) : parent.conversation\n #self.conversation = parent.nil? ? Conversation.create :\n # parent.conversation\n end", "def show\n if @message = Message.find_by_id(params[:id]) and @conversation = @message.conversation\n if @conversation.is_participant?(@actor)\n redirect_to conversation_path(@conversation, :box => @box, :anchor => \"message_\" + @message.id.to_s)\n return\n end\n end\n redirect_to conversations_path(:box => @box)\n end", "def switch_choice\n pokemon_to_send = @visual.show_pokemon_choice\n if pokemon_to_send\n pokemon_to_switch = @logic.battler(0, @player_actions.size)\n # The player made a choice we store the action and we check if he can make other choices\n @player_actions << { type: :switch, who: pokemon_to_switch, with: pokemon_to_send }\n pokemon_to_send.switching = true\n pokemon_to_switch.switching = true\n log_debug(\"Action : #{@player_actions.last}\") if debug? # To prevent useless overhead outside debug\n @next_update = can_player_make_another_action_choice? ? :player_action_choice : :trigger_all_AI\n else\n # If the player canceled we return to the player action\n @next_update = :player_action_choice\n end\n end", "def switch_player\n @act_p = @act_p.id == 0 ? self[1] : self[0]\n end", "def set_conversation\n @issue = Conversation.find(params[:id])\n end", "def switch_player()\n\t\tif $current_player == @player1\n\t\t\t$current_player = @player2\n\t\telse \n\t\t\t$current_player = @player1\n\t\tend \n\tend", "def conversation\n @conversation ||= mailbox.conversations.find(params[:id])\n end", "def conversation\n @conversation ||= mailbox.conversations.find(params[:id])\n end", "def switch_player(player_turn)\n\t\tplayer_turn == @player1 ? @player2 : @player1\n\tend", "def link_to_conversation conversation_id\n conversation = Conversation.find(conversation_id)\n board_conversation_path(conversation.board_id,conversation_id)\n end", "def partner\n @chat_win = ChatWindow.find\n lclick_at(@partner_tab)\n sleep 1\n loop do\n cmd = wait_for_cmd\n if cmd\n response = eval cmd\n @chat_win.say \"#{ACK}#{response}\" \n end\n sleep 1\n end\n end", "def set_conversation_message\n @conversation_message = ConversationMessage.find(params[:id])\n end", "def switch_players\n \n if @current_asker == @player1\n @current_asker = @player2\n @current_responder = @player1\n else\n @current_asker = @player1\n @current_responder = @player2\n end\n\n end", "def change_turn\n if @player_to_move == \"w\"\n @player_to_move = \"b\"\n else\n @player_to_move = \"w\"\n end\n end", "def show\n\t\tif @message = Message.find_by_id(params[:id]) and @conversation = @message.conversation\n\t\t\tif @conversation.is_participant?(@actor)\n\t\t\t\tredirect_to conversation_path(@conversation, :box => @box, :anchor => \"message_\" + @message.id.to_s)\n\t\t\treturn\n\t\t\tend\n\t\tend\n\tend", "def set_conversation\n @conversation = Conversation.where(featured: true).find(params[:id])\n end", "def set_task\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation_and_chapter\n @conversation = Conversation.find(params[:id])\n @chapter = @conversation.chapter\n end", "def set_user_conversation\n @user_conversation = UserConversation.find(params[:id])\n end", "def switch_player\n if @active_player == @player1\n @active_player = @player2\n else\n @active_player = @player1\n end\n end", "def talk\n if current_room.npc\n puts current_room.npc.dialogue[:default]\n else\n puts \"Sorry, no one else is in here!\"\n end\n end", "def local_switch(body, prevent = false)\n room = body\n room = 'chat' if room.length < 1\n unless @connection.room_ids[room] or room == 'chat' or room[0,1] == '@' or\n @var[:special_rooms].include?(room)\n _notice \"You are not in room '#{room}'\", :error\n return false\n end\n @var[:room] = room\n unless prevent\n if room[0,1] == '@'\n _notice \"You are now private messaging with #{room[1..-1]}.\", room\n else\n _notice \"You are now chatting in '#{room}'\", room\n end\n end\n true\nend", "def start_conversation(friend, topic) \n case(topic)\nwhen \"politics\" \n friend.happiness -= 2\n self.happiness -= 2\n return \"blah blah partisan blah lobbyist\"\nwhen \"weather\"\n friend.happiness += 1\n self.happiness += 1\n return \"blah blah sun blah rain\"\n#use else because it tells us if none of the above check out then do the following\nelse \n return \"blah blah blah blah blah\" \n end \nend", "def switch_player\n @current_player = (@current_player == 'x' ? 'o' : 'x')\n end", "def reply!\n self[:sport], self[:dport] = self[:dport], self[:sport]\n self\n end", "def create \n # If there is an existing conversation between the 2 parties, then the database is queried for the previous conversation and it is displayed. \n if Conversation.between(params[:sender_id], params[:recipient_id]).present?\n @conversation = Conversation.between(params[:sender_id], params[:recipient_id]).first\n else\n #if there is no conversation between the two parties, then the beloew line will create a new conversation\n @conversation = Conversation.create!(conversation_params)\n end\n redirect_to conversation_messages_path(@conversation)\n end", "def switch_player\n if @current_player == @players[0]\n @current_player = @players[1]\n else\n @current_player = @players[0]\n end\n end", "def stopConversation\n $conversation.update_column(\"open\",false)\n end", "def switch_players\n @player1_turn = !@player1_turn\n end", "def start_conversation(person, topic)\n if topic == \"politics\"\n person.happiness -= 2\n self.happiness -= 2\n \"blah blah partisan blah lobbyist\"\n elsif topic == \"weather\"\n person.happiness += 1\n self.happiness += 1\n \"blah blah sun blah rain\"\n else \n \"blah blah blah blah blah\"\n end\n end", "def show\n @conversation = Conversation.new\n end", "def answer_on_incoming()\n update({:state => 'active'})\n reload()\n end", "def switch_current_player\n @current_player = @current_player == @player1 ? @player2 : @player1\n end", "def find_conversation!\n if params[:receiver_id]\n @receiver = User.find_by(id: params[:receiver_id])\n @conversation = Conversation.between(current_user.id, @receiver.id)[0]\n if @conversation\n redirect_to conversation_personal_messages_path(@conversation)\n else\n @conversation = Conversation.create(params.permit(:author_id, :receiver_id))\n redirect_to conversation_personal_messages_path(@conversation)\n end\n else\n @conversation = Conversation.find_by(id: params[:conversation_id])\n # redirect_to(root_path) unless @conversation && @conversation.participates?(current_user)\n end\nend", "def converse( msg = nil )\n @session.puts msg if msg\n return @session.gets.chomp\n end", "def show\n @conversation = Conversation.find(params[:id])\n @reciever = interlocutor(@conversation)\n @messages = @conversation.messages.sort_by(&:created_at)\n @message = Message.new\n @admin = current_user.admin\n if @admin\n @conversations = Conversation.where(\"recipient_id = ?\", current_user.id)\n else\n @conversation.update_column(\"open\",true)\n end\n end", "def move_player1 (choice_case)\n symbole_player1 = @player1.symbole\n @board.move_player1(choice_case, symbole_player1)\n @@game_count+=1\n end", "def switch_players!\n if current_player==player1\n @current_player=player2\n else\n @current_player=player1\n end\n end", "def move_player2 (choice_case)\n symbole_player2 = @player2.symbole\n @board.move_player2(choice_case, symbole_player2) \n @@game_count+=1\n end", "def start_conversation(person, topic)\n if topic == \"politics\"\n self.happiness -= 2\n person.happiness -= 2\n return \"blah blah partisan blah lobbyist\"\n elsif topic == \"weather\"\n self.happiness += 1\n person.happiness += 1\n return \"blah blah sun blah rain\"\n else\n return \"blah blah blah blah blah\"\n end\n end", "def switch_player_turn(player_turn)\n case player_turn\n when \"O\"\n player_turn = \"X\"\n when \"X\"\n player_turn = \"O\"\n end\n return player_turn\n end", "def show\n @conversation = Conversation.find(params[:id])\n end", "def edit\n @conversation = Conversation.find(params[:id])\n end", "def switch_player\n @current_player = @current_player == @players.first ? @players.last : @players.first\n end", "def switch_player(player)\n if player == @player1\n player = @player2\n else \n player = @player1\n end\n end", "def reply_to\n sent_to_channel? ? dest : nick\n end", "def switch_to_other_window\n @window_id = (@window_id - 1).abs\n if @window_id != 0 and @window_id !=1\n puts @window_id\n raise(Exception::WindowMatchError, \"You cannot use this keyword when more than 2 windows are open; you must use 'Switch To Window', 'Switch to Next Window', or 'Switch to Previous Window'\")\n end\n\n @browser.windows[@window_id].use\n end", "def switch_player\n @current_player = if @current_player == @player_o\n @player_x\n else\n @player_o\n end\n\n @number_of_turns += 1\n end", "def switch_to_next_question!\n\n raise \"Quiz has to be started to switch the question\" if !started?\n\n next_question_index = self.current_question_index + 1\n next_question_exist = self.quiz.questions.rank(:row_order)[next_question_index]\n succeeded_to_switch = if !next_question_exist.nil?\n self.current_question_index = next_question_index\n send_current_question()\n save()\n else\n false\n end\n return succeeded_to_switch \n end", "def reply_to_activity(conversation_id, activity_id, new_activity)\n uri = \"/v3/conversations/#{conversation_id}/activities/#{activity_id}\"\n api_post(uri, new_activity.to_hash)\n end", "def change_player\n\t\tif @current_player == @player1\n\t\t\t@current_player = @player2\n\t\t\t@opponent_player = @player1\n\t\telse\n\t\t\t@current_player = @player1\n\t\t\t@opponent_player = @player2\n\t\tend\n\tend", "def edit\n # current_user.id = 25\n # Si le get précise la fermeture d'une conversation\n if !params[:conversation_to_close_id].nil?\n @conversation_to_close = Conversation.find(params[:conversation_to_close_id])\n @conversation_to_close.finished!\n redirect_to message_path\n end\n\n # Si le get précise la publication d'une conversation\n if !params[:conversation_to_publish_id].nil?\n # On va voir lequel des interlocuteur clos la conversation_id\n @conversation_to_publish = Conversation.find(params[:conversation_to_publish_id])\n \n @conversation_to_publish.publish(current_user.id)\n redirect_to message_path\n end\n # @\n\n end", "def changeChannel(channel, password)\n @IRCsocket.write(\"PART #{@ch}\\n\")\n @ch = channel\n @ch_pw = password\n @IRCsocket.write(\"JOIN #{@ch} #{@ch_pw}\\n\")\n end", "def change_turns\n (@current_player == @p1) ? @current_player = @p2 : @current_player = @p1\n end", "def switch_players\n if @current_player.name == @player1.name\n @current_player = @player2\n @other_player = @player1\n else \n @current_player = @player1\n @other_player = @player2\n end\n return\n end", "def 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 switch_players\n @current_player, @other_player = @other_player, @current_player\n end", "def switch_players\n @current_player, @other_player = @other_player, @current_player\n end", "def turn_game\n\t\t@player_1.new_question\n\t\tcheck_score\n\t\t@player_2.new_question\n\t\tcheck_score\n\t\tcheck_status\n\t\tputs '------------NEW-TURN-------------'\n\t\tturn_game\n\tend", "def set_conversation_user\n @conversation_user = ConversationUser.find(params[:id])\n end", "def get_messages\n if Conversation.previous_talks(params[:sender_id],params[:recipient_id]).present?\n @conversation = Conversation.previous_talks(params[:sender_id],params[:recipient_id]).first\n else\n @conversation = Conversation.create!(conversation_params)\n end\n end", "def 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 switch_players(player_one, player_two)\n self.current_player = current_player == player_one ? player_two : player_one\n\n end", "def abajo\n case @selection\n when 1\n mesaje_select(@difficulty_message)\n @selection = 2\n @select_song.play\n when 2\n mesaje_select(@music_message)\n @selection = 3\n @select_song.play\n when 3\n mesaje_select(@about_message)\n @selection = 4\n @select_song.play\n when 4\n mesaje_select(@exit_message)\n @selection = 5\n @select_song.play\n end\n sleep(0.15)\n end", "def reply_switch post\n if(@reply_area)\n render partial: 'posts/reply_area', locals: {post: post}\n else\n render partial: 'posts/reply_button', locals: {post: post}\n end\n end", "def conversation_id=(value)\n @conversation_id = value\n end", "def conversation_id=(value)\n @conversation_id = value\n end", "def change_turn\n @turn = @turn >= 'X' ? 'O' : 'X'\n @turn_played += 1\n end", "def turn\n puts \"Turn #{@board.count_turn + 1}, player #{get_current_player.name} choose:\"\n @board.play_turn\n end", "def switch\n unless current_conference.tag == 'ponzu_tag'\n raise \"User switch only available on demo conference\"\n end\n @user_session = current_conference.user_sessions.new(params[:user_session])\n if @user_session.save\n flash[:notice] = \"Successfully logged in.\"\n else\n flash[:error] = \"Failed to log in.\"\n end\n\n respond_with @user_session, :location => \"/\"\n end", "def switch_to\n task = current_user.tasks.find(params[:id]).switch_to\n\n respond_to do |format|\n if task.save\n format.html { redirect_to(tasks_url, :notice => 'Task was successfully switched back to again.') }\n format.xml { render :xml => task, :status => :created, :location => task }\n else\n format.html { redirect_to(tasks_url, :notice => 'Error! Please try again...') }\n format.xml { render :xml => task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def switch_current_player\n\t\tif @playerx\n\t\t\t@playerx = false\n\t\t\t@current_player.set_text(\"Player: O\")\n\t\telse\n\t\t\t@playerx = true\n\t\t\t@current_player.set_text(\"Player: X\")\n\t\tend\t\t\n\tend", "def start_turn\n puts \"----- NEW TURN -----\"\n @turn += 1\n if (@turn.odd?)\n active = @player1\n Turn.new(active)\n else\n active = @player2\n Turn.new(active)\n end\n\n if (game_over?)\n winner_message\n puts \"----- GAME OVER -----\"\n else\n player_lives\n start_turn\n end\n end", "def show\n @conversation = Conversation.find_by_id(@match.conversation_id)\n @messages = @conversation.messages\n @message = Message.new\n end", "def turn\n choice = current_player.move(board)\n if board.valid_move?(choice)\n board.update(choice, current_player)\n end\n end", "def switch_player(current_player)\n current_player == player1 ? @next_player = player2 : @next_player = player1\n end", "def start_conversation(person, topic)\n # If the topic is politics, both people get sadder and the method returns \"blah blah partisan blah lobbyist\".\n if topic == 'politics'\n sadder_person = self.happiness - 2\n self.happiness = sadder_person\n\n sadder_friend = person.happiness - 2\n person.happiness = sadder_friend\n return \"blah blah partisan blah lobbyist\"\n # If the topic is weather, both people get a little happier and the method returns \"blah blah sun blah rain\".\n elsif topic == 'weather'\n happier_person = self.happiness + 1\n self.happiness = happier_person\n\n happier_friend = person.happiness + 1\n person.happiness = happier_friend\n return \"blah blah sun blah rain\"\n # If the topic is not politics or weather, their happiness points don't change and the method returns \"blah blah blah blah blah\".\n else\n return \"blah blah blah blah blah\"\n end\n end" ]
[ "0.65577716", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.64013493", "0.6382312", "0.6342955", "0.63158756", "0.63158756", "0.63158756", "0.63158756", "0.63158756", "0.62875247", "0.60662204", "0.6033655", "0.5984118", "0.59828633", "0.5970615", "0.59619904", "0.5837265", "0.5798787", "0.5797209", "0.5797209", "0.5782614", "0.5749286", "0.5746074", "0.57300115", "0.57296604", "0.5713248", "0.56945837", "0.565406", "0.5635055", "0.56266487", "0.5624782", "0.5623052", "0.5603472", "0.5594738", "0.55938244", "0.5568829", "0.55365264", "0.55362666", "0.5533037", "0.5513322", "0.5506873", "0.54777926", "0.5465725", "0.5436457", "0.54318625", "0.5429363", "0.5424763", "0.54171616", "0.5400196", "0.5394775", "0.5353571", "0.53448373", "0.5343805", "0.5338985", "0.5329235", "0.53100353", "0.5303097", "0.53018343", "0.530022", "0.5300164", "0.5299522", "0.5294935", "0.52903235", "0.52872103", "0.52852815", "0.52702296", "0.52665675", "0.5251093", "0.52500224", "0.52500224", "0.5249842", "0.5237385", "0.52370805", "0.52351624", "0.5231829", "0.5231033", "0.52213293", "0.5216714", "0.5216714", "0.52144027", "0.52075344", "0.52036464", "0.5192519", "0.5191915", "0.5191032", "0.51901454", "0.5187354", "0.5187092", "0.5182104" ]
0.0
-1
See for more details.
def supports_optimizer_hints? !mariadb? && database_version >= "5.7.7" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def refutal()\n end", "def who_we_are\r\n end", "def usage; end", "def usage; end", "def schubert; end", "def verdi; end", "def loc; end", "def loc; end", "def loc; end", "def weber; end", "def informational?; end", "def tell()\n #This is a stub, used for indexing\n end", "def used?; end", "def terpene; end", "def accessibility; end", "def internal; end", "def diagnostic; end", "def implementation; end", "def implementation; end", "def what_is\n end", "def info; end", "def info; end", "def desc; end", "def extra; end", "def how_it_works\r\n end", "def operations; end", "def operations; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def berlioz; end", "def spec; end", "def spec; end", "def ref; end", "def custom; end", "def custom; end", "def hints; end", "def suivre; end", "def r; end", "def r; end", "def flags; end", "def ibu; end", "def doc; end", "def doc; end", "def doc; end", "def doc; end", "def returns; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def hd\n \n end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end" ]
[ "0.8107999", "0.71451133", "0.7124696", "0.7124696", "0.7124696", "0.7124696", "0.7040452", "0.6935659", "0.68564904", "0.68564904", "0.67835283", "0.67249644", "0.66593087", "0.66593087", "0.66593087", "0.66581976", "0.66429484", "0.6635239", "0.6620886", "0.66105586", "0.6587493", "0.65764683", "0.65499806", "0.65278846", "0.65278846", "0.6520751", "0.6512931", "0.6512931", "0.64863944", "0.6481606", "0.6461911", "0.64546454", "0.64546454", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64355487", "0.64128476", "0.64112914", "0.64112914", "0.638354", "0.6363767", "0.6363767", "0.6359676", "0.6358744", "0.6358033", "0.6358033", "0.63412166", "0.63376456", "0.631654", "0.631654", "0.631654", "0.631654", "0.631613", "0.6314355", "0.6314355", "0.6314355", "0.6314355", "0.6314355", "0.6314355", "0.6314355", "0.6314355", "0.6283774", "0.62738746", "0.62738746", "0.62738746", "0.62738746", "0.62738746", "0.62738746", "0.62738746", "0.62738746", "0.62738746", "0.62738746", "0.62738746", "0.62738746", "0.62738746" ]
0.0
-1
HELPER METHODS =========================================== The two drivers have slightly different ways of yielding hashes of results, so this method must be implemented to provide a uniform interface.
def each_hash(result) # :nodoc: raise NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each_result(results = last_results, &block)\n results.each do |result|\n block.call(Hashie::Mash.new(result))\n end\nend", "def get_db_as_hash()\n db = get_db()\n db.results_as_hash = true \n return db\n end", "def each_hash(the_query, with_table_names = false, &block)\n begin\n if with_table_names\n # We have to build the hash ourselves, if we want table names included\n query(the_query, { as: :array, cache_rows: false })\n if @result != nil\n fields = @result.fields\n tables = @result.respond_to?(:tables) ? @result.tables : [] # My addition to mysql2 results.c\n\n result = []\n @result.each do |row|\n hrow = {}\n (0...row.length).each do |i|\n field_name = tables[i].nil? ? fields[i] : \"#{tables[i]}.#{fields[i]}\"\n hrow[field_name] = row[i]\n end\n yield hrow\n result << hrow\n end\n return result\n end\n else\n query(the_query, { as: :hash, cache_rows: false })\n if @result != nil\n if block_given?\n @result.each(&block)\n else\n return @result.to_a\n end\n end\n end\n rescue Mysql2::Error => e\n # puts \"#{e.errno}: #{e.error}\"\n raise e\n ensure\n if block_given? && @result != nil\n @result.free\n end\n end\n end", "def results\n raise NotImplementedError\n end", "def to_result_hash\n if self.class.respond_to?(:returns) && self.class.returns.any?\n to_hash([:status] | self.class.returns)\n else\n to_hash\n end\n end", "def get_object_results(hash, sparql)\n\n # create a new Array to parameterize the query generation\n data = Array.new\n \n data.push(hash)\n \n # generate the query\n query = object_query_generator(data)\n \n # send the query to the sparql database and get back the results\n result = sparql.query(query)\n \n # create a data structure to pass data to the webpage and safe the results in it\n return_value = Array.new\n \n result.each_solution do |solution|\n return_value << solution.inspect\n end\n \n return return_value\n end", "def ResultHash(base_value)\n base_value.is_a?(::Saxinator::ResultHash) ? base_value : ::Saxinator::ResultHash.new(base_value)\nend", "def find_and_map\n return enum_for(__method__) if !block_given?\n\n address_to_record = Hash.new\n each_record do |r|\n if result = yield(r.dup)\n address_to_record[r['address']] = result.to_hash\n end\n end\n MemoryDump.new(address_to_record)\n end", "def each_hit_with_result\n verified_hits.each do |hit|\n yield(hit, hit.result)\n end\n end", "def hash()\n #This is a stub, used for indexing\n end", "def get_results\n raise NotImplementedError.new\n end", "def make_results_table(drivers,sort_by=:driver_id,order=:lowtohigh)\n # drivers = master[:drivers]\n # sort_by = any key in results_table\n # order = :hightolow or :lowtohigh\n results_table = Array.new\n drivers.each do |h|\n orphan = Hash.new\n orphan[:driver_id] = h[:driver_id]\n orphan[:tot_rides] = h[:rides].size\n orphan[:tot_cost] = h[:rides].reduce(0) {|m,h| m + h[:cost]}\n orphan[:avg_rating] = (( h[:rides].reduce(0) {|m,h| m + h[:rating]}\n ) / h[:rides].size.to_f ).round(3)\n orphan[:best_day] = best_day(h[:rides])\n results_table << orphan\n end\n\n sort_results_table(results_table,sort_by,order)\n return results_table\nend", "def output_hash; end", "def hash()\n #This is a stub, used for indexing\nend", "def get_hash(*params); raise('Stub or mock required.') end", "def result\n Hash[\n metadata.map do |key, value|\n [key, PostgresValue.for(value).result]\n end\n ]\n end", "def get_payment_info_by_mfhds_ledgers(mfhd_ids, ledgers, conn)\n results = {}\n ledgers.each do |ledger|\n mfhd_ids.each_slice(1000) do |segment|\n query = payment_info_by_mfhds(segment, ledger)\n conn.exec(query, *segment) do |row|\n hash = {}\n mfhd_id = row.shift\n results[mfhd_id] = [] unless results[mfhd_id]\n hash[:invoice_id] = row.shift\n hash[:vendor_code] = row.shift\n hash[:invoice_num] = row.shift\n hash[:voucher_num] = row.shift\n hash[:invoice_status] = row.shift\n hash[:status_date] = row.shift\n hash[:invoice_date] = row.shift\n hash[:conversion_rate] = row.shift\n hash[:reporting_fund] = row.shift\n hash[:allocated_fund] = row.shift\n hash[:invoice_line_amount] = row.shift\n hash[:percentage] = row.shift\n cost_share = hash[:invoice_line_amount] * (hash[:percentage] / 100_000_000.0)\n converted_cost_share = convert_currency(hash[:conversion_rate], cost_share)\n converted_total = convert_currency(hash[:conversion_rate], hash[:invoice_line_amount])\n hash[:converted_inv_line_amount] = converted_total\n hash[:converted_cost_share] = converted_cost_share\n hash[:account_number] = row.shift\n hash[:ledger] = row.shift\n results[mfhd_id] << hash\n end\n end\n end\n results\nend", "def gather_results(spec, output, result)\n {\n :arch => RbConfig::CONFIG[\"arch\"],\n :vendor => RbConfig::CONFIG[\"target_vendor\"],\n :os => RbConfig::CONFIG[\"target_os\"],\n :machine_arch => RbConfig::CONFIG[\"target_cpu\"],\n :name => spec.name,\n :version => spec.version,\n :platform => spec.platform,\n :ruby_version => RUBY_VERSION,\n :result => result,\n :test_output => output\n }.to_yaml\n end", "def fetch_hash(with_table=nil)\n @result.fetch_hash with_table\n end", "def create_expected_results(hash)\n\t\treturn hash.inject({}){|obj,memo|k,v=memo[0].to_s,memo[1].to_i;obj[k] = v;obj}\n\tend", "def results\n @results ||= {}\n end", "def next_result()\n #This is a stub, used for indexing\n end", "def return_for_targets(data)\n data.each_with_object(@data) do |(target, result), hsh|\n raise \"Mocked results must be hashes: #{target}: #{result}\" unless result.is_a? Hash\n # set the inventory from the BoltSpec::Plans, otherwise if we try to convert\n # this target to a string, it will fail to string conversion because the\n # inventory is nil\n hsh[target] = result_for(Bolt::Target.new(target, @inventory), **Bolt::Util.walk_keys(result, &:to_sym))\n end\n raise \"Cannot set return values and return block.\" if @return_block\n @data_set = true\n self\n end", "def results(progA, progB); @results[@progs[progA], @progs[progB]]; end", "def fetch_hash_all\n fetch_many0(nil, Hash)\n end", "def results; end", "def results; end", "def results; end", "def each\n return unless @result\n\n @result.each(as: :hash, symbolize_keys: true) do |row|\n next unless row # This sometimes happens when streaming results...\n row = Hash[row.map { |k, v| [k, v.to_s] }] if @type_translation == :string\n yield row\n end\n end", "def hash\n end", "def hash\n end", "def hash\n end", "def hash\n @hash || calculate_hash!\n end", "def get_prev_hash(*params); raise('Stub or mock required.') end", "def search_results_hashes\n wait_until_bus_section_load\n search_results_table.rows_text.map{ |row| Hash[*search_results_table.headers_text.zip(row).flatten] }\n end", "def make_result_info\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def build_driver_hash(all_rides, all_drivers)\n all_rides.each_pair do |driver, data|\n all_drivers[driver] = 0\n end\n return all_drivers\nend", "def prepare_result; end", "def use_result\n store_result\n end", "def hash\n [host_list, total_matching, total_returned].hash\n end", "def yield_hash_rows(res, cols)\n res.ntuples.times do |recnum|\n converted_rec = {}\n cols.each do |fieldnum, type_proc, fieldsym|\n value = res.getvalue(recnum, fieldnum)\n converted_rec[fieldsym] = (value && type_proc) ? type_proc.call(value) : value\n end\n yield converted_rec\n end\n end", "def yield_hash_rows(res, cols)\n res.ntuples.times do |recnum|\n converted_rec = {}\n cols.each do |fieldnum, type_proc, fieldsym|\n value = res.getvalue(recnum, fieldnum)\n converted_rec[fieldsym] = (value && type_proc) ? type_proc.call(value) : value\n end\n yield converted_rec\n end\n end", "def hash\n [query, sample_rate].hash\n end", "def each_hash(the_query, with_table_names = false, &block)\n begin\n query(the_query)\n unless @result.nil?\n @affected_rows = @result.num_rows # This is non-zero is we do a select, and get results.\n if block_given?\n @result.each_hash(with_table_names, &block)\n else\n result = []\n @result.each_hash(with_table_names) { |row| result << row }\n return result\n end\n end\n rescue Mysql::Error => e\n # puts \"#{e.errno}: #{e.error}\"\n raise e\n ensure\n if block_given? && @result != nil\n @result.free\n end\n end\n end", "def merge_resultsets(result1, result2); end", "def merge_resultsets(result1, result2); end", "def merged_result; end", "def next_hash\n result = @stmt.step\n return nil if result.nil?\n unless result.kind_of?(Hash)\n result_ary = result\n result = {}\n result_ary.each_with_index do |el, i|\n result[@stmt.column_name(i)] = el\n end\n end\n result\n end", "def results\n content = Nokogiri::XML::Builder.new do |xml|\n xml.get_results(filter: \"first=1 rows=#{MAX_RESULTS} task_id=#{id}\", details: 1)\n end\n Hash.from_xml(@agent.sendrecv(content.to_xml)).deep_symbolize_keys\n end", "def to_hash\r\n result = {}\r\n each do |elt|\r\n result[elt] = yield(elt)\r\n end\r\n result\r\n end", "def raw_results\n results\n end", "def call\n if hash?\n return iterate_hash { |*args, **opts| yield(*args, **opts) }\n end\n\n iterate { |*args, **opts| yield(*args, **opts) }\n end", "def hash\n [compute, group_by, index, multi_compute, search].hash\n end", "def offers_hashes\n fail NotImplementedError\n end", "def result\n Hash[\n value.map do |k, v|\n [k, calling_mapper.for(v).result]\n end\n ]\n end", "def generate_results!(key)\n generate_results(key, true)\n end", "def each_hash\n if block_given?\n while row = next_hash\n yield row\n end\n else\n self.enum_for(:each_hash)\n end\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = GenomesResultSet.new(resp)\n return results\n end", "def hash(*) end", "def resultset_to_hash(resultset)\n meta = resultset.meta_data\n rows = []\n\n while resultset.next\n row = {}\n\n (1..meta.column_count).each do |i|\n name = meta.column_name i\n row[name] = case meta.column_type(i)\n when -6, -5, 5, 4\n # TINYINT, BIGINT, INTEGER\n resultset.get_int(i).to_i\n when 41\n # Date\n resultset.get_date(i)\n when 92\n # Time\n resultset.get_time(i).to_i\n when 93\n # Timestamp\n resultset.get_timestamp(i)\n when 2, 3, 6\n # NUMERIC, DECIMAL, FLOAT\n case meta.scale(i)\n when 0\n resultset.get_long(i).to_i\n else\n BigDecimal.new(resultset.get_string(i).to_s)\n end\n when 1, -15, -9, 12\n # CHAR, NCHAR, NVARCHAR, VARCHAR\n resultset.get_string(i).to_s\n else\n resultset.get_string(i).to_s\n end\n end\n\n rows << row\n end\n rows\nend", "def test_results_to_hash\n results = [1, \" \", \"3\", \"4\", 5, 6]\n phs = @parser.results_to_hash(results, 7)\n exp_msg = 1\n exp_spc = 2\n exp_key = \"3\"\n exp_val = \"4\"\n exp_ask = 5\n exp_asv = 6\n exp_opt = 7\n assert_equal exp_msg, phs[:msg]\n assert_equal exp_spc, phs[:spc]\n assert_equal exp_key, phs[:key]\n assert_equal exp_val, phs[:val]\n assert_equal exp_ask, phs[:ask]\n assert_equal exp_asv, phs[:asv]\n assert_equal exp_opt, phs[:opt]\n end", "def to_hash(*)\n mapper.new(self).to_hash\n end", "def hashes\n return @hashes\n end", "def resultset; end", "def or other_hash\n return self if other_hash.nil?\n result = {}\n new_keys = self.keys | other_hash.keys\n new_keys.each do |key|\n value1 = self[key]\n value2 = other_hash[key]\n if block_given?\n result[key] = yield value1, value2\n elsif value1.nil? and not value2.nil?\n result[key] = value2\n elsif (not value1.nil?) and value2.nil?\n result[key] = value1\n elsif value1 == value2 or value1.eql?(value2)\n result[key] = value1 \n elsif value1.class == value2.class && value1.respond_to?(:|)\n result[key] = (value1 | value2)\n else # Hash#merge behavior\n result[key] = value2\n end\n end\n result\n end", "def synchronize_resultset; end", "def hash\n [grand_total, skip_empty_buckets, timeout, priority, query_id, use_cache, populate_cache, use_result_level_cache, populate_result_level_cache, by_segment, finalize, chunk_period, max_scatter_gather_bytes, max_queued_bytes, serialize_date_time_as_long, serialize_date_time_as_long_inner, enable_parallel_merge, parallel_merge_parallelism, parallel_merge_initial_yield_rows, parallel_merge_small_batch_rows].hash\n end", "def to_h\n { :timestamp => @timestamp, \n :algorithms => @algorithms.map { |algo| algo.to_h }\n }\n end", "def all_hash\n results = CONNECTION.execute(\"SELECT * FROM #{get_table_name};\")\n return array_list = make_object_array(results)\n end", "def to_hash\n result = {}\n each_pair { |name,results| result[name] = results }\n result\n end", "def run\n @results = Hash.new\n permutation.each do |options|\n simulation = Simulation.new(options).execute\n if block_given?\n @results[simulation.command] = yield(simulation)\n else\n @results[simulation.command] = simulation\n end\n end\n end", "def linkMetadataToResults(metas)\n\n # Go through metadata\n # m - has all metadata combined\n m = {} \n metas.each do |t|\n # Skip metadata from old blobs\n if t.metadata_blob_id != nil && t.devfile_blob_id != t.metadata_blob_id\n next\n end\n \n # n - has metadata of one file \n n = {}\n \n store = m[t.devfile_id]\n \n # Is there already data for this devfile_id\n if store == nil\n # No data for this devfile yet, create it\n n.merge!({t.metadatatype => t.metadata_value})\n \n # Add metadata of this file to combined metadata\n m.merge!({t.devfile_id => n })\n\n else\n block = store[t.metadatatype]\n\n # Is there already this metadatatype\n if block == nil\n # Create the new metadatatype for this file\n store.merge!({t.metadatatype => t.metadata_value})\n elsif t.metadatatype == \"tag\" or t.metadatatype == \"context_hash\"\n # Add new metadatatype for this file\n store.merge!({t.metadatatype => block + \", \" + t.metadata_value})\n end\n \n # Add metadata of this file to combined metadata\n m.merge!({t.devfile_id => store }) \n end\n end \n \n \n \n \n # link metadata to right result, with hash\n @results.each do |r|\n mdata = m[r.devfile_id.to_i]\n if mdata != nil\n #puts \"r: #{r.devfile_file_id.to_s}\"\n @metadatas.merge!({r.devfile_id.to_i => mdata})\n end\n end\n \n \n\n \n \n end", "def results_as_objects(results)\n results_as_objects = []\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects \n end", "def hash\n swap\n scatter\n completed_string\n end", "def select\n hsh = ::Archetype::Hash.new\n self.each do |key, value|\n hsh[key] = value if yield(key, value)\n end\n return hsh\n end", "def select\n hsh = ::Archetype::Hash.new\n self.each do |key, value|\n hsh[key] = value if yield(key, value)\n end\n return hsh\n end", "def calculate_values_hashes\n @values_hashes || recalculate_values_hashes\n end", "def raw_hash_with_cycles\n @raw_hash_with_cycles ||= self.class.fetch_raw_hash_with_cycles block_hash\n end", "def hash\n\t\t[@a, @b, self.class::D].hash\n\tend", "def hashes_for(*args)\n return matches_for(*args).map { |match| match.hash }\n end", "def generate_result(obj, key)\n obj.tap do |a|\n rkey = key[0]\n (rt = root?(rkey)) and probe(0, rt, key[1..-1], a)\n !a.empty? and yield(rkey, a)\n end\n end", "def get_valid_results(drvs)\n drv_list_str = drvs.map { |d| \"\\\"#{d}\\\"\" }.join(\", \")\n query = <<END\nselect d.path, o.id, o.path\nfrom ValidPaths d\njoin DerivationOutputs o on d.id == o.drv\njoin ValidPaths v on o.path == v.path\nwhere d.path in (#{drv_list_str});\nEND\n r = {}\n nix_db.execute(query) do |drv, output_id, output_path|\n drv = drv.to_sym\n r[drv] ||= {}\n r[drv][output_id.to_sym] = output_path\n end\n r\nend", "def go!\n results = {}\n dups = []\n\n @enumerable.each do |line|\n line.strip!\n sequences(line).each do |sequence|\n if results[sequence]\n dups << sequence\n else\n results[sequence] = line\n end\n end\n end\n \n # Remove dups from the results map\n dups.each { |dup| results.delete(dup) }\n \n if block_given?\n results.each do |k,v|\n yield(k,v)\n end\n end\n\n results\n end" ]
[ "0.57877463", "0.57007825", "0.56494826", "0.5632043", "0.56057423", "0.56017214", "0.55607474", "0.5553489", "0.555235", "0.55475515", "0.5543713", "0.55344355", "0.55117965", "0.54950285", "0.5489595", "0.5467286", "0.5443337", "0.54361165", "0.54039854", "0.53991973", "0.5394864", "0.537139", "0.53657323", "0.5364368", "0.5341839", "0.53284544", "0.53284544", "0.53284544", "0.5319184", "0.53181064", "0.53181064", "0.53181064", "0.5317824", "0.5291154", "0.52554375", "0.5250013", "0.5248554", "0.5248554", "0.5248554", "0.5248554", "0.5248554", "0.5248554", "0.5248554", "0.524078", "0.524078", "0.524078", "0.524078", "0.524078", "0.524078", "0.524078", "0.524078", "0.524078", "0.524078", "0.52345544", "0.5228542", "0.52278143", "0.5226197", "0.5219034", "0.5219034", "0.5204515", "0.52004534", "0.51980364", "0.519731", "0.51840866", "0.5183829", "0.5180324", "0.51794034", "0.5176886", "0.5172349", "0.5169063", "0.5165548", "0.51368296", "0.5123841", "0.51236665", "0.5115041", "0.5114477", "0.5111042", "0.5107086", "0.5105112", "0.50990206", "0.50962305", "0.5081795", "0.50798124", "0.50672865", "0.5059849", "0.5056851", "0.505177", "0.5048405", "0.50428337", "0.50384283", "0.5034849", "0.50274074", "0.50274074", "0.5024488", "0.5010443", "0.5010021", "0.5000311", "0.49996832", "0.49983212", "0.49964824" ]
0.6416849
0
Must return the MySQL error number from the exception, if the exception has an error number.
def error_number(exception) # :nodoc: raise NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sqlite_error_code(exception)\n exception.resultCode.code if exception.respond_to?(:resultCode)\n end", "def error_code(exception)\n case exception\n when Java::JavaSql::SQLException\n exception.getErrorCode\n else\n nil\n end\n end", "def error_code\n if ( @error_code ||= nil ).nil?\n @error_code = jdbc_exception ? jdbc_exception.getErrorCode : nil\n else\n @error_code\n end\n end", "def error_number; end", "def jdbc_exception; @jdbc_exception end", "def errnum\r\n self.class.errnum\r\n end", "def geterrorcode()\r\n return getvalue(@@ERROR_CODE)\r\n end", "def code\n @errorcode\n end", "def errno\n @last_error ? @last_error.errno : 0\n end", "def error_code\n @data[\"code\"] || 0\n end", "def error_code\n @request['error']['code'].to_i\n end", "def errors_count\n @error_rows_codes.count\n end", "def errors_count\n @error_rows_codes.count\n end", "def errors_count\n @error_rows_codes.count\n end", "def safe_rescue_exception?(exception)\n # Exceptions to be safe rescued\n errors = [\n { :type => PG::UniqueViolation, :messages => [\"ERROR: duplicate key value violates unique constraint\"] }, # Happens when primary key (id) is overwritten with where or create_with value\n { :type => PG::InvalidParameterValue, :messages => [\"ERROR: invalid hexadecimal digit\"] }, # Happens when setting binary_col with invalid values (usually when not going through Active Record, for example with update_columns/update_column)\n { :type => PG::InvalidTextRepresentation, :messages => [\"ERROR: invalid input syntax for type\"] }, # Happens when setting columns with special types (for example booleans or decimals) with invalid values (usually when not going through Active Record, for example with update_columns/update_column)\n { :type => PG::InvalidTextRepresentation, :messages => [\"ERROR: invalid input syntax for integer\"] }, # Happens when setting integer columns with invalid values (usually when not going through Active Record, for example with update_columns/update_column)\n { :type => PG::InvalidDatetimeFormat, :messages => [\"ERROR: invalid input syntax for type\"] }, # Happens when setting datetime columns with invalid values (usually when not going through Active Record, for example with update_columns/update_column)\n { :type => PG::DatetimeFieldOverflow, :messages => [\"ERROR: date/time field value out of range\"] }, # Happens when setting datetime columns with values without range, for example the value 0 (usually when not going through Active Record, for example with update_columns/update_column)\n { :type => PG::SyntaxError, :messages => [\"ERROR: syntax error at or near \\\"DISTINCT\\\"\", \"DISTINCT DISTINCT\"] }, # This is necessary due to a bug in Rails finder options when setting a limit, distinct true and eager_load on has_many or has_and_belongs_to_many\n { :type => PG::AmbiguousColumn, :messages => [\"ERROR: column reference \\\"id\\\" is ambiguous\"] }, # Happens when setting a value for finder option having while also setting a value for finder option eager_load or joins (it is probable expecting a different input format for having then)\n { :type => ActiveRecord::RecordNotFound, :messages => [] }, # Happens when we try to find a non-existing record (for example by using the find method with an unknown id)\n { :type => ActiveRecord::ConfigurationError, :messages => [\"Association named\", \"was not found\"] }, # Happens when trying to set an association method (for example includes) with an invalid association name\n { :type => ArgumentError, :messages => [\"invalid value for Integer()\"] }, # Happens when setting an invalid value for the limit finder option\n { :type => ArgumentError, :messages => [\"argument out of range\"] }, # Happens when setting an very small or very large value (such as 0000-00-00 00:00:00) for a datetime field (and possibly other fields)\n ]\n errors.each do |error|\n if exception.is_a?(error[:type])\n match = true\n error[:messages].each do |message|\n unless exception.message.scan(message).present?\n match = false\n break\n end\n end\n return true if match\n end\n end\n false\n end", "def foreign_key_error?(exception)\n exception.message =~ /query does not return ResultSet/\n end", "def errorcount\r\n\t\t\t`#{BITS::BITSADMIN} /geterrorcount {#{@id}}`\r\n\t\tend", "def code\n @error['code']\n end", "def exit_status_from_exception; end", "def results_errno()\n r = attr_get(\"status\")\n if(r.eql?(\"passed\"))\n 0\n end\n r = attr_get(\"errno\")\n unless r\n r = -1\n end\n r\n end", "def sql_state; jdbc_exception ? jdbc_exception.getSQLState : nil end", "def status_code_for_exception(exception)\n Egregious.status_code_for_exception(exception)\n end", "def handle_sql_exception(ex, sql = nil)\n error \"DB error #{ex}, [#{sql}]\"\n error ex.backtrace.join(\"\\n\")\n raise StoreException.new(ex, sql) if Og.raise_store_exceptions\n\n # FIXME: should return :error or something.\n return nil\n end", "def database_specific_error_class(exception, opts)\n case exception.errno\n when 1048\n NotNullConstraintViolation\n when 1062\n UniqueConstraintViolation\n when 1451, 1452\n ForeignKeyConstraintViolation\n else\n super\n end\n end", "def operation_error\n (connection.get_operation_result.code == 0) ? nil : connection.get_operation_result\n end", "def get_redshift_error\n sql = <<-RE.squish\n SELECT filename, line_number, colname, type, raw_field_value, raw_line, err_reason\n FROM STL_LOAD_ERRORS\n WHERE filename like '%#{import_file}%'\n ORDER BY starttime desc\n LIMIT 1\n RE\n result = ::RailsRedshiftReplicator.connection.exec(sql).entries\n error = result.first.map{ |k, v| [k, v.strip].join('=>') }.join(\";\")\n replication.update_attribute :last_error, error\n end", "def error_count\n peek('origen.debug.errors').to_i\n end", "def index_for row\n ie = insert_error_for row\n return ie.index if ie\n nil\n end", "def get_error_code\n codes = get_error_codes\n return '' if codes.empty?\n codes[0]\n end", "def determine_exit_code(db)\n if db.insert_count > 0 then 2 else 0 end\nend", "def error(ex) [:error, ex]; end", "def error_for_message(msg)\n unless @errors\n with_reader do |conn|\n @errors = (0..127).inject({}) do |h, err|\n h[conn.err2string(err)] = err; h\n end\n end\n @errors.delete(\"Unknown error\")\n end\n @errors[msg]\n end", "def identify_error\n begin\n yield\n rescue => ex\n ex.message.insert(0, \"#{@id} error: \")\n raise\n end\n end", "def translate_exception(exception, message) #:nodoc:\r\n return super unless exception.respond_to?(:errno)\r\n case exception.errno\r\n when 2121\r\n if exception.sql !~ /^SELECT/i then\r\n raise ActiveRecord::ActiveRecordError.new(message)\r\n else\r\n super\r\n end\r\n when 7076\r\n raise InvalidForeignKey.new(message, exception)\r\n when 7057\r\n raise RecordNotUnique.new(message, exception)\r\n else\r\n super\r\n end\r\n super\r\n end", "def get_line(exception)\n # SyntaxErrors have weird line reporting\n # when there's trailing whitespace,\n # which there is for BabyBro documents.\n return (exception.message.scan(/:(\\d+)/).first || [\"??\"]).first if exception.is_a?(::SyntaxError)\n (exception.backtrace[0].scan(/:(\\d+)/).first || [\"??\"]).first\n end", "def error_count\n return @error_count\n end", "def merror(pset, pnum)\n vidioma = $idioma\n vidioma = 'es'\n mer = Errormessage.where(\"idioma_isocod2 = '#{vidioma}' AND msg_set = #{pset} AND msg_num = #{pnum} \").first\n if mer\n mer.contenido.html_safe\n else\n \"Error Number: \"+pset.to_s+\",\"+pnum.to_s\n end\nend", "def expect_db_error(&block)\n begin\n db_error, other_error = 'db_ok', 'other_ok'\n yield\n rescue ActiveRecord::StatementInvalid\n db_error = 'db_error'\n rescue\n other_error = 'other_error'\n end\n expect(other_error).to eql 'other_ok'\n expect(db_error).to eql 'db_error'\nend", "def errno; end", "def errno\n self.class::Errno\n end", "def error(exception) nil ; end", "def check_error_no\n @error_no = 0\n if @err_bit\n if @data != nil && @data.size > 0\n @error_no = (0x0 - 0xFFFFFFFF + (BioPacket.swap_dword(@data.first) - 1)).to_i\n @error_desc = BioPacket.format_err_desc(@error_no)\n $test_logger.log(\"Error#{(\" in ACK\" if @ack_bit)}: #{@error_no} #{@error_desc}\")\n else \n $test_logger.log(\"Error bit is set but error code not found!!\")\n end\n end\n end", "def get_error_text\n if error_code == CartoDB::NO_ERROR_CODE\n CartoDB::NO_ERROR_CODE\n elsif error_code.blank? || error_code == GENERIC_ERROR_CODE\n connector_error_message || CartoDB::IMPORTER_ERROR_CODES[GENERIC_ERROR_CODE]\n else\n CartoDB::IMPORTER_ERROR_CODES[error_code]\n end\n end", "def error_count\n peek(\"#{testbench_top}.debug.errors\").to_i\n end", "def extract_error_code response\n return unless response\n return unless response['data'] && response['data'].class == Hash\n return unless response['data']['errorCode']\n\n response['data']['errorCode'].to_i\n end", "def raise_error\n code = lib.tcidbecode( @db )\n msg = lib.tcidberrmsg( code )\n raise Error.new(\"[ERROR #{code}] : #{msg}\")\n end", "def processerror(i,errormsg)\n linenum = errormsg.backtrace[0].split(':')[1]\n\tdberror = \"[#{linenum}] #{errormsg}\"\n puts \"error for oid: #{i[\"oid\"]} errormsg: #{dberror}\"\n\tputs \"ERROR:\" + errormsg.backtrace.to_s\n\tputs \"STACK:\" + errormsg.backtrace.to_s\n\tehid = @@client.execute(%Q/insert into dbo.hydra_publish_error (hpid,date,oid,error) values (#{i[\"hpid\"]},GETDATE(),#{i[\"oid\"]},\"#{dberror}\")/)\n\tehid.insert\n end", "def lookup_error_code(err)\n @@ErrorPatternsToCode.each do |rx,code|\n return code if rx =~ err\n end\n @@UnknownErrorCode\n end", "def error\n @last_error && @last_error.error\n end", "def error_code\n raise BASICRuntimeError.new(:te_err_no_err) if @error_stack.empty?\n\n code = @error_stack[-1]\n NumericConstant.new(code)\n end", "def error_count\n @@state[@server] ? @@state[@server][:count] : 0\n end", "def error_code\n extract_raw_value __callee__\n end", "def errored\n @errored ||= count('errored')\n end", "def previous_error\n error = command(:getpreverror => 1)\n error[\"err\"] ? error : nil\n end", "def db_error_handler(exception)\n logger.error exception.message\n logger.error exception.backtrace.join(\"\\n\")\n config = Rails.configuration.database_configuration\n host = config[Rails.env][\"host\"]\n database = config[Rails.env][\"database\"]\n username = config[Rails.env][\"username\"]\n password = config[Rails.env][\"password\"]\n default_params = { :adapter => \"mysql2\",\n :host => host,\n :username => username,\n :password => password,\n :database => database }\n if !(exception.message =~(/Table '(\\w+).(\\w+)' doesn't exist/i)).nil?\n matchdata = exception.message.match(/Table '(\\w+).(\\w+)' doesn't exist/i)\n if !matchdata[1].blank? && matchdata[1] != 'openweb' \n ActiveRecord::Base.establish_connection(default_params)\n redirect_to auth_hub.dashboard_path\n return\n end\n elsif !(exception.message =~(/Unknown database/i)).nil?\n ActiveRecord::Base.establish_connection(default_params)\n flash[:error] = \"Database non presente\"\n redirect_to auth_hub.dashboard_path\n else\n raise ActionController::RoutingError.new('Not Found')\n end\n \n end", "def duplicate_key_update_error?(exception)# :nodoc:\n exception.is_a?(ActiveRecord::JDBCError) && exception.to_s.include?('Duplicate entry')\n end", "def last_exception\n nil\n end", "def http_err_code\n http_codes[@http_err]\n end", "def error_sqlstate\n IBM_DB.getErrorstate(@conn, IBM_DB::DB_CONN)\n end", "def exception_codes\n return Egregious.exception_codes\n end", "def error\n 1/0\n end", "def database_exception_sqlstate(exception, opts)\n nil\n end", "def get_number_in_exception\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/error/numberInException'\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 = @http_client.get(\r\n _query_url,\r\n headers: _headers\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 if _context.response.status_code == 444\r\n raise ExceptionWithNumberException.new(\r\n 'number in exception',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end", "def error\n errors.first\n end", "def error\n errors.first\n end", "def error_count(queue)\n collection.find(conditions(queue).merge({ :error => { '$ne' => nil } })).count\n end", "def getError\n return @error\n end", "def error\n @current_offset\n end", "def error_count\n Array(@gapi.insert_errors).count\n end", "def error\n return unless id.nil?\n @error ||= @response['message']\n end", "def get_error_code(code)\n assert_not_nil @rdigg.info.get_error_code(\"500\")\n end", "def check_return_code(ret, key = nil) #:doc:\n if ret == 0 # Lib::MEMCACHED_SUCCESS\n elsif ret == 32 # Lib::MEMCACHED_BUFFERED\n elsif ret == 16\n raise @not_found # Lib::MEMCACHED_NOTFOUND\n elsif ret == 14\n raise @not_stored # Lib::MEMCACHED_NOTSTORED\n else\n reraise(key, ret)\n end\n rescue TypeError\n # Reached if show_backtraces is true\n reraise(key, ret)\n end", "def error!\n throw :return, -1\n end", "def error!\n # Unhandled exception\n if @exception\n exception_message\n exit 2\n # Some checksums did not match?\n elsif !(invalid_packages.empty? && invalid_metadata_files.empty?)\n error_message\n exit 2\n # We don't have checksums for some packages?\n elsif unverifiable_package_count != 0\n unverifiable_packages_message\n exit 2\n else\n success_message\n exit 0\n end\n end", "def line_number\n return unless backtrace and backtrace[0]\n\n backtrace[0].split(\":\")[1].to_i\n end", "def last_error\n @error.respond_to?(:message) ? @error.message : @error\n end", "def insert_count\n @rows.count - error_count\n end", "def get_error(error_text,tenant_id)\n error = Error.find_by_error_text_and_tenant_id(error_text.downcase,tenant_id)\n if error.nil? or error.blank?\n error = create_error(error_text.downcase,tenant_id)\n end\n return error.id\n end", "def error_to_line_number(error, doc)\n return 0 unless doc\n\n nodes = doc.search(error.location)\n return 0 if nodes.count.zero? || nodes.first.class != Nokogiri::XML::Element\n\n nodes.first.line\n end", "def error\n errors.first\n end", "def error_msg\n IBM_DB.getErrormsg(@conn, IBM_DB::DB_CONN)\n end", "def status\n return 404 if NOT_FOUND_ERRORS.include? @exception.class.to_s\n @exception.respond_to?(:http_status) ? @exception.http_status : 500\n end", "def get_line_number(error)\n error_to_line_number(error, get_doc(error.test_execution.artifact, error.file_name))\n end", "def last_exit_code\n Integer(capture(\"echo $?\"))\n end", "def get_last_error()\n return @last_error\n end", "def errmsg(message); end", "def rescue_from(exception); end", "def report_error(err)\n case err.message\n when Creator::REPOSITORY_CREATION_FAILED\n GitHubClassroom.statsd.increment(\"v2_exercise_repo.create.repo.fail\")\n when Creator::REPOSITORY_COLLABORATOR_ADDITION_FAILED\n GitHubClassroom.statsd.increment(\"v2_exercise_repo.create.adding_collaborator.fail\")\n when Creator::REPOSITORY_STARTER_CODE_IMPORT_FAILED\n GitHubClassroom.statsd.increment(\"v2_exercise_repo.create.importing_starter_code.fail\")\n else\n GitHubClassroom.statsd.increment(\"v2_exercise_repo.create.fail\")\n end\n end", "def error(rc)\n return rc[0].strip if rc[2].success?\n\n puts \"ERROR: #{rc[1]}\"\n\n exit(-1)\nend", "def recoverable?; jdbc_exception.is_a?(Java::JavaSql::SQLRecoverableException) end", "def check_error(response) #:nodoc:\n case response.code\n when 200 then # ignore, ok\n when 500 then\n raise Error, 'server error'\n when 601 then\n raise AddressError, 'missing address'\n when 602 then\n raise AddressError, 'unknown address'\n when 603 then\n raise AddressError, 'unavailable address'\n when 610 then\n raise CredentialsError, 'invalid key'\n when 620 then\n raise CredentialsError, 'too many queries'\n else\n raise Error, \"unknown error #{response.code}\"\n end\n end", "def error\n @error\n end", "def log_error(exception); end", "def sqlstate\n @last_error ? @last_error.sqlstate : \"00000\"\n end", "def error_key\n self.class.error_key\n end", "def error\r\n\t\t\t`#{BITS::BITSADMIN} /geterror {#{@id}}`\r\n\t\tend", "def error\n return @error\n end", "def findCsvRowError (row)\n error = nil\n\n if row.size != 4\n error = 'Row does not have 4 entries'\n elsif !row.key?('object_id') || row['object_id'] == '' || !isPositiveInteger?(row['object_id'])\n error = 'Row object_id does not correspond to a valid integer'\n elsif !row.key?('object_type') || row['object_type'] == ''\n error = 'Row object_type does not correspond to a non-empty string'\n elsif !row.key?('timestamp') || row['timestamp'] == '' || !isPositiveInteger?(row['timestamp'])\n error = 'Row timestamp does not correspond to a valid integer'\n elsif !row.key?('object_changes')\n error = 'Row object_changes is not a valid json structure'\n else\n begin\n JSON.parse(row['object_changes'])\n rescue JSON::ParserError => e\n error = 'Row object_changes is not a valid json structure'\n end\n end\n\n return error\n end", "def failure_message\n +\"expected to find #{description}\" << count_message\n end", "def exception\n @__exception\n end" ]
[ "0.7294421", "0.72759324", "0.69282037", "0.6549092", "0.6456522", "0.64231855", "0.62017584", "0.61924934", "0.61848027", "0.61785", "0.61143553", "0.6101044", "0.6101044", "0.6101044", "0.5991355", "0.59792393", "0.5892648", "0.5855871", "0.58156127", "0.5814836", "0.58084345", "0.5807907", "0.5788223", "0.5770442", "0.5764172", "0.5754619", "0.574613", "0.57269347", "0.5726401", "0.57124364", "0.5699669", "0.5699013", "0.5681061", "0.56285834", "0.5627836", "0.5622077", "0.56115866", "0.55983245", "0.5594599", "0.55582815", "0.55428135", "0.55380213", "0.55376595", "0.5502011", "0.54939073", "0.54893196", "0.5486795", "0.54809815", "0.547269", "0.5468399", "0.5458875", "0.54542524", "0.54361695", "0.541848", "0.5400305", "0.53876877", "0.53836477", "0.53813934", "0.5366708", "0.53623694", "0.53611207", "0.5359399", "0.5354725", "0.5348312", "0.5348312", "0.5346379", "0.53386384", "0.53356063", "0.5334955", "0.53242505", "0.53189915", "0.53151596", "0.52997553", "0.5297423", "0.52959037", "0.52887285", "0.52864105", "0.5274504", "0.5273888", "0.5267993", "0.5267952", "0.5255878", "0.52439356", "0.523839", "0.52058", "0.51982725", "0.517992", "0.51663786", "0.51617986", "0.51522213", "0.5151447", "0.5150881", "0.5146102", "0.5142731", "0.5137536", "0.5131739", "0.5127761", "0.51260316", "0.51256806", "0.511837" ]
0.7238417
2
DATABASE STATEMENTS ====================================== ++ Mysql2Adapter doesn't have to free a result after using it, but we use this method to write stuff in an abstract way without concerning ourselves about whether it needs to be explicitly freed or not.
def execute_and_free(sql, name = nil, async: false) # :nodoc: sql = transform_query(sql) check_if_write_query(sql) mark_transaction_written_if_write(sql) yield raw_execute(sql, name, async: async) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flushdb; end", "def commit(q)\n\t\tdbh=Mysql.init\n\t\tdbh.real_connect(@host, @user, @password, @db,@port,nil,Mysql::CLIENT_MULTI_RESULTS)\n\t\tdbh.query_with_result=false\n\t\tdbh.query(q)\n\t\t\tbegin\n\t\t\t rs = dbh.use_result\n\t\t\trescue Mysql::Error => e \n\t\t\t no_more_results=true\n\t\t\tend \n\t\tif rs.fetch_row == nil\n\t\t\treturn nil\n\t\telse\n\t\t\treturn rs\n\t\tend\n\tend", "def do_sql_command(sql, use_global_connection = true, close_connection = false)\n begin\n \n if use_global_connection \n dbconn = open_conn\n else\n dbconn = open_conn(false)\n end\n \n dbres = dbconn.query(sql)\n\n rescue Mysql::Error => err\n raise err\n ensure\n close_conn(dbconn) if close_connection\n end\n \n dbres\nend", "def _execute(conn, sql, opts)\n r = log_connection_yield((log_sql = opts[:log_sql]) ? sql + log_sql : sql, conn){conn.query(sql)}\n if opts[:type] == :select\n yield r if r\n elsif defined?(yield)\n yield conn\n end\n if conn.respond_to?(:more_results?)\n while conn.more_results? do\n if r\n r.free\n r = nil\n end\n begin\n conn.next_result\n r = conn.use_result\n rescue Mysql::Error => e\n raise_error(e, :disconnect=>true) if MYSQL_DATABASE_DISCONNECT_ERRORS.match(e.message)\n break\n end\n yield r if opts[:type] == :select\n end\n end\n rescue Mysql::Error => e\n raise_error(e)\n ensure\n r.free if r\n # Use up all results to avoid a commands out of sync message.\n if conn.respond_to?(:more_results?)\n while conn.more_results? do\n begin\n conn.next_result\n r = conn.use_result\n rescue Mysql::Error => e\n raise_error(e, :disconnect=>true) if MYSQL_DATABASE_DISCONNECT_ERRORS.match(e.message)\n break\n end\n r.free if r\n end\n end\n end", "def commit\n # Nothing to do for an in memory database\n end", "def close\n @mysql.close\n @mysql = nil\n end", "def execute_and_clear(sql, name, binds)\n ret = nil\n if sql.include? \"SELECT \\\"users\\\".* FROM \\\"users\\\"\" and sql.include? 'LIMIT'\n logger.debug \"Returning in-memory users\"\n # instrumentation is inserted at #log, so we fake the call here\n log(sql, name, binds) { io_sleep }\n count = sql.scan(/LIMIT\\s(\\d+)/).last.last.to_i\n ret = ActiveRecord::Result.new(users[:cols],users[:rows][0..(count-1)])\n elsif sql.include? \"SELECT \\\"cities\\\".* FROM \\\"cities\\\"\" and sql.include? 'LIMIT'\n logger.debug \"Returning in-memory cities\"\n # instrumentation is inserted at #log, so we fake the call here\n log(sql, name, binds) { io_sleep } \n count = sql.scan(/LIMIT\\s(\\d+)/).last.last.to_i\n ret = ActiveRecord::Result.new(cities[:cols],cities[:rows][0..(count-1)])\n else\n result = without_prepared_statement?(binds) ? exec_no_cache(sql, name, binds) :\n exec_cache(sql, name, binds)\n ret = yield result\n result.clear\n end\n ret\n end", "def close\n @stmt.close\n end", "def commit_db_transaction() end", "def commit_db_transaction() end", "def close\n @conn.close\n super\n end", "def close\n @stmt.close\n end", "def execute\n results = ResultSet.new( @db, @statement.to_s )\n\n if block_given?\n begin\n yield results\n ensure\n results.close\n end\n else\n return results\n end\n end", "def flushdb(options = T.unsafe(nil)); end", "def synchronize_resultset; end", "def query_db (sql_statement)\n db = SQLite3::Database.new 'database.sqlite3'\n db.results_as_hash = true\n results = db.execute sql_statement\n db.close\n results\nend", "def free\n IBM_DB.free_stmt(@stmt)\n end", "def free_result\n IBM_DB.free_result(@stmt)\n end", "def execute_sql(my_sql)\n pg_result = ActiveRecord::Base.connection.execute(my_sql)\n\n # In this example we are just calling #to_a to convert the PG::Result to an\n # Array. PG::Result has a nice API for slicing and dicing itself so you may\n # want to to something clever instead. See\n # https://www.rubydoc.info/gems/pg/PG/Result for details.\n #\n # The important bit here is that we are copying all the data we care about\n # out of the PG::Result in preparation for later clearing the PG::Result\n results = pg_result.to_a\n\n # Calling #clear on the PG::Result is the important bit of cleanup and the\n # whole reason this method exists. See\n # https://www.rubydoc.info/gems/pg/PG/Result#clear-instance_method\n pg_result.clear\n\n yield results if block_given?\n\n results\nend", "def _execute(conn, sql, opts)\n begin\n r = log_yield(sql){conn.query(sql)}\n if opts[:type] == :select\n yield r if r\n elsif block_given?\n yield conn\n end\n rescue ::Mysql2::Error => e\n raise_error(e, :disconnect=>MYSQL_DATABASE_DISCONNECT_ERRORS.match(e.message))\n end\n end", "def reconnect\n @mutex.synchronize do\n require \"mysql2\" unless ::Object.const_defined?(:Mysql2)\n\n args = {\n host: @db.opts[:host],\n username: @db.opts[:user],\n password: @db.opts[:pass],\n database: @db.opts[:db],\n port: @port,\n symbolize_keys: true,\n cache_rows: false,\n encoding: encoding\n }\n\n # Symbolize keys should also be given here, else table-data wont be symbolized for some reason - knj.\n @query_args = {symbolize_keys: true}\n @query_args[:cast] = false unless @db.opts[:type_translation]\n @query_args.merge!(@db.opts[:query_args]) if @db.opts[:query_args]\n\n pos_args = [:as, :async, :cast_booleans, :database_timezone, :application_timezone, :cache_rows, :connect_flags, :cast]\n pos_args.each do |key|\n args[key] = @db.opts[key] if @db.opts.key?(key)\n end\n\n args[:as] = :array\n\n if @db.opts[:conn]\n @conn = @db.opts[:conn]\n else\n @conn = ::Mysql2::Client.new(args)\n end\n\n query(\"SET NAMES '#{esc(encoding)}'\") if encoding\n end\n end", "def commit\n @MySQLConnection.query('commit')\n end", "def close_session\n close_prepared_statement(@MySQLConnection, @StatementSelectFromStatsOrders)\n close_prepared_statement(@MySQLConnection, @StatementDeleteFromStatsOrders)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsLocations)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsCategories)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsObjects)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsValues)\n close_prepared_statement(@MySQLConnection, @StatementSelectFromStatsValues)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsBinaryValues)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsOrders)\n close_prepared_statement(@MySQLConnection, @StatementSelectFromStatsLastKeys)\n close_prepared_statement(@MySQLConnection, @StatementSelectFromStatsBinaryValues)\n close_prepared_statement(@MySQLConnection, @StatementInsertIntoStatsLastKeys)\n close_prepared_statement(@MySQLConnection, @StatementUpdateStatsLastKeys)\n close_mysql(@MySQLConnection)\n end", "def flushdb\n end", "def _execute(conn, sql, opts)\n stmt = log_connection_yield(sql, conn){conn.execute(sql)}\n if block_given?\n yield(stmt)\n else \n stmt.affected\n end\n ensure\n stmt.free if stmt\n end", "def establish_db_connection()\n @host = '127.0.0.1'\n @username = ''\n @password = ''\n\n my = Mysql.connect(@host, @username, @password)\n res = my.query('SHOW DATABASES;')\n puts res # need to be converted to string \n puts \"Tables_in_valutation\"\n res.each {|x| p x.to_s}\n res.free\nend", "def flush\n conn.transaction do\n buffer.flatten.each do |row|\n # check to see if this row's compound key constraint already exists\n # note that the compound key constraint may not utilize virtual fields\n next unless row_allowed?(row)\n\n # add any virtual fields\n add_virtuals!(row)\n \n names = []\n values = []\n order.each do |name|\n names << \"`#{name}`\"\n values << conn.quote(row[name]) # TODO: this is probably not database agnostic\n end\n q = \"INSERT INTO `#{table_name}` (#{names.join(',')}) VALUES (#{values.join(',')})\"\n ETL::Engine.logger.debug(\"Executing insert: #{q}\")\n conn.insert(q, \"Insert row #{current_row}\")\n @current_row += 1\n end\n buffer.clear\n end\n end", "def release\n chk_conn\n @connected = false\n @db.release(self)\n end", "def query_db(sql_statement)\n db = SQLite3::Database.new 'database.sqlite3'\n db.results_as_hash = true\n\n puts sql_statement # optional but nice for debugging\n\n results = db.execute sql_statement\n db.close\n results # implicit return\n\nend", "def teardown\n @db.close\n super\n end", "def flush\n return nil if @queries.empty?\n \n @args[:db].transaction do\n @queries.shift(1000).each do |str|\n STDOUT.print \"Executing via buffer: #{str}\\n\" if @debug\n @args[:db].q(str)\n end\n end\n \n return nil\n end", "def prepare(query)\n sth = nil\n mutex.synchronize do\n self.last_query = query\n sth = new_statement(query)\n yield sth if block_given?\n sth.finish if block_given?\n end\n\n return self.last_statement = sth\n end", "def begin\n db.transaction do\n yield\n end\n end", "def close\n IBM_DB.close(@conn)\n end", "def execute(sql, opts=OPTS, &block)\n super(prepared_statement_name, opts, &block)\n end", "def execute(sql, opts=OPTS)\n _execute(sql, opts) do |conn|\n begin\n yield(stmt = log_connection_yield(sql, conn){conn.prepare(sql)})\n ensure\n stmt.close if stmt\n end\n end\n end", "def close_database\n @database = nil\n @writable_database = nil\n GC.start\n end", "def close_database\n @database = nil\n @writable_database = nil\n GC.start\n end", "def prepare(name, sql)\n check_disconnect_errors{super}\n end", "def close()\n @db.close()\n end", "def closeDBConn()\n if ( !@db_conn.nil? )\n begin\n @db_conn.finish()\n rescue Exception => e\n #ignore it\n end\n end\n end", "def close_connection\n @db.close if @db\n end", "def unlock_tables(mysql2_client)\n # This statement does not return a result set\n mysql2_client.query('UNLOCK TABLES')\nend", "def begin_db_transaction() end", "def begin_db_transaction() end", "def db_write! args\n #TODO put this in rescue blocks so that if something chokes, we don't completely die, and put in a new table (or maybe a column for logging errors?)\n args.collect! do |o|\n o.is_a?(String) ? SQLite3::Database.quote(o) : o\n end\n \n sql = %{\n INSERT INTO %s\n (article_name, desc, revision_id, old_id, user, byte_diff, ts, description)\n VALUES ('%s', '%s', '%d', %d, '%s', %d, %d, '%s')\n } % ([@table_name] + args)#article_name, desc, rev_id, old_id, user, byte_diff, ts, description\n \n #deal with multiple threads writing to db\n key = Digest::MD5.hexdigest(Time.now.to_i.to_s + sql)\n @db_queue << [sql, key]\n key\n #return the primary id of the row that was created:\n #@db.get_first_value(\"SELECT last_insert_rowid()\")\n end", "def execute(*values)\n raise ClientError, \"not prepared\" unless @param_count\n raise ClientError, \"parameter count mismatch\" if values.length != @param_count\n values = values.map{|v| @mysql.charset.convert v}\n @protocol.synchronize do\n begin\n @sqlstate = \"00000\"\n @protocol.reset\n @protocol.send_packet Protocol::ExecutePacket.new(@statement_id, CURSOR_TYPE_NO_CURSOR, values)\n res_packet = @protocol.read_result_packet\n raise ProtocolError, \"invalid field_count\" unless res_packet.field_count == @fields.length\n @fieldname_with_table = nil\n if res_packet.field_count == 0\n @affected_rows, @insert_id, @server_status, @warning_conut =\n res_packet.affected_rows, res_packet.insert_id, res_packet.server_status, res_packet.warning_count\n return nil\n end\n @fields = Array.new(res_packet.field_count).map{Field.new @protocol.read_field_packet}\n @protocol.read_eof_packet\n return StatementResult.new(@mysql, @fields)\n rescue ServerError => e\n @sqlstate = e.sqlstate\n raise\n end\n end\n end", "def persist_data(db_columns_and_rows, store)\n store.transaction do\n store['db_columns_and_rows'] = db_columns_and_rows\n end\nend", "def run_sql(sql)\n db = PG.connect(dbname: 'goodfoodhunting')\n results = db.exec(sql)\n db.close\n results\nend", "def query_db (sql_statement)\n puts sql_statement # Option feature which will help for debugging\n db = SQLite3::Database.new 'database.sqlite3'\n db.results_as_hash = true\n result = db.execute sql_statement\n db.close\n result #implicitly returned\nend", "def close\n\n @db.connection.close\n end", "def prepare_result; end", "def with_connection\n ActiveRecord::Base.connection_pool.with_connection do |connection|\n connection.transaction do\n if connection.adapter_name == \"PostgreSQL\"\n connection.execute \"SET TRANSACTION READ ONLY\"\n connection.execute \"SET LOCAL statement_timeout = 100\"\n # TODO support equivalent options for other adapters (such as mysql)\n end\n\n yield connection\n end\n end\n end", "def endRun\n db_cached_connect\n\n @dbh.do(\"SELECT endRun();\")\n @dbh.do(\"COMMIT TRANSACTION;\")\n end", "def transaction\n raise Mysql::Error, 'Not Connected' if @my.nil?\n\n if block_given?\n begin\n @my.query('START TRANSACTION WITH CONSISTENT SNAPSHOT')\n yield # Start executing the query black.\n @my.query('COMMIT')\n rescue Mysql::Error => e\n @my.query('ROLLBACK')\n raise e\n end\n end\n end", "def write_db(user_hash)\n begin\n conn = open_db() # open database for updating\n max_id = conn.exec(\"select max(id) from details\")[0] # determine current max index (id) in details table\n max_id[\"max\"] == nil ? v_id = 1 : v_id = max_id[\"max\"].to_i + 1 # set index variable based on current max index value\n v_name = user_hash[\"name\"] # prepare data from user_hash for database insert\n v_age = user_hash[\"age\"]\n v_image = user_hash[\"image\"][:filename]\n v_n1 = user_hash[\"n1\"]\n v_n2 = user_hash[\"n2\"]\n v_n3 = user_hash[\"n3\"]\n v_quote = user_hash[\"quote\"]\n conn.prepare('q_statement',\n \"insert into details (id, name, age, image)\n values($1, $2, $3, $4)\") # bind parameters\n conn.exec_prepared('q_statement', [v_id, v_name, v_age, v_image])\n conn.exec(\"deallocate q_statement\")\n conn.prepare('q_statement',\n \"insert into numbers (id, details_id, n1, n2, n3)\n values($1, $2, $3, $4, $5)\") # bind parameters\n conn.exec_prepared('q_statement', [v_id, v_id, v_n1, v_n2, v_n3])\n conn.exec(\"deallocate q_statement\")\n conn.prepare('q_statement',\n \"insert into quotes (id, details_id, quote)\n values($1, $2, $3)\") # bind parameters\n conn.exec_prepared('q_statement', [v_id, v_id, v_quote])\n conn.exec(\"deallocate q_statement\")\n rescue PG::Error => e\n puts 'Exception occurred'\n puts e.message\n ensure\n conn.close if conn\n end\nend", "def close_connection_after_writing\n\t\tclose_connection true\n\tend", "def execute(sql, args=nil)\n\t\t\t\t\targs = args.map{|v| @db.bound_variable_arg(v, self)} if args\n\t\t\t\t\tq = check_disconnect_errors{execute_query(sql, args)}\n\t\t\t\t\tbegin\n\t\t\t\t\t\tblock_given? ? yield(q) : q.cmd_tuples\n\t\t\t\t\tensure\n\t\t\t\t\t\tq.clear if q && q.respond_to?(:clear)\n\t\t\t\t\tend\n\t\t\t\tend", "def execute(sql, opts = {}, &block)\n res = nil\n synchronize(opts[:server]) do |conn|\n res = check_database_errors do\n if sql.is_a?(Symbol)\n execute_prepared_statement(conn, sql, opts, &block)\n else\n log_yield(sql) do\n conn.query(sql, opts[:arguments])\n end\n end\n end\n yield res if block_given?\n res.cmd_tuples\n end\n end", "def db_close\n @dbh and @dbh.close\n @dbh = nil\n end", "def db_close\n @dbh and @dbh.close\n @dbh = nil\n end", "def commit_db_transaction\n execute(\"COMMIT\")\n end", "def commit_db_transaction\n execute(\"COMMIT\")\n end", "def execute_prepared_statement(conn, name, opts=OPTS, &block)\n ps = prepared_statement(name)\n sql = ps.prepared_sql\n ps_name = name.to_s\n\n if args = opts[:arguments]\n args = args.map{|arg| bound_variable_arg(arg, conn)}\n end\n\n unless conn.prepared_statements[ps_name] == sql\n conn.execute(\"DEALLOCATE #{ps_name}\") if conn.prepared_statements.include?(ps_name)\n conn.check_disconnect_errors{log_connection_yield(\"PREPARE #{ps_name} AS #{sql}\", conn){conn.prepare(ps_name, sql)}}\n conn.prepared_statements[ps_name] = sql\n end\n\n log_sql = \"EXECUTE #{ps_name}\"\n if ps.log_sql\n log_sql += \" (\"\n log_sql << sql\n log_sql << \")\"\n end\n\n q = conn.check_disconnect_errors{log_connection_yield(log_sql, conn, args){_execute_prepared_statement(conn, ps_name, args, opts)}}\n begin\n block_given? ? yield(q) : q.cmd_tuples\n ensure\n q.clear if q && q.respond_to?(:clear)\n end\n end", "def query_db(sql_statement)\n db = SQLite3::Database.new 'database.sqlite3'\n db.results_as_hash = true\n\n puts sql_statement\n\n results = db.execute(sql_statement) #action statement\n db.close #close the database\n results #return result\nend", "def prepare_sql_statements\n begin\n databases.each do |db|\n create_query[db][0] = create_query[db][0] + \" \" + create_query[db][1]\n create_query[db].delete_at(1)\n create_query[db] = create_query[db].join(\", \")\n create_query[db] << \");\"\n end\n rescue TypeError => e\n end\n end", "def close_conn(conn)\n LOGGER.debug \"Closing db connection\"\n \n begin\n conn.close if conn\n rescue Mysql::Error => err\n LOGGER.error \"Error closing db connection: #{$1}\"\n end\n \nend", "def transaction; end", "def transaction; end", "def transaction; end", "def close_mysql(iMySQLConnection)\n # Find the connection\n if (defined?($RUtilAnts_MySQLPool_Pool) == nil)\n $RUtilAnts_MySQLPool_Pool = {}\n end\n lDBKey = findMySQLConnectionKey(iMySQLConnection)\n $RUtilAnts_MySQLPool_Pool[lDBKey][1] -= 1\n if ($RUtilAnts_MySQLPool_Pool[lDBKey][1] == 0)\n # Close for real\n $RUtilAnts_MySQLPool_Pool[lDBKey][0].close\n $RUtilAnts_MySQLPool_Pool[lDBKey] = nil\n end\n end", "def with_connection\n ActiveRecord::Base.connection_pool.with_connection do |conn|\n yield conn\n end\n end", "def query_db(sql)\n pp sql\n db = SQLite3::Database.new('database.db')\n db.results_as_hash = true\n data = db.execute(sql)\n db.close\n data\nend", "def execute(sql)\n raise NotImplementedError, \"#execute should be overridden by adapters\"\n end", "def sql_state; end", "def comments\n db_connection do |conn|\n conn.exec(\"SELECT * FROM comments\").to_a\n end\nend", "def close\n @db.close\n end", "def commit_db_transaction\n @connection.commit\n @connection.autocommit = true\n end", "def execute(sql, args=nil)\n args = args.map{|v| @db.bound_variable_arg(v, self)} if args\n q = check_disconnect_errors{execute_query(sql, args)}\n begin\n block_given? ? yield(q) : q.cmd_tuples\n ensure\n q.clear if q && q.respond_to?(:clear)\n end\n end", "def execute\n return if empty?\n statement = Statement.new\n write_to_statement(statement)\n statement.append(*data_set.row_specifications_cql)\n data_set.write(*statement.args)\n end", "def close_prepared_statement(iMySQLConnection, iPreparedStatement)\n lPreparedStatements = $RUtilAnts_MySQLPool_Pool[findMySQLConnectionKey(iMySQLConnection)][2]\n lFound = false\n lDelete = nil\n lPreparedStatements.each do |iStrSQL, ioPreparedStatementInfo|\n if (ioPreparedStatementInfo[0] == iPreparedStatement)\n # Found it\n if (ioPreparedStatementInfo[1] != -1)\n ioPreparedStatementInfo[1] -= 1\n if (ioPreparedStatementInfo[1] == 0)\n # Close it for real\n ioPreparedStatementInfo[0].close\n lDelete = iStrSQL\n end\n end\n lFound = true\n end\n end\n lPreparedStatements.delete(lDelete) if (lDelete != nil)\n if (!lFound)\n raise MissingPreparedStatementFromPoolError.new(\"Prepared statement #{iPreparedStatement.inspect} can't be found among the pool of MySQL connection #{iMySQLConnection.inspect}\")\n end\n end", "def query(the_query)\n raise Mysql::Error, 'Not Connected' if @my.nil?\n\n begin\n if @result != nil\n @result.free # Free any result we had left over from previous use.\n @result = nil\n end\n @affected_rows = 0 # incase this query crashes and burns, this will have a value.\n @result = @my.query(the_query)\n @affected_rows = @my.affected_rows # This is non-zero for insert/delete/update of rows\n if block_given?\n yield @result\n else\n return @result\n end\n rescue Mysql::Error => e\n if @result != nil\n @result.free # Free any result we had left over from previous use.\n @result = nil\n end\n raise e\n end\n end", "def commit()\n #This is a stub, used for indexing\n end", "def initialize( db, sql )\n @db = db\n #prepare_method = @db.utf16? ? :prepare16 : :prepare\n prepare_method = :prepare\n @param_positions = {}\n @stmt_api = @db.api.send( prepare_method, sql )\n @blobs_to_write = []\n @rowid_index = nil\n @result_meta = nil\n @open = true\n end", "def close\n @database.close if @database\n end", "def close\n @database.close if @database\n end", "def commit; end", "def commit; end", "def commit; end", "def execute(sql, opts=OPTS, &block)\n synchronize(opts[:server]){|conn| check_database_errors{_execute(conn, sql, opts, &block)}}\n end", "def after_commit(*); end", "def transaction\n raise Mysql2::Error, 2002 if @my.nil?\n\n if block_given?\n begin\n @my.query('START TRANSACTION WITH CONSISTENT SNAPSHOT')\n yield # Start executing the query black.\n @my.query('COMMIT')\n rescue Mysql2::Error => e\n @my.query('ROLLBACK')\n raise e\n end\n end\n end", "def execute\n result = nil\n ActiveRecord::Base.connection_pool.with_connection do |con|\n result = con.execute(to_sql)\n end\n if @sql_returning.nil?\n nil\n else\n if @returning_flat\n result.values.map{|r| r.first}\n else\n result\n end\n end\n end", "def close\n\t\t\t@conn.close\n\t\tend", "def execute\n conn = connection\n Benchmark.bm { |x| x.report { yield conn } }\n conn.close\n end", "def reconnect\n @mutex.synchronize do\n if @db.opts[:conn]\n @jdbc_loaded = true\n @conn = @db.opts.fetch(:conn)\n else\n com.mysql.cj.jdbc.Driver\n @conn = java.sql::DriverManager.getConnection(jdbc_connect_command)\n end\n\n query_no_result_set(\"SET SQL_MODE = ''\")\n query_no_result_set(\"SET NAMES '#{esc(@encoding)}'\") if @encoding\n end\n end", "def transaction( &block )\n connect do | conn |\n conn.transaction do | conn |\n yield SqlRunner.new(SingleConnectionPool.new( conn ))\n end\n end\n end", "def exec_query(sql, name = 'SQL', binds = [])\n log(sql, name, binds) do\n result = without_prepared_statement?(binds) ? exec_no_cache(sql) :\n exec_cache(sql, binds)\n result_array = result_as_array(result)\n if ActiveRecord::VERSION::MAJOR >= 4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end\n end", "def fetch_rows(sql, &block)\n raise NotImplementedError, NOTIMPL_MSG\n end", "def q_buffer(&block)\r\n Knj::Db::Query_buffer.new(:db => self, &block)\r\n end" ]
[ "0.60829854", "0.5959344", "0.59277534", "0.58936864", "0.5889978", "0.58822626", "0.585421", "0.5847666", "0.5745714", "0.5745714", "0.5745504", "0.5716193", "0.5687672", "0.56662166", "0.56535983", "0.5642623", "0.56225", "0.5605796", "0.5549946", "0.55464476", "0.55241996", "0.5522911", "0.5474358", "0.5465715", "0.5420562", "0.5413285", "0.5411274", "0.54059064", "0.54004776", "0.53958464", "0.5390863", "0.5381393", "0.53647304", "0.5355867", "0.53316385", "0.53029925", "0.5301921", "0.5301921", "0.5294483", "0.52791303", "0.5277935", "0.5272144", "0.52695763", "0.5261701", "0.5261701", "0.5249049", "0.52460766", "0.5241578", "0.5239629", "0.5236294", "0.5235545", "0.5225748", "0.5224962", "0.5223112", "0.521564", "0.52120996", "0.5210865", "0.5190223", "0.5189966", "0.5180528", "0.5180528", "0.5178651", "0.5178651", "0.51773196", "0.51728386", "0.5165799", "0.5163989", "0.5151347", "0.5151347", "0.5151347", "0.5144782", "0.5144675", "0.5136871", "0.51358056", "0.5131548", "0.51211727", "0.51196074", "0.5115819", "0.51091576", "0.5102364", "0.50972515", "0.50948775", "0.5084086", "0.5078604", "0.5075754", "0.5075754", "0.50678784", "0.50678784", "0.50678784", "0.5067009", "0.50571084", "0.5054446", "0.5044962", "0.5041421", "0.5040147", "0.5038183", "0.503657", "0.5032964", "0.5032426", "0.5030205" ]
0.58788615
6