query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Returns the content description for building a content. 1. It looks in the element's contents description 2. It builds a description hash from essence type, if the the name key is not present
def content_description(element, essence_hash) essence_hash.stringify_keys! # No name given. We build the content from essence type. if essence_hash['name'].blank? && essence_hash['essence_type'].present? content_description_from_essence_type(element, essence_hash['essence_type']) else content_description_from_element(element, essence_hash['name']) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_description_from_essence_type(element, essence_type)\n {\n 'type' => essence_type,\n 'name' => content_name_from_element_and_essence_type(element, essence_type)\n }\n end", "def description\n return {} if element.nil? or element.content_descriptions.nil?\n element.content_descriptions.detect { |c| c['name'] == self.content.name } || {}\n end", "def content_definition(element, essence_hash)\n essence_hash.stringify_keys!\n # No name given. We build the content from essence type.\n if essence_hash['name'].blank? && essence_hash['essence_type'].present?\n content_definition_from_essence_type(element, essence_hash['essence_type'])\n else\n element.content_definition_for(essence_hash['name'])\n end\n end", "def content_description_from_element(element, name)\n element.content_description_for(name) ||\n element.available_content_description_for(name)\n end", "def description\n if element.blank?\n log_warning \"Content with id #{self.id} is missing its Element.\"\n return {}\n end\n Content.content_description_from_element(element, name) || {}\n end", "def description\n if element.blank?\n log_warning \"Content with id #{self.id} is missing its Element.\"\n return {}\n end\n desc = self.element.content_description_for(self.name)\n if desc.blank?\n self.element.available_content_description_for(self.name)\n end\n desc || {}\n end", "def content_definition_from_essence_type(element, essence_type)\n {\n 'type' => essence_type,\n 'name' => content_name_from_element_and_essence_type(element, essence_type)\n }\n end", "def content_description_for(content_name)\n if content_descriptions.blank?\n log_warning \"Element #{self.name} is missing the content definition for #{content_name}\"\n return nil\n else\n content_descriptions.detect { |d| d['name'] == content_name }\n end\n end", "def content_description_for(content_name)\n if content_descriptions.blank?\n log_warning \"Element #{self.name} is missing the content description for #{content_name}\"\n return nil\n else\n content_descriptions.detect { |d| d['name'] == content_name }\n end\n end", "def content_descriptions\n return nil if definition.blank?\n definition['contents']\n end", "def build(element, essence_hash)\n if (description = content_description(element, essence_hash)).blank?\n raise ContentDefinitionError, \"No description found in elements.yml for #{essence_hash.inspect} and #{element.inspect}\"\n else\n new(name: description['name'], element_id: element.id, skip_translate: description['translate'] == false)\n end\n end", "def create_contents\n contents = []\n if description[\"contents\"].blank?\n logger.warn \"\\n++++++\\nWARNING! Could not find any content descriptions for element: #{self.name}\\n++++++++\\n\"\n else\n description[\"contents\"].each do |content_hash|\n contents << Alchemy::Content.create_from_scratch(self, content_hash.symbolize_keys)\n end\n end\n end", "def definition\n if element.blank?\n log_warning \"Content with id #{self.id} is missing its Element.\"\n return {}\n end\n element.content_definition_for(name) || {}\n end", "def content_descriptions\n return nil if description.blank?\n description['contents']\n end", "def definition\n if element.blank?\n log_warning \"Content with id #{id} is missing its Element.\"\n return {}\n end\n element.content_definition_for(name) || {}\n end", "def available_content_description_for(content_name)\n return nil if available_contents.blank?\n available_contents.detect { |d| d['name'] == content_name }\n end", "def available_content_description_for(content_name)\n return nil if available_content_descriptions.blank?\n available_content_descriptions.detect { |d| d['name'] == content_name }\n end", "def description\n description = self.class.descriptions.detect { |d| d['name'] == self.name }\n if description.blank?\n log_warning \"Could not find element definition for #{self.name}. Please check your elements.yml!\"\n return {}\n else\n return description\n end\n end", "def description\n\t # if the description exists\n\t # return it \n\t # else \n\t # scrape to get the description\n\t # return it\n\t # end\n\tend", "def create_contents\n contents = []\n if definition[\"contents\"].blank?\n log_warning \"Could not find any content descriptions for element: #{self.name}\"\n else\n definition[\"contents\"].each do |content_hash|\n contents << Content.create_from_scratch(self, content_hash.symbolize_keys)\n end\n end\n end", "def description_for(item)\n if item.description\n item.description\n elsif item.content\n item.content\n else\n \"\"\n end\n end", "def create_contents\n contents = []\n if description[\"contents\"].blank?\n log_warning \"Could not find any content descriptions for element: #{self.name}\"\n else\n description[\"contents\"].each do |content_hash|\n contents << Content.create_from_scratch(self, content_hash.symbolize_keys)\n end\n end\n end", "def descriptions\n Element.descriptions.collect { |e| e['contents'] }.flatten.compact\n end", "def descriptions\n Element.descriptions.collect { |e| e['contents'] }.flatten.compact\n end", "def content_for_rss_description\n rss_title = content_descriptions.detect { |c| c['rss_description'] }\n contents.find_by_name(rss_title['name'])\n end", "def site_description\n headings = @doc.xpath(\"//h3[@class='clearl']\")\n content_sections = @doc.xpath(\"//h3[@class='clearl']/following-sibling::p[1]\")\n content = \"\"\n headings.zip(content_sections).each do |h, c| \n unless (c.to_s().squeeze().empty?)\n content << \"<h3>#{sanitize(h.to_s)}</h3>\" \n content << \"<p>#{sanitize(c.to_s)}\"\n end\n end\n rhtml = IO.read(File.expand_path(\"site_description.rhtml\", File.dirname(__FILE__)))\n content_html = Erubis::Eruby.new(rhtml)\n content_html.result(:content => content)\n end", "def content_based_description\n first_long_paragraph = parsed_search('//p[string-length() >= 120]').first\n first_long_paragraph ? first_long_paragraph.text : ''\n end", "def description\n return nil if document.xml?\n Nokogiri::HTML4::ElementDescription[name]\n end", "def content_for_rss_description\n rss_description = content_descriptions.detect { |c| c['rss_description'] }\n return if rss_description.blank?\n contents.find_by_name(rss_description['name'])\n end", "def build_content_metadata record, tags\n # TODO: Further enrich the structured data by marking up FAQ accordions, Video Carousels, Image Galleries, etc.\n # Also ItemList metadata for the meditations archive\n # See here: https://developers.google.com/search/docs/data-types/article\n []\n end", "def content_description\n @content ? \"with content #{@content.inspect}\" : \"\"\n end", "def content_definition_for(content_name)\n if content_definitions.blank?\n log_warning \"Element #{name} is missing the content definition for #{content_name}\"\n nil\n else\n content_definitions.detect { |d| d[\"name\"] == content_name.to_s }\n end\n end", "def meta_description(content)\n content_for_wrapper(:meta_description, content)\n end", "def content_for_rss_description\n content_for_rss_meta(\"description\")\n end", "def extract_description(content)\n Woro::TaskList.extract_description content\n end", "def descr\n return text_get(2, id)\n end", "def build(element, essence_hash)\n definition = content_definition(element, essence_hash)\n if definition.blank?\n raise ContentDefinitionError, \"No definition found in elements.yml for #{essence_hash.inspect} and #{element.inspect}\"\n else\n new(name: definition['name'], element_id: element.id)\n end\n end", "def display_name\n description.blank? ? content_key : description\n end", "def description\n text_get(7, @id)\n end", "def available_content_descriptions\n return nil if description.blank?\n description['available_contents']\n end", "def description\n meta = ASF::Committee.metadata(name)\n meta[:description] if meta\n end", "def content_for_rss_title\n rss_title = content_descriptions.detect { |c| c['rss_title'] }\n contents.find_by_name(rss_title['name'])\n end", "def description\n search_by_itemprop 'description'\n end", "def description(index)\n feed.entries[index].content || feed.entries[index].summary\n end", "def page_description\n if content_for?(:description)\n \"#{yield_content(:description)}\"\n else\n \"Capra is a design agency based in Ottawa, Canada run by husband and wife team Ollie and Kat Kavanagh. Our focus is great design. We love interactive work like websites, games and apps because we get involved in building what we design.\"\n end\n end", "def create_meta_description\n '<meta name=\"description\" content=\"' + item[:description] + '\"/>' if item[:description]\n end", "def description; @doc['description']; end", "def description; @doc['description']; end", "def description\n desc = object.description.to_s\n desc = h.strip_tags(markdown.render(desc)).strip # Escape HTML and remove Markdown\n\n if desc.blank? or [\"[!\", \"[](\", \"===\", \"```\"].any? { |s| desc.include? s }\n \"<em>#{ DESCRIPTION_UNAVAILABLE }</em>\".html_safe\n else\n desc = \"#{ desc }.\" if /\\w/ =~ desc.last # Add trailing dot\n desc[0] = desc[0].upcase # Capitalize 1st letter\n desc.html_safe\n end\n end", "def description\n page.render_part('description') rescue ''\n end", "def description\n page.render_part('description') rescue ''\n end", "def desc\n if self.namespace\n content_from 'ns:desc', :ns => self.namespace.href\n else\n content_from :desc\n end\n end", "def content_for(name, content = nil, &block)\n # this doesn't exist, and causes errors\n @_content_for = {} unless defined? @_content_for\n # we've got to initialize this, so we can concat to it\n @_content_for[name] = '' if @_content_for[name].nil?\n # now the rest is the same as in rails\n content = capture(&block) if block_given?\n @_content_for[name] << content if content\n @_content_for[name] unless content\n end", "def content_name_from_element_and_essence_type(element, essence_type)\n essences_of_same_type = element.contents.where(essence_type: normalize_essence_type(essence_type))\n \"#{essence_type.classify.demodulize.underscore}_#{essences_of_same_type.count + 1}\"\n end", "def content_name_from_element_and_essence_type(element, essence_type)\n essences_of_same_type = element.contents.where(essence_type: normalize_essence_type(essence_type))\n \"#{essence_type.classify.demodulize.underscore}_#{essences_of_same_type.count + 1}\"\n end", "def description\n meta['description'] || extract_description\n end", "def element_description\n raise NotImplementedError\n end", "def get_description(n)\n description = Nokogiri::HTML(super(n)).text\n if description.include?(\"IF YOU GO\")\n description = description.split(\"IF YOU GO\")[0]\n description = description.split(\" \")[3..-1].join(\" \") # remove \"by 'author name'\"\n description.slice!(\"[ Subscribe to the comments on this story ] \")\n description\n else\n nil\n end\n end", "def description\n data[:description]\n end", "def description\n data[:description]\n end", "def content_for_rss_title\n rss_title = content_descriptions.detect { |c| c['rss_title'] }\n return if rss_title.blank?\n contents.find_by_name(rss_title['name'])\n end", "def description\n desc = details.at(\"div.summary_text[itemprop='description']\").text.strip.clean_description rescue nil\n (desc.nil? || desc.empty?) ? nil : desc\n end", "def content\n \"#{title} #{description_text}\"\n end", "def description\n node.at(\"description\").text\n end", "def get_description( forte_set_name )\n dictionary_entry = @dictionary[forte_set_name]\n dictionary_entry.nil? ? nil : dictionary_entry[2].clone\n end", "def content\n @content ||= if valid_attrs?(:content_id, :content_type)\n Object.const_get(content_type).find_by_id(content_id)\n end\n end", "def description_nested\n self[Solrizer.solr_name('description_nested', :displayable)]\n end", "def description; @text; end", "def create_contents\n return if definition.fetch(:ingredients, []).any?\n\n definition.fetch(\"contents\", []).each do |attributes|\n Content.create(attributes.merge(element: self))\n end\n end", "def description\n object[\"description\"]\n end", "def description\n parsed {\n @description\n }\n end", "def description(text)\n content_for(:description) { text }\n end", "def description(text)\n content_for(:description) { text }\n end", "def description\n data.description\n end", "def description\n data.description\n end", "def description\n data.description\n end", "def description\n @data['description']\n end", "def description\n @data['description']\n end", "def name\n\t\tself.content\n\tend", "def description\n data['description']\n end", "def description_text\n\t\t\tif @data[\"description\"] \n\t\t\t\thtml_data = @data[\"description\"][\"text\"] \n\t\t\t\tparsed_data = Nokogiri::HTML(html_data)\n\t\t\t\tparsed_data.text\n\t\t\tend\n\t\tend", "def description(person_or_type = nil)\n generic_description = read_attribute(:description)\n return generic_description if person_or_type.nil?\n aud = Event.process_audience(person_or_type)\n custom_description = attribute_for_audience(:description, aud)\n custom_description.blank? ? generic_description : custom_description\n end", "def description\n self[:description] || name\n end", "def description\n return nil if info.nil?\n info[:description]\n end", "def repeated_descriptions(node); end", "def description\n\t\t\t@data[\"description\"]\n\t\tend", "def description\n @data['description']\n end", "def show_embedded_description_title(desc, _parent)\n type = desc.type_tag\n title = description_title(desc)\n links = []\n if writer?(desc)\n links << link_with_query(:EDIT.t, action: \"edit_#{type}\", id: desc.id)\n end\n if is_admin?(desc)\n links << link_with_query(:DESTROY.t,\n { action: \"destroy_#{type}\", id: desc.id },\n data: { confirm: :are_you_sure.l })\n end\n content_tag(:p, content_tag(:big, title) + links.safe_join(\" | \"))\n end", "def best_description\n if description?\n description\n else\n additional_description\n end\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 name\n return self.article.headline if self.article\n return self.image.caption if self.image\n\n 'Empty piece'\n end", "def description\n @data['description']\n end", "def build_specification(val, ele)\n attrs = {}\n ele.search('li').each do |li|\n attrs[li.search('.title').first.content] = li.search('.value').first.content\n end\n attrs\n end", "def description\n info[\"Description\"]\n end", "def description_for_google\n google_description.present? ? google_description : description\n end", "def description_html\n convert_html description\n end", "def description\n if description_attribute = read_attribute(:description)\n description_attribute\n elsif self.properties && self.properties['description'].present?\n self.properties['description']\n else\n default_description\n end\n end", "def extract_description\n\t\tparts = self.readme&.parts or return nil\n\t\tdesc_para = parts.find {|part| part.is_a?(RDoc::Markup::Paragraph) }&.text or return nil\n\t\tformatter = RDoc::Markup::ToHtml.new( RDoc::Options.new )\n\t\thtml = formatter.convert( desc_para )\n\n\t\treturn html.gsub( /<.*?>/, '' ).strip\n\tend", "def description\n\t\t\treturn @description || self.generate_description\n\t\tend", "def description\n query_root_node(\"description/text()\")\n end" ]
[ "0.77958477", "0.7436956", "0.7392278", "0.7310024", "0.7229824", "0.722587", "0.7033766", "0.70027167", "0.6887653", "0.6740992", "0.6528336", "0.651121", "0.6500961", "0.6474051", "0.64018965", "0.6367252", "0.63440955", "0.6260909", "0.623556", "0.6213252", "0.6188391", "0.6161501", "0.61265945", "0.61265945", "0.61114633", "0.60803086", "0.6056899", "0.60395133", "0.60303444", "0.60224026", "0.60138834", "0.5991683", "0.597494", "0.59284174", "0.591519", "0.58715266", "0.58702755", "0.5859816", "0.58226603", "0.58067703", "0.579437", "0.5777651", "0.57692325", "0.5764573", "0.57565916", "0.57477325", "0.57407194", "0.57407194", "0.57385856", "0.57130206", "0.57130206", "0.56895524", "0.56619984", "0.56602645", "0.56602645", "0.5659047", "0.56539166", "0.565108", "0.56429464", "0.56429464", "0.5632655", "0.56256586", "0.56255776", "0.5624096", "0.5621461", "0.5620402", "0.5607639", "0.5595164", "0.55918384", "0.55890006", "0.55841684", "0.5577889", "0.55770457", "0.55721253", "0.55721253", "0.55721253", "0.5570898", "0.5570898", "0.5569244", "0.5560979", "0.5558539", "0.55547494", "0.5553985", "0.5541722", "0.55302906", "0.5522728", "0.55135745", "0.5510949", "0.5509698", "0.5503324", "0.54926044", "0.5488892", "0.5486116", "0.54831463", "0.548104", "0.54797614", "0.54753697", "0.5468633", "0.5466928", "0.5465656" ]
0.8284185
0
Returns a hash for building a content from essence type.
def content_description_from_essence_type(element, essence_type) { 'type' => essence_type, 'name' => content_name_from_element_and_essence_type(element, essence_type) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_definition_from_essence_type(element, essence_type)\n {\n 'type' => essence_type,\n 'name' => content_name_from_element_and_essence_type(element, essence_type)\n }\n end", "def hash\n\t\t(language + type + klass + thing).hash\n\tend", "def hash\n [ data, type ].hash\n end", "def content_definition(element, essence_hash)\n essence_hash.stringify_keys!\n # No name given. We build the content from essence type.\n if essence_hash['name'].blank? && essence_hash['essence_type'].present?\n content_definition_from_essence_type(element, essence_hash['essence_type'])\n else\n element.content_definition_for(essence_hash['name'])\n end\n end", "def hash\n @type.hash\n end", "def hash\n @content.hash\n end", "def get_hash(type)\n allowed_tables = A_HASHES\n allowed_tran = %w(month day)\n allowed_spec = %w(time)\n\n if allowed_tables.include? type\n rows = get_list(type)\n if rows == 'ERROR' # Dirty fix for 'multiple responses' error\n return 'ERROR'\n end\n\n r = {}\n\n rows.each {|v|\n r[v.id] = v.name\n }\n\n r\n elsif allowed_tran.include? type\n a = ::I18n.t(\"g_#{type}s\").clone # Because Translation is given by reference. REFERENCE.\n\n i = 0\n a.map! {|v| [i += 1, v]}\n\n a.to_h\n\n elsif allowed_spec.include? type\n get_special_list type\n\n else\n # TODO: Log error\n end\n end", "def to_hash # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity\n hash = {}\n hash[\"type\"] = type if type\n hash[\"formattedref\"] = formattedref.to_hash if formattedref\n hash[\"title\"] = title.to_hash\n hash[\"place\"] = place if place\n hash[\"organization\"] = organization if organization\n hash[\"abbreviation\"] = abbreviation.to_hash if abbreviation\n hash[\"from\"] = from if from\n hash[\"to\"] = to if to\n hash[\"number\"] = number if number\n hash[\"partnumber\"] = partnumber if partnumber\n hash[\"run\"] = run if run\n hash\n end", "def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend", "def hash\n digest = Digest::MD5.new\n digest << title.to_s\n digest << content.join('').to_s\n digest.to_s\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def content_description(element, essence_hash)\n essence_hash.stringify_keys!\n # No name given. We build the content from essence type.\n if essence_hash['name'].blank? && essence_hash['essence_type'].present?\n content_description_from_essence_type(element, essence_hash['essence_type'])\n else\n content_description_from_element(element, essence_hash['name'])\n end\n end", "def to_hash\n @content\n end", "def to_h\n hash = {\n name: name,\n contents: contents\n }\n hash[:id] = id if id\n hash[:syntax] = syntax || 'autodetect'\n hash[:size] = size if size\n\n hash\n end", "def contents_by_type(essence_type)\n contents.select do |content|\n content.essence_type == Content.normalize_essence_type(essence_type)\n end\n end", "def hash\n [type, id, timestamp, local_timestamp, local_timezone, caller_id, service_url, channel_id, from, conversation, recipient, text_format, attachment_layout, members_added, members_removed, reactions_added, reactions_removed, topic_name, history_disclosed, locale, text, speak, input_hint, summary, suggested_actions, attachments, entities, channel_data, action, reply_to_id, label, value_type, value, name, relates_to, code, expiration, importance, delivery_mode, listen_for, text_highlights, semantic_action].hash\n end", "def to_hash\n @content.to_hash\n end", "def content_by_type(essence_type)\n contents_by_type(essence_type).first\n end", "def hash\n [@bit, @type].hash\n end", "def hash\n [content_addressable].hash\n end", "def content_type_map\n Hash.new(\"text\").tap do |h|\n h[\"audio\"] = \"sound\"\n h[\"visual material\"] = \"image\"\n h[\"video\"] = \"video\"\n h[\"musical score\"] = \"sound\"\n h[\"map\"] = \"image\"\n end\n end", "def hash\n [color, cards, address_placement, custom_envelope, double_sided, extra_service, mail_type, return_envelope, bleed, file_original_url].hash\n end", "def to_h\n Hash[@content.select { |item| item[:type] == :value }.collect { |item| item.values_at(:key,:value) }]\n end", "def hash\n [attachments, billing, body, body_html, body_rtf, body_type, categories, companies, item_id, message_class, mileage, recipients, sensitivity, subject, subject_prefix, properties, discriminator, electronic_addresses, events, name_info, other_fields, personal_info, photo, physical_addresses, professional_info, telephones].hash\n end", "def id_for(type, content)\n sha \"#{type} #{content.length}\\0#{content}\"\n end", "def extract_hash\n\n value = @array.extract_hash if @array\n value = @valueItem.extract_hash if @valueItem\n value = @map.extract_hash if @map\n\n @text = value\n\n return if @type == 'index'\n return if @type == 'hidden'\n return if @type == 'version'\n return if @type == 'class'\n return if @type == 'method'\n return if @type == 'import'\n return if @type == 'allow'\n return if @type == 'expect'\n\n formatted_key = Substitutions.process UnicodeEscapes.process @key\n {formatted_key => @text}\n end", "def create_from_scratch(element, essence_hash)\n essence_hash.stringify_keys!\n if content = build(element, essence_hash)\n content.create_essence!(essence_hash['essence_type'])\n end\n content\n end", "def create_from_scratch(element, essence_hash)\n essence_hash.stringify_keys!\n if content = build(element, essence_hash)\n content.create_essence!(essence_hash['essence_type'])\n end\n content\n end", "def essence_class(type = nil)\n Content.normalize_essence_type(type || description['type']).constantize\n end", "def to_hash\n hash = {\n :id => id,\n :code => code,\n :guid => guid,\n :name => name,\n :difficulty => difficulty,\n :terrain => terrain,\n :latitude => latitude,\n :longitude => longitude,\n :size => size,\n :type => type,\n :location => location,\n :owner => owner,\n :owner_display_name => owner_display_name,\n :logs => logs,\n :pmonly? => pmonly?,\n :archived? => archived?,\n :in_review? => in_review?,\n :unpublished? => unpublished?\n }\n\n if [:event, :megaevent, :lfevent, :cito].include?(type.to_sym)\n hash[:event_date] = event_date\n else\n hash[:hidden_at] = hidden_at\n end\n\n hash\n end", "def hash\n [actor, artist, aspect_ratio, audience_rating, author, back_finding, band_material_type, binding, bluray_region, brand, cero_age_rating, chain_type, clasp_type, color, cpu_manufacturer, cpu_speed, cpu_type, creator, department, director, display_size, edition, episode_sequence, esrb_age_rating, feature, flavor, format, gem_type, genre, golf_club_flex, golf_club_loft, hand_orientation, hard_disk_interface, hard_disk_size, hardware_platform, hazardous_material_type, item_dimensions, is_adult_product, is_autographed, is_eligible_for_trade_in, is_memorabilia, issues_per_year, item_part_number, label, languages, legal_disclaimer, list_price, manufacturer, manufacturer_maximum_age, manufacturer_minimum_age, manufacturer_parts_warranty_description, material_type, maximum_resolution, media_type, metal_stamp, metal_type, model, number_of_discs, number_of_issues, number_of_items, number_of_pages, number_of_tracks, operating_system, optical_zoom, package_dimensions, package_quantity, part_number, pegi_rating, platform, processor_count, product_group, product_type_name, product_type_subcategory, publication_date, publisher, region_code, release_date, ring_size, running_time, shaft_material, scent, season_sequence, seikodo_product_code, size, size_per_pearl, small_image, studio, subscription_length, system_memory_size, system_memory_type, theatrical_release_date, title, total_diamond_weight, total_gem_weight, warranty, weee_tax_value].hash\n end", "def build_object(type, content)\n # taken from http://schacon.github.io/gitbook/7_how_git_stores_objects.html\n header = \"#{type} #{content.size}\\0\"\n store = header + content\n [Digest::SHA1.hexdigest(store), Zlib::Deflate.deflate(store)]\n end", "def hash\n [_name, _type, _klass].hash\n end", "def essence_class(type = nil)\n Content.normalize_essence_type(type || definition['type']).constantize\n end", "def essence_class\n (essence_type || Content.normalize_essence_type(definition[\"type\"])).constantize\n end", "def hash\n [format, text_compression, embed_full_fonts, compliance, sufficient_resolution, jpeg_quality, draw_slides_frame, show_hidden_slides, save_metafiles_as_png, password, embed_true_type_fonts_for_ascii, additional_common_font_families, notes_position, comments_position, comments_area_width, comments_area_color, show_comments_by_no_author, image_transparent_color, apply_image_transparent].hash\n end", "def to_h\n {\n type: type,\n float: float,\n content: content.map(&:to_h),\n tags: tags,\n }\n end", "def to_hash\n # TODO: find a better option to populate the data to the Hash\n image;feed;links;charset;absolute_links;title;meta_keywords\n @data.to_hash\n end", "def to_hash\n { 'Content-Type' => @content_type,\n 'Content-Transfer-Encoding' => @encoding,\n 'Extensions' => @extensions,\n 'System' => @system,\n 'Obsolete' => @obsolete,\n 'Docs' => @docs,\n 'URL' => @url,\n 'Registered' => registered?,\n }\n end", "def hash\n [action, attachments, attendees, description, duration, repeat, summary, trigger].hash\n end", "def content_name_from_element_and_essence_type(element, essence_type)\n essences_of_same_type = element.contents.where(essence_type: normalize_essence_type(essence_type))\n \"#{essence_type.classify.demodulize.underscore}_#{essences_of_same_type.count + 1}\"\n end", "def content_name_from_element_and_essence_type(element, essence_type)\n essences_of_same_type = element.contents.where(essence_type: normalize_essence_type(essence_type))\n \"#{essence_type.classify.demodulize.underscore}_#{essences_of_same_type.count + 1}\"\n end", "def to_hash\n hash = {}\n hash[:name] = name\n hash[:type_name] = type_name\n hash[:file] = file\n hash[:line] = line\n hash[:docstring] = PuppetStrings::Yard::Util.docstring_to_hash(docstring)\n hash[:confines] = confines if confines && !confines.empty?\n hash[:features] = features if features && !features.empty?\n hash[:defaults] = defaults if defaults && !defaults.empty?\n hash[:commands] = commands if commands && !commands.empty?\n hash\n end", "def hash\n [author, created, icon, id, integration_id, is_favorite, is_read_only, is_shared, modified, popularity, tags, title, type, url].hash\n end", "def attr_hash\n\t\t\thash = {:sourcetype => @type}\n\t\t\tcase @type\n\t\t\twhen 'random_string'\n\t\t\t\thash[:length] = @length\n\t\t\twhen 'random_number'\n\t\t\t\thash[:start] = @start\n\t\t\t\thash[:end] = @end\n\t\t\twhen 'eval'\n\t\t\t\thash[:code] = @code.chomp.to_sym\t\t\t# symbolize it in order to prevent it from being escaped\n\t\t\twhen 'file'\n\t\t\t\thash[:fileid] = @fileid\n\t\t\t\thash[:delimiter] = @delimiter\n\t\t\t\thash[:order] = @order\n\t\t\tend\n\t\t\thash\n\t\tend", "def hash\n [contact, extensions, external_resources, info, integrations, org, schema_version, tags].hash\n end", "def hash\n [type, id, updated_at, version, is_deleted, catalog_v1_ids, present_at_all_locations, present_at_location_ids, absent_at_location_ids, item_data, category_data, item_variation_data, tax_data, discount_data, modifier_list_data, modifier_data].hash\n end", "def hash\n [format, display_header, display_from_email_address, display_email_address, display_to_email_address, display_cc_email_address, display_bcc_email_address, time_zone_offset, convert_attachments, field_labels, preserve_original_date].hash\n end", "def hash\n title.hash\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def hash\n [author, text, created_time, child_comments, type, text_selection_start, text_selection_length, status].hash\n end", "def hash\n [life_style_type, listing_action, contact_preference, under_offer_or_contract, auction, bond, available_from, property_details, is_new_development, statement_of_information, price, domain_ad_id, domain_agency_id, provider_ad_id, features, description, summary, inspection_details, media, contacts, other_enquiry_email, receive_emails_to_default_address, is_rural, supplementary].hash\n end", "def create_tps_hash(data, hash_type)\n return \"SECRET KEY NOT PROVIDED\" if !defined? @SECRET_KEY\n case hash_type \n when 'HMAC_SHA256'\n OpenSSL::HMAC.hexdigest('sha256', @SECRET_KEY, data)\n when 'SHA512'\n Digest::SHA512.hexdigest(@SECRET_KEY + data)\n when 'SHA256'\n Digest::SHA256.hexdigest(@SECRET_KEY + data)\n when 'MD5'\n Digest::MD5.hexdigest(@SECRET_KEY + data)\n else\n OpenSSL::HMAC.hexdigest('sha512', @SECRET_KEY, data)\n end\n end", "def hash; [searchable_id, searchable_type].hash; end", "def hash; [searchable_id, searchable_type].hash; end", "def to_h message_id, preferred_type\n parts = mime_parts(preferred_type).map do |type, fn, cid, content, size|\n if type =~ /^text\\//\n { :type => type, :filename => fn, :cid => cid, :content => content, :here => true }\n else\n { :type => type, :filename => fn, :cid => cid, :size => content.size, :here => false }\n end\n end.compact\n\n { :from => (from ? from.to_email_address : \"\"),\n :to => to.map(&:to_email_address),\n :cc => (cc || []).map(&:to_email_address),\n :bcc => (bcc || []).map(&:to_email_address),\n :subject => subject,\n :date => date,\n :refs => refs,\n :parts => parts,\n :message_id => message_id,\n :snippet => snippet,\n :reply_to => (reply_to ? reply_to.to_email_address : \"\"),\n\n :recipient_email => recipient_email,\n :list_post => list_post,\n :list_subscribe => list_subscribe,\n :list_unsubscribe => list_unsubscribe,\n\n :email_message_id => @msgid,\n }\n end", "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "def to_hash\n h = self.href.nil? ? '' : self.href\n r = self.rel.nil? ? '' : self.rel\n t = self.title.nil? ? '' : self.title\n y = self.type.nil? ? '' : self.type\n\n { \n \"href\" => h,\n \"type\" => y,\n \"rel\" => r,\n \"title\" => t\n }\n end", "def hash\n [status, rating, title, url, publisher_date, business_id, comments, content, date, author_name, author_email, location_id, last_yext_update_time, publisher_id, id].hash\n end", "def hash\n [is_blueprint_copy, is_included, item_id, material_efficiency, quantity, record_id, runs, time_efficiency, type_id].hash\n end", "def hash\n [active, additional_properties, author, authored, banned, category, comments, contributors, created_date, embed, extension, height, id, length, location, long_description, mime_type, name, priority, privacy, published, short_description, size, tags, template, thumbnail, updated_date, uploader, views, width].hash\n end", "def hash\n [name, type, sub_attributes, multi_valued, description, required, canonical_values, case_exact, mutability, returned, uniqueness, reference_types].hash\n end", "def hash\n return unless doc_value?\n result['doc']['hash']\n end", "def hash\n [income_type, description, tax_rate, tax_amount, tax_amount_no_vat, withheld, total, vat_type].hash\n end", "def hash\n [class_id, object_type, description, name, type, system].hash\n end", "def hash\n [sequence_number, corporate_number, process, correct, update_date, change_date, name, name_image_id, kind, prefecture_name, city_name, street_number, address_image_id, prefecture_code, city_code, post_code, address_outside, address_outside_image_id, close_date, close_cause, successor_corporate_number, change_cause, assignment_date, latest, en_name, en_prefecture_name, en_city_name, en_address_outside, furigana, hihyoji].hash\n end", "def hash\n [author_handle, author_name, created_at, description, id, is_read_only, layout_type, modified_at, notify_list, reflow_type, restricted_roles, tags, template_variable_presets, template_variables, title, url, widgets].hash\n end", "def node(type, content)\n return { \"type\" => type, \"content\" => content }\n end", "def hash\n [article_number, name, quantity, unit_price, discount_percent, vat_percent, unit, temporary_reference, row_number, merchant_data].hash\n end", "def body(sub_type=\"plain\")\n return { \"type\" => sub_type, \"content\" => @body[sub_type] }\n end", "def to_h\n hash = {}\n self.instance_variables.each do |var|\n hash[var.to_s.gsub( /@/, '' )] = self.instance_variable_get( var )\n end\n hash.merge( 'type' => type )\n end", "def hash\n [year, make, model, trim, short_trim, body_type, body_subtype, vehicle_type, transmission, drivetrain, fuel_type, engine, engine_size, engine_block, doors, cylinders, made_in, steering_type, antibrake_sys, tank_size, overall_height, overall_length, overall_width, std_seating, opt_seating, highway_miles, city_miles, engine_measure, engine_aspiration, trim_r].hash\n end", "def hash\n [text, font_name, font_size, bold, italic, color, width, height, top, left, rotation_angle, transparency, background, image, auto_align].hash\n end", "def hash\n [link, node_id, list_items, checked, appearance, date_display_locale, date_display_format, full_date, title, date_storage_format, building_block_gallery, building_block_category, multiline, color, style_name, calendar_type, is_temporary, level, sdt_type, placeholder_name, lock_content_control, lock_contents, is_showing_placeholder_text, tag, id, word_open_xml].hash\n end", "def hash\n [clean_result, contains_executable, contains_invalid_file, contains_script, contains_password_protected_file, contains_restricted_file_format, contains_macros, contains_xml_external_entities, contains_insecure_deserialization, contains_html, contains_unsafe_archive, verified_file_format, found_viruses, content_information].hash\n end", "def hash\n [link, font, built_in, next_paragraph_style_name, base_style_name, is_quick_style, linked_style_name, type, is_heading, aliases, style_identifier, name].hash\n end", "def meta_content_type(body); end", "def hash\n [prefix, postfix, snippet_count, fragment_size, max_analyzed_chars, merge_contiguous, use_phrase_highlighter, fields].hash\n end", "def to_hash\n {\n 'printerId' => @printer_id,\n 'title' => @title,\n 'contentType' => @content_type,\n 'content' => load_content,\n 'source' => @source\n }\n end", "def contentByType( type )\n\t\tcontent = nil\n\t\[email protected]_index { |i|\n\t\t\tif @content[i].type == type\n\t\t\t\tcontent = @content[i]\n\t\t\tend\n\t\t}\n\t\tcontent\n\tend", "def hash\n [attachments, created_by_id, created_by_name, created_on, id, modified_by_id, modified_by_name, modified_on, name, owners, status_id, status_name, address_business_city, address_business_country, address_business_is_primary, address_business_line1, address_business_state, address_business_zip_code, address_home_city, address_home_country, address_home_is_primary, address_home_line1, address_home_state, address_home_zip_code, address_other_city, address_other_country, address_other_is_primary, address_other_line1, address_other_state, address_other_zip_code, current_position_company_id, current_position_company_name, current_position_title, current_position_when_end, current_position_when_start, description, education_accreditation_id, education_accreditation_name, education_honors, education_institution_id, education_institution_name, education_when_end, education_when_start, email_address_other, email_address_other_is_primary, email_address_personal, email_address_personal_is_primary, email_address_work, email_address_work_is_primary, ethnicity_id, ethnicity_name, external_primary_key, first_name, gender_id, gender_name, key_date_anniversary, key_date_birthday, key_date_other, last_name, middle_name, nick_name, phone_number_fax, phone_number_fax_extension, phone_number_fax_is_primary, phone_number_home, phone_number_home_extension, phone_number_home_is_primary, phone_number_mobile, phone_number_mobile_extension, phone_number_mobile_is_primary, phone_number_other, phone_number_other_extension, phone_number_other_is_primary, phone_number_skype, phone_number_skype_extension, phone_number_skype_is_primary, phone_number_work_direct, phone_number_work_direct_extension, phone_number_work_direct_is_primary, phone_number_work_main, phone_number_work_main_extension, phone_number_work_main_is_primary, preferred_contact_method_type_id, preferred_contact_method_type_name, record_type, related_contact_assistant_first_name, related_contact_assistant_id, related_contact_assistant_is_primary, related_contact_assistant_last_name, related_contact_client_first_name, related_contact_client_id, related_contact_client_is_primary, related_contact_client_last_name, related_contact_other_first_name, related_contact_other_id, related_contact_other_is_primary, related_contact_other_last_name, related_contact_referred_by_first_name, related_contact_referred_by_id, related_contact_referred_by_is_primary, related_contact_referred_by_last_name, related_contact_spouse_first_name, related_contact_spouse_id, related_contact_spouse_is_primary, related_contact_spouse_last_name, salary, salary_details, salutation_id, salutation_name, social_aim, social_aim_is_primary, social_facebook_chat, social_facebook_chat_is_primary, social_face_time, social_face_time_is_primary, social_google_talk, social_google_talk_is_primary, social_icq, social_icq_is_primary, social_other, social_other_is_primary, social_skype, social_skype_is_primary, social_twitter, social_twitter_is_primary, social_yahoo_msg, social_yahoo_msg_is_primary, source_id, source_name, suffix_id, suffix_name, tags, website_blog, website_blog_is_primary, website_business, website_business_is_primary, website_facebook, website_facebook_is_primary, website_linked_in, website_linked_in_is_primary, website_other, website_other_is_primary, website_personal, website_personal_is_primary].hash\n end", "def to_hash\n body.to_hash\n end", "def to_h\n {\n contents: contents,\n pos: pos,\n allowed: allowed,\n class: self.class\n }\n end", "def generate_metadata_rules_hash(params)\n rules = {\n required_entity_type_ids: [],\n show_stopper_entity_type_ids: [],\n boosted_entity_type_ids: [],\n entity_type_ordered_list: [],\n parts_of_speech: {}\n }\n\n params.each do |k,v|\n if k.to_s.starts_with?('required_entity_')\n rules[:required_entity_type_ids] << v.to_i\n end\n\n if k.to_s.starts_with?('show_stopper_entity_')\n rules[:show_stopper_entity_type_ids] << v.to_i\n end\n\n if k.to_s.starts_with?('boosted_entity_')\n rules[:boosted_entity_type_ids] << v.to_i\n end\n\n if k.to_s.starts_with?('pos_')\n key = ::Epiphany::Analyzers::PartsOfSpeech::SUPPORTED_FIELDS.find do |field|\n field == k.split('pos_').last\n end\n\n val = ::Epiphany::Analyzers::PartsOfSpeech::VALUE_OPTIONS.find do |opt|\n opt == v.strip\n end\n\n # parts of speech fields / vals are enforced in the above constants\n next unless key && val\n rules[:parts_of_speech][key] = val\n end\n\n if k == 'entity_type_ordered_list' && v.present?\n rules[:entity_type_ordered_list] = v.split(',').map{|val| val.strip }\n end\n end\n\n rules\n end", "def get_hearing_type hearing_type\n result = Hash.new(\"\")\n result['1'] = \"Central Office\"\n result['2'] = \"Travel Board\"\n result['6'] = \"Video\"\n\n result[hearing_type]\n end", "def hash\n [id, to, from, description, metadata, merge_variables, send_date, mail_type, memo, check_number, message, amount, bank_account, check_bottom_template_id, attachment_template_id, check_bottom_template_version_id, attachment_template_version_id, url, carrier, thumbnails, expected_delivery_date, tracking_events, object, date_created, date_modified, deleted, use_type].hash\n end", "def hash\n [domain, message, stack, type].hash\n end", "def to_hash\n data_structure = {}\n @tense_list.each do |t|\n ts = t.to_sym\n data_structure[ts]=self.send ts\n end\n data_structure['original_string'] = @original_string\n return data_structure\n end", "def hash_for_merging(hash)\n new_hash = { id: hash['message_id'].to_i,\n date: Time.at(hash['date'].to_i),\n from: User.new(hash['from'], @bot),\n chat: Chat.new(hash['chat'], @bot) }\n\n type = TYPES.find { |t| hash[t.to_s] }\n new_hash[type] = hash[type.to_s] # TODO: fail if type not found\n\n new_hash\n end", "def data_and_type\n fail_on_non_200_family_if_specified\n\n {\n data: to_s,\n type: content_type\n }\n end", "def to_hash\n h = self.Header.to_hash\n h.merge! self.Metadata.to_hash\n h.merge! self.NewsContent.to_hash\n h\n end", "def hash\n [id, url, external_id, first_name, last_name, middle_name, birth_date, gender, language, phone, allow_phone_contact, email, allow_email_contact, notes, date_created, date_modified, ext_date_created, ext_date_modified, doc_type, doc_issuer_info, doc_series, doc_number, department_code, department_name, doc_issue_date, doc_expiration_date, is_closed, merged_to, building_no, city, country_code, country_name, district, flat_no, house_no, region, room_no, settlement_type, street, raw_address, cards, view_url, preferences].hash\n end", "def to_h\n {\n 'abstracts' => abstracts,\n 'doctypes' => doctypes,\n 'names' => names,\n 'pub_info' => pub_info,\n 'publishers' => publishers,\n 'titles' => titles\n }\n end", "def hash \n @hash ||= CobraVsMongoose.xml_to_hash(file_content)\n end", "def hash\n data.hash\n end", "def hash\n [type, page_access_token, app_id, app_secret, account_sid, auth_token, phone_number_sid, token, channel_access_token, encoding_aes_key, from_address, certificate, password, auto_update_badge, server_key, sender_id, consumer_key, consumer_secret, access_token_key, access_token_secret].hash\n end", "def hash\n [address_format, address_format_metadata, allow_region, calendar_type, calendar_type_metadata, culture_name, culture_name_metadata, currency_code, currency_code_metadata, currency_negative_format, currency_negative_format_metadata, currency_positive_format, currency_positive_format_metadata, custom_date_format, custom_sign_date_format, custom_sign_time_format, custom_time_format, date_format, date_format_metadata, effective_address_format, effective_calendar_type, effective_currency_code, effective_currency_negative_format, effective_currency_positive_format, effective_custom_date_format, effective_custom_time_format, effective_date_format, effective_initial_format, effective_name_format, effective_time_format, effective_time_zone, initial_format, initial_format_metadata, name_format, name_format_metadata, sign_date_format, sign_date_format_metadata, sign_time_format, sign_time_format_metadata, time_format, time_format_metadata, time_zone, time_zone_metadata].hash\n end", "def to_hash\n hash = {\n \"id\" => id,\n \"isbn\" => isbn,\n \"edition_group_id\" => edition_group_id,\n \"author\" => author,\n \"edition\" => edition,\n \"publisher\" => publisher,\n \"cover\" => cover,\n \"image\" => full_image_uri }\n end", "def hash\n type.hash ^ (id.hash >> 1)\n end", "def hash\n self.atoms.hash\n end" ]
[ "0.74021894", "0.6699435", "0.65669703", "0.6477308", "0.6271651", "0.62293464", "0.6138441", "0.61168486", "0.6030077", "0.6025322", "0.60214335", "0.6005596", "0.58988315", "0.58712846", "0.58502895", "0.58315", "0.5828687", "0.58101785", "0.5809049", "0.5785308", "0.57788825", "0.5753974", "0.57224673", "0.57186216", "0.5698157", "0.5684803", "0.56259906", "0.56259906", "0.5622632", "0.5564818", "0.5562232", "0.5554964", "0.55515045", "0.5547327", "0.55402946", "0.552039", "0.55164284", "0.5513736", "0.54997474", "0.54835755", "0.54697573", "0.54697573", "0.546639", "0.5455017", "0.5417355", "0.53987664", "0.5392547", "0.5388258", "0.53784513", "0.5378332", "0.53782713", "0.5367495", "0.5364488", "0.53626627", "0.53626627", "0.53515023", "0.5338922", "0.53385234", "0.5335002", "0.53262347", "0.53191", "0.5318252", "0.53098613", "0.53019476", "0.5283696", "0.52819246", "0.5265478", "0.5249019", "0.52464795", "0.52362", "0.5234197", "0.52294165", "0.5226673", "0.52077454", "0.5202458", "0.5194625", "0.5193949", "0.5185722", "0.5184328", "0.51749367", "0.51729107", "0.5165786", "0.51622736", "0.51594275", "0.51506096", "0.5150388", "0.5143374", "0.51371276", "0.5134463", "0.51241404", "0.5124019", "0.5123586", "0.51230866", "0.5121371", "0.5114213", "0.51040083", "0.5103013", "0.5102908", "0.5099552", "0.5089775" ]
0.7140074
1
A name for content from its essence type and amount of same essences in element. Example: essence_picture_1
def content_name_from_element_and_essence_type(element, essence_type) essences_of_same_type = element.contents.where(essence_type: normalize_essence_type(essence_type)) "#{essence_type.classify.demodulize.underscore}_#{essences_of_same_type.count + 1}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_description_from_essence_type(element, essence_type)\n {\n 'type' => essence_type,\n 'name' => content_name_from_element_and_essence_type(element, essence_type)\n }\n end", "def content_definition_from_essence_type(element, essence_type)\n {\n 'type' => essence_type,\n 'name' => content_name_from_element_and_essence_type(element, essence_type)\n }\n end", "def content_description(element, essence_hash)\n essence_hash.stringify_keys!\n # No name given. We build the content from essence type.\n if essence_hash['name'].blank? && essence_hash['essence_type'].present?\n content_description_from_essence_type(element, essence_hash['essence_type'])\n else\n content_description_from_element(element, essence_hash['name'])\n end\n end", "def content_definition(element, essence_hash)\n essence_hash.stringify_keys!\n # No name given. We build the content from essence type.\n if essence_hash['name'].blank? && essence_hash['essence_type'].present?\n content_definition_from_essence_type(element, essence_hash['essence_type'])\n else\n element.content_definition_for(essence_hash['name'])\n end\n end", "def form_field_name(essence_column = self.essence.ingredient_column)\n \"contents[content_#{self.id}][#{essence_column}]\"\n end", "def name\n return self.article.headline if self.article\n return self.image.caption if self.image\n\n 'Empty piece'\n end", "def essence_class\n (essence_type || Content.normalize_essence_type(definition[\"type\"])).constantize\n end", "def content_type(name)\n name_li(name).span(:class=>/(mylibrary_item_|searchcontent_result_)mimetype/).text\n end", "def essence_class(type = nil)\n Content.normalize_essence_type(type || description['type']).constantize\n end", "def content_by_type(essence_type)\n contents_by_type(essence_type).first\n end", "def name\n\t\tself.content\n\tend", "def name\n @content[pn(:Name)]\n end", "def partial_text_name\n put_together_name(:part).t.html_to_ascii\n end", "def essence_class(type = nil)\n Content.normalize_essence_type(type || definition['type']).constantize\n end", "def content_type_tag content_type\n content_tag(:figure, class: \"content-type\") do\n content_tag(:i, nil, class: \"icons-nyu-content-type-#{content_type.downcase}\") +\n content_tag(:figcaption, content_type.capitalize.gsub(\"_\", \" \"))\n end\n end", "def render_content_name(content)\n\t\t\t\tif content.blank?\n\t\t\t\t\twarning('Element is nil')\n\t\t\t\t\treturn \"\"\n\t\t\t\telse\n\t\t\t\t\tcontent_name = content.name_for_label\n\t\t\t\tend\n\t\t\t\tif content.description.blank?\n\t\t\t\t\twarning(\"Content #{content.name} is missing its description\")\n\t\t\t\t\ttitle = t(\"Warning: Content is missing its description.\", :contentname => content.name)\n\t\t\t\t\tcontent_name = %(<span class=\"warning icon\" title=\"#{title}\"></span>&nbsp;#{content_name}).html_safe\n\t\t\t\tend\n\t\t\t\tcontent.has_validations? ? \"#{content_name}<span class='validation_indicator'>*</span>\".html_safe : content_name\n\t\t\tend", "def class_name\n\t\tname = self.class.to_s.downcase\n\t\tif self.instance_of?(Description) or self.instance_of?(Rating)\n\t\t\tname += self.question_items.size.to_s\n\t\t\titem = self.question_items.collect { |item| item.text.length unless item.text.nil? }.compact.max\n\t\t\tname << case item\n\t\t\twhen (1..1) then \"lab\" # labels 0 1 2 etc\n\t\t\twhen (2..4) then \"lab1\" # nej, ja, etc\n\t\t\twhen (5..8) then \"lab2\" # middel, daarligt, bedre etc\n\t\t\twhen (9..15) then \"lab3\" # laengere\n\t\t\twhen (16..40) then \"lab4\" # lange fx mindre end gennemsnit etc\n\t\t\telse \"\"\n\t\t\tend\n\t\tend\n\t\tname\n\tend", "def article_title\n self.part_title_by_type('Article')\n end", "def assessment_type_author\n frm.div(:class=>\"tier2\").table(:index=>$frame_index)[1][1].text\n end", "def contents_by_type(essence_type)\n contents.select do |content|\n content.essence_type == Content.normalize_essence_type(essence_type)\n end\n end", "def name\n @elements[:name]\n end", "def get_type \n @doc.css(\"div.prob_genre\").text\n end", "def render_essence_editor_by_type(element, essence_type, options = {}, editor_options = {})\n return warning('Element is nil', _t(:no_element_given)) if element.blank?\n return warning('EssenceType is blank', _t(\"No EssenceType given\")) if essence_type.blank?\n defaults = {\n :position => 1,\n :all => false\n }\n options = defaults.merge(options)\n essence_type = Alchemy::Content.normalize_essence_type(essence_type)\n return_string = \"\"\n if options[:all]\n contents = element.contents.find_all_by_essence_type_and_name(essence_type, options[:all])\n contents.each do |content|\n return_string << render_essence_editor(content, editor_options)\n end\n else\n content = element.contents.find_by_essence_type_and_position(essence_type, options[:position])\n return_string = render_essence_editor(content, editor_options)\n end\n return_string\n end", "def name\n (self.title.match(/^(IMG[\\s\\-\\_])?[\\d]+/i) ? \"#{self.photo_collection.name} ##{self.position.to_s}\" : self.title).gsub(/[\\-_]+/,' ').split(/\\s+/).each(&:capitalize!).join(' ')\n end", "def look_up_title(result)\n case name\n when \"IGN\"\n return result.children.to_s.strip\n when \"GameSpot\"\n if result.children.count > 1\n return result.children[1].children[1].children[1].attributes[\"alt\"].value.strip \n end\n when \"GiantBomb\" \n if result.children.count > 1\n return result.children[1].children[1].attributes[\"alt\"].value.strip\n end\n end\n end", "def render_essence(content, part = :view, options = {})\n if content.nil?\n logger.warn %(\\n\n ++++ WARNING: Content is nil!\\n\n Usage: render_essence(content, part, options = {})\\n\n )\n return part == :view ? \"\" : \"<p class=\\\"content_editor_error\\\">\" + _(\"content_not_found\") + \"</p>\"\n elsif content.essence.nil?\n logger.warn %(\\n\n ++++ WARNING: Content.essence is nil!\\n\n Please delete the element and create it again!\n )\n return part == :view ? \"\" : \"<p class=\\\"content_editor_error\\\">\" + _(\"content_essence_not_found\") + \"</p>\"\n end\n defaults = {\n :for_editor => {\n :as => 'text_field',\n :css_class => 'long'\n },\n :for_view => {\n :image_size => \"120x90\",\n :css_class => \"\",\n :date_format => \"%d. %m. %Y, %H:%Mh\",\n :caption => true,\n :blank_value => \"\"\n },\n :render_format => \"html\"\n }\n options_for_partial = defaults[('for_' + part.to_s).to_sym].merge(options[('for_' + part.to_s).to_sym])\n options = options.merge(defaults)\n render(\n :partial => \"essences/#{content.essence.class.name.underscore}_#{part.to_s}.#{options[:render_format]}.erb\",\n :locals => {\n :content => content,\n :options => options_for_partial\n }\n )\n end", "def rdf_type_entity_fragment\n Seek::Rdf::JERMVocab.measured_item_entity_fragment(title)\n end", "def title_attachment_type_value_name\n\t\t\ttype_values[4]\n\t\tend", "def element_name() @stag.element_name end", "def put_together_name(full_or_part)\n tag = :\"description_#{full_or_part}_title_#{source_type}\"\n user_name = begin\n user.legal_name\n rescue StandardError\n \"?\"\n end\n args = {\n text: source_name,\n user: user_name\n }\n if full_or_part == :full\n args[:object] = parent.format_name\n elsif source_name.present?\n tag = :\"#{tag}_with_text\"\n end\n tag.l(args)\n end", "def content_dom_id(content)\n\t\t\t\treturn \"\" if content.nil?\n\t\t\t\tif content.class == String\n\t\t\t\t\tc = Content.find_by_name(content)\n\t\t\t\t\treturn \"\" if c.nil?\n\t\t\t\telse\n\t\t\t\t\tc = content\n\t\t\t\tend\n\t\t\t\t\"#{c.essence_type.demodulize.underscore}_#{c.id}\"\n\t\t\tend", "def identify doc = @doc\n doc.elements.first.name.to_sym\n end", "def name\n metadata.fetch(:example_name, example.description)\n end", "def name\n @name ||= doc.search('.moviename-big').text\n end", "def content_dom_id(content)\n return \"\" if content.nil?\n if content.class == String\n a = Content.find_by_name(content)\n return \"\" if a.nil?\n else\n a = content\n end\n \"#{a.essence_type.underscore}_#{a.id}\"\n end", "def nature_text\n return text_get(8, nature.first)\n end", "def container_element(type)\n val = text(data.at_xpath(\"/c/did/container[@type='#{type}']\"))\n \"#{type.capitalize} #{val.first}\" if val\n end", "def thing_name\n if asset.nil? || asset.content_type.blank?\n \"file\"\n elsif asset.content_type.start_with?(\"image/\")\n \"image\"\n elsif asset.content_type == \"application/pdf\"\n \"document\"\n else\n \"file\"\n end\n end", "def group_type(name)\n self.span(:class=>\"s3d-search-result-name\",:text=>name).parent.parent.span(:class=>\"mymemberships_item_grouptype\").text\n end", "def edm_type\n lambda do |record, accumulator, _context|\n accumulator << 'Image' if record[CLASSIFICATION].present?\n end\n end", "def part_title_by_type(resource_type)\n if self.type == resource_type\n self.title\n elsif self.has_part && self.has_part.type == resource_type\n self.has_part.title\n else\n nil\n end\n end", "def render_essence_editor_by_type(element, type, position = nil, options = {})\n if element.blank?\n logger.warn %(\\n\n ++++ WARNING: Element is nil!\\n\n Usage: render_essence_view(element, position, options = {})\\n\n )\n return \"<p class='element_error'>\" + _(\"no_element_given\") + \"</p>\"\n end\n if position.nil?\n content = element.content_by_type(type)\n else\n content = element.contents.find_by_essence_type_and_position(type, position)\n end\n render_essence(content, :editor, :for_editor => options)\n end", "def itemtype\n format = self[:format_main_ssim] || []\n genre = self[:genre_ssim] || []\n case\n when genre.include?('Thesis/Dissertation')\n 'http://schema.org/Thesis'\n when genre.include?('Video games')\n 'http://schema.org/VideoGame'\n when format.include?('Equipment')\n 'http://schema.org/Thing'\n when format.include?('Book')\n 'http://schema.org/Book'\n when format.include?('Dataset')\n 'http://schema.org/Dataset'\n when format.include?('Image')\n 'http://schema.org/ImageObject'\n when format.include?('Journal/Periodical')\n 'http://schema.org/Periodical'\n when format.include?('Map')\n 'http://schema.org/Map'\n when format.include?('Music recording')\n 'http://schema.org/MusicRecording'\n when format.include?('Newspaper')\n 'http://bib.schema.org/Newspaper'\n when format.include?('Software/Multimedia')\n 'http://schema.org/SoftwareApplication'\n when format.include?('Sound recording')\n 'http://schema.org/AudioObject'\n when format.include?('Video')\n 'http://schema.org/VideoObject'\n else\n 'http://schema.org/CreativeWork'\n end\n end", "def name\n return item_info.name + quality_txt\n end", "def render_essence_editor_by_name(element, name, options = {})\n if element.blank?\n logger.warn %(\\n\n ++++ WARNING: Element is nil!\\n\n Usage: render_essence_view(element, position, options = {})\\n\n )\n return \"<p class='element_error'>\" + _(\"no_element_given\") + \"</p>\"\n end\n content = element.content_by_name(name)\n render_essence(content, :editor, :for_editor => options)\n end", "def text_name\n summary.to_s\n end", "def name\n @example.description.scan(/\\((\\w+)\\)/).flatten.first\n rescue\n @example.description\n end", "def content_owner(name)\n name_li(name).div(:class=>/(mylibrary_item_|searchcontent_result_)by/).link.text\n end", "def species\n return text_get(1, id)\n end", "def element_name; end", "def assessment_type_title\n frm.div(:class=>\"tier2\").table(:index=>0)[0][1].text\n end", "def attention_name\n element_with_value('AttentionName', opts[:attention_name][0..34])\n end", "def name\n text_get(6, @id)\n end", "def unique_text_name\n title = all_subjects.map(&:text_name).uniq.sort.join(\" & \")\n if title.blank?\n :image.l + \" ##{id || \"?\"}\"\n else\n title + \" (#{id || \"?\"})\"\n end\n end", "def name_en\n doc.search(\"#headerPeople span[itemprop='alternativeHeadline']\").text.strip\n end", "def content_type_tag(content_type)\n raise ArgumentError, \"content_type must be a string\" unless content_type.is_a? String\n content_tag(:figure, class: \"content-type\") do\n content_tag(:i, nil, class: \"icons-nyu-content-type-#{content_type.downcase}\") +\n content_tag(:figcaption, content_type.capitalize.tr(\"_\", \" \"))\n end\n end", "def get_summary_property_name(entity_name)\n metadata.xpath(\"//EntityType[@Name='#{entity_name}']/Property[@FC_TargetPath='SyndicationSummary']\").first.attributes['Name'].value\n rescue NoMethodError\n nil\n end", "def render_essence_editor_by_name(element, name, options = {}, html_options = {})\n if element.blank?\n return warning('Element is nil', _t(:no_element_given))\n end\n content = element.content_by_name(name)\n if content.nil?\n render_missing_content(element, name, options)\n else\n render_essence_editor(content, options, html_options)\n end\n end", "def render_essence_editor_by_name(element, name, options = {}, html_options = {})\n if element.blank?\n return warning('Element is nil', _t(:no_element_given))\n end\n content = element.content_by_name(name)\n if content.nil?\n render_missing_content(element, name, options)\n else\n render_essence_editor(content, options, html_options)\n end\n end", "def type\n content.split(' ', 2).first\n end", "def content_type\n self.name[/::(.*)$/, 1].underscore.gsub(/_/, '/')\n end", "def element_id what\n \"#{object_type}_#{what}\"\n end", "def type_name\n TYPE[self.exercise_type].to_s\n end", "def type_title\n \treturn SurvivorEntry.game_type_title(SurvivorEntry.name_to_game_type(self.game_type))\n end", "def sort_elements_by_content(elements, content_name)\n elements.sort_by do |element|\n content = element.content_by_name(content_name)\n content ? content.ingredient.to_s : ''\n end\n end", "def es_type_name\n self.name.pluralize.downcase\n end", "def element_name\n @element_name ||= Utils.string_underscore(Utils.string_demodulize(name))\n end", "def attachment_detail_type_value_name\n\t\t\ttype_values[3]\n\t\tend", "def term_name\n self.content\n end", "def fetch_type name\n exercises = []\n data.exercises.each do |exe|\n if exe.target === name\n exercises.push(exe.name)\n end\n end\n exercises\n end", "def show\n @material_composition.type_name = ['Material', \"Alvenaria: Parede Simples\",\"Alvenaria: Parede Dupla\" ][@material_composition.mtype]\n @impacts = @material_composition.impacts\n end", "def artwork_type_label\n at = ArtworkType.find_by_code(self.artwork_type)\n if at\n return at[:label]\n else\n return artwork_type\n end\n end", "def content_type\n guidance_urls.for_scraping.first.try(:content_type)\n end", "def assessment_type_description\n frm.div(:class=>\"tier2\").table(:index=>0)[2][1].text\n end", "def textile_figure(tag, atts, cite, content)\n span_class = \"\"\n if atts =~ /class=\"([^\\\"]+)\"/\n span_class = $1\n end\n (caption, img_url) = content.split(\"|\").map { |w| w.strip! }\n\n figure_name = \"Figure \" + @figure_counter.chr\n figure_id = figure_name.downcase.gsub(\" \", \"-\")\n @figure_counter += 1\n\n %Q(<div class=\"figure #{span_class}\" id=\"#{figure_id}\"><img src=\"#{img_url}\" alt=\"#{caption}\" title=\"#{figure_name}\" /><div><strong>#{figure_name}</strong> #{caption}</div></div>)\n end", "def document_partial_name(document)\n document[Blacklight.config[:show][:display_type]]\n end", "def content_description_from_element(element, name)\n element.content_description_for(name) ||\n element.available_content_description_for(name)\n end", "def name\n @name ||= details.at(\"h1.header span[itemprop='name']\").text.strip.clean_name\n end", "def edition\n ed_name = xpath(\"//mods:detail[@type='edition']/mods:caption\")\n return ed_name.text unless ed_name.size.zero?\n # fallback to edition number if name unavailable:\n xpath(\"//mods:detail[@type='edition']/mods:number\").text\n end", "def existing_kases_list_header_in_words(kind)\n case kind\n when :idea then \"Existing Ideas in the Community\".t\n when :question then \"Existing Questions in the Community\".t\n when :problem then \"Existing Problems in the Community\".t\n when :praise then \"Existing Praise in the Community\".t\n else \"Existing Cases in the Community\".t\n end\n end", "def text_name\n put_together_name(:full).t.html_to_ascii\n end", "def name\n return text_get(0, id)\n end", "def typeName\n case ftype\n when FTYPE_TEST\n return 'test'\n when FTYPE_SHEET\n return 'mathsheet'\n else # \n return 'generic'\n end\n end", "def ingredient(name)\n content = content_by_name(name)\n return nil if content.blank?\n content.ingredient\n end", "def ingredient(name)\n content = content_by_name(name)\n return nil if content.blank?\n content.ingredient\n end", "def medium_names\n primary_media | secondary_media | component_media\n end", "def name\n attachment.name\n end", "def t_experience_kind(experience)\n I18n.t(\"values.experience_kind.#{experience}\", default: experience.capitalize)\n end", "def render_essence_view_by_type(element, type, position, options = {})\n if element.blank?\n logger.warn %(\\n\n ++++ WARNING: Element is nil!\\n\n Usage: render_essence_view(element, position, options = {})\\n\n )\n return \"\"\n end\n if position.nil?\n content = element.content_by_type(type)\n else\n content = element.contents.find_by_essence_type_and_position(type, position)\n end\n render_essence(content, :view, :for_view => options)\n end", "def append_name\n self.name = self.content\n end", "def page_kind\n \"species\"\n end", "def termdef(name)\n element(name, {:name => name, :class => 'object_type'}, 'a')\n end", "def termdef(name)\n element(name, {:name => name, :class => 'object_type'}, 'a')\n end", "def termdef(name)\n element(name, {:name => name, :class => 'object_type'}, 'a')\n end", "def kind() @tag.sub( /_.*/, '' ) end", "def kind() @tag.sub( /_.*/, '' ) end", "def extract_definition_from_entry_type(entry_type)\n case entry_type\n when 'Problem', 'Problems'\n 'diagnosis'\n when 'Encounter', 'Encounters'\n 'encounter'\n when 'LabResults', 'Results'\n 'laboratory_test'\n when 'Procedure', 'Procedures'\n 'procedure'\n when 'Demographics'\n definition_for_demographic\n when 'Derived'\n 'derived'\n else\n fail \"Unknown data criteria template identifier [#{entry_type}]\"\n end\n end", "def purpose\n \"Intern seeking #{category_name.capitalize} position\"\n end", "def content_item_count(name)\n text = self.span(:class=>\"s3d-search-result-name\",:text=>name).parent.parent.parent.link(:title=>/\\d+.content items/).text\n text[/\\d+/].to_i\n end" ]
[ "0.71933603", "0.71113056", "0.65124255", "0.6335268", "0.6307188", "0.58309793", "0.5773666", "0.57632476", "0.5745741", "0.57351565", "0.5715605", "0.56285834", "0.5442997", "0.5436257", "0.54141855", "0.53965896", "0.53815836", "0.5379749", "0.5360881", "0.53572696", "0.53541553", "0.53462154", "0.53421617", "0.53291416", "0.53286266", "0.5315055", "0.52910566", "0.5285005", "0.5274637", "0.5249661", "0.5245364", "0.5240382", "0.5203158", "0.51992214", "0.5198901", "0.51689494", "0.51635706", "0.5159566", "0.5144852", "0.512416", "0.5119834", "0.5119286", "0.5118886", "0.5117936", "0.51129", "0.5107604", "0.5106672", "0.5104704", "0.5100817", "0.50977176", "0.508544", "0.50843245", "0.5072494", "0.5067272", "0.5065581", "0.5065051", "0.5064536", "0.5054615", "0.5054615", "0.5039945", "0.5027338", "0.5022769", "0.50160563", "0.5014471", "0.5006072", "0.50047636", "0.4997195", "0.49930635", "0.49800712", "0.49739644", "0.49504456", "0.49431205", "0.4938594", "0.49231672", "0.49222216", "0.4921799", "0.49125895", "0.4911215", "0.49092364", "0.4906377", "0.49038622", "0.48998126", "0.48950726", "0.48937345", "0.48937345", "0.48908332", "0.4886442", "0.48848292", "0.4858784", "0.4852333", "0.48509434", "0.4850411", "0.4850411", "0.4850411", "0.4847859", "0.4847859", "0.48471987", "0.48430148", "0.48404077" ]
0.8285629
1
Returns the content description hash from element. It first uses the normal content description described in the +elements.yml+ +contents+ array. If the content description could not be found it tries to load it from +available_contents+ array.
def content_description_from_element(element, name) element.content_description_for(name) || element.available_content_description_for(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description\n return {} if element.nil? or element.content_descriptions.nil?\n element.content_descriptions.detect { |c| c['name'] == self.content.name } || {}\n end", "def content_description_for(content_name)\n if content_descriptions.blank?\n log_warning \"Element #{self.name} is missing the content definition for #{content_name}\"\n return nil\n else\n content_descriptions.detect { |d| d['name'] == content_name }\n end\n end", "def content_descriptions\n return nil if description.blank?\n description['contents']\n end", "def content_description_for(content_name)\n if content_descriptions.blank?\n log_warning \"Element #{self.name} is missing the content description for #{content_name}\"\n return nil\n else\n content_descriptions.detect { |d| d['name'] == content_name }\n end\n end", "def description\n if element.blank?\n log_warning \"Content with id #{self.id} is missing its Element.\"\n return {}\n end\n Content.content_description_from_element(element, name) || {}\n end", "def content_descriptions\n return nil if definition.blank?\n definition['contents']\n end", "def content_description(element, essence_hash)\n essence_hash.stringify_keys!\n # No name given. We build the content from essence type.\n if essence_hash['name'].blank? && essence_hash['essence_type'].present?\n content_description_from_essence_type(element, essence_hash['essence_type'])\n else\n content_description_from_element(element, essence_hash['name'])\n end\n end", "def content_for_rss_description\n rss_title = content_descriptions.detect { |c| c['rss_description'] }\n contents.find_by_name(rss_title['name'])\n end", "def content_for_rss_description\n rss_description = content_descriptions.detect { |c| c['rss_description'] }\n return if rss_description.blank?\n contents.find_by_name(rss_description['name'])\n end", "def available_content_descriptions\n return nil if description.blank?\n description['available_contents']\n end", "def description\n if element.blank?\n log_warning \"Content with id #{self.id} is missing its Element.\"\n return {}\n end\n desc = self.element.content_description_for(self.name)\n if desc.blank?\n self.element.available_content_description_for(self.name)\n end\n desc || {}\n end", "def available_content_description_for(content_name)\n return nil if available_contents.blank?\n available_contents.detect { |d| d['name'] == content_name }\n end", "def available_content_description_for(content_name)\n return nil if available_content_descriptions.blank?\n available_content_descriptions.detect { |d| d['name'] == content_name }\n end", "def create_contents\n contents = []\n if definition[\"contents\"].blank?\n log_warning \"Could not find any content descriptions for element: #{self.name}\"\n else\n definition[\"contents\"].each do |content_hash|\n contents << Content.create_from_scratch(self, content_hash.symbolize_keys)\n end\n end\n end", "def create_contents\n contents = []\n if description[\"contents\"].blank?\n log_warning \"Could not find any content descriptions for element: #{self.name}\"\n else\n description[\"contents\"].each do |content_hash|\n contents << Content.create_from_scratch(self, content_hash.symbolize_keys)\n end\n end\n end", "def create_contents\n contents = []\n if description[\"contents\"].blank?\n logger.warn \"\\n++++++\\nWARNING! Could not find any content descriptions for element: #{self.name}\\n++++++++\\n\"\n else\n description[\"contents\"].each do |content_hash|\n contents << Alchemy::Content.create_from_scratch(self, content_hash.symbolize_keys)\n end\n end\n end", "def content_definition_for(content_name)\n if content_definitions.blank?\n log_warning \"Element #{name} is missing the content definition for #{content_name}\"\n nil\n else\n content_definitions.detect { |d| d[\"name\"] == content_name.to_s }\n end\n end", "def description\n description = self.class.descriptions.detect { |d| d['name'] == self.name }\n if description.blank?\n log_warning \"Could not find element definition for #{self.name}. Please check your elements.yml!\"\n return {}\n else\n return description\n end\n end", "def content_info(id)\n filename = settings.root + '/contents/' + id + '.yml'\n content = YAML.load(File.read(filename))\n\n raise 'Content has not key' unless content[:key]\n\n # Complete HMS information with default values.\n content[:id] ||= \"urn:marlin:organization:example:#{id}\"\n content[:title] ||= id\n content[:synopsis] ||= content[:title]\n content[:url] ||= url(\"/contents/#{id}.dcf\")\n\n # Other useful URLs.\n content[:rights_url] = url('/license/' + id)\n content[:download_url] = url('/download/' + id)\n content[:stream_url] = url('/stream/' + id)\n content[:cad_url] = url('/cad/' + id)\n\n content\n rescue Errno::ENOENT\n # .yml file does not exist. Show a 404 Not Found.\n not_found\n end", "def available_contents\n description['available_contents']\n end", "def definition\n if element.blank?\n log_warning \"Content with id #{id} is missing its Element.\"\n return {}\n end\n element.content_definition_for(name) || {}\n end", "def definition\n if element.blank?\n log_warning \"Content with id #{self.id} is missing its Element.\"\n return {}\n end\n element.content_definition_for(name) || {}\n end", "def build(element, essence_hash)\n if (description = content_description(element, essence_hash)).blank?\n raise ContentDefinitionError, \"No description found in elements.yml for #{essence_hash.inspect} and #{element.inspect}\"\n else\n new(name: description['name'], element_id: element.id, skip_translate: description['translate'] == false)\n end\n end", "def content_definitions\n return nil if definition.blank?\n\n definition[\"contents\"]\n end", "def content_definition(element, essence_hash)\n essence_hash.stringify_keys!\n # No name given. We build the content from essence type.\n if essence_hash['name'].blank? && essence_hash['essence_type'].present?\n content_definition_from_essence_type(element, essence_hash['essence_type'])\n else\n element.content_definition_for(essence_hash['name'])\n end\n end", "def descriptions\n Element.descriptions.collect { |e| e['contents'] }.flatten.compact\n end", "def descriptions\n Element.descriptions.collect { |e| e['contents'] }.flatten.compact\n end", "def content_for_rss_title\n rss_title = content_descriptions.detect { |c| c['rss_title'] }\n contents.find_by_name(rss_title['name'])\n end", "def extract_description(content)\n Woro::TaskList.extract_description content\n end", "def content_for_rss_title\n rss_title = content_descriptions.detect { |c| c['rss_title'] }\n return if rss_title.blank?\n contents.find_by_name(rss_title['name'])\n end", "def content_description_from_essence_type(element, essence_type)\n {\n 'type' => essence_type,\n 'name' => content_name_from_element_and_essence_type(element, essence_type)\n }\n end", "def available_contents\n definition['available_contents']\n end", "def content_for_rss_description\n content_for_rss_meta(\"description\")\n end", "def metadata\n @metadata ||= (\n if md = /\\<\\!\\-\\-\\-(.*?)\\-{2,3}\\>\\s*\\Z/m.match(content)\n YAML.load(md[1])\n else\n {}\n end\n )\n end", "def hash\n @content.hash\n end", "def build(element, essence_hash)\n definition = content_definition(element, essence_hash)\n if definition.blank?\n raise ContentDefinitionError, \"No definition found in elements.yml for #{essence_hash.inspect} and #{element.inspect}\"\n else\n new(name: definition['name'], element_id: element.id)\n end\n end", "def site_description\n headings = @doc.xpath(\"//h3[@class='clearl']\")\n content_sections = @doc.xpath(\"//h3[@class='clearl']/following-sibling::p[1]\")\n content = \"\"\n headings.zip(content_sections).each do |h, c| \n unless (c.to_s().squeeze().empty?)\n content << \"<h3>#{sanitize(h.to_s)}</h3>\" \n content << \"<p>#{sanitize(c.to_s)}\"\n end\n end\n rhtml = IO.read(File.expand_path(\"site_description.rhtml\", File.dirname(__FILE__)))\n content_html = Erubis::Eruby.new(rhtml)\n content_html.result(:content => content)\n end", "def definition\n if (definition = self.class.definition_by_name(name))\n definition\n else\n log_warning \"Could not find element definition for #{name}. \" \\\n \"Please check your elements.yml file!\"\n {}\n end\n end", "def description\n @description ||= begin\n readme = File.read( path( 'README.txt' ) )\n md = readme.match( /== DESCRIPTION:(.+?)\\n== /m ) or\n fail( \"can't find a description section in README.txt\" )\n md[1].strip\n end\n end", "def definition\n if definition = self.class.definition_by_name(name)\n definition\n else\n log_warning \"Could not find element definition for #{name}. \" \\\n \"Please check your elements.yml file!\"\n {}\n end\n end", "def parse_description\n desc = self.description\n text, tag = split_last_line(desc)\n\n begin\n config = JSON.parse(tag)\n unless config.kind_of?(Hash)\n log.error(\"Ignoring non-hash JSON tag\", text: text, tag: tag, group_email: group_email)\n text = desc\n config = {}\n end\n rescue JSON::ParserError\n text = desc\n config = {}\n end\n\n [text, config]\n end", "def hash\n element.hash\n end", "def content_based_description\n first_long_paragraph = parsed_search('//p[string-length() >= 120]').first\n first_long_paragraph ? first_long_paragraph.text : ''\n end", "def description_lookup\n @@description_lookup ||= {}\n end", "def getHash element\n\tfile = File.new(element)\n\thash = Digest::SHA256.file file\n\tfile.close\n\treturn hash.hexdigest \n\tend", "def get_hash(path=\"\")\n Element.get_hash(@element, path)\n end", "def meta_description(content)\n content_for_wrapper(:meta_description, content)\n end", "def vol_constants_hash content_md_doc\n doc_hash = {}\n obj_resource_nodes = content_md_doc.root.xpath('/contentMetadata/resource[@type=\"object\"][@sequence=\"1\"][label=\"Object 1\"]')\n raise \"content_md didn't have single object node\" if obj_resource_nodes.size != 1\n obj_node = obj_resource_nodes.first\n pdf_nodes = obj_node.xpath('file[@mimetype=\"application/pdf\"]')\n if pdf_nodes.size == 1\n pdf_node = pdf_nodes.first\n pdf_name = pdf_node.xpath('@id').text\n doc_hash[:vol_pdf_name_ss] = pdf_name.strip if pdf_name && pdf_name.strip\n pdf_size = pdf_node.xpath('@size').text\n begin\n doc_hash[:vol_pdf_size_ls] = Integer(pdf_size.strip) if pdf_size && pdf_size.strip\n rescue ArgumentError => e\n logger.warn(\"bad value for PDF size: '#{pdf_size}'\")\n end\n else\n logger.warn(\"couldn't find pdf in contentMetadata object <resource> element: #{obj_node.to_xml}\")\n end\n tei_nodes = obj_node.xpath('file[@mimetype=\"application/xml\"]')\n if tei_nodes.size == 1\n tei_node = tei_nodes.first\n tei_name = tei_node.xpath('@id').text\n doc_hash[:vol_tei_name_ss] = tei_name.strip if tei_name && tei_name.strip\n tei_size = tei_node.xpath('@size').text\n begin\n doc_hash[:vol_tei_size_is] = Integer(tei_size.strip) if tei_size && tei_size.strip\n rescue ArgumentError => e\n logger.warn(\"bad value for TEI size: '#{tei_size}'\")\n end\n else\n logger.warn(\"couldn't find tei in contentMetadata object <resource> element: #{obj_node.to_xml}\")\n end\n\n page_resource_nodes = content_md_doc.root.xpath('/contentMetadata/resource[@type=\"page\"]')\n if page_resource_nodes.size > 0\n last_page_node = page_resource_nodes.last\n doc_hash[:vol_total_pages_is] = page_num last_page_node\n else\n logger.warn(\"no page <resource> elements found in contentMetadata: #{content_md_doc.to_xml}\")\n end\n doc_hash \n end", "def read_content(element_name)\n element_content = read_element(\"#{element_name}\").first.content rescue nil\n unless element_content.nil?\n element_content.empty? ? nil : element_content\n else\n nil\n end\n end", "def description\n\t # if the description exists\n\t # return it \n\t # else \n\t # scrape to get the description\n\t # return it\n\t # end\n\tend", "def extract_description\n\t\tparts = self.readme&.parts or return nil\n\t\tdesc_para = parts.find {|part| part.is_a?(RDoc::Markup::Paragraph) }&.text or return nil\n\t\tformatter = RDoc::Markup::ToHtml.new( RDoc::Options.new )\n\t\thtml = formatter.convert( desc_para )\n\n\t\treturn html.gsub( /<.*?>/, '' ).strip\n\tend", "def content\n @content ||= if valid_attrs?(:content_id, :content_type)\n Object.const_get(content_type).find_by_id(content_id)\n end\n end", "def element\n return nil if content.nil?\n @element ||= content.element\n end", "def content_definition_from_essence_type(element, essence_type)\n {\n 'type' => essence_type,\n 'name' => content_name_from_element_and_essence_type(element, essence_type)\n }\n end", "def contents\n @contents ||= begin\n # First collect the localized content\n contents_data = localized_contents\n contents_data = [] if contents_data.blank?\n # Then grab the content that belongs directly to the page\n contents_data << non_localized_contents\n unless contents_data.blank?\n contents_data = contents_data.flatten.sort{|a,b| a.section_position <=> b.section_position}\n end\n end\n @contents\n end", "def get_hash(path='.')\n Element.get_hash(@element, path)\n end", "def hash\n digest = Digest::MD5.new\n digest << title.to_s\n digest << content.join('').to_s\n digest.to_s\n end", "def find_item description\n items = find_items\n elem = items.xpath(\".//rasd:Description\").find{ |e| e.content == description }\n raise MissingElement.new(description) if elem.nil?\n elem.parent\n end", "def description\n desc = object.description.to_s\n desc = h.strip_tags(markdown.render(desc)).strip # Escape HTML and remove Markdown\n\n if desc.blank? or [\"[!\", \"[](\", \"===\", \"```\"].any? { |s| desc.include? s }\n \"<em>#{ DESCRIPTION_UNAVAILABLE }</em>\".html_safe\n else\n desc = \"#{ desc }.\" if /\\w/ =~ desc.last # Add trailing dot\n desc[0] = desc[0].upcase # Capitalize 1st letter\n desc.html_safe\n end\n end", "def find_content(payload)\n return nil unless payload.present?\n\n content = payload.body&.data\n return content if content.present?\n\n parts = payload.parts\n parts.each do |part|\n content = find_content(part)\n return content if content.present?\n end\n end", "def hash\n [content_addressable].hash\n end", "def description_section\n section_of( 'README.md', 'DESCRIPTION')\n end", "def render_content_element(content_element)\n return \"\" unless content_element.template\n parsed_template = Liquid::Template.parse(content_element.template.code)\n parsed_template.render('content_element' => Kernel.const_get(content_element.element_type).find_by_content_element_id(content_element.id))\n end", "def definitions\n Element.definitions.collect { |e| e['contents'] }.flatten.compact\n end", "def extended_description_field\n product_descriptions.where(content_name: \"extended_description\").first_or_initialize\n end", "def localized_contents\n @localized_contents ||= begin\n # First collect the localized content\n contents_data = Gluttonberg::Content.localization_associations.inject([]) do |memo, assoc|\n memo += send(assoc).all\n end\n contents_data = contents_data.sort{|a,b| a.section_position <=> b.section_position}\n end\n @localized_contents\n end", "def elementhash\n return @elementHash\n end", "def find_item_with_content(content)\n # TODO Stubbed - Requires definition and implementation\n end", "def description_for(item)\n if item.description\n item.description\n elsif item.content\n item.content\n else\n \"\"\n end\n end", "def set_description_digest\n self.description_digest = digest_for(description)\n end", "def content(name, content, opts = {})\n page = Islay::Pages.definitions[name]\n raise \"The page '#{name}' has not been defined\" if page.nil?\n raise \"The content '#{content}' has not been defined\" if page.contents[content].nil?\n\n if record = page.record\n config = record.content_with_config(content)\n\n case config[:type]\n when :markdown then render_markdown(config[:value], opts[:level] || 1)\n when :text then simple_format(config[:value])\n when :string, :color then config[:value]\n when :image\n if opts[:url_only]\n version_image_url(config[:value].asset, opts[:version]) if config[:value]\n else\n version_image_tag(config[:value].asset, opts[:version]) if config[:value]\n end\n end\n end\n end", "def content\n\t @content_hash[@parsing_library].content \n\t end", "def contents\n conf['contents'] || []\n end", "def hash\n @elements.hash\n end", "def hash\n @elements.hash\n end", "def check_description\n @repo_data ? @repo_data['description'] : nil\n end", "def definitions\n definitions = Element.definitions.flat_map { |e| e[\"contents\"] }\n definitions.compact!\n definitions\n end", "def hash \n @hash ||= CobraVsMongoose.xml_to_hash(file_content)\n end", "def hashed_content\n @hashed_content ||= valid? ? Digest::SHA1.hexdigest(content) : nil \n end", "def description\n desc = details.at(\"div.summary_text[itemprop='description']\").text.strip.clean_description rescue nil\n (desc.nil? || desc.empty?) ? nil : desc\n end", "def all_contents\n yml_filenames = Dir.glob(settings.root + '/contents/*.yml')\n yml_filenames.map { |filename|\n id = filename.match(/\\/contents\\/(.*)\\.yml/)[1]\n content_info(id)\n }\n end", "def content_path\n raise \"An Entry must define a `content_path` in its Spec.\"\n end", "def find_item_with_content(content)\n # TODO Stubbed - Requires definition and implementation\n end", "def get_hash(element, path='.')\n return unless element\n \n result = element.at_xpath(path)\n if result\n hash = {}\n result = result.children\n result.each do |item|\n hash[item.name] = item.inner_html\n end \n hash\n end\n end", "def description\n return nil if document.xml?\n Nokogiri::HTML4::ElementDescription[name]\n end", "def desc\n if self.namespace\n content_from 'ns:desc', :ns => self.namespace.href\n else\n content_from :desc\n end\n end", "def extract_metadata\n YAML_METADATA.match(content) do |match|\n @metadata = YAML.load(match[0])\n @content = content.gsub(YAML_METADATA, \"\")\n end\n end", "def smartContent\n smart_content_element\n end", "def find_en_description(item)\n item['Description'].find { |d| d['Language'] == 'EN' }['Description']\n end", "def hash_tag_description(pr)\n pull_req = pull_req_entry(pr)\n unless pull_req[:body].nil?\n pull_req[:body].\\\n gsub(/`.*?`/, '').\\\n scan(/#([0-9]+)/).size\n else\n 0\n end\n end", "def getContentSummary(iContent)\n return iContent\n end", "def content_for(part_slug)\n part_with_slug(part_slug).try(:body)\n end", "def description(index)\n feed.entries[index].content || feed.entries[index].summary\n end", "def content_description\n @content ? \"with content #{@content.inspect}\" : \"\"\n end", "def to_h\n hash = {\n name: name,\n contents: contents\n }\n hash[:id] = id if id\n hash[:syntax] = syntax || 'autodetect'\n hash[:size] = size if size\n\n hash\n end", "def get_unordered_element(what)\n result = @unordered_elements[conform_to_symbol(what)]\n raise RuntimeError if result.nil?\n result\n end", "def existing_tags\n Notion.where(locale: @lecture.locale || I18n.default_locale)\n .pluck('title') & @content_descriptions\n end", "def description\n text_get(7, @id)\n end", "def contents()\n html = Nokogiri::HTML(@markdown_document.to_html())\n\n # Fixup refs to other markdown documents\n html.css(\"a\").each do |anchor|\n anchor[\"href\"] = anchor[\"href\"].sub(%r{\\.md$}, \".html\")\n end\n\n # Since we transform device-specific $device/README.md pages into\n # discrete $device.html, we need to fixup cross-linking into its namespace\n # This could be generalized some more, to be fixed once we have other internal links to mismatched README.md/index.html locations.\n if File.dirname(relative_output) == \"devices\"\n html.css(\"a\").each do |anchor|\n if anchor[\"href\"].match(%r{\\.\\./[^\\.]+$})\n anchor[\"href\"] = anchor[\"href\"].sub(%r{\\.\\./}, \"devices/\") + \".html\"\n end\n end\n end\n\n # Since Nokogiri produces a complete document from our fragment, we\n # have to pick only what's in the body; so strip the body added tags and higher-up tags.\n html\n .at_css(\"body\").to_s()\n .sub(%r{^<body>}, \"\").sub(%r{</body>$}, \"\")\n end", "def extract_content_attr(nodes)\n nodes.first.andand['content']\n end" ]
[ "0.6210891", "0.6051284", "0.6032567", "0.5991266", "0.59829277", "0.59794676", "0.59772605", "0.59560263", "0.5893565", "0.5891129", "0.58809966", "0.58598936", "0.5721566", "0.5669537", "0.56397694", "0.5636007", "0.56188446", "0.56168675", "0.55757695", "0.55506754", "0.55386", "0.5528308", "0.552012", "0.54172426", "0.5375131", "0.533871", "0.533871", "0.52979666", "0.5270475", "0.5178043", "0.5155687", "0.51132375", "0.50838745", "0.5001451", "0.49973387", "0.498688", "0.4986019", "0.4931035", "0.4927426", "0.49041626", "0.48968112", "0.4887333", "0.487484", "0.4870702", "0.48431367", "0.4838318", "0.48127347", "0.48070845", "0.47772154", "0.47648987", "0.4746656", "0.47426862", "0.47373837", "0.47021058", "0.46570426", "0.46385372", "0.4617773", "0.4595073", "0.45798838", "0.45793372", "0.455794", "0.45541447", "0.45458364", "0.4532653", "0.4499516", "0.4490365", "0.44886553", "0.44866517", "0.44856513", "0.44832522", "0.4478627", "0.44774252", "0.44703642", "0.4469111", "0.4469111", "0.44687685", "0.44683054", "0.4465075", "0.44634295", "0.44599196", "0.4450997", "0.44494823", "0.4447683", "0.4446774", "0.44427565", "0.44364154", "0.44362682", "0.4435784", "0.44270128", "0.44267464", "0.44216502", "0.44026223", "0.4394812", "0.43910468", "0.43910214", "0.43833816", "0.4382292", "0.4376876", "0.43752572", "0.4372105" ]
0.62684584
0
Returns all content descriptions from elements.yml
def descriptions Element.descriptions.collect { |e| e['contents'] }.flatten.compact end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_descriptions\n return nil if description.blank?\n description['contents']\n end", "def content_descriptions\n return nil if definition.blank?\n definition['contents']\n end", "def descriptions\n if ::File.exists? \"#{::Rails.root}/config/alchemy/elements.yml\"\n ::YAML.load_file(\"#{::Rails.root}/config/alchemy/elements.yml\") || []\n else\n raise LoadError, \"Could not find elements.yml file! Please run: rails generate alchemy:scaffold\"\n end\n end", "def description\n return {} if element.nil? or element.content_descriptions.nil?\n element.content_descriptions.detect { |c| c['name'] == self.content.name } || {}\n end", "def description\n description = self.class.descriptions.detect { |d| d['name'] == self.name }\n if description.blank?\n log_warning \"Could not find element definition for #{self.name}. Please check your elements.yml!\"\n return {}\n else\n return description\n end\n end", "def available_content_descriptions\n return nil if description.blank?\n description['available_contents']\n end", "def description\n if element.blank?\n log_warning \"Content with id #{self.id} is missing its Element.\"\n return {}\n end\n desc = self.element.content_description_for(self.name)\n if desc.blank?\n self.element.available_content_description_for(self.name)\n end\n desc || {}\n end", "def create_contents\n contents = []\n if description[\"contents\"].blank?\n logger.warn \"\\n++++++\\nWARNING! Could not find any content descriptions for element: #{self.name}\\n++++++++\\n\"\n else\n description[\"contents\"].each do |content_hash|\n contents << Alchemy::Content.create_from_scratch(self, content_hash.symbolize_keys)\n end\n end\n end", "def descriptions\n []\n end", "def description\n if element.blank?\n log_warning \"Content with id #{self.id} is missing its Element.\"\n return {}\n end\n Content.content_description_from_element(element, name) || {}\n end", "def descriptions\n @all_descriptions ||= @doc.match DESCRIPTION_MATCHES\n end", "def create_contents\n contents = []\n if description[\"contents\"].blank?\n log_warning \"Could not find any content descriptions for element: #{self.name}\"\n else\n description[\"contents\"].each do |content_hash|\n contents << Content.create_from_scratch(self, content_hash.symbolize_keys)\n end\n end\n end", "def all_descriptions\n result = []\n @pages.each do |page|\n result << [page.page_url, page.meta_desc_content] if page.page_a_tags\n end\n result\n end", "def site_description\n headings = @doc.xpath(\"//h3[@class='clearl']\")\n content_sections = @doc.xpath(\"//h3[@class='clearl']/following-sibling::p[1]\")\n content = \"\"\n headings.zip(content_sections).each do |h, c| \n unless (c.to_s().squeeze().empty?)\n content << \"<h3>#{sanitize(h.to_s)}</h3>\" \n content << \"<p>#{sanitize(c.to_s)}\"\n end\n end\n rhtml = IO.read(File.expand_path(\"site_description.rhtml\", File.dirname(__FILE__)))\n content_html = Erubis::Eruby.new(rhtml)\n content_html.result(:content => content)\n end", "def extract_description(content)\n Woro::TaskList.extract_description content\n end", "def content_description_from_element(element, name)\n element.content_description_for(name) ||\n element.available_content_description_for(name)\n end", "def create_contents\n contents = []\n if definition[\"contents\"].blank?\n log_warning \"Could not find any content descriptions for element: #{self.name}\"\n else\n definition[\"contents\"].each do |content_hash|\n contents << Content.create_from_scratch(self, content_hash.symbolize_keys)\n end\n end\n end", "def content_description_for(content_name)\n if content_descriptions.blank?\n log_warning \"Element #{self.name} is missing the content definition for #{content_name}\"\n return nil\n else\n content_descriptions.detect { |d| d['name'] == content_name }\n end\n end", "def content_for_rss_description\n content_for_rss_meta(\"description\")\n end", "def content_description_for(content_name)\n if content_descriptions.blank?\n log_warning \"Element #{self.name} is missing the content description for #{content_name}\"\n return nil\n else\n content_descriptions.detect { |d| d['name'] == content_name }\n end\n end", "def descriptions\n I18n.available_locales.map {|l| [l, description(l)] }.to_h\n end", "def available_content_description_for(content_name)\n return nil if available_content_descriptions.blank?\n available_content_descriptions.detect { |d| d['name'] == content_name }\n end", "def descriptions\n return attributes[:descriptions] if attributes[:descriptions]\n attributes[:descriptions] = {}\n attributes[:descriptions]\n end", "def content_for_rss_description\n rss_title = content_descriptions.detect { |c| c['rss_description'] }\n contents.find_by_name(rss_title['name'])\n end", "def descriptions\n\t\t@profile[:descriptions]\n\tend", "def all_contents\n yml_filenames = Dir.glob(settings.root + '/contents/*.yml')\n yml_filenames.map { |filename|\n id = filename.match(/\\/contents\\/(.*)\\.yml/)[1]\n content_info(id)\n }\n end", "def descriptions\n @@descriptions ||= Parser::DescriptionLookup.new\n end", "def descriptions\n return xpath_all(doc, './/Identify/description')\n end", "def return_descriptions_array(doc)\n descriptions = doc.css(\".search-content .field-item.even\")\n recipe_descriptions = []\n descriptions.each do |element|\n recipe_descriptions << element.text\n end\n return recipe_descriptions\n end", "def desc\n if self.namespace\n content_from 'ns:desc', :ns => self.namespace.href\n else\n content_from :desc\n end\n end", "def description\n values = super\n values = Deepblue::MetadataHelper.ordered( ordered_values: description_ordered, values: values )\n return values\n end", "def existing_tags\n Notion.where(locale: @lecture.locale || I18n.default_locale)\n .pluck('title') & @content_descriptions\n end", "def available_contents\n description['available_contents']\n end", "def content_for_rss_description\n rss_description = content_descriptions.detect { |c| c['rss_description'] }\n return if rss_description.blank?\n contents.find_by_name(rss_description['name'])\n end", "def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.desc)}\n return(cfg)\n end", "def available_content_description_for(content_name)\n return nil if available_contents.blank?\n available_contents.detect { |d| d['name'] == content_name }\n end", "def elements_for_layout(layout)\n elements = []\n layout_elements = PageLayout.get(layout)[\"elements\"]\n return Element.descriptions if layout_elements == \"all\"\n Element.descriptions.each do |element|\n if layout_elements.include?(element[\"name\"])\n elements << element\n end\n end\n elements\n end", "def description\n response_json = @client.api_get_request('', 'tree=description')\n response_json['description']\n end", "def description\n text_attribute('description')\n end", "def content\n \"#{title} #{description_text}\"\n end", "def description\n search_by_itemprop 'description'\n end", "def description\n I18n.t(\"rubrics.item.description.#{basename.underscore}\")\n end", "def description\n values = super\n values = MetadataHelper.ordered( ordered_values: self.description_ordered, values: values )\n return values\n end", "def description\n values = super\n values = MetadataHelper.ordered( ordered_values: self.description_ordered, values: values )\n return values\n end", "def description\n\t # if the description exists\n\t # return it \n\t # else \n\t # scrape to get the description\n\t # return it\n\t # end\n\tend", "def description\n query_root_node(\"description/text()\")\n end", "def description\n parsed {\n @description\n }\n end", "def description_text\n\t\t\tif @data[\"description\"] \n\t\t\t\thtml_data = @data[\"description\"][\"text\"] \n\t\t\t\tparsed_data = Nokogiri::HTML(html_data)\n\t\t\t\tparsed_data.text\n\t\t\tend\n\t\tend", "def page_description\n if content_for?(:description)\n \"#{yield_content(:description)}\"\n else\n \"Capra is a design agency based in Ottawa, Canada run by husband and wife team Ollie and Kat Kavanagh. Our focus is great design. We love interactive work like websites, games and apps because we get involved in building what we design.\"\n end\n end", "def description\n description_section.join(\" \").tr(\"\\n\", ' ').gsub(/[{}]/,'').gsub(/\\[[^\\]]+\\]/,'') # strip rdoc\n end", "def description(text)\n content_for(:description) { text }\n end", "def description(text)\n content_for(:description) { text }\n end", "def repeated_descriptions(node); end", "def description\n node.at(\"description\").text\n end", "def description\n text_get(7, @id)\n end", "def content_description(element, essence_hash)\n essence_hash.stringify_keys!\n # No name given. We build the content from essence type.\n if essence_hash['name'].blank? && essence_hash['essence_type'].present?\n content_description_from_essence_type(element, essence_hash['essence_type'])\n else\n content_description_from_element(element, essence_hash['name'])\n end\n end", "def description\n fields['description']\n end", "def tags_with_html_content\n [:details, :description, :detailed_information, :impact]\n end", "def tags_with_html_content\n [:details, :description, :detailed_information, :impact]\n end", "def content_info(id)\n filename = settings.root + '/contents/' + id + '.yml'\n content = YAML.load(File.read(filename))\n\n raise 'Content has not key' unless content[:key]\n\n # Complete HMS information with default values.\n content[:id] ||= \"urn:marlin:organization:example:#{id}\"\n content[:title] ||= id\n content[:synopsis] ||= content[:title]\n content[:url] ||= url(\"/contents/#{id}.dcf\")\n\n # Other useful URLs.\n content[:rights_url] = url('/license/' + id)\n content[:download_url] = url('/download/' + id)\n content[:stream_url] = url('/stream/' + id)\n content[:cad_url] = url('/cad/' + id)\n\n content\n rescue Errno::ENOENT\n # .yml file does not exist. Show a 404 Not Found.\n not_found\n end", "def description\n if I18n.locale == :en\n description_en\n else\n description_pl\n end\n end", "def describe\n @description\n end", "def describe\n @description\n end", "def get_description\n get_field_config['description']\n end", "def ansible_content\n @ansible_content ||= begin\n require_relative 'plugins/ansible_content'\n flat_map do |engine|\n content_directories(engine, \"ansible\").map { |dir| AnsibleContent.new(dir) }\n end\n end\n end", "def description_html\n convert_html description\n end", "def show\n @descriptions = Utils::I18n.sort_descriptions(@dictionary.dictionary_descriptions)\n end", "def find_en_description(item)\n item['Description'].find { |d| d['Language'] == 'EN' }['Description']\n end", "def description_nested\n self[Solrizer.solr_name('description_nested', :displayable)]\n end", "def content_based_description\n first_long_paragraph = parsed_search('//p[string-length() >= 120]').first\n first_long_paragraph ? first_long_paragraph.text : ''\n end", "def category_descriptions\n return @category_descriptions\n end", "def meta_description(content)\n content_for_wrapper(:meta_description, content)\n end", "def content_definitions\n return nil if definition.blank?\n\n definition[\"contents\"]\n end", "def generate_description\n text, _ = parse_description\n parts = []\n parts << text if text.length > 0\n parts << JSON.generate(config) if config && config.length > 0\n parts.join(\"\\n\")\n end", "def description\n page.render_part('description') rescue ''\n end", "def description\n page.render_part('description') rescue ''\n end", "def description(page_description) \n content_for(:description) do \n \"<meta name=\\\"description\\\" content=\\\"#{page_description}\\\" />\\n\" \n end \n end", "def description_for(item)\n if item.description\n item.description\n elsif item.content\n item.content\n else\n \"\"\n end\n end", "def description\n ::I18n.translate(['refinery', 'plugins', name, 'description'].join('.'))\n end", "def description\n @data['description']\n end", "def description\n @data['description']\n end", "def description_section\n section_of( 'README.md', 'DESCRIPTION')\n end", "def values\n @yaml.values\n end", "def description(page_description)\n content_for(:description) { page_description }\n end", "def tags_with_html_content\n [:description, :recommendation]\n end", "def extra_description\n attributes_description + content_description + count_description\n end", "def index\n @admin_descriptions = Admin::Description.all\n end", "def definitions\n Element.definitions.collect { |e| e['contents'] }.flatten.compact\n end", "def description\n @data['description']\n end", "def description\n return nil if document.xml?\n Nokogiri::HTML4::ElementDescription[name]\n end", "def description\n data['description']\n end", "def description_for(game)\n File.read(\"app/views/games/description/_#{game.slug}.html.haml\")\n end", "def contents\n conf['contents'] || []\n end", "def description\n return super if ordered_descriptions.blank?\n JSON.parse(ordered_descriptions)\n end", "def description\n object[\"description\"]\n end", "def has_descriptions\n options[:descriptions]\n end", "def spec_descriptions\n [spec_description, spec_additional_description].compact\n end", "def print_event_yml()\n # Parse the event container <aside><div><p>...</p></div></aside>\n # to get the orga dates and names\n allevents = fetch_html()\n allevents.xpath('//aside//div//p').each do |events_chunk|\n\n # # Split array in cohensive elements at once\n # elements = events_chunk.content.split(/\\,\\ |\\.\\ |\\n/)\n\n # # Puts warning\n # elements_yml = \"# Do not edit this list manually, it will be overwritten\\n\"\n # elements_yml = elements_yml + \"# in a couple of hours anyway!\\n\\n\"\n\n # elements_yml = elements_yml + \"events:\\n\"\n # i = 0\n\n # until i >= elements.length do\n # if i != nil and elements[i +3] != nil then\n # # Puts all event names out of elements\n # elements_yml = elements_yml + \" - name: \\\"\" + elements[i + 3] + \"\\\"\\n\"\n # end\n # if i != nil then\n # # Puts all event dates out of elements\n # puts elements[i + 2] + \":\" + elements[i + 1]\n # begin\n # elements_yml = elements_yml + Date.new(2018,elements[i + 2].to_i,elements[i + 1].to_i).strftime(\" date: \\\"%b %d, %Y\\\"\\n\")\n # rescue ArgumentError\n # end\n # end\n # if i != nil then\n # # Puts all event background colors\n # elements_yml = elements_yml + \" background: \\\"\" + gen_color() + \"\\\"\\n\"\n # end\n # i += 4;\n # end\n # return elements_yml\n end\nend", "def get_description(n)\n @description_xpath[n].text\n end" ]
[ "0.75444865", "0.73952186", "0.72706515", "0.725854", "0.70734763", "0.70090723", "0.6845667", "0.6794899", "0.6790442", "0.6719457", "0.6667728", "0.65636176", "0.6535613", "0.6531282", "0.6495377", "0.6491458", "0.6485071", "0.64366806", "0.6391138", "0.63480014", "0.6290597", "0.6284297", "0.6246026", "0.6226386", "0.6189089", "0.6188803", "0.61709106", "0.6149617", "0.60989785", "0.6080423", "0.6077583", "0.6058137", "0.6000169", "0.5986038", "0.5983743", "0.59743464", "0.59360445", "0.5932285", "0.592373", "0.5892956", "0.58897233", "0.58886", "0.5861226", "0.5861226", "0.5848521", "0.58433783", "0.5826244", "0.58238155", "0.5818103", "0.58144635", "0.57859445", "0.57842827", "0.5770869", "0.57667035", "0.5758365", "0.5756569", "0.57126504", "0.57117116", "0.57117116", "0.57080823", "0.5705957", "0.5705571", "0.5705571", "0.5703669", "0.5699588", "0.5696504", "0.56945324", "0.56879485", "0.5680166", "0.5679098", "0.5675715", "0.56742084", "0.5674145", "0.56688255", "0.5662885", "0.5662885", "0.56624764", "0.5660503", "0.56315523", "0.56301045", "0.56301045", "0.5629867", "0.56194", "0.561825", "0.5606282", "0.5599339", "0.5597607", "0.559118", "0.55899125", "0.5585906", "0.5579331", "0.5570967", "0.5562382", "0.5561359", "0.5557213", "0.55478233", "0.5546915", "0.5533163", "0.55323654" ]
0.7668952
1
Returns a normalized Essence type Adds Alchemy module name in front of given essence type unless there is a Class with the specified name that is an essence.
def normalize_essence_type(essence_type) essence_type = essence_type.classify return essence_type if is_an_essence?(essence_type) "Alchemy::#{essence_type}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def essence_class\n (essence_type || Content.normalize_essence_type(definition[\"type\"])).constantize\n end", "def essence_class(type = nil)\n Content.normalize_essence_type(type || definition['type']).constantize\n end", "def essence_class(type = nil)\n Content.normalize_essence_type(type || description['type']).constantize\n end", "def type_name_with_module(type_name)\n self.name =~ /::/ ? self.name.scan(/(.*)::/).first.first + \"::\" + type_name : type_name\n end", "def type_name\n @type_name ||= self.name.demodulize.underscore\n end", "def content_name_from_element_and_essence_type(element, essence_type)\n essences_of_same_type = element.contents.where(essence_type: normalize_essence_type(essence_type))\n \"#{essence_type.classify.demodulize.underscore}_#{essences_of_same_type.count + 1}\"\n end", "def content_name_from_element_and_essence_type(element, essence_type)\n essences_of_same_type = element.contents.where(essence_type: normalize_essence_type(essence_type))\n \"#{essence_type.classify.demodulize.underscore}_#{essences_of_same_type.count + 1}\"\n end", "def es_type_name\n self.name.pluralize.downcase\n end", "def get_module_name( class_name )\n\t\tif class_name =~ /\\w+#{self.plugin_type}/\n\t\t\tmod_name = class_name.sub( /(?:.*::)?(\\w+)(?:#{self.plugin_type})/, \"\\\\1\" )\n\t\telse\n\t\t\tmod_name = class_name\n\t\tend\n\n\t\treturn mod_name\n\tend", "def type_name\n @type_name ||= name.underscore\n end", "def normalize_type\n if self.type.present?\n self.type = self.type.to_s.underscore.strip\n end\n end", "def creature_type(name)\n puts \"Looking for name #{name}\"\n org.bukkit.entity.EntityType.from_name(name.to_s)\n end", "def class_name\n (self.type.to_s || self.class.name).demodulize\n end", "def compute_type(type_name)\n type_name_with_module(type_name).split(\"::\").inject(Object) do |final_type, part| \n final_type = final_type.const_get(part)\n end\n end", "def full_implementation_class_name\n full_item_type_name.ns_camelize\n end", "def name\n type.to_s.capitalize\n end", "def type_name\n self.class.name.split('::').last.upcase\n end", "def type_name\n @type_name ||= StringHelpers.underscore(StringHelpers.demodulize(@value.class.name)).to_sym\n end", "def sti_name\n store_full_sti_class && store_full_class_name ? name : name.demodulize\n end", "def compute_type(type_name)\n type_name.constantize\n end", "def create_type_from_name\n raise \"roles require a name\" if self.name.nil?\n raise \"roles require a barclamp\" if self.barclamp_id.nil?\n namespace = \"Barclamp#{self.barclamp.name.camelize}\"\n # remove the redundant part of the name (if any)\n name = self.name.sub(\"#{self.barclamp.name}-\", '').camelize\n # these routines look for the namespace & class\n m = Module::const_get(namespace) rescue nil\n # barclamps can override specific roles\n test_specific = m.const_get(name).superclass == Role rescue false\n # barclamps can provide a generic fallback \"BarclampName::Role\"\n test_generic = m.const_get(\"Role\").superclass == Role rescue false\n # if they dont' find it we fall back to the core Role\n self.type = if test_specific\n \"#{namespace}::#{name}\"\n elsif test_generic\n \"#{namespace}::Role\"\n else\n Rails.logger.info \"Role #{self.name} created with fallback Model!\"\n \"Role\"\n end\n end", "def to_type_name(name, namespace = '')\n return namespace + to_type_name(name) unless namespace.blank?\n name = name.to_s\n name = name.camelize(:upper) if Rails.config.camel_case\n name = name.gsub(/\\W/, '_')\n name\n end", "def valid_entity_type_name name\n @constellation.EntityType[[identifying_role_values, name]] or\n check_valid_nonexistent_object_type_name name\n end", "def display_name\n \"#{entity_type_name} (#{entity_type_abbreviation})\"\n end", "def full_name\n klass.name\n end", "def stripped_class_name\n name.demodulize\n end", "def type_from_module( object )\n\t\tif ( name = object.name )\n\t\t\tname = name.split( '::' ).collect do |part|\n\t\t\t\tpart.gsub( SNAKE_CASE_SEPARATOR ) do |m|\n\t\t\t\t\t\"%s_%s\" % [ m[0], m[1] ]\n\t\t\t\tend\n\t\t\tend.join( '.' )\n\n\t\t\treturn name.downcase\n\t\telse\n\t\t\treturn \"anonymous_%s_%d\" % [ object.class.name.downcase, object.object_id ]\n\t\tend\n\tend", "def type\n entity_type.name\n end", "def full_item_type_name\n prefix = ''\n prefix = \"#{self.class.implementation_prefix.ns_underscore}__\" if self.class.implementation_prefix.present?\n\n \"#{prefix}#{implementation_model_name}\"\n end", "def name\n has_module?(klass) ? klass[(klass.index(\"::\")+2)..-1] : klass\n end", "def type\n return @type if defined? @type\n\n @type = self.to_s.gsub(/.*::/, '')\n end", "def get_sugarcrm_module_type(type)\n modules = {\n \"iso\" => SugarCRM::EmpIso,\n \"agent\" => SugarCRM::EmpAgent,\n \"merchant\" => SugarCRM::EmpMerchant,\n \"payment_method\" => SugarCRM::EmpPaymentmethod,\n \"settlement_bank_account\" => SugarCRM::EmpSettlementBankAccount,\n \"security_group\" => SugarCRM::SecurityGroup,\n \"email\" => SugarCRM::EmpEmail\n }\n modules[type]\n end", "def type\n return @type if defined? @type\n @type = self.to_s.gsub(/.*::/, '')\n end", "def get_module_name( className )\n\t\tif className =~ /\\w+#{self.factory_type}/\n\t\t\tmod_name = className.sub( /(?:.*::)?(\\w+)(?:#{self.factory_type})/, \"\\\\1\" )\n\t\telse\n\t\t\tmod_name = className\n\t\tend\n\n\t\treturn mod_name\n\tend", "def type\n @klass.is_a?(Rubinius::ToolSets::Runtime::ToolSet::AST::Class) ? \"class\" : \"module\"\n end", "def fullTypeName(namespace, name)\n #noinspection RubyUnusedLocalVariable\n ns, _ = splitNameSpace(name.to_s) # if it is already a full namespaced name or a standard type, return original\n validNs?(ns, name) || STANDARD_TYPES.member?(name) ? name.to_sym : \"#{combineNsBase(namespace, name)}\".to_sym\nend", "def create_essence!(type = nil)\n self.essence = essence_class(type).create!(prepared_attributes_for_essence)\n self.save!\n end", "def type=(name)\n self.entity_type = EntityType.find_or_create_by(name: name)\n end", "def type\n m = name.match /.*\\.(.*)/\n m.nil? ? nil : m[1]\n end", "def create_essence!(type = nil)\n self.essence = essence_class(type).create!(prepared_attributes_for_essence)\n save!\n end", "def type; self.class.name.split('::').last.to_sym; end", "def engine_class_name(e)\n e.class.name.deconstantize # remove the ::Engine part\n end", "def initialize\n @type = self.class.to_s.demodulize.downcase\n end", "def type_name\n @type_name ||= determine_type_name(descriptor)\n end", "def name_with_type\n\t\t\"#{type}: #{name}\"\n\tend", "def ensure_proper_type\n unless self.class.descends_from_active_record?\n write_attribute(self.class.inheritance_column, Inflector.demodulize(self.class.name))\n end\n end", "def normalize(type); end", "def klass\n name.gsub(module_name+\"::\",\"\")\n end", "def type\n self.class.class_name.downcase\n end", "def type\n self.class.name.downcase\n end", "def validate_class_name(name)\n only_basic_type(name) || name.gsub(/-/, \"_\").camelcase\n end", "def type\n self.class.name.demodulize.underscore.gsub(/_filter$/, '').to_sym\n end", "def name\n @type_name\n end", "def get_type_name(type)\n type_name = TypeName.new get_class_name(type), get_class_module_path(type), get_class_file_name(type), get_class_file_path(type)\n type_name.parent = make_parents get_class_module_path(type)\n type_name\n end", "def to_engine_name(name)\n return nil unless name.instance_of?(String)\n name.underscore.gsub(/\\//, '_')\n end", "def entity_name_for_human\r\n self.class.name.titleize\r\n end", "def create_type_from_name\n raise \"attribs require a name\" if self.name.nil?\n raise \"attribs require a role\" if self.barclamp_id.nil?\n # remove the redundant part of the name (if any)\n name = self.name.gsub('-','_').camelize\n # Find the proper class to use to instantiate this attribute\n # 1. If the barclamp provides a specific class for this attribute, use it.\n # 2. Otherwise fall back on attrib class that the jig provides.\n # 3. Finally, fall back on the generic Attrib class.\n klassnames = []\n klassnames << \"Barclamp#{self.barclamp.name.camelize}::Attrib::#{name}\" if self.barclamp_id\n klassnames << \"#{self.role.jig.type}Attrib\" if self.role_id\n klassnames << \"Attrib\"\n klassnames.each do |t|\n if (t.constantize rescue nil)\n Rails.logger.info(\"Attrib: Using #{t} for #{self.name}\")\n self.type = t\n return\n else\n Rails.logger.info(\"Attrib: #{t} cannot be used for #{self.name}\")\n end\n end\n raise \"Cannot find the appropriate class for attribute #{self.name}\"\n end", "def get_entity(name)\n # These are the valid entities and their validators are defined\n if [\"Taluk\",\"Panchayat\",\"Place\"].include?(name)\n return name.constantize, name.downcase+\"_params\", name.downcase\n else\n return nil\n end\n end", "def typedname include_type=false, include_ref=false\n return name unless include_type\n type_label =\n if include_ref && meaning\n \"#{meaning.model_name.human} ##{meaning.id}\"\n else\n typename\n end\n %Q{#{name} [#{type_label}]}\n end", "def her_containing_module\n return unless name =~ /::/\n name.split(\"::\")[0..-2].join(\"::\").constantize\n end", "def display_name\n \"#{entity_name} (#{entity_type.entity_type_abbreviation})\"\n end", "def asset_type\n return self.class.to_s.gsub(/^.*::/,'').gsub(/AssetSet/,'').gsub(/([^^])([A-Z])/,'$1_$2').downcase.to_sym\n end", "def type\n klass = self.class.name\n if sep = klass.rindex('::')\n klass[(sep+2)..-1]\n else\n klass\n end.underscore.to_sym\n end", "def full_name\n \"#{type_etablissement.nom} #{nom}\"\n end", "def append_class(name); end", "def append_class(name); end", "def type\n Msf::MODULE_EXPLOIT\n end", "def add_module(class_type, name)\n mod = @classes[name] || @modules[name]\n return mod if mod\n\n full_name = child_name name\n mod = @store.modules_hash[full_name] || class_type.new(name)\n\n add_class_or_module mod, @modules, @store.modules_hash\n end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def class_name\n Heroics.camel_case(name)\n end", "def type\n self.class.name.split(':').last.downcase\n end", "def type\n @type ||= self.class.name.split('::').last\n end", "def create_subtype(name)\n Class.new(self) do\n @name = Dry::Inflector.new.classify(name.to_s)\n end\n end", "def typeName\n case ftype\n when FTYPE_TEST\n return 'test'\n when FTYPE_SHEET\n return 'mathsheet'\n else # \n return 'generic'\n end\n end", "def entry_class_name\n ensure_loaded { StorageRoom.entry_class_for_name(entry_type)}\n end", "def find_class_or_module name\n @store.find_class_or_module name\n end", "def normalize(name); end", "def type_name\n TYPE[self.exercise_type].to_s\n end", "def type\n self.class.to_s.split('::').last.downcase.to_sym\n end", "def type_phrase\n case type.to_s\n when 'maj', 'major'\n 'Major Enhancements'\n when 'min', 'minor'\n 'Minor Enhancements'\n when 'bug'\n 'Bug Fixes'\n when ''\n 'General Enhancements'\n when '-'\n 'Administrative Changes'\n else\n \"#{type.capitalize} Enhancements\"\n end\n end", "def type_name( type )\n @type_name_cache[type] ||= begin\n type = \"\" if type.nil?\n type = $1 if type =~ /^(.*?)\\(/\n type.upcase\n end\n end", "def entry_type_name\n if self.new_design?\n self.new_entry_type_name\n elsif self.dot_rev_design?\n self.dot_rev_entry_type_name\n else\n 'Entry Type Not Set'\n end\n end", "def inicial\n self.class.name.gsub(/#{Module.nesting.last}::/, '').chr\n end", "def type_name_for_module(impl_module)\n impl_module = impl_module.name if impl_module.is_a?(Module)\n name = @parent.type_name_for_module(impl_module) unless @parent.nil?\n name.nil? ? find_mapping(impl_module, @type_names_per_implementation, @impl_name_substitutions) : name\n end" ]
[ "0.6928682", "0.68985933", "0.6833396", "0.6497258", "0.59919596", "0.58787775", "0.58787775", "0.58698183", "0.5750265", "0.57347554", "0.5694976", "0.5640596", "0.560522", "0.55942565", "0.55565727", "0.55561715", "0.5529584", "0.5446075", "0.5416031", "0.5383443", "0.53651947", "0.53554195", "0.5326328", "0.5317055", "0.52981776", "0.5296422", "0.52896184", "0.528321", "0.5268528", "0.5264932", "0.5264555", "0.52447176", "0.52414894", "0.5215556", "0.5214588", "0.52111024", "0.5201809", "0.518214", "0.5176621", "0.5170715", "0.51680094", "0.5166921", "0.515087", "0.51491135", "0.51461095", "0.5142454", "0.5129719", "0.51253957", "0.5117789", "0.5111307", "0.5108452", "0.5103108", "0.50986063", "0.5079719", "0.50773776", "0.50693", "0.506864", "0.50655633", "0.5063343", "0.5051712", "0.50490326", "0.504506", "0.50439465", "0.5043641", "0.50421274", "0.50421274", "0.5039868", "0.5037754", "0.5021236", "0.5021236", "0.5021236", "0.5021236", "0.5021236", "0.5021236", "0.5021236", "0.5021236", "0.5021236", "0.5021236", "0.5021236", "0.5021236", "0.5021236", "0.5021236", "0.5021236", "0.50210464", "0.50209296", "0.5020084", "0.50135624", "0.50102377", "0.49910954", "0.49862593", "0.49855727", "0.49830666", "0.49814132", "0.49792966", "0.4974905", "0.49741143", "0.49686635", "0.4968264" ]
0.7825047
2
end class methods Instance Methods Returns the description hash from +elements.yml+ file.
def description if element.blank? log_warning "Content with id #{self.id} is missing its Element." return {} end Content.content_description_from_element(element, name) || {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description\n description = self.class.descriptions.detect { |d| d['name'] == self.name }\n if description.blank?\n log_warning \"Could not find element definition for #{self.name}. Please check your elements.yml!\"\n return {}\n else\n return description\n end\n end", "def descriptions\n if ::File.exists? \"#{::Rails.root}/config/alchemy/elements.yml\"\n ::YAML.load_file(\"#{::Rails.root}/config/alchemy/elements.yml\") || []\n else\n raise LoadError, \"Could not find elements.yml file! Please run: rails generate alchemy:scaffold\"\n end\n end", "def descriptions\n Element.descriptions.collect { |e| e['contents'] }.flatten.compact\n end", "def descriptions\n Element.descriptions.collect { |e| e['contents'] }.flatten.compact\n end", "def description\n return {} if element.nil? or element.content_descriptions.nil?\n element.content_descriptions.detect { |c| c['name'] == self.content.name } || {}\n end", "def definition\n if (definition = self.class.definition_by_name(name))\n definition\n else\n log_warning \"Could not find element definition for #{name}. \" \\\n \"Please check your elements.yml file!\"\n {}\n end\n end", "def definition\n if definition = self.class.definition_by_name(name)\n definition\n else\n log_warning \"Could not find element definition for #{name}. \" \\\n \"Please check your elements.yml file!\"\n {}\n end\n end", "def description\n if element.blank?\n log_warning \"Content with id #{self.id} is missing its Element.\"\n return {}\n end\n desc = self.element.content_description_for(self.name)\n if desc.blank?\n self.element.available_content_description_for(self.name)\n end\n desc || {}\n end", "def descriptions\n []\n end", "def description\n parsed {\n @description\n }\n end", "def descriptions\n @@descriptions ||= Parser::DescriptionLookup.new\n end", "def description\n info[\"Description\"]\n end", "def describe\n @description\n end", "def describe\n @description\n end", "def element_description\n raise NotImplementedError\n end", "def descriptions\n\t\t@profile[:descriptions]\n\tend", "def description\n @data['description']\n end", "def description\n @data['description']\n end", "def description\n @data['description']\n end", "def description\n attributes.fetch(:description)\n end", "def descriptions\n return attributes[:descriptions] if attributes[:descriptions]\n attributes[:descriptions] = {}\n attributes[:descriptions]\n end", "def description\n self[:description]\n end", "def description\n object[\"description\"]\n end", "def description\n @data['description']\n end", "def description\n parser.description\n end", "def description\n\t\t\t@data[\"description\"]\n\t\tend", "def description\n end", "def description\n end", "def description\n data[:description]\n end", "def description\n data[:description]\n end", "def description\n @attributes[:description]\n end", "def description\n I18n.t(\"rubrics.item.description.#{basename.underscore}\")\n end", "def description\n\t # if the description exists\n\t # return it \n\t # else \n\t # scrape to get the description\n\t # return it\n\t # end\n\tend", "def description\n text_attribute('description')\n end", "def content_descriptions\n return nil if definition.blank?\n definition['contents']\n end", "def description\n data['description']\n end", "def description\n values = super\n values = Deepblue::MetadataHelper.ordered( ordered_values: description_ordered, values: values )\n return values\n end", "def typus_description\n Typus::Configuration.config[self.name]['description']\n end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description\n return nil if document.xml?\n Nokogiri::HTML4::ElementDescription[name]\n end", "def main_description; end", "def introduction\n intro = @config[0]\n attribute = attributes(intro)\n index = attribute.index\n title = attribute.title\n reference = attribute.ref\n devices = generate_table(intro.elements[1].elements)\n\n Introduction.new(index, title, reference, devices)\n end", "def description\n\t\tmodule_info['Description']\n\tend", "def getDescription\r\n\t\t\t\t\treturn @description\r\n\t\t\t\tend", "def getDescription\r\n\t\t\t\t\treturn @description\r\n\t\t\t\tend", "def description\n Properties[self.class] ||= {}\n return Properties[self.class][:desc] || \"\"\n end", "def description\n data['Description']\n end", "def get_description\n get_field_config['description']\n end", "def description\n end", "def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.desc)}\n return(cfg)\n end", "def desc\n Desc.new(self)\n end", "def description\n metadata[:description]\n end", "def content_descriptions\n return nil if description.blank?\n description['contents']\n end", "def description\n node.at(\"description\").text\n end", "def get_description\n @description\n end", "def description\n data.description\n end", "def description\n data.description\n end", "def description\n data.description\n end", "def describe\n\t\t\treturn {}\n\t\tend", "def description\n @description ||= begin\n readme = File.read( path( 'README.txt' ) )\n md = readme.match( /== DESCRIPTION:(.+?)\\n== /m ) or\n fail( \"can't find a description section in README.txt\" )\n md[1].strip\n end\n end", "def introduction\n intro = @config[0]\n attribute = attributes(intro)\n index = attribute.index\n title = attribute.title\n reference = attribute.ref\n date = Date.parse(intro.elements[0].text).to_s\n devices = generate_table(intro.elements[1].elements)\n security_issue_overview = {}\n intro.elements[2].elements[1..4].map do |issue|\n security_issue_overview[issue['title']] = issue.text\n end\n rating = generate_table(intro.elements[3].elements[2].elements[1].elements)\n\n Introduction.new(\n index, title, reference, date, devices,\n security_issue_overview, rating\n )\n end", "def description\n fields['description']\n end", "def description; @doc['description']; end", "def description; @doc['description']; end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end" ]
[ "0.8090134", "0.7178595", "0.7133156", "0.7133156", "0.67329913", "0.67216116", "0.6669087", "0.64167565", "0.6411929", "0.63861424", "0.63471437", "0.63282114", "0.6276081", "0.6276081", "0.62750065", "0.6269788", "0.6252658", "0.6252658", "0.62450475", "0.62244564", "0.6191454", "0.6191435", "0.6189809", "0.61804384", "0.6172925", "0.6167584", "0.61560506", "0.61560506", "0.60980755", "0.60980755", "0.6086123", "0.6082473", "0.60743946", "0.60672486", "0.60657567", "0.6055128", "0.60469615", "0.6036632", "0.60307294", "0.60307294", "0.60307294", "0.60307294", "0.60307294", "0.60307294", "0.60307294", "0.60307294", "0.60307294", "0.60307294", "0.6030728", "0.60214794", "0.60152715", "0.599666", "0.59924436", "0.59924436", "0.59831667", "0.5976899", "0.5970524", "0.5969844", "0.5965935", "0.5963068", "0.5961324", "0.5928051", "0.59270203", "0.59193254", "0.59130037", "0.59130037", "0.59130037", "0.5912912", "0.5900227", "0.5900214", "0.58975035", "0.58859956", "0.58859956", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977", "0.5884977" ]
0.6459263
7
Creates essence from description. If an optional type is passed, this type of essence gets created.
def create_essence!(type = nil) self.essence = essence_class(type).create!(prepared_attributes_for_essence) self.save! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_essence!(description)\n essence_class = self.class.normalize_essence_type(description['type']).constantize\n attributes = {\n :ingredient => default_text(description['default'])\n }\n if description['type'] == \"EssenceRichtext\" || description['type'] == \"EssenceText\"\n attributes.merge!(:do_not_index => !description['do_not_index'].nil?)\n end\n essence = essence_class.create(attributes)\n if essence\n self.essence = essence\n save!\n else\n false\n end\n end", "def create_essence!(type = nil)\n self.essence = essence_class(type).create!(prepared_attributes_for_essence)\n save!\n end", "def essence_class(type = nil)\n Content.normalize_essence_type(type || description['type']).constantize\n end", "def essence_class(type = nil)\n Content.normalize_essence_type(type || definition['type']).constantize\n end", "def essence_class\n (essence_type || Content.normalize_essence_type(definition[\"type\"])).constantize\n end", "def content_description_from_essence_type(element, essence_type)\n {\n 'type' => essence_type,\n 'name' => content_name_from_element_and_essence_type(element, essence_type)\n }\n end", "def build_essence(attributes = {})\n self.essence = essence_class.new(\n { content: self, ingredient: default_value }.merge(attributes)\n )\n end", "def content_definition_from_essence_type(element, essence_type)\n {\n 'type' => essence_type,\n 'name' => content_name_from_element_and_essence_type(element, essence_type)\n }\n end", "def create_essence!(attrs = {})\n build_essence(attrs).save!\n save!\n end", "def create_object\n definition.sought_type.new\n end", "def create_employee(type, person)\n result = EmployeeSpecification.new\n root = EmployeeFolder.candidates_root\n result.team = if type.to_sym == :interview\n root\n else\n obtain('Team', root)\n end\n result.first = obtain('First', person.fetch(:first, 'Zaphod'))\n result.last = obtain('Last', person.fetch(:last, 'Beeblebrox'))\n result.to_employee\n end", "def create(attributes = {})\n new(attributes).tap do |content|\n content.essence.save && content.save\n end\n end", "def add_spec(type, name, desc = nil, params = {})\n # Ensure required params are set\n raise SpecificationError.new(\"Invalid #{type} specification - name must be a string\") unless name.is_a?(String)\n \n # Bump over options if needed (ie no description provided)\n if desc.is_a?(Hash)\n params = desc\n desc = nil\n end\n \n # Add in extra options if needed\n params.merge!(@extra_options)\n \n # Create a new instance of the given argument spec type\n klass = type.to_s.split(/[_\\-]/).collect{|s| s.capitalize}.join\n klass = \"Console::#{klass}Specification\".constantize\n item = klass.new(name, desc, params)\n \n # Add it to the list!\n self << item\n\n # All set here...\n item\n end", "def content_description(element, essence_hash)\n essence_hash.stringify_keys!\n # No name given. We build the content from essence type.\n if essence_hash['name'].blank? && essence_hash['essence_type'].present?\n content_description_from_essence_type(element, essence_hash['essence_type'])\n else\n content_description_from_element(element, essence_hash['name'])\n end\n end", "def create_from_scratch(element, essence_hash)\n essence_hash.stringify_keys!\n if content = build(element, essence_hash)\n content.create_essence!(essence_hash['essence_type'])\n end\n content\n end", "def create_from_scratch(element, essence_hash)\n essence_hash.stringify_keys!\n if content = build(element, essence_hash)\n content.create_essence!(essence_hash['essence_type'])\n end\n content\n end", "def create_resource(type, title, parameters = {})\n parameters = parameters.merge(:name => title)\n resource = Puppet::Type.type(type.to_sym).new(parameters)\n catalog.add_resource(resource)\n resource\n end", "def build(element, essence_hash)\n if (description = content_description(element, essence_hash)).blank?\n raise ContentDefinitionError, \"No description found in elements.yml for #{essence_hash.inspect} and #{element.inspect}\"\n else\n new(name: description['name'], element_id: element.id, skip_translate: description['translate'] == false)\n end\n end", "def spec(name, type = nil, mode = nil, &block)\n return specs(name, type) unless block_given?\n fail 'A type argument is required when defining a spec!' unless type\n\n _specs\n name = name_audit(name)\n fail 'Specification names must be of SPEC_TYPES Symbol or String and cannot start with a number' if name.nil?\n fail \"Spec type must be one of #{SPEC_TYPES.join(', ')}\" unless SPEC_TYPES.include? type\n\n type = type\n mode = get_mode if mode.nil?\n owner_name = ''\n if respond_to?(:name) && send(:name)\n owner_name = self.name.to_s.downcase.to_sym\n elsif self == Origen.top_level\n owner_name = self.class.to_s.split('::').last.downcase.to_sym\n else\n owner_name = self.class.to_s.split('::').last.downcase.to_sym\n end\n spec_placeholder = Spec\n .new(name, type, mode, owner_name, &block)\n # Check if the spec already exists\n if has_spec?(name, type: type, mode: mode, sub_type: spec_placeholder.sub_type, creating_spec: true)\n # Spec already exists. Go ahead flag error and drop processing.\n # This is a fatal error.\n fail \"Spec already exists for name: #{name}, type: #{type}, mode: #{mode} for object #{self}\"\n end\n\n @_specs[name][mode][type][spec_placeholder.sub_type] = spec_placeholder\n end", "def create(type:, **options)\n find(type).new(**options)\n end", "def new(attributes = {})\n element = attributes[:element] || Element.find_by(id: attributes[:element_id])\n return super if attributes.empty? || element.nil?\n\n definition = element.content_definition_for(attributes[:name])\n if definition.blank? && attributes[:essence_type].nil?\n raise ContentDefinitionError, \"No definition found in elements.yml for #{attributes.inspect} and #{element.inspect}\"\n end\n\n super(\n name: attributes[:name],\n essence_type: attributes[:essence_type] || normalize_essence_type(definition[:type]),\n element: element\n ).tap(&:build_essence)\n end", "def create; super(:type); end", "def new_talent(email)\n Talent.new( :name => \"Zaphod\",\n :description => \"Has two heads\",\n :phone => \"098-987-9877\",\n :email => email,\n :address => \"The Heart of gold\",\n :comments => \"Just this guy\",\n :type_id => 3)\n end", "def description(person_or_type = nil)\n generic_description = read_attribute(:description)\n return generic_description if person_or_type.nil?\n aud = Event.process_audience(person_or_type)\n custom_description = attribute_for_audience(:description, aud)\n custom_description.blank? ? generic_description : custom_description\n end", "def spec_type(desc, *additional); end", "def initialize(type:nil, name:nil, created_at: nil, params: nil, run_context: nil, cookbook_name: nil, recipe_name: nil, enclosing_provider: nil)\n @type = type\n @name = name\n @created_at = created_at\n @params = params\n @run_context = run_context\n @cookbook_name = cookbook_name\n @recipe_name = recipe_name\n @enclosing_provider = enclosing_provider\n end", "def render_essence_editor_by_type(element, type, position = nil, options = {})\n if element.blank?\n logger.warn %(\\n\n ++++ WARNING: Element is nil!\\n\n Usage: render_essence_view(element, position, options = {})\\n\n )\n return \"<p class='element_error'>\" + _(\"no_element_given\") + \"</p>\"\n end\n if position.nil?\n content = element.content_by_type(type)\n else\n content = element.contents.find_by_essence_type_and_position(type, position)\n end\n render_essence(content, :editor, :for_editor => options)\n end", "def description(person_or_type = nil)\n attribute_for_audience_with_generic(:description, person_or_type)\n end", "def create\n identify.tap { type }\n end", "def create_alert(obj, alert_type)\n alert = self.alerts.new\n alert.thing = obj\n alert.reason_type = alert_type\n alert.save\n end", "def create_event(title, start, duration = nil, description = \"\", particular = false)\n finish = set_finish_date(start, duration)\n return if finish.nil? or not events_in_period(start, finish).empty?\n\n event_class = ModelFabric.get_class(SocialFramework.event_class)\n event = event_class.create(title: title, start: start, finish: finish,\n description: description, particular: particular)\n\n unless event.nil?\n participant_event_class.create(event: event, schedule: self, confirmed: true, role: \"creator\")\n end\n\n return event\n end", "def initialize(type, name, container: true, injury: 0)\n raise InvalidArg.new(\"type must be one of: #{VALID_PARTS.map{|p|p.inspect}.join(\", \")}\") if !VALID_PARTS.include?(type)\n raise InvalidArg.new(\"name must be a String\") if !name.is_a?(String)\n raise InvalidArg.new(\"container must be true or false\") if ![true, false].include?(container)\n raise InvalidArg.new(\"injury must be an injury duration (Integer)\") if injury && !injury.is_a?(Integer)\n \n @type = type\n @name = name\n @container = container\n @injury = Injury.new(injury)\n end", "def construct_item type, description, options\n type = type.downcase\n if type_allowed? type\n # Create and return a new item of the type passed in\n @@list_types[type.to_sym].new(description, options)\n else\n # Raise the invalid item type error if the type does not exist\n raise UdaciListErrors::InvalidItemType if !type_allowed? type\n end\n end", "def component(name, type: ConfigStruct, description: nil, &block)\n type = Class.new(type, &block) if block\n attribute = attribute!(name)\n attribute.description = description\n attribute.factory = type\n end", "def create_from_properties(properties = {})\n check_property_value(properties, :type)\n\n require 'opsview_rest/entity'\n entity = OpsviewRest::Entity.new(properties[:type], properties)\n create(entity)\n end", "def type_and_description(opts = {})\n { type: type, description: description(opts) }\n end", "def setOfferType(offer_type)\n # Set the offer type based on the required test\n # This allows programme content definitions to be used for both PPV and subscription\n # offers.\n offer = @item['offer']\n offer['offerType'] = offer_type\n \n # Set the accessTerm value depending on the Subscription/PPV value\n # to ensure the correct DRM model is applied.\n if offer_type == 'Subscription'\n offer['accessTerm'] = 'CA900004'\n else\n offer['accessTerm'] = 'CA900006'\n offer['rental'] = '48'\n offer['timeToStartView'] = 'P7D'\n end \n end", "def add_entity(name, type, definition, x, y)\n entity = Entity.new\n entity.type = type\n entity.definition = definition\n entity.set_tool_tip_text definition\n\n if name.empty? || name.nil?\n name = \"untitled\"\n else\n entity.name = name\n end\n\n entity.set_bounds x, y, ENTITY_WIDTH, ENTITY_HEIGHT\n @panel.add entity\n\n entity.add_mouse_listener @select_action\n entity.add_component_listener @move_action\n @entities << entity\n @cm.register_component entity\n\n @panel.repaint\n entity\n end", "def content_definition(element, essence_hash)\n essence_hash.stringify_keys!\n # No name given. We build the content from essence type.\n if essence_hash['name'].blank? && essence_hash['essence_type'].present?\n content_definition_from_essence_type(element, essence_hash['essence_type'])\n else\n element.content_definition_for(essence_hash['name'])\n end\n end", "def add(type, description, options={})\n type = type.downcase\n add_item construct_item(type, description, options)\n end", "def initialize(declared_at, text, describe=true)\n super(declared_at)\n @text = text\n @args = []\n if describe\n SubprogItem.describe(text).tap do |m|\n @name = m[:name]\n @kind = m[:kind]\n @args = m[:args]\n @return_type = m[:return_type]\n @declare_start_pos = m[:declare_start_pos]\n end\n end\n end", "def entity(name, type, opts = {})\n fail InvalidType unless type_valid?(type)\n\n define_property name, type, opts\n end", "def create_event(event_type, timestamp=nil, event_rec)\n save_event event_type, timestamp, Event.new(event_rec)\n end", "def new_entry(resource_type, name, data=nil)\n case resource_type\n when :machine\n MachineSpec.new(self, resource_type, name, data)\n when :machine_image\n MachineImageSpec.new(self, resource_type, name, data)\n when :load_balancer\n LoadBalancerSpec.new(self, resource_type, name, data)\n else\n ManagedEntry.new(self, resource_type, name, data)\n end\n end", "def initialize(type, text)\n @type, @text = type, text\n end", "def initialize(type, text)\n @type, @text = type, text\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 initialize(type,text)\n @type = type\n @text = text\n end", "def initialize(type, content=nil)\n @type = type\n @content = content\n end", "def setResponseType(type)\n if type == 0\n @audience = Human.new\n elsif type == 1\n @audience = Asura.new\n elsif type == 2\n @audience = Charr.new\n elsif type == 3\n @audience = Norn.new\n elsif type == 4\n @audience = Sylvari.new\n else\n @audience = Skritt.new\n end\n end", "def create_new_resource(resource_descr, type_to_create, authorizer)\n debug \"create_new_resource: resource_descr: #{resource_descr}, type_to_create: #{type_to_create}\"\n authorizer.can_create_resource?(resource_descr, type_to_create)\n\n if type_to_create == \"Lease\" #Lease is a unigue case, needs special treatment\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Attribute account is mandatory.\" if resource_descr[:account].nil? && resource_descr[:account_attributes].nil?\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Attribute components is mandatory.\" if (resource_descr[:components].nil? || resource_descr[:components].empty?) && (resource_descr[:components_attributes].nil? || resource_descr[:components_attributes].empty?)\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Attributes valid_from and valid_until are mandatory.\" if resource_descr[:valid_from].nil? || resource_descr[:valid_until].nil?\n\n res_descr = {} # praktika ena hash/antigrafo tou resource description, me kapoia epipleon\n res_descr[:name] = resource_descr[:name]\n res_descr[:valid_from] = resource_descr[:valid_from]\n res_descr[:valid_until] = resource_descr[:valid_until]\n ac_desc = resource_descr[:account] || resource_descr[:account_attributes] # praktika simainei opoio ap ta 2 uparxei\n ac = OMF::SFA::Model::Account.first(ac_desc)\n raise OMF::SFA::AM::Rest::UnknownResourceException.new \"Account with description '#{ac_desc}' does not exist.\" if ac.nil? \n raise OMF::SFA::AM::Rest::NotAuthorizedException.new \"Account with description '#{ac_desc}' is closed.\" unless ac.active?\n res_descr[:account_id] = ac.id\n lease = @am_manager.find_or_create_lease(res_descr, authorizer) # Return the lease described by +lease_descr+. Create if it doesn't exist.\n\n comps = resource_descr[:components] || resource_descr[:components_attributes]\n nil_account_id = @am_manager._get_nil_account.id # default account, admin account\n components = []\n comps.each do |c|\n desc = {}\n desc[:account_id] = nil_account_id\n desc[:uuid] = c[:uuid] unless c[:uuid].nil?\n desc[:name] = c[:name] unless c[:name].nil?\n if k = OMF::SFA::Model::Resource.first(desc)\n components << k #vres to component me to tade uuid h name (analoga ti exei do8ei) kai valto ston pinaka components\n end\n end \n\n scheduler = @am_manager.get_scheduler\n comps = []\n components.each do |comp|\n comps << c = scheduler.create_child_resource({uuid: comp.uuid, account_id: ac.id}, comp[:type].to_s.split('::').last)\n unless scheduler.lease_component(lease, c)\n scheduler.delete_lease(lease)\n @am_manager.release_resources(comps, authorizer) # kanei destroy ta resources\n raise NotAuthorizedException.new \"Reservation for the resource '#{c.name}' failed. The resource is either unavailable or a policy quota has been exceeded.\"\n end\n end\n resource = lease\n else\n if resource_descr.kind_of? Array\n descr = []\n resource_descr.each do |res|\n res_descr = {}\n res_descr.merge!({uuid: res[:uuid]}) if res.has_key?(:uuid) # an sto hash uparxei kleisi \"uuid\"\n res_descr.merge!({name: res[:name]}) if res.has_key?(:name) # ftiaxnei ena hashaki me to uuid kai to name kai to vazei ston pinaka descr\n descr << res_descr unless eval(\"OMF::SFA::Model::#{type_to_create}\").first(res_descr) # ektos an uparxei hdh\n end # elegxei an ta resources uparxoun\n raise OMF::SFA::AM::Rest::BadRequestException.new \"No resources described in description #{resource_descr} is valid. Maybe all the resources alreadt=y exist.\" if descr.empty?\n elsif resource_descr.kind_of? Hash\n descr = {}\n descr.merge!({uuid: resource_descr[:uuid]}) if resource_descr.has_key?(:uuid)\n descr.merge!({name: resource_descr[:name]}) if resource_descr.has_key?(:name)\n \n if descr.empty?\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Resource description is '#{resource_descr}'.\"\n else\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Resource with descr '#{descr} already exists'.\" if eval(\"OMF::SFA::Model::#{type_to_create}\").first(descr)\n end\n end\n\n if resource_descr.kind_of? Array # logika an exeis dosei polla resources\n resource = []\n resource_descr.each do |res_desc|\n resource << eval(\"OMF::SFA::Model::#{type_to_create}\").create(res_desc)\n @am_manager.manage_resource(resource.last) if resource.last.account.nil?\n if type_to_create == 'Account'\n @am_manager.liaison.create_account(resource.last)\n end\n end\n elsif resource_descr.kind_of? Hash # an exeis dwsei ena resource\n\n # EXW PEIRAKSEI\n\n if @opts[:semantic]\n debug \"semantic creation\"\n sparql = SPARQL::Client.new($repository)\n id = resource_descr[:name]\n resource_descr.delete(:name)\n res = eval(\"Semantic::#{type_to_create}\").for(id, resource_descr)\n res.save!\n resource = sparql.construct([res.uri, :p, :o]).where([res.uri, :p, :o])\n\n ##############\n else\n resource = eval(\"OMF::SFA::Model::#{type_to_create}\").create(resource_descr)\n @am_manager.manage_resource(resource) if resource.class.can_be_managed?\n if type_to_create == 'Account'\n @am_manager.liaison.create_account(resource)\n end\n end\n end\n end\n resource\n end", "def create\n @type_of_article = TypeOfArticle.new(type_of_article_params)\n\n respond_to do |format|\n if @type_of_article.save\n format.html { redirect_to @type_of_article, notice: 'Type of article was successfully created.' }\n format.json { render :show, status: :created, location: @type_of_article }\n else\n format.html { render :new }\n format.json { render json: @type_of_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def createDefinition(csdl = '')\n\t\t\tDataSift::Definition.new(self, csdl, false)\n\t\tend", "def create\n if text.match(/\\_QUOTE/)\n require 'organismo/element/quote'\n Organismo::Element::Quote.new(text, location)\n elsif text.match(/\\_SRC/)\n require 'organismo/element/code'\n Organismo::Element::Code.new(text, location)\n elsif text.match(/\\_EXAMPLE/)\n require 'organismo/element/example'\n Organismo::Element::Example.new(text, location)\n elsif text.match(/\\*/)\n require 'organismo/element/header'\n Organismo::Element::Header.new(text, location)\n elsif text.match(/\\[\\[\\S*(\\.png)|(\\jpg)|(\\.jpeg)\\]\\]/)\n require 'organismo/element/image'\n Organismo::Element::Image.new(text, location)\n elsif text.match(/\\[\\[\\S*\\]\\]/)\n require 'organismo/element/link'\n Organismo::Element::Link.new(text, location) \n elsif text.match(/\\-/)\n require 'organismo/element/plain_list'\n Organismo::Element::PlainList.new(text, location)\n else\n require 'organismo/element/text'\n Organismo::Element::Text.new(text, location)\n end\n end", "def initialize(attributes = {})\n super\n self.type = 'story'\n end", "def create_health_card(bundle, type: HealthCard)\n type.new(issuer: url, bundle: bundle)\n end", "def create_episode(title)\n Episode.new(title, self)\n end", "def create\n @attendence_type = AttendenceType.new(attendence_type_params)\n\n respond_to do |format|\n if @attendence_type.save\n format.html { redirect_to @attendence_type, notice: 'Attendence type was successfully created.' }\n format.json { render :show, status: :created, location: @attendence_type }\n else\n format.html { render :new }\n format.json { render json: @attendence_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(name, *traits_and_overrides, &block); end", "def add_card(type = nil, title = nil , subtitle = nil, content = nil)\n # A Card must have a type which the default is Simple.\n @card = Hash.new()\n @card[:type] = type || 'Simple'\n @card[:title] = title unless title.nil?\n @card[:subtitle] = subtitle unless subtitle.nil?\n @card[:content] = content unless content.nil?\n @card\n end", "def initialize(name, type, sound)\n\t\t@name = name\n\t\t@type = type\n\t\t@sound = sound\n\tend", "def create_keyword_instance(name, card)\n case name.downcase\n # Expansions\n when 'Base'.downcase\n CardKeyword.create!({\n name: 'Base (1st Edition)',\n category: 'Expansion',\n description: 'First release of Dominion (2008).',\n card: card\n })\n # Card types\n when 'Action'.downcase\n CardKeyword.create!({\n name: 'Action',\n category: 'Card Type',\n description: 'Standard card type',\n card: card\n })\n when 'Reaction'.downcase\n CardKeyword.create!({\n name: 'Reaction',\n category: 'Card Type',\n description: 'Can be played after another player plays an Attack card',\n card: card\n })\n when 'Attack'.downcase\n CardKeyword.create!({\n name: 'Attack',\n category: 'Card Type',\n description: 'Causes a negative effect to all other players.',\n card: card\n })\n when 'Victory'.downcase\n CardKeyword.create!({\n name: 'Victory',\n category: 'Card Type',\n description: 'Award victory points at the end of the game.',\n card: card\n })\n # Subtypes\n # Attack Subtypes\n when 'Handsize Attack'.downcase\n CardKeyword.create!({\n name: 'Handsize Attack',\n category: 'Subtype',\n description: 'Forces players to discard cards.',\n card: card\n })\n when 'Deck Inspection Attack'.downcase\n CardKeyword.create!({\n name: 'Deck Inspection Attack',\n category: 'Subtype',\n description: 'Allows you to see other player\\'s cards and choose whether they keep or discard them.',\n card: card\n })\n when 'Trashing Attack'.downcase\n CardKeyword.create!({\n name: 'Trashing Attack',\n category: 'Subtype',\n description: 'Forces other players to trash cards.',\n card: card\n })\n when 'Curser'.downcase\n CardKeyword.create!({\n name: 'Curser',\n category: 'Subtype',\n description: 'Gives other players curse cards.',\n card: card\n })\n\n\n # Trasher Subtypes\n when 'Trash-For-Benefit'.downcase\n CardKeyword.create!({\n name: 'Trash-For-Benefit',\n category: 'Subtype',\n description: 'Allow you to trash a card and gain an additional benefit.',\n card: card\n })\n\n # Archetypes\n when 'Blocker'.downcase\n CardKeyword.create!({\n name: 'Blocker',\n category: 'Archetype',\n description: 'Nullifies the effects of Attacks against you.',\n card: card\n })\n when 'Sifter'.downcase\n CardKeyword.create!({\n name: 'Sifter',\n category: 'Archetype',\n description: 'Enables players to cycle through junk cards in their deck faster.',\n card: card\n })\n\n when 'Trasher'.downcase\n CardKeyword.create!({\n name: 'Trasher',\n category: 'Archetype',\n description: 'Allows player to remove one or more cards from their deck.',\n card: card\n })\n when 'Deck Discarder'.downcase\n CardKeyword.create!({\n name: 'Deck Discarder',\n category: 'Archetype',\n description: 'Allows you to discard your deck, allowing you to draw recently bought cards more quickly.',\n card: card\n })\n when '+Buy'.downcase\n CardKeyword.create!({\n name: '+Buy',\n category: 'Archetype',\n description: 'Grants you one or more additional Buys',\n card: card\n })\n when 'Gainer'.downcase\n CardKeyword.create!({\n name: 'Gainer',\n category: 'Archetype',\n description: 'Allows you to obtain a Card during your Action Phase without consuming a Buy.',\n card: card\n })\n when \"One-Shot\".downcase\n CardKeyword.create!({\n name: 'One-Shot',\n category: 'Archetype',\n description: 'Card that can only be played once, then is removed from your deck.',\n card: card\n })\n when 'Smithies'.downcase\n CardKeyword.create!({\n name: 'Smithies',\n category: 'Archetype',\n description: 'Allows you to draw 2 or more cards.',\n card: card\n })\n when 'Virtual Coin'.downcase\n CardKeyword.create!({\n name: 'Virtual Coin',\n category: 'Archetype',\n description: 'Non-Treasure card that gives Coins on the turn it is played.',\n card: card\n })\n when 'Throne Room'.downcase, 'Duplicator'.downcase\n CardKeyword.create!({\n name: 'Throne Room',\n category: 'Archetype',\n description: 'Duplicates the effect of another card.',\n card: card\n })\n when 'Draw'.downcase\n CardKeyword.create!({\n name: 'Draw',\n category: 'Archetype',\n description: 'Draws you two or more cards.',\n card: card\n })\n when 'Digger'.downcase\n CardKeyword.create!({\n name: 'Digger',\n category: 'Archetype',\n description: 'Searches the deck for a particular card type',\n card: card\n })\n # Terminality\n when 'Non-Terminal'.downcase\n CardKeyword.create!({\n name: 'Non-Terminal',\n category: 'Terminality',\n description: 'Refunds the Action spent to use this card, allowing additional Action cards to be played.',\n card: card\n })\n when 'Terminal'.downcase\n CardKeyword.create!({\n name: 'Terminal',\n category: 'Terminality',\n description: 'Consumes the Action spent to use this card.',\n card: card\n })\n when 'Village'.downcase, 'Splitter'.downcase\n if(CardKeyword.where(name: 'Splitter / Village').any?)\n return\n end\n \n CardKeyword.create!({\n name: 'Splitter / Village',\n category: 'Terminality',\n description: 'Refunds the Action spent to use this card plus provides one or more additional Actions.',\n card: card\n })\n when 'Cantrip'.downcase\n CardKeyword.create!({\n name: 'Cantrip',\n category: 'Terminality',\n description: 'Refunds the Action spent to use this card and draws you an additional card, effectively taking up no space in your deck.',\n card: card\n })\n # Strategies\n when 'Trashing'.downcase, 'Deckthinning'.downcase\n CardKeyword.create!({\n name: 'Deckthinning / Trashing',\n category: 'Strategy',\n description: 'Removing as many low-value cards from your deck as possible to more consistently draw your strongest cards.',\n card: card\n })\n when 'Engine'.downcase\n CardKeyword.create!({\n name: 'Engine',\n category: 'Strategy',\n description: 'Focusing on extra actions and card draw to build towards big turns that combo multiple effects.',\n card: card\n })\n when 'Rush'.downcase\n CardKeyword.create!({\n name: 'Rush',\n category: 'Strategy',\n description: 'Attempt to end the game early by depleting victory card piles as fast as possible.',\n card: card\n })\n when 'Alt-VP'.downcase\n CardKeyword.create!({\n name: 'Alt-VP',\n category: 'Strategy',\n description: 'Focus on obtaining victory points through card effects rather than traditional victory cards.',\n card: card\n })\n when 'Big Money'.downcase\n CardKeyword.create!({\n name: 'Big Money',\n category: 'Strategy',\n description: 'Focus on high-value Treasure cards and card draw.',\n card: card\n })\n else\n raise \"Invalid keyword creation request. Params name: '#{name}' card: '#{card}'\"\n end\nend", "def create_synthetics_test(type, config, options = {})\n body = {\n 'type' => type,\n 'config' => config\n }.merge(options)\n\n request(Net::HTTP::Post, \"/api/#{API_VERSION}/synthetics/tests\", nil, body, true)\n end", "def make_fact_type vocabulary\n fact_type = vocabulary.constellation.FactType(:new)\n trace :matching, \"Making new fact type for #{@phrases.inspect}\" do\n @phrases.each do |phrase|\n next unless phrase.respond_to?(:player)\n phrase.role = vocabulary.constellation.Role(fact_type, fact_type.all_role.size, :object_type => phrase.player, :concept => :new)\n phrase.role.role_name = phrase.role_name if phrase.role_name && phrase.role_name.is_a?(String)\n end\n end\n fact_type\n end", "def create\n @defect_type = DefectType.new(defect_type_params)\n\n respond_to do |format|\n if @defect_type.save\n format.html { redirect_to @defect_type, notice: 'Defect type was successfully created.' }\n format.json { render :show, status: :created, location: @defect_type }\n else\n format.html { render :new }\n format.json { render json: @defect_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @articletype = Articletype.new(articletype_params)\n\n respond_to do |format|\n if @articletype.save\n format.html { redirect_to @articletype, notice: 'Articletype was successfully created.' }\n format.json { render :show, status: :created, location: @articletype }\n else\n format.html { render :new }\n format.json { render json: @articletype.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @edition_type = EditionType.new(params[:edition_type])\n\n respond_to do |format|\n if @edition_type.save\n format.html { redirect_to @edition_type, notice: 'Edition type was successfully created.' }\n format.json { render json: @edition_type, status: :created, location: @edition_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @edition_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @archetype = Archetype.new(archetype_params)\n if @archetype.save\n flash[:notice] = 'Archetype was successfully created.'\n respond_with @archetype\n else\n render action: 'new'\n end\n end", "def create\n @specification_type = SpecificationType.new(specification_type_params)\n\n if @specification_type.save\n audit(@specification_type, current_user)\n render json: @specification_type, status: :created, serializer: Web::V1::SpecificationTypeSerializer\n else\n render json: @specification_type.errors, status: :unprocessable_entity\n end\n end", "def initialize(type,text)\n\t\t@type = type\n\t\t@text = text\n\tend", "def normalize_essence_type(essence_type)\n essence_type = essence_type.classify\n return essence_type if is_an_essence?(essence_type)\n\n \"Alchemy::#{essence_type}\"\n end", "def normalize_essence_type(essence_type)\n essence_type = essence_type.classify\n return essence_type if is_an_essence?(essence_type)\n\n \"Alchemy::#{essence_type}\"\n end", "def normalize_essence_type(essence_type)\n essence_type = essence_type.classify\n return essence_type if is_an_essence?(essence_type)\n\n \"Alchemy::#{essence_type}\"\n end", "def create\n\n if params[:sample]\n analyse = Ca::Analyse.new(HTMLReader.instance.page(params[:sample][:address]));\n end\n if params[:text]\n analyse = Ca::Analyse.new(params[:text][:content]);\n end\n descript = analyse.description\n @problems = descript.problems\n @text = descript.text\n @best_phrases = Hash[analyse.description.first_n]\n @nr_of_chars = descript.text_number_of_chars\n @nr_of_words = descript.text_number_of_words\n @nr_of_nodes = descript.nr_of_nodes\n @score = descript.score\n @plagiarism = descript.plagiarism\n @html = descript.text.to_s.force_encoding(\"UTF-8\")\n @tags_problem = descript.tag_problem_flag\n end", "def create\n @archetype = Archetype.new(params[:archetype])\n\n respond_to do |format|\n if @archetype.save\n format.html { redirect_to @archetype, notice: 'Archetype was successfully created.' }\n format.json { render json: @archetype, status: :created, location: @archetype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @archetype.errors, status: :unprocessable_entity }\n end\n end\n end", "def make_corpse\n if @@corpse_proto == nil\n @@corpse_proto = Tag.find_any_obj(\"do.not.change::corpse.prototype\")[0] # corpse prototype\n end\n # generate a new item based off of the corpse prototype.\n\n o = @@corpse_proto.instance # new corpse\n if ('A'..'Z') === short_desc[0]\n o.name = o.name % self.short_desc\n else\n o.name = o.name % self.short_desc.en.a\n end\n\n in_room.accept(o) # put the object in the same room.\n end", "def create\n @engine_type = EngineType.new(params[:engine_type])\n\n respond_to do |format|\n if @engine_type.save\n format.html { redirect_to(@engine_type, :notice => 'Engine type was successfully created.') }\n format.xml { render :xml => @engine_type, :status => :created, :location => @engine_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @engine_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def render_essence_editor_by_type(element, essence_type, options = {}, editor_options = {})\n return warning('Element is nil', _t(:no_element_given)) if element.blank?\n return warning('EssenceType is blank', _t(\"No EssenceType given\")) if essence_type.blank?\n defaults = {\n :position => 1,\n :all => false\n }\n options = defaults.merge(options)\n essence_type = Alchemy::Content.normalize_essence_type(essence_type)\n return_string = \"\"\n if options[:all]\n contents = element.contents.find_all_by_essence_type_and_name(essence_type, options[:all])\n contents.each do |content|\n return_string << render_essence_editor(content, editor_options)\n end\n else\n content = element.contents.find_by_essence_type_and_position(essence_type, options[:position])\n return_string = render_essence_editor(content, editor_options)\n end\n return_string\n end", "def custom_entity_type_and_analyzer(**args)\n validate_entity_analyzer_args(args)\n custom_entity_types[args[:type]] = Epiphany::EntityType.new(args)\n end", "def custom_entity_type_and_analyzer(**args)\n validate_entity_analyzer_args(args)\n custom_entity_types[args[:type]] = Epiphany::EntityType.new(args)\n end", "def create\n create_respond_to(@phrase)\n end", "def create\n @especy = Especie.new(params[:especy])\n\n respond_to do |format|\n if @especy.save\n format.html { redirect_to @especy, notice: 'Especie was successfully created.' }\n format.json { render json: @especy, status: :created, location: @especy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @especy.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(type,text)\r\n\t\t@type = type\r\n\t\t@text = text\r\n\tend", "def initialize(pseudo,forme,etat, type)\n\t\t@nom = pseudo\n\t\t@forme = forme\n\t\t@etat = etat\n\t\t@type = type\n\tend", "def create_train(train_type)\n Train.new(\n @train_types.find do |type|\n type.to_s.eql? \"#{train_type.fetch('type')}T\"\n end\n )\n end", "def create\n create_entry\n \n # Redirect to entry view to show the new element\n redirect_to show_entry_path(params[:type], @entry[:id])\n end", "def create\n @event_type = EventType.new(event_type_params)\n\n respond_to do |format|\n if @event_type.save\n format.html { redirect_to(@event_type, notice: 'Event type was successfully created.') }\n format.xml { render xml: @event_type, status: :created, location: @event_type }\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @event_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_offer(options = {}, &block)\n options = set_options(options, &block)\n @response = post('offer', options)\n end", "def render_essence_view_by_type(element, type, position, options = {})\n if element.blank?\n logger.warn %(\\n\n ++++ WARNING: Element is nil!\\n\n Usage: render_essence_view(element, position, options = {})\\n\n )\n return \"\"\n end\n if position.nil?\n content = element.content_by_type(type)\n else\n content = element.contents.find_by_essence_type_and_position(type, position)\n end\n render_essence(content, :view, :for_view => options)\n end", "def equip_type_params\n params.require(:equip_type).permit(:description)\n end", "def render_essence(content, part = :view, options = {})\n if content.nil?\n logger.warn %(\\n\n ++++ WARNING: Content is nil!\\n\n Usage: render_essence(content, part, options = {})\\n\n )\n return part == :view ? \"\" : \"<p class=\\\"content_editor_error\\\">\" + _(\"content_not_found\") + \"</p>\"\n elsif content.essence.nil?\n logger.warn %(\\n\n ++++ WARNING: Content.essence is nil!\\n\n Please delete the element and create it again!\n )\n return part == :view ? \"\" : \"<p class=\\\"content_editor_error\\\">\" + _(\"content_essence_not_found\") + \"</p>\"\n end\n defaults = {\n :for_editor => {\n :as => 'text_field',\n :css_class => 'long'\n },\n :for_view => {\n :image_size => \"120x90\",\n :css_class => \"\",\n :date_format => \"%d. %m. %Y, %H:%Mh\",\n :caption => true,\n :blank_value => \"\"\n },\n :render_format => \"html\"\n }\n options_for_partial = defaults[('for_' + part.to_s).to_sym].merge(options[('for_' + part.to_s).to_sym])\n options = options.merge(defaults)\n render(\n :partial => \"essences/#{content.essence.class.name.underscore}_#{part.to_s}.#{options[:render_format]}.erb\",\n :locals => {\n :content => content,\n :options => options_for_partial\n }\n )\n end", "def build(element, essence_hash)\n definition = content_definition(element, essence_hash)\n if definition.blank?\n raise ContentDefinitionError, \"No definition found in elements.yml for #{essence_hash.inspect} and #{element.inspect}\"\n else\n new(name: definition['name'], element_id: element.id)\n end\n end", "def create_attribute(name, type, options = Hash.new)\n options = Kernel.validate_options options, :init => true\n\n Orocos.load_typekit_for(type, false)\n orocos_type_name = Orocos.find_orocos_type_name_by_type(type)\n Orocos.load_typekit_for(orocos_type_name, true)\n\n local_attribute = @local_task.do_create_attribute(Attribute, name, orocos_type_name)\n @local_attributes[local_attribute.name] = local_attribute\n @attributes[local_attribute.name] = local_attribute\n if options[:init]\n local_attribute.write(local_attribute.new_sample)\n end\n local_attribute\n end", "def initialize(name, description, how_to_pass, required, type, params, known_types)\n check_name(name)\n @name = name\n\n if description\n @description = description\n end\n\n how_to_pass = how_to_pass.to_s\n unless HOW_TO_PASS.include? how_to_pass\n raise SwaggerInvalidException.new(\"Unknown how to pass value [#{how_to_pass}]#{list_or_none(HOW_TO_PASS, 'registered types')}\")\n end\n @how_to_pass = how_to_pass\n\n if @how_to_pass == HOW_TO_PASS_BODY\n get_type(type, PRIMITIVE_TYPES + known_types + [TYPE_FILE])\n else\n get_type(type, PRIMITIVE_TYPES_FOR_NON_BODY)\n end\n\n unless [true, false].include? required\n raise SwaggerInvalidException.new(\"Required should be a boolean instead of [#{required}]\")\n end\n @required = required\n\n params = white_list_params(params, PARAMS_LIST, SwaggerTypeProperty::PROPERTIES)\n validate_params(@type == TYPE_ARRAY ? @items : @type, params)\n @default = params[PARAMS_DEFAULT]\n @params = params\n end", "def create(res_type, config_props = {}, &block)\n # new_res = nil\n #res_name = res_name.to_sym\n #config_props[:name] ||= res_name\n config_props[:type] ||= res_type\n debug \"Create resource of type '#{res_type}'\"\n create_message_and_publish(:create, config_props, block)\n self\n end", "def absence_type=(*_args)\n raise_invalid_argument(property_name: :absence_type)\n end", "def declare_resource(type, name, created_at=nil, &resource_attrs_block)\n created_at ||= caller[0]\n\n resource = build_resource(type, name, created_at, &resource_attrs_block)\n\n run_context.resource_collection.insert(resource, resource_type: type, instance_name: name)\n resource\n end", "def create_resource(description, opts)\n unless (experiment = opts[:context]).is_a? GIMI::Resource::Experiment\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Can only create slices in the context of an experiment\"\n end\n if name = description[:name]\n if (res = @resource_class.first(name: name, experiment: experiment))\n return modify_resource(res, description, opts)\n end\n end\n\n description[:experiment] = experiment\n super\n end", "def create\n @etsy = Etsy.new(params[:etsy])\n\n respond_to do |format|\n if @etsy.save\n format.html { redirect_to @etsy, notice: 'Etsy was successfully created.' }\n format.json { render json: @etsy, status: :created, location: @etsy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @etsy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spec_type = SpecType.new(spec_type_params)\n\n respond_to do |format|\n if @spec_type.save\n format.html { redirect_to @spec_type, notice: 'Spec type was successfully created.' }\n format.json { render :show, status: :created, location: @spec_type }\n else\n format.html { render :new }\n format.json { render json: @spec_type.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.78051805", "0.7677013", "0.7086594", "0.6676211", "0.6399988", "0.6296492", "0.6151227", "0.6002307", "0.5941078", "0.573827", "0.57081807", "0.56647956", "0.5470817", "0.5406903", "0.5346387", "0.5346387", "0.53385884", "0.53089505", "0.530048", "0.52967817", "0.5236582", "0.5234515", "0.5231483", "0.52122724", "0.52043116", "0.51691633", "0.5150198", "0.5149275", "0.5083043", "0.5074934", "0.50641376", "0.5046169", "0.50066507", "0.5005746", "0.50029224", "0.49569017", "0.49521476", "0.494608", "0.49363118", "0.49278685", "0.4917947", "0.49058777", "0.4899615", "0.4898764", "0.48906404", "0.48906404", "0.4880758", "0.48786625", "0.48741186", "0.48717391", "0.48672524", "0.4853401", "0.4849454", "0.48306605", "0.48224145", "0.48139453", "0.4808178", "0.48079333", "0.47975385", "0.47606605", "0.47573948", "0.4755555", "0.47547403", "0.47533053", "0.47504872", "0.47442028", "0.4730744", "0.47297537", "0.47271538", "0.47251973", "0.47192606", "0.47192606", "0.47192606", "0.47180355", "0.47148865", "0.47129494", "0.47111395", "0.47077015", "0.47047502", "0.47047502", "0.47018605", "0.4701558", "0.46985355", "0.4689766", "0.46845046", "0.46791106", "0.4668503", "0.46684557", "0.46627182", "0.4657171", "0.46554732", "0.4641816", "0.4633216", "0.46272874", "0.4623372", "0.46177927", "0.46177915", "0.4614422", "0.46132028", "0.46084976" ]
0.76771885
1
Returns a class constant from description's type field. If an optional type is passed, this type of essence gets constantized.
def essence_class(type = nil) Content.normalize_essence_type(type || description['type']).constantize end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def essence_class(type = nil)\n Content.normalize_essence_type(type || definition['type']).constantize\n end", "def constantized_type\n @constantized_type ||= begin\n constantized = klass.get_discriminator_mapping(type) || constantize(type)\n\n # Check if the class is a Document class\n raise Errors::UnknownModel.new(camelized, type) unless constantized.respond_to?(:instantiate)\n\n constantized\n end\n end", "def type_class(type)\n TYPES[type]\n end", "def class_from_type(type)\n send(\"#{type}_class\") if respond_to?(\"#{type}_class\")\n end", "def type_c\n @type_c ||= type[1]\n end", "def final_type(klass, type)\n case\n when Object.const_defined?(type) ; Object.const_get(type)\n when klass.const_defined?(type) ; klass.const_get(type)\n when klass._base.const_defined?(type); klass._base.const_get(type)\n else\n raise ArgumentError.new(\"Failed to find the definition for #{type}!\")\n end\n end", "def compute_type(type_name)\n type_name.constantize\n end", "def my_type(type)\n case type\n when /bond/i\n \"Bonds\"\n when /stock/i\n \"Stocks\"\n when /alternative/i\n \"Alternatives\"\n else\n \"Unclassified\"\n end\n end", "def klass\n class_name = self[\"_type\"]\n class_name ? class_name.constantize : nil\n end", "def klass\n type.to_s.classify.constantize\n end", "def klass(type)\n # wonderful world of Ruby - get a class from its name\n Module.const_get(\"CX::CSV::Field::#{type.to_s.camel_case}\")\n end", "def human_type\n Core::TYPES_DESC[type]\n end", "def essence_class\n (essence_type || Content.normalize_essence_type(definition[\"type\"])).constantize\n end", "def type_class(val)\n case val\n when 'image'\n 'icon-picture'\n when 'video'\n 'icon-video'\n when 'text'\n 'icon-doc-text'\n when 'sound'\n 'icon-headphones'\n when 'physical object'\n 'icon-physical-object'\n end\n end", "def compute_type(type_name)\n if type_name.start_with?(\"::\")\n # If the type is prefixed with a scope operator then we assume that\n # the type_name is an absolute reference.\n type_name.constantize\n else\n type_candidate = @_type_candidates_cache[type_name]\n if type_candidate && type_constant = type_candidate.safe_constantize\n return type_constant\n end\n\n # Build a list of candidates to search for\n candidates = []\n name.scan(/::|$/) { candidates.unshift \"#{$`}::#{type_name}\" }\n candidates << type_name\n\n candidates.each do |candidate|\n constant = candidate.safe_constantize\n if candidate == constant.to_s\n @_type_candidates_cache[type_name] = candidate\n return constant\n end\n end\n\n raise NameError.new(\"uninitialized constant #{candidates.first}\", candidates.first)\n end\n end", "def klass\n @klass ||= BSON.const_get(description)\n end", "def compute_type(type_name)\n if type_name.start_with?(\"::\".freeze)\n # If the type is prefixed with a scope operator then we assume that\n # the type_name is an absolute reference.\n ActiveSupport::Dependencies.constantize(type_name)\n else\n type_candidate = @_type_candidates_cache[type_name]\n if type_candidate && type_constant = ActiveSupport::Dependencies.safe_constantize(type_candidate)\n return type_constant\n end\n\n # Build a list of candidates to search for\n candidates = []\n type_name.scan(/::|$/) { candidates.unshift \"#{$`}::#{type_name}\" }\n candidates << type_name\n\n candidates.each do |candidate|\n constant = ActiveSupport::Dependencies.safe_constantize(candidate)\n if candidate == constant.to_s\n @_type_candidates_cache[type_name] = candidate\n return constant\n end\n end\n\n raise NameError.new(\"uninitialized constant #{candidates.first}\", candidates.first)\n end\n end", "def classize_resource(type)\n return type unless type.is_a?(Symbol) || type.is_a?(String)\n\n klass = nil\n begin\n klass = qualified_const_get(type.to_s)\n rescue NameError\n raise NameError, \"Could not find relation class #{type} (referenced as #{type} by #{self})\"\n end\n klass\n end", "def compute_type(type_name)\n if type_name.start_with?(\"::\".freeze)\n # If the type is prefixed with a scope operator then we assume that\n # the type_name is an absolute reference.\n ActiveSupport::Dependencies.constantize(type_name)\n else\n type_candidate = @_type_candidates_cache[type_name]\n if type_candidate && type_constant = ActiveSupport::Dependencies.safe_constantize(type_candidate)\n return type_constant\n end\n\n # Build a list of candidates to search for\n candidates = []\n name.scan(/::|$/) { candidates.unshift \"#{$`}::#{type_name}\" }\n candidates << type_name\n\n candidates.each do |candidate|\n constant = ActiveSupport::Dependencies.safe_constantize(candidate)\n if candidate == constant.to_s\n @_type_candidates_cache[type_name] = candidate\n return constant\n end\n end\n\n raise NameError.new(\"uninitialized constant #{candidates.first}\", candidates.first)\n end\n end", "def klass\n case type\n when :integer then Fixnum\n when :float then Float\n when :decimal then BigDecimal\n when :datetime then Time\n when :date then Date\n when :timestamp then Time\n when :time then Time\n when :text, :string then String\n when :binary then String\n when :boolean then Object\n end\n end", "def type(type = nil, &block)\n return @type unless type\n @type = Apigen::Model.type type, &block\n end", "def get_class type\n case type\n when Class\n type\n when BaseModel\n type.my_class\n when String, Symbol\n return get_class send(\"#{type}_model\") if [:subject, :object, :join].include?(type.to_sym)\n type.to_s.constantize\n else\n raise \"Can't determine a class from: #{type}\"\n end \n end", "def get_type(type)\n TYPES[type.downcase]\n end", "def typeclass(type)\n tcmap = {\n 'A' => Resolv::DNS::Resource::IN::A,\n 'PTR' => Resolv::DNS::Resource::IN::PTR,\n 'CNAME' => Resolv::DNS::Resource::IN::CNAME,\n 'MX' => Resolv::DNS::Resource::IN::MX,\n 'SRV' => Resolv::DNS::Resource::IN::SRV,\n }\n raise ArgumentError, 'dns_resource::nsupdate.typeclass invalid type' unless tcmap.keys.include?(type)\n tcmap[type]\n end", "def schema_type_class(type)\n @schema_type_classes[type]\n end", "def spec_type desc, *additional\n TYPES.find { |matcher, _klass|\n if matcher.respond_to? :call then\n matcher.call desc, *additional\n else\n matcher === desc.to_s\n end\n }.last\n end", "def type\n Type.new(type_param).yard_type_string\n end", "def class_type=(value)\n\t\tself[:type] = value\n\tend", "def compute_type(type_name)\n if type_name.match(/^::/)\n # If the type is prefixed with a scope operator then we assume that\n # the type_name is an absolute reference.\n ActiveSupport::Dependencies.constantize(type_name)\n else\n # Build a list of candidates to search for\n candidates = []\n name.scan(/::|$/) { candidates.unshift \"#{$`}::#{type_name}\" }\n candidates << type_name\n\n candidates.each do |candidate|\n begin\n constant = ActiveSupport::Dependencies.constantize(candidate)\n return constant if candidate == constant.to_s\n rescue NameError => e\n # We don't want to swallow NoMethodError < NameError errors\n raise e unless e.instance_of?(NameError)\n end\n end\n\n fail NameError, \"uninitialized constant #{candidates.first}\"\n end\n end", "def type(type)\n types.each { |t| return t if t.id =~ /^#{Regexp.escape(type)}$/}\n nil\n end", "def type\n read_attr :type, :to_sym\n end", "def type_name\n @type_name ||= determine_type_name(descriptor)\n end", "def type(type = nil)\n @type = type if type\n @type || name.split('::').last.gsub(/Resource$/, '').underscore\n end", "def type\n return constant_value_type\n end", "def compute_type(type_name)\n type_name_with_module(type_name).split(\"::\").inject(Object) do |final_type, part| \n final_type = final_type.const_get(part)\n end\n end", "def classtype\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n type_a = nil\n t = nil\n\n begin\n # at line 521:2: t= IDENTIFIER\n t = match( IDENTIFIER, TOKENS_FOLLOWING_IDENTIFIER_IN_classtype_585 )\n # --> action\n\n \t type_a = t.text\n \t\n # <-- action\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__, 11 )\n\n end\n \n return type_a\n end", "def type\n @type ||= calculate_type\n end", "def find_const_comment(type, const_name, class_name = nil)\n @const_table ||= {}\n @const_table[@content] ||= gen_const_table @content\n table = @const_table[@content]\n\n comment =\n table[[type, const_name]] ||\n (class_name && table[class_name + \"::\" + const_name]) ||\n table[const_name] ||\n ''\n\n new_comment comment, @top_level, :c\n end", "def find_model(type)\n if type == \"liti_types\"\n modeltype = TypesLiti\n elsif type == \"nonliti_types\"\n modeltype = TypesNonLiti\n elsif type == \"activity_types\"\n modeltype = Physical::Timeandexpenses::ActivityType\n elsif type == \"expense_types\"\n modeltype = Physical::Timeandexpenses::ExpenseType\n else\n modeltype = type.singularize.camelize.constantize\n end\n return modeltype\n end", "def klass\n case type\n when :integer, :long then Fixnum\n when :float then Float\n when :double then BigDecimal\n when :timestamp, :time, :datetime then Time\n when :date then Date\n when :text, :string, :binary, :ascii then String\n when :boolean then Object\n when :uuid then ::Cql::TimeUuid\n when :list then DatastaxRails::Types::DynamicList\n when :set then DatastaxRails::Types::DynamicSet\n when :map then DatastaxRails::Types::DynamicMap\n end\n end", "def type\n @type ||= self.class.name.split('::').last\n end", "def get_constraint_class(type)\r\n {:access => AccessConstraint,\r\n :create => CreateConstraint,\r\n :extend => ExtendConstraint}[type.to_sym]\r\n end", "def get_class_by_type_and_object(type, object)\n if @configuration['types'][type] && klass = @configuration['types'][type][object]\n return get_const_by_name(klass)\n else\n Log.logger_for(:configuration).error(\"No class configuration defined for #{object} and type #{type}\")\n end\n return nil\n end", "def prepare_type\n @type = params[:type]\n @klass = @type.constantize\n end", "def klazz\n params[:type].camelize.constantize\n end", "def type\n ::HubEdos::Common::Reference::Descriptor.new(@data['type']) if @data['type']\n end", "def type\n ::HubEdos::Common::Reference::Descriptor.new(@data['type']) if @data['type']\n end", "def type\n ::HubEdos::Common::Reference::Descriptor.new(@data['type']) if @data['type']\n end", "def type\n ::HubEdos::Common::Reference::Descriptor.new(@data['type']) if @data['type']\n end", "def type\n _type.split(\"::\").last.downcase\n end", "def type\n @type.name\n end", "def type\n attr_val('./@typeCode')\n end", "def _type\n special_attribute('@type'.freeze)\n end", "def type_klass; end", "def type\n ::HubEdos::Common::Reference::Descriptor.new(@data['type']) if @data['type']\n end", "def type\n @type ||= IDS_TYPES[type_id]\n end", "def find_type(record)\n klass = OBSERVE_CLASSES.find{|k| record.kind_of?(k)}\n return unless klass\n klass.name.underscore\n end", "def wsdl_constantize(type)\n type = type.split(':').last\n type = 'int' if %w[long short byte].include?(type)\n type = 'float' if type == 'double'\n type = 'binary' if type == 'base64Binary'\n type = 'ManagedObject' if type == 'ManagedObjectReference'\n\n type = type.camelcase\n type.safe_constantize || \"RbVmomi::BasicTypes::#{type}\".safe_constantize || \"#{wsdl_to_rbvmomi_namespace(@wsdl)}::#{type}\".safe_constantize\n end", "def type_str\n self.class.const_get(:TYPE_STR)\n end", "def type_name\n @type_name ||= StringHelpers.underscore(StringHelpers.demodulize(@value.class.name)).to_sym\n end", "def cstype(generic_type)\n CS_TYPES[generic_type] || camelcasetype(generic_type)\nend", "def instance_of_resource_type(resource_type)\n resource = nil\n begin\n resource_class = resource_type.classify.constantize unless resource_type.nil?\n resource = resource_class.send(:new) if !resource_class.nil? && resource_class.respond_to?(:new)\n rescue NameError => e\n logger.error(\"Unable to find constant for resource type #{resource_type}\")\n end\n resource\n end", "def object_class_from_kind(kind)\n case kind\n when 't1'\n RedditKit::Comment\n when 't2'\n RedditKit::User\n when 't3'\n RedditKit::Link\n when 't4'\n RedditKit::PrivateMessage\n when 't5'\n RedditKit::Subreddit\n when 'LabeledMulti'\n RedditKit::Multireddit\n when 'LabeledMultiDescription'\n RedditKit::MultiredditDescription\n when 'modaction'\n RedditKit::ModeratorAction\n end\n end", "def class_for(type)\n klass = type.to_s.classify.constantize rescue nil\n return klass if self.subclasses.include? klass\n end", "def type\n fetch('company.type')\n end", "def object_class object_type\n object_type.classify.constantize\n end", "def type\n self.class.name.split(':').last.downcase\n end", "def type\n self.class::TYPE\n end", "def type\n @type ||= @collection.nil? ? nil : @collection.label.to_sym\n end", "def type\n field[:type]\n end", "def model\n @type.constantize\n end", "def model\n @type.constantize\n end", "def type\n singleton ? 'class' : 'instance'\n end", "def type\n singleton ? 'class' : 'instance'\n end", "def type\n singleton ? 'class' : 'instance'\n end", "def type_to_klass(spring_type)\n without_project = spring_type.split(',')\n namespaced_type = without_project.first\n namespaced_type.split('.').last\n end", "def klass(kind=nil)\n [BlogPost, DictionaryEntry, PressRelease].each do |sc|\n return sc if kind && sc.name.underscore.to_sym == kind.to_sym\n end\n Article\n end", "def get_type\n\n end", "def class_name\n (self.type.to_s || self.class.name).demodulize\n end", "def type\n TYPES[@type_id]\n end", "def type_code\n type.try(:code)\n end", "def type\n self.class.class_name.downcase\n end", "def type\n _type rescue nil\n end", "def type(value_=nil)\n if value_\n @type = value_\n else\n @type\n end\n end", "def suggested_technology_type_label\n return nil if self.is_modelling?\n return nil if self[:technology_type_label].nil?\n return self[:technology_type_label] if technology_type_reader.class_hierarchy.hash_by_label[self[:technology_type_label].downcase].nil?\n end", "def canonic_type\n t = type.to_s.downcase.to_sym\n CANONIC_TYPES[ t ] || t\n end", "def component(name, type: ConfigStruct, description: nil, &block)\n type = Class.new(type, &block) if block\n attribute = attribute!(name)\n attribute.description = description\n attribute.factory = type\n end", "def lookup_cpptype(t) t = @@typemap[t] and return t end", "def type\n return @type if defined? @type\n @type = self.to_s.gsub(/.*::/, '')\n end", "def type_name\n @type_name ||= self.name.demodulize.underscore\n end", "def handle_constants(type, var_name, const_name, definition)\n class_name = @known_classes[var_name]\n\n return unless class_name\n\n class_obj = find_class var_name, class_name\n\n unless class_obj then\n @options.warn 'Enclosing class or module %p is not known' % [const_name]\n return\n end\n\n comment = find_const_comment type, const_name, class_name\n comment.normalize\n\n # In the case of rb_define_const, the definition and comment are in\n # \"/* definition: comment */\" form. The literal ':' and '\\' characters\n # can be escaped with a backslash.\n if type.downcase == 'const' then\n no_match, new_definition, new_comment = comment.text.split(/(\\A.*):/)\n\n if no_match and no_match.empty? then\n if new_definition.empty? then # Default to literal C definition\n new_definition = definition\n else\n new_definition = new_definition.gsub(\"\\:\", \":\")\n new_definition = new_definition.gsub(\"\\\\\", '\\\\')\n end\n\n new_definition.sub!(/\\A(\\s+)/, '')\n\n new_comment = \"#{$1}#{new_comment.lstrip}\"\n\n new_comment = self.new_comment(new_comment, @top_level, :c)\n\n con = RDoc::Constant.new const_name, new_definition, new_comment\n else\n con = RDoc::Constant.new const_name, definition, comment\n end\n else\n con = RDoc::Constant.new const_name, definition, comment\n end\n\n con.record_location @top_level\n @stats.add_constant con\n class_obj.add_constant con\n end", "def type\n return @type if defined? @type\n\n @type = self.to_s.gsub(/.*::/, '')\n end", "def resolve_constant(content_type)\n raise ArgumentError, 'content_type cannot be nil' unless content_type\n\n const = _registry[content_type]\n return const if const\n\n const_name = WCC::Contentful::Helpers.constant_from_content_type(content_type).to_s\n # #parent renamed to #module_parent in Rails 6\n parent = try(:module_parent) || self.parent\n\n loop do\n begin\n # The app may have defined a model and we haven't loaded it yet\n const = parent.const_get(const_name)\n return const if const && const < self\n rescue NameError => e\n raise e unless e.message =~ /uninitialized constant (.+::)*#{const_name}$/\n end\n\n # const_missing only searches recursively up the module tree in a Rails\n # context. If we're in a non-Rails app, we have to do that recursion ourselves.\n # Keep looking upwards until we get to Object.\n break if parent == Object\n\n parent = parent.try(:module_parent) || parent.parent\n end\n\n # Autoloading couldn't find their model - we'll register our own.\n const = const_get(\n WCC::Contentful::Helpers.constant_from_content_type(content_type)\n )\n register_for_content_type(content_type, klass: const)\n end", "def type\n return @options[:type] || DEF_TYPE\n end", "def class_constant; end", "def class_constant; end", "def type\n return @type\n end", "def data_class(content_type)\n network_name = Ryp.ticker_to_name(network)\n Ryp.const_get(\"#{network_name}#{content_type}\")\n end", "def type\n if self.institution?\n return \"Institution\"\n elsif self.funder?\n return \"Funder\"\n elsif self.organisation?\n return \"Organisation\"\n elsif self.research_institute?\n return \"Research Institute\"\n elsif self.project?\n return \"Project\"\n elsif self.school?\n return \"School\"\n end\n return \"None\"\n end", "def human_type\n self[:type].to_human\n end" ]
[ "0.6815076", "0.6687589", "0.64250803", "0.6358563", "0.633951", "0.63331604", "0.619358", "0.6156101", "0.6123586", "0.6085561", "0.60430837", "0.60318226", "0.60211843", "0.5994334", "0.59805554", "0.59530014", "0.59428644", "0.59413135", "0.5940107", "0.5899553", "0.58539635", "0.5841847", "0.58271337", "0.58157825", "0.5791165", "0.578651", "0.57824814", "0.5753179", "0.5750852", "0.5745096", "0.5743739", "0.5720285", "0.5719586", "0.57130986", "0.5712389", "0.56730676", "0.56611997", "0.56492954", "0.56419015", "0.56374776", "0.56339735", "0.5627213", "0.5621544", "0.5617356", "0.5593839", "0.55865544", "0.55865544", "0.55865544", "0.55865544", "0.5573172", "0.55722934", "0.5569258", "0.5566909", "0.5566213", "0.55599445", "0.5551803", "0.55501354", "0.5544098", "0.5530593", "0.5527936", "0.5525847", "0.5524672", "0.5514473", "0.55113465", "0.54908305", "0.5489334", "0.54878426", "0.5475162", "0.5472219", "0.5460424", "0.5449756", "0.5449756", "0.54398876", "0.54398876", "0.54398876", "0.5429272", "0.54279333", "0.54246575", "0.54184014", "0.54089075", "0.5403886", "0.540268", "0.5401139", "0.5395838", "0.53898275", "0.53887236", "0.53618026", "0.5358971", "0.5354299", "0.53535634", "0.5353493", "0.5351293", "0.5350999", "0.5350701", "0.53505397", "0.53505397", "0.5348354", "0.5342877", "0.53186864", "0.5303927" ]
0.7083883
0
Prepares the attributes for creating the essence. 1. It sets a default text if given in +elements.yml+
def prepared_attributes_for_essence attributes = { ingredient: default_text(description['default']) } attributes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepared_attributes_for_essence\n attributes = {\n ingredient: default_text(definition['default'])\n }\n attributes\n end", "def pre_execute\n\n @node['atts'] = []\n end", "def use_default_attributes\n self.name = \"element#{column}\"\n self.units = ''\n self.default_min = nil\n self.default_max = nil\n self.scale_factor = 1.0\n self.offset = 0.0\n self.display_type = 'continuous'\n end", "def build_essence(attributes = {})\n self.essence = essence_class.new(\n { content: self, ingredient: default_value }.merge(attributes)\n )\n end", "def prepare_attribute!(_element, _options)\n end", "def prepare\n set_title\n set_name\n end", "def initialize(atts = {})\n @attributes = {}\n @embedding = {}\n @_memo = {}\n update_attributes(model.defaults.merge(atts))\n end", "def preinitialize(attrs = nil)\n @attributes = {}\n end", "def initialize(attributes)\n @name = attributes[:name]\n @description = attributes[:description]\n @prep_time = attributes[:prep_time]\n @status = attributes[:status] || false\n @difficulty = attributes[:difficulty] || nil\n end", "def initialize\n super(TITLE, DESCRIPTION, true)\n end", "def post_initialize(args)\n begin\n specify_children()\n specify_attributes()\n if(!args.nil?)\n if(args.is_a?(Hash))\n if(args.has_key? :children)\n bulk_children(args[:children])\n end\n if(args.has_key? :attributes)\n #puts \"Has attributes\"\n args[:attributes].keys.each do |a|\n #puts \"Writing attribute:\", a\n @attributes[a] = args[:attributes][a] #TODO, this should have better error checking in it, like is a field required but is passed nil?\n end\n end\n if(args.has_key? :text)\n #puts \"Added text\", args[:text]\n @text = args[:text]\n else\n #TODO #put error that the proper hash keys were not identified.\n end\n end\n else\n #TODO give some indication that no arguments were provided\n end\n #TODO - make this active only on a boolean, possibly filter\n delete_unwanted_children()\n rescue => error\n puts \"Could not create the BuildingSync element properly.\"\n puts error.inspect, error.backtrace\n end\n end", "def initialize(attributes = {})\n @name = attributes[:name]\n @description = attributes[:description]\n @prep_time = attributes[:prep_time]\n @done = attributes[:done] || false\n end", "def new(attributes = {})\n element = attributes[:element] || Element.find_by(id: attributes[:element_id])\n return super if attributes.empty? || element.nil?\n\n definition = element.content_definition_for(attributes[:name])\n if definition.blank? && attributes[:essence_type].nil?\n raise ContentDefinitionError, \"No definition found in elements.yml for #{attributes.inspect} and #{element.inspect}\"\n end\n\n super(\n name: attributes[:name],\n essence_type: attributes[:essence_type] || normalize_essence_type(definition[:type]),\n element: element\n ).tap(&:build_essence)\n end", "def set_creation_defaults\n # Only run this before_validation because rails fires this before save/create\n if self.id.nil?\n self.title = \"My plan (#{self.template.title})\" if self.title.nil? && !self.template.nil?\n end\n end", "def set_defaults\n self.why_text ||= \"\"\n self.why_source ||= \"\"\n end", "def initialize with_filename=\"\", options={}\n @id = if with_filename.blank?\n options[:filename]\n else\n with_filename\n end\n\n @attributes = if options.empty?\n yaml_front_matter\n else\n options\n end\n\n self._accessible_attributes.each do |attribute|\n class_eval do\n define_method(attribute) { @attributes[attribute] }\n end\n end\n end", "def set_default_attrs\n self.state = 'Texas' if self.respond_to? :state\n self.origin = 'hunted' if self.respond_to? :origin\n self.gender = 'male' if self.respond_to? :gender\n if self.respond_to? :parts\n parts = Part::NAMES.map { |part_name| {name: part_name} }\n parts << { other: true }\n self.parts = parts\n end\n if self.respond_to? :taxidermy_parts\n taxidermy_parts = self.class::DEFAULT_TAXIDERMY_PARTS.map { |part_name| {name: part_name} }\n taxidermy_parts << { other: true }\n self.taxidermy_parts = taxidermy_parts\n end\n self\n end", "def prepare\n [ \"alpha\", \"bravo\", \"charly\" ].each do |name|\n\n @engine.register_participant(name) do |workitem|\n\n workitem.attributes[name] = true\n workitem.attributes[\"key\"] = name\n end\n end\n\n #@engine.register_participant(\"display_workitem\") do |workitem|\n # puts\n # puts\n #end\n end", "def initialize(attr = {})\n @name = attr[:name]\n @description = attr[:description]\n @prep_time = attr[:prep_time]\n @difficulty = attr[:difficulty]\n @done = attr[:done] == \"true\"\n end", "def sanitize_attributes\n # Summary, content are sanitized with an HTML sanitizer, we want imgs etc to be present.\n # Other attributes are sanitized by stripping tags, they should be plain text.\n self.content = Sanitizer.sanitize_html self.content\n self.summary = Sanitizer.sanitize_html self.summary\n\n self.title = Sanitizer.sanitize_plaintext self.title\n self.author = Sanitizer.sanitize_plaintext self.author\n self.guid = Sanitizer.sanitize_plaintext self.guid\n self.url = Sanitizer.sanitize_plaintext self.url\n end", "def init_default_attributes\n self.config_params ||= DEFAULT_CONFIG_PARAMS\n self.has_inventory = true\n end", "def setup_defaults\n @program_title = 'PROGRAM TITLE'\n @program_site = 'PROGRAM SITE'\n @request_availability = false\n @meeting_times = ''\n @sourcing_options = ''\n @course_options = ''\n @student_id_required = false\n @student_id_format = ''\n @student_id_format_help = ''\n @student_id_excluded_chars = ''\n @contact_email = '[email protected]'\n @is_preaccelerator_student = false\n end", "def initialize(name)\n super\n @attributes = nil\n @content = nil\n end", "def set_default_teaser\n return true unless self.default_teaser.blank?\n textfield = self.contexts.ascending(:position).detect{ |c| c._type.to_s == 'Text' }\n return true unless textfield \n doc = ::Nokogiri::HTML::DocumentFragment.parse(textfield.body)\n self.update_attribute(:default_teaser, doc.xpath('.//p').first.try(:text).to_s)\n doc = nil\n true\n end", "def initialize\n @attribute_manager = RDoc::Markup::AttributeManager.new\n @output = nil\n end", "def initialize(attributes)\n @id = attributes['id']\n @name = attributes['name']\n @description = attributes['description']\n @instructions = attributes['instructions']\n\n # @id = id\n # @name = name\n # @instructions = instructions\n # @description = description\n # @ingredients = ingredients\n end", "def initialize( parent, record, yaml )\n @parent = parent\n @record = record\n @yaml = yaml\n @form = parent.form\n @yaml['html'] ||= {}\n # set readonly field\n @readonly = (@yaml and @yaml['readonly']) || (@form and @form['readonly'])\n @yaml['html']['readonly'] = true if @readonly\n # assign size to html element if not already there\n @yaml['html']['size'] ||= @yaml['size'] if @yaml['size'] \n \n @html = '' \n @js = ''\n @css = set_css_code @yaml['css']\n self\nend", "def specify(attrs)\n attrs[:sources] ||= attrs[:language].to_s\n attrs[:source_ext] ||= attrs[:language].to_s\n attrs.each { |name, value| instance_variable_set(\"@#{name}\", value) }\n end", "def set_pe_descriptions\n physical_exams = \"Exámen físico:\\n\"\n\n if @options['head_neck_pe'] == true\n physical_exams += \" Cabeza y cuello: #{@record.consultations.last.physical_exams.where(exam_type: 'Head and Neck').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['chest_pe'] == true\n physical_exams += \" Torax: #{@record.consultations.last.physical_exams.where(exam_type: 'Chest').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['abdomen_pe'] == true\n physical_exams += \" Adbomen: #{@record.consultations.last.physical_exams.where(exam_type: 'Abdomen').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['genitals_pe'] == true\n physical_exams += \" Genitales: #{@record.consultations.last.physical_exams.where(exam_type: 'Genitals').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['soft_parts_pe'] == true\n physical_exams += \" Partes blandas: #{@record.consultations.last.physical_exams.where(exam_type: 'Soft Parts').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['extremities_pe'] == true\n physical_exams += \" Extremidades: #{@record.consultations.last.physical_exams.where(exam_type: 'Extremities').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['vascular_pe'] == true\n physical_exams += \" Vascular: #{@record.consultations.last.physical_exams.where(exam_type: 'Vascular').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['skin_pe'] == true\n physical_exams += \" Piel: #{@record.consultations.last.physical_exams.where(exam_type: 'Skin').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['mamma_pe'] == true\n physical_exams += \" Mamas: #{@record.consultations.last.physical_exams.where(exam_type: 'Mamma').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['others_pe'] == true\n physical_exams += \" Otros: #{@record.consultations.last.physical_exams.where(exam_type: 'Others').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n physical_exams += \"\\n\"\n end", "def initialize(attributes = {})\n @name = attributes[:name]\n @description = attributes[:description]\n @done = attributes[:done] || false\n end", "def initialize(attributes)\n @id = attributes['id']\n @name = attributes['name']\n @description = attributes['description']\n @equipment_type = attributes['equipmentType']\n @availability = attributes['availability']\n @manufacture_option_name = attributes['manufactureOptionName']\n @manufacture_option_code = attributes['manufactureOptionCode']\n @category = attributes['category']\n @attributes = attributes['attributes']\n @equipment = attributes['equipment']\n end", "def create\n if text.match(/\\_QUOTE/)\n require 'organismo/element/quote'\n Organismo::Element::Quote.new(text, location)\n elsif text.match(/\\_SRC/)\n require 'organismo/element/code'\n Organismo::Element::Code.new(text, location)\n elsif text.match(/\\_EXAMPLE/)\n require 'organismo/element/example'\n Organismo::Element::Example.new(text, location)\n elsif text.match(/\\*/)\n require 'organismo/element/header'\n Organismo::Element::Header.new(text, location)\n elsif text.match(/\\[\\[\\S*(\\.png)|(\\jpg)|(\\.jpeg)\\]\\]/)\n require 'organismo/element/image'\n Organismo::Element::Image.new(text, location)\n elsif text.match(/\\[\\[\\S*\\]\\]/)\n require 'organismo/element/link'\n Organismo::Element::Link.new(text, location) \n elsif text.match(/\\-/)\n require 'organismo/element/plain_list'\n Organismo::Element::PlainList.new(text, location)\n else\n require 'organismo/element/text'\n Organismo::Element::Text.new(text, location)\n end\n end", "def initialize(attributes = {})\n # Instance variables are internal data\n # Not available from the outside\n @name = attributes[:name]\n @description = attributes[:description]\n @prep_time = attributes[:prep_time]\n # Setting a default value to @done\n @done = attributes[:done] || false\n end", "def element_init\n extend TagMaker\n methods = \"\"\n # - -\n for element in %w[ A TT I B U STRIKE BIG SMALL SUB SUP EM STRONG\n DFN CODE SAMP KBD VAR CITE FONT ADDRESS DIV center MAP\n APPLET PRE XMP LISTING DL OL UL DIR MENU SELECT table TITLE\n STYLE SCRIPT H1 H2 H3 H4 H5 H6 TEXTAREA FORM BLOCKQUOTE\n CAPTION ]\n methods += <<-BEGIN + nn_element_def(element) + <<-END\n def #{element.downcase}(attributes = {})\n BEGIN\n end\n END\n end\n\n # - O EMPTY\n for element in %w[ IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT\n ISINDEX META ]\n methods += <<-BEGIN + nOE_element_def(element) + <<-END\n def #{element.downcase}(attributes = {})\n BEGIN\n end\n END\n end\n\n # O O or - O\n for element in %w[ HTML HEAD BODY P PLAINTEXT DT DD LI OPTION tr\n th td ]\n methods += <<-BEGIN + nO_element_def(element) + <<-END\n def #{element.downcase}(attributes = {})\n BEGIN\n end\n END\n end\n eval(methods)\n end", "def generate_attributes(name = default_fauxture_name)\n Sweatshop.attributes(self, name)\n end", "def initialize text=\"\", config={}, &block\n @text = text\n @editable = false\n @focusable = false\n config_setup config # @config.each_pair { |k,v| variable_set(k,v) }\n instance_eval &block if block_given?\n init_vars\n end", "def initialize text=\"\", config={}, &block\n @text = text\n @editable = false\n @focusable = false\n config_setup config # @config.each_pair { |k,v| variable_set(k,v) }\n instance_eval &block if block_given?\n init_vars\n end", "def initialize text=\"\", config={}, &block\n @text = text\n @editable = false\n @focusable = false\n config_setup config # @config.each_pair { |k,v| variable_set(k,v) }\n instance_eval &block if block_given?\n init_vars\n end", "def set_attributes_from_etsy\n\t\tetsy_data = get_etsy_data\n\t\tlisting = etsy_data[\"results\"][0]\n\t\tself[:name] = listing[\"title\"]\n\t\tself[:description] = listing[\"description\"]\n\t\tself[:price] = listing[\"price\"]\n\t\tself[:quantity] = listing[\"quantity\"]\n\t\t# self[:style] = listing[\"style\"]\n\t\tself[:views] = listing[\"views\"]\n\t\tself[:photo_pic] = get_pictures_from_etsy\n\t\t\n\tend", "def add_default_values\n ensure_license\n ensure_publisher\n ensure_resource_type\n end", "def prepare_attribute!(name, _element, options)\n options[:attribute] = true if %w[href rel].include?(name.to_s)\n options[:render_nil] = render_nil?\n end", "def init_custom_fields\n @default_title_id = 1\n @titles = []\n end", "def initialize(attrs = {})\n super()\n self.class.description[\"fields\"].each do |field|\n self.send(\"#{field[\"name\"]}=\", field[\"defaultValueFormula\"])\n end\n self.attributes=(attrs)\n end", "def initialize(*args, &block)\n super(*args, &block)\n reset_font_settings\n set_data_font(:normal)\n @maqj_default_font = contents.font.dup\n # Change the windowskin, tone if they are set to be changed\n self.windowskin = Cache.system($game_system.quest_windowskin) if $game_system.quest_windowskin\n self.opacity = $game_system.quest_window_opacity if $game_system.quest_window_opacity\n end", "def set_defaults\n\t\tself.outside_agency_staff\t= DEFAULT_FIELD_TEXT\t\t\tif outside_agency_staff.nil?\n\t\tself.overview \t\t\t\t\t\t= DEFAULT_FIELD_TEXT\t\t \tif overview.nil?\n\t\tself.ratio \t\t\t\t\t\t\t\t= DEFAULT_FIELD_TEXT\t\t \tif ratio.nil?\n\t\tself.trainings_needed \t\t= DEFAULT_FIELD_TEXT\t\t \tif trainings_needed.nil?\n\t\tself.medication_times \t\t= DEFAULT_FIELD_TEXT\t\t \tif medication_times.nil?\n\t\tself.waivers \t\t\t\t\t\t\t= DEFAULT_FIELD_TEXT\t\t \tif waivers.nil?\n\t\tself.keys \t\t\t\t\t\t\t\t= DEFAULT_FIELD_TEXT\t\t \tif keys.nil?\n\t\tself.schedule_info \t\t\t\t= DEFAULT_FIELD_TEXT \t\t\tif schedule_info.nil?\n\t\tself.phone_numbers \t\t\t\t= DEFAULT_FIELD_TEXT \t\t\tif phone_numbers.nil?\n\t\tself.behavior_plans \t\t\t= DEFAULT_FIELD_TEXT \t\t\tif behavior_plans.nil?\n\t\tself.name\t\t\t\t\t\t\t\t\t= \"Untitled\"\t\t\t\t \t\t\tif name.nil?\n self.address_street\t\t\t\t= DEFAULT_ADDRESS_STREET \tif address_street.nil?\n self.address_city\t\t\t\t\t= DEFAULT_ADDRESS_CITY \t\tif address_city.nil?\n self.address_state\t\t\t\t= DEFAULT_ADDRESS_STATE \tif address_state.nil?\n self.address_zip\t\t\t\t\t= DEFAULT_ADDRESS_ZIP \t\tif address_zip.nil?\n self.phone_1\t\t\t\t\t\t\t= DEFAULT_PHONE_1 \t\t\t\tif phone_1.nil?\n self.phone_2\t\t\t\t\t\t\t= DEFAULT_PHONE_2 \t\t\t\tif phone_2.nil?\n self.fax\t\t\t\t\t\t\t\t\t= DEFAULT_FAX \t\t\t\t\t\tif fax.nil?\n self.bu_code\t\t\t\t\t\t\t= DEFAULT_BU_CODE\t\t \t\t\tif bu_code.nil?\n\tend", "def initialize_attributes(attributes); end", "def initialize(args = {})\n @title = args[:title]\n @abstract = args[:abstract]\n @time = args[:time]\n @difficulty = args[:difficulty]\n @cooked = args[:cooked]\n end", "def initialize_attrs\n attrs[:initial] and initial(attrs[:initial])\n attrs[:target] and target(attrs[:target])\n attrs[:terminal] and terminal(attrs[:terminal])\n log_transitions(attrs.fetch(:log_transitions, false))\n end", "def attributes=(_arg0); end", "def construct_data\n add_properties(@adv_settings, :if_missing)\n super\n end", "def tool_attributes(overrides = {})\n {\n name: \"Pros and Cons\",\n description: \"Weighing up pros and cons can speed up the decision-making process,\n improve your understanding of the situation and help you avoid decision-making\n paralysis.\",\n price: 10.00\n }.merge(overrides)\nend", "def start_book_title(attributes)\n @mode = 'book-title' if @mode == 'book'\n end", "def setup_initial_config!\n application.config do\n attribute :praxis do\n attribute :validate_responses, Attributor::Boolean, default: false\n attribute :validate_response_bodies, Attributor::Boolean, default: false\n\n attribute :show_exceptions, Attributor::Boolean, default: false\n attribute :x_cascade, Attributor::Boolean, default: true\n end\n end\n end", "def initialize(attributes={}) #can set instance variables when creating the instance\n @name = attributes[:name]\n @major = attributes[:major]\n @course = attributes[:course]\n @grade = attributes[:grade]\n end", "def on_start_element(element, attributes)\n\t\t\t\t\t@tag = element\n\t\t\t\t\t@vals[@tag] = \"\"\n\n\t\t\t\t\tif !@valid_elements.include?(element)\n\t\t\t\t\t\tputs \"New XML element detected: #{element}. Please report this at #{Risu::GITHUB}/issues/new or via email to #{Risu::EMAIL}\"\n\t\t\t\t\tend\n\n\t\t\t\t\tcase element\n\t\t\t\t\t\twhen \"Policy\"\n\t\t\t\t\t\t\t@policy = Risu::Models::Policy.create\n\t\t\t\t\t\t\[email protected]\n\t\t\t\t\t\twhen \"preference\"\n\t\t\t\t\t\t\t@sp = @policy.server_preferences.create\n\t\t\t\t\t\t\[email protected]\n\t\t\t\t\t\twhen \"item\"\n\t\t\t\t\t\t\t@item = @policy.plugins_preferences.create\n\t\t\t\t\t\t\[email protected]\n\t\t\t\t\t\twhen \"FamilyItem\"\n\t\t\t\t\t\t\t@family = @policy.family_selections.create\n\t\t\t\t\t\t\[email protected]\n\t\t\t\t\t\twhen \"PluginItem\"\n\t\t\t\t\t\t\t@plugin_selection = @policy.individual_plugin_selections.create\n\t\t\t\t\t\t\t@plugin_selection.save\n\t\t\t\t\t\twhen \"Report\"\n\t\t\t\t\t\t\t@report = @policy.reports.create\n\t\t\t\t\t\t\[email protected] = attributes[\"name\"]\n\t\t\t\t\t\t\[email protected]\n\t\t\t\t\t\twhen \"ReportHost\"\n\t\t\t\t\t\t\t@rh = @report.hosts.create\n\t\t\t\t\t\t\[email protected] = attributes[\"name\"]\n\t\t\t\t\t\t\[email protected]\n\t\t\t\t\t\twhen \"tag\"\n\t\t\t\t\t\t\t@attr = nil\n\t\t\t\t\t\t\t@hp = @rh.host_properties.create\n\n\t\t\t\t\t\t\tif attributes[\"name\"] =~ /[M|m][S|s]\\d{2,}-\\d{2,}/\n\t\t\t\t\t\t\t\t@attr = if attributes[\"name\"] =~ /[M|m][S|s]\\d{2,}-\\d{2,}/\n\t\t\t\t\t\t\t\t\t\t\tattributes[\"name\"]\n\t\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t\tnil\n\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t#Ugly as fuck. Really this needs to be rewritten. Fuck.\n\t\t\t\t\t\t\telsif attributes['name'] =~ /patch-summary-cve-num/ ||\n\t\t\t\t\t\t\t\tattributes['name'] =~ /patch-summary-cves/ ||\n\t\t\t\t\t\t\t\tattributes['name'] =~ /patch-summary-txt/ ||\n\t\t\t\t\t\t\t\tattributes['name'] =~ /cpe-\\d+/ ||\n\t\t\t\t\t\t\t\tattributes['name'] =~ /KB\\d+/\n\t\t\t\t\t\t\t\t@attr = if attributes[\"name\"] =~ /patch-summary-cve-num/ ||\n\t\t\t\t\t\t\t\tattributes['name'] =~ /patch-summary-cves/ ||\n\t\t\t\t\t\t\t\tattributes['name'] =~ /patch-summary-txt/ ||\n\t\t\t\t\t\t\t\tattributes['name'] =~ /cpe-\\d+/ ||\n\t\t\t\t\t\t\t\tattributes['name'] =~ /KB\\d+/\n\t\t\t\t\t\t\t\t\t\t\tattributes[\"name\"]\n\t\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t\tnil\n\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t@attr = if @valid_host_properties.include?(attributes[\"name\"])\n\t\t\t\t\t\t\t\t\tattributes[\"name\"]\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\tnil\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t# implicit nil check?\n\t\t\t\t\t\t\tif attributes[\"name\"] !~ /(netstat-(?:established|listen)-(?:tcp|udp)\\d+-\\d+)/ && attributes[\"name\"] !~ /traceroute-hop-\\d+/\n\t\t\t\t\t\t\t\tputs \"New HostProperties attribute: #{attributes[\"name\"]}. Please report this at #{Risu::GITHUB}/issues/new or via email to #{Risu::EMAIL}\\n\" if @attr.nil?\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\twhen \"ReportItem\"\n\t\t\t\t\t\t\t@vals = Hash.new # have to clear this out or everything has the same references\n\t\t\t\t\t\t\t@ri = @rh.items.create\n\t\t\t\t\t\t\tif attributes[\"pluginID\"] == \"0\"\n\t\t\t\t\t\t\t\t@plugin = Risu::Models::Plugin.find_or_create_by(:id => 1)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t@plugin = Risu::Models::Plugin.find_or_create_by(:id => attributes[\"pluginID\"])\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\[email protected] = attributes[\"port\"]\n\t\t\t\t\t\t\[email protected]_name = attributes[\"svc_name\"]\n\t\t\t\t\t\t\[email protected] = attributes[\"protocol\"]\n\t\t\t\t\t\t\[email protected] = attributes[\"severity\"]\n\n\t\t\t\t\t\t\[email protected]_id = @plugin.id\n\t\t\t\t\t\t\[email protected]_name = attributes[\"pluginName\"]\n\t\t\t\t\t\t\[email protected]_name = attributes[\"pluginFamily\"]\n\t\t\t\t\t\t\[email protected]\n\t\t\t\t\t\t\[email protected]\n\t\t\t\t\t\twhen \"attachment\"\n\t\t\t\t\t\t\t@attachment = @ri.attachments.create\n\t\t\t\t\t\t\[email protected] = attributes['name']\n\t\t\t\t\t\t\[email protected] = attributes['type']\n\t\t\t\t\t\t\[email protected]\n\t\t\t\t\tend\n\t\t\t\tend", "def defaults()\n @height ||= 200\n @width ||= 350\n @filename ||= \"文件名\"\n @title ||= \"文章标题\"\n @smalltitle ||= \"文章小标题\"\n @foot ||= \"页脚\"\n end", "def initialize author:, title:, summary:, images:, source:, date:, document_type:, section_name:\r\n super author: author, title: title, summary: summary, images: images, source: source, date: date\r\n @document_type = document_type\r\n @section_name = section_name\r\n end", "def initialize\n @am = RDoc::Markup::AttributeManager.new\n @output = nil\n end", "def initialize( parent, record, yaml )\n @parent = parent\n @record = record\n @yaml = yaml\n @form = parent.form\n @readonly = (@yaml and @yaml['readonly']) || (@form and @form['readonly'])\n if @yaml['size'] # move size to html element if not already there\n @yaml['html'] ||= {}\n @yaml['html']['size'] ||= @yaml['size']\n end\n @html = '' \n @js = ''\n self\nend", "def initialize(*args, &content_block)\n init_component(args, [:content, :title, :tag_type, :attributes], &content_block)\n\n # Defaults\n @tag_type ||= :span\n end", "def make_builder_settings(extra_settings = {})\n opts = super\n opts[:auto_inventory_attributes] = false\n opts\n end", "def setup\n @tc = TranslatableAttributes\n end", "def set_default_attributes\n self.attributes = default_attributes\n self.attributes.each do |key, value|\n # Scrub the attributes if there's no value\n attr_clean!(key) unless value\n end\n end", "def generate\n if language_id && excercise_type\n prepare_text\n self.generated = case excercise_type\n when 1 then prepare_fill_gaps\n when 2 then text\n end\n end\n end", "def fill_missing_fields\n unless self.title.blank?\n self.menu_name = self.title if self.menu_name.blank?\n self.shortcut = self.title.parameterize.html_safe if self.shortcut.blank?\n else\n unless self.menu_name.blank?\n self.title = self.menu_name if self.title.blank?\n self.shortcut = self.menu_name.parameterize.html_safe if self.shortcut.blank?\n end\n end\n end", "def create_texts\n self.title = I18n.t(:tictactoe)\n @new_btn.label = I18n.t(:new_game)\n @quit_btn.label = I18n.t(:quit)\n @default_size_btn.label = I18n.t(:default_size)\n end", "def initialize_element\n end", "def initialize\n # Since we want the ProfessionalLife model to be a proper ActiveRecord class,\n # we need to call the initialize function of the superclass first\n super \n \n ALL_TEXT_FIELDS.each do |field|\n self[field] = \"\"\n end\n end", "def initialize(opts = {})\n if opts[:element] && opts[:gpx_file]\n wpt_elem = opts[:element]\n @gpx_file = opts[:gpx_file]\n super(element: wpt_elem, gpx_file: @gpx_file)\n instantiate_with_text_elements(wpt_elem, SUB_ELEMENTS)\n else\n opts.each do |key, value|\n assignment_method = \"#{key}=\"\n send(assignment_method, value) if respond_to?(assignment_method)\n end\n end\n end", "def initialize\n @config = ATTRIBUTES.inject({}) do |memo, attribute|\n memo[attribute] = Polymer::Project::DEFAULTS[attribute]\n memo\n end\n end", "def prepare_tags()\n\t$currentCase.create_tag(OCR_MUST)\n\t$currentCase.create_tag(OCR_IMAGES_OVER_500KB)\n\t$currentCase.create_tag(OCR_IMAGES_OVER_1MB)\n\t$currentCase.create_tag(OCR_IMAGES_OVER_5MB)\n\t$currentCase.create_tag(OCR_AVG_WORDS_01_20)\n\t$currentCase.create_tag(OCR_AVG_WORDS_21_40)\n\t$currentCase.create_tag(OCR_AVG_WORDS_41_60)\n\t$currentCase.create_tag(OCR_AVG_WORDS_61_80)\n\t$currentCase.create_tag(OCR_AVG_WORDS_81_100)\n\t$currentCase.create_tag(OCR_AVG_WORDS_101)\nend", "def attributes=(*args)\n define_dynamic_answer_setters!\n super(*args)\n end", "def add_defaults_local\n super\n self.collection_event ||= parent.collection_event if parent\n self.specimen_characteristics ||= CaTissue::SpecimenCharacteristics.new\n end", "def initialize (title, artist, genre)\n # insert lines here\n @title = title\n @artist = artist\n\t\t@genre = genre\n\tend", "def create_element(name, *contents_or_attrs, &block); end", "def set_text\n {\n status: 'generated',\n div: '<div><h1>Pre-Visit Questionnaire</h1></div>'\n }\n end", "def component_initialize\n # Only create and supply a random ID this when a :heading is present\n return unless heading\n new_id = options[:id].nil? ? random_id : options[:id]\n options[:id] = new_id\n end", "def set_default_attributes\n self.quantity = 1\n\n case self.purchasable.class\n when Package\n self.description = \"Upgrade package to #{self.purchasable.name}\"\n # Hitung kekurangan dari paket sebelumnya\n old_package = self.invoice.contest_upgrade.old_package\n new_package = self.invoice.contest_upgrade.new_package\n price = new_package.calculate_sell_price - old_package.calculate_sell_price\n self.upgrade_price = price\n self.transaction_fee = 300000\n when Feature\n self.description = \"Upgrade feature to #{self.purchasable.name}\"\n if !self.free_upgrade\n self.upgrade_price = self.purchasable.price\n else\n self.upgrade_price = 0\n end\n end\n\n end", "def init_tags\n @attr_tags = [\n InlineTag.new(RDoc::Markup::Attribute.bitmap_for(:BOLD), l(\"\\\\textbf{\"), l(\"}\")),\n InlineTag.new(RDoc::Markup::Attribute.bitmap_for(:TT), l(\"\\\\texttt{\"), l(\"}\")),\n InlineTag.new(RDoc::Markup::Attribute.bitmap_for(:EM), l(\"\\\\emph{\"), l(\"}\")),\n ]\n end", "def initialize(atts = nil)\n initialize_attributes\n self.update_attributes(atts || {})\n end", "def set_elements\n super\n element(:purchase_order_number_field) {b.text_field(:id => \"document.purchaseOrderIdentifier\")}\n element(:invoice_number_field) {b.text_field(:id => \"document.invoiceNumber\")}\n element(:invoice_date_field) {b.text_field(:id => \"document.invoiceDate\")}\n element(:invoice_amount_field) {b.text_field(:id => \"document.vendorInvoiceAmount\")}\n element(:special_handling_line_1) {b.text_field(:id => \"document.specialHandlingInstructionLine1Text\")}\n element(:special_handling_line_2) {b.text_field(:id => \"document.specialHandlingInstructionLine2Text\")}\n element(:special_handling_line_3) {b.text_field(:id => \"document.specialHandlingInstructionLine3Text\")}\n element(:foreign_invoice_amount_field) {b.text_field(:id => \"document.foreignVendorInvoiceAmount\")}\n element(:continue_button) {b.div(:id => \"globalbuttons\").input(:title => \"Continue\")}\n element(:clear_button) {b.div(:id => \"globalbuttons\").input(:title => \"Clear\")}\n end", "def create_essence!(description)\n essence_class = self.class.normalize_essence_type(description['type']).constantize\n attributes = {\n :ingredient => default_text(description['default'])\n }\n if description['type'] == \"EssenceRichtext\" || description['type'] == \"EssenceText\"\n attributes.merge!(:do_not_index => !description['do_not_index'].nil?)\n end\n essence = essence_class.create(attributes)\n if essence\n self.essence = essence\n save!\n else\n false\n end\n end", "def initialize attribute_manager = nil\n @attribute_manager = attribute_manager || RDoc::Markup::AttributeManager.new\n @output = nil\n end", "def initialize(text,options={ :align=>:show_left, :tag => :default_font, :color => 0 } )\n @text = text\n @options=DEFAULT_OPTIONS.dup.merge(options)\n end", "def texts_attributes=(texts_attributes)\n texts_attributes.each do |text_title, attributes|\n text(text_title).update_attributes(attributes)\n end\n end", "def initialize(attributes = {})\n @id = attributes[:id]\n @name = attributes[:name]\n @room = attributes[:room]\n @cured = attributes[:cured] || false\n end", "def assign_meta_search\n\t\t\tassign_attributes meta_search_1: \"#{display_id} #{title} #{description}\"\n\t\t\t\n\t\t\t# tempLocale = I18n.locale\n\t\t\t# I18n.locale = 'vi'\n\n\t\t\t# assign_attributes meta_search_1: \"#{display_id} #{id} #{street.name if street.present?} #{district.name.gsub('Quận', '') if district.present?} #{I18n.t('real_estate_type.name.' + real_estate_type.name) if real_estate_type.present?}\", meta_search_2: \"#{I18n.t('real_estate.attribute.' + (is_alley ? 'alley' : 'facade'))} #{province.name if province.present?}\", meta_search_3: \"#{user_type == 'user' ? \"#{user.full_name} #{user.email} #{user.phone_number}\" : \"#{contact_user.name} #{contact_user.email} #{contact_user.phone_number}\"} #{title.gsub('Quận', '').gsub('quận', '')}\"\n\n\t\t\t# I18n.locale = tempLocale\n\t\tend", "def initialize(options={},&block)\n super(options,&block)\n [:title,:dom_id].each do |field|\n raise \"set :#{field} in #{self.class}.#{current_method}; this is required\" unless self.send(field)\n end\n end", "def initialize(attributes = {})\r\n\t\t@name = attributes[:name]\r\n\t\t@email = attirbutes[:email]\r\n\tend", "def build(element, essence_hash)\n if (description = content_description(element, essence_hash)).blank?\n raise ContentDefinitionError, \"No description found in elements.yml for #{essence_hash.inspect} and #{element.inspect}\"\n else\n new(name: description['name'], element_id: element.id, skip_translate: description['translate'] == false)\n end\n end", "def init(element, count)\r\n self.pid = element.attributes['id']\r\n self.pitcher_name = element.attributes['name']\r\n self.out = element.attributes['out']\r\n self.inn = convert_out_to_inn(element.attributes['out'])\r\n self.er = element.attributes['er']\r\n self.r = element.attributes['r']\r\n self.h = element.attributes['h']\r\n self.so = element.attributes['so']\r\n self.hr = element.attributes['hr']\r\n self.bb = element.attributes['bb']\r\n self.w = element.attributes['w']\r\n self.l = element.attributes['l']\r\n self.era = element.attributes['era']\r\n self.note = element.attributes['note']\r\n if count == 1\r\n self.start = true\r\n else\r\n self.start = false\r\n end\r\n end", "def initialize(attributes={})\n super\n self.name = nil unless name\n end", "def preencher\n nome.set 'leticia'\n \n end", "def update!(**args)\n @abstract_display = args[:abstract_display] if args.key?(:abstract_display)\n @abstract_html = args[:abstract_html] if args.key?(:abstract_html)\n @abstract_html_left_over = args[:abstract_html_left_over] if args.key?(:abstract_html_left_over)\n @abstract_language = args[:abstract_language] if args.key?(:abstract_language)\n @abstract_text = args[:abstract_text] if args.key?(:abstract_text)\n @abstract_type_from_source = args[:abstract_type_from_source] if args.key?(:abstract_type_from_source)\n end", "def create_from_scratch(element, essence_hash)\n essence_hash.stringify_keys!\n if content = build(element, essence_hash)\n content.create_essence!(essence_hash['essence_type'])\n end\n content\n end", "def create_from_scratch(element, essence_hash)\n essence_hash.stringify_keys!\n if content = build(element, essence_hash)\n content.create_essence!(essence_hash['essence_type'])\n end\n content\n end", "def initialize\n @title = \"title\"\n end", "def initialize(*attrs)\n set_attributes(attrs.extract_options!)\n end", "def set_defaults\n\t\tself.main_image ||= PlaceholderConcern.image_generator(height: '200', width: '300')\n self.sport_icon ||= PlaceholderConcern.image_generator(height: '40', width: '40')\n\tend", "def run\n super\n create_easy_attribute_source\n add_attribute_to_type\n end" ]
[ "0.66988754", "0.6012592", "0.5932437", "0.5904717", "0.5839869", "0.5829158", "0.575019", "0.5716449", "0.5690441", "0.5626508", "0.5624486", "0.5621992", "0.5589652", "0.5579654", "0.5568456", "0.55602074", "0.55438054", "0.5523974", "0.55086535", "0.5503863", "0.54089737", "0.53805935", "0.53564966", "0.5349655", "0.53392655", "0.5320452", "0.53056073", "0.52982277", "0.5294948", "0.52905744", "0.5285797", "0.5279933", "0.5279063", "0.5275907", "0.52684325", "0.52533627", "0.52533627", "0.52533627", "0.5252095", "0.52480197", "0.52399427", "0.5237165", "0.5235353", "0.5232538", "0.52315384", "0.5228213", "0.5218769", "0.5215358", "0.52044743", "0.5203409", "0.5203148", "0.520311", "0.5176807", "0.5175311", "0.5168665", "0.5163984", "0.51595974", "0.5158732", "0.5154175", "0.5140873", "0.5138616", "0.5134574", "0.513189", "0.51291054", "0.5127589", "0.5126085", "0.5125653", "0.51233035", "0.51035243", "0.50992584", "0.5097883", "0.509259", "0.5088328", "0.50872415", "0.5085514", "0.5083834", "0.50781065", "0.50777936", "0.50735974", "0.50731844", "0.50695044", "0.5059157", "0.505826", "0.5054248", "0.50528246", "0.50457335", "0.5039282", "0.5029537", "0.50290406", "0.50200903", "0.5014157", "0.5009953", "0.50096536", "0.5007444", "0.5005944", "0.5005944", "0.5005794", "0.50029314", "0.4998864", "0.4998264" ]
0.6771289
0
Default vaules for arguments
def default_args(a,b,c=1) puts "\nValues of variables: ",a,b,c end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default _args\n \"default _args;\" \n end", "def default_args\n args.select &:default\n end", "def defaultArguments (x = 22, y = x + 20, z = 50)\n puts \"x = \" + x.to_s\n puts \"y = \" + y.to_s\n puts \"z = \" + z.to_s\n end", "def arguments=(_arg0); end", "def default=(_arg0); end", "def two_arg_method_defaults(arg1=0, arg2=\"020202\")\n puts \"Here are my args: #{arg1}, #{arg2}\"\nend", "def arguments; end", "def arguments; end", "def arguments; end", "def args(*) end", "def arguments\n \"\"\n end", "def args=(_arg0); end", "def args=(_arg0); end", "def args=(_arg0); end", "def args=(_arg0); end", "def args=(_arg0); end", "def format_arguments=(_arg0); end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def default_argument(argname)\n if (arg = find_argument(argname)) && arg.has_default?\n [true, arg.default]\n end\n end", "def args()\n #This is a stub, used for indexing\n end", "def inflamed _args\n \"inflamed _args;\" \n end", "def defaults!; end", "def defaults!; end", "def in_kwarg=(_arg0); end", "def to_ruby_arg\n \"#{to_s_name}#{@default ? ' = ' + @default : ''}\"\n end", "def overrides=(_arg0); end", "def set_arguments (args)\n end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def parameters=(_arg0); end", "def func3(name=\"default name\",age=18)\n puts (\"name is \"+name)\n puts (\"age is \"+age.to_s)\n puts \"\"\nend", "def params=(_arg0); end", "def params=(_arg0); end", "def default_parameters\n {}\n end", "def arguments(required, *optional)\n puts \"required: #{required}\"\n puts \"optional: #{optional}\"\nend", "def defVals(par1, opt1 = \"optional one applied\", opt2 = \"optional two applied\") \n puts \"First parameter => #{par1}\"\n puts \"Second parameter => #{opt1}\"\n puts \"Third parameter => #{opt2}\"\nend", "def initialize hashed_args\n new_args = DEFAULT_ARGS.merge(hashed_args)\n \n @type = new_args[:type]\n if @type.is_a?(Enumerable)\n @type.each do |type|\n raise ArgumentError, \"#{type} is not a Class\" unless type.is_a?(Class)\n end\n else\n raise ArgumentError, \"#{@type} is not a Class\" unless @type.is_a?(Class)\n end\n \n @validator = new_args[:validator]\n @reqd = new_args[:reqd]\n \n unless @reqd\n msg = \"if hashed arg is not required, a default value or value generator (proc) must be defined via :default key\"\n raise ArgumentError, msg unless new_args.has_key?(:default)\n @default = new_args[:default]\n end\n end", "def hello(name=\"World\") # Default parameter\n puts \"Hello #{ name }\"\nend", "def complete_defaults(hash)\n ok, values = @validator.convert_and_validate(*collect_on_hash(hash))\n @args.each_with_index {|arg, i| hash[arg] = values[i]}\n end", "def transformed_argname=(_); end", "def extra_args; end", "def method (a=3, b)\r\nend", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def process_base_argument(arg)\n case arg\n when *@mapping[:help] then check_and_set_helpvalue\n when *@mapping[:version] then @parameters[:version] = true\n when *@mapping[:file] then create_argument_entry(:file) \n when /-[a-z]|--[a-z]+/ then process_argument(arg)\n else\n check_and_set_argument(@unflagged_arguments.shift, arg)\n end\n nil\n end", "def initialize(names,options)\n super(names,options)\n @argument_name = options[:arg_name] || \"arg\"\n @must_match = options[:must_match]\n @type = options[:type]\n @mask = options[:mask]\n @required = options[:required]\n @multiple = options[:multiple]\n end", "def method (a=3, b=4)\r\nend", "def arg(key, default = nil)\n args.fetch(key.to_s, default)\n end", "def undefinable_arguments\r\n @undefinable_arguments ||= arguments.all_not_definable\r\n end", "def _apply_default_options args, defaults\n options = args.extract_options!\n args << options.reverse_merge!(defaults)\n end", "def process_params(args = {})\r\n args ||= {}\r\n end", "def default(opts)\n opts = check_params(opts,[:field_names])\n super(opts)\n end", "def default_bare=(_arg0); end", "def manage_args(*args)\n end", "def extra=(_arg0); end", "def initialize(args)\n\t\targs = defaults.merge(args)\n\t\t@rim = args[:rim]\n\t\t@tire = args[:tire]\n\tend", "def PO109=(arg)", "def transformed_argname; end", "def method (number, default1 = 1, default2 = 2)\nend", "def argument_types=(*value)\n end", "def my_method(first: nil, second: nil)\n puts \"First is #{first} and second is #{second}\"\nend", "def default_url_options(*args); end" ]
[ "0.78734386", "0.7371773", "0.7289391", "0.7187405", "0.7001331", "0.69773114", "0.69285154", "0.69285154", "0.69285154", "0.68992424", "0.6773884", "0.67551154", "0.67551154", "0.67551154", "0.67551154", "0.67551154", "0.67155325", "0.670283", "0.670283", "0.670283", "0.670283", "0.670283", "0.670283", "0.670283", "0.670283", "0.670283", "0.670283", "0.670283", "0.670283", "0.670283", "0.670283", "0.670283", "0.670283", "0.670283", "0.670283", "0.670283", "0.670283", "0.6700476", "0.6649957", "0.6627482", "0.6589375", "0.6589375", "0.65809035", "0.6580685", "0.6540186", "0.6532863", "0.6467118", "0.6467118", "0.6467118", "0.6467118", "0.6467118", "0.6467118", "0.6467118", "0.6467118", "0.6467118", "0.6467118", "0.6427747", "0.6415596", "0.6375803", "0.6375803", "0.6355318", "0.63501203", "0.63137156", "0.6306403", "0.63048506", "0.62994236", "0.6298051", "0.62949854", "0.6288893", "0.62878853", "0.62878853", "0.62878853", "0.62878853", "0.62878853", "0.62878853", "0.62878853", "0.62878853", "0.62878853", "0.62878853", "0.62878853", "0.62878853", "0.62878853", "0.62568855", "0.62539554", "0.62469333", "0.6239931", "0.62305206", "0.6218291", "0.62141484", "0.619587", "0.61841995", "0.61822784", "0.61796296", "0.6166401", "0.6164696", "0.6162142", "0.61520743", "0.61498576", "0.6146522", "0.61446625" ]
0.7509507
1
Order of parameters and arguments
def mixed_args(a,b,*c,d) puts "\nArguments:" p a,b,c,d end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order=(_arg0); end", "def arguments; end", "def arguments; end", "def arguments; end", "def arg_order(*args)\n if args.size > 0\n begin\n args = args.uniq\n args.each do |x|\n __doodle__.handle_error :arg_order, ArgumentError, \"#{x} not a Symbol\", Doodle::Utils.doodle_caller if !(x.class <= Symbol)\n __doodle__.handle_error :arg_order, NameError, \"#{x} not an attribute name\", Doodle::Utils.doodle_caller if !doodle.attributes.keys.include?(x)\n end\n __doodle__.arg_order = args\n rescue Exception => e\n __doodle__.handle_error :arg_order, InvalidOrderError, e.to_s, Doodle::Utils.doodle_caller(e)\n end\n else\n __doodle__.arg_order + (__doodle__.attributes.keys - __doodle__.arg_order)\n end\n end", "def parameters=(_arg0); end", "def sort_params=(_arg0); end", "def sort_params=(_arg0); end", "def args(*) end", "def params=(_arg0); end", "def params=(_arg0); end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def arglists\n if @call_seq then\n @call_seq\n elsif @params then\n \"#{name}#{param_seq}\"\n end\n end", "def arglists\n if @call_seq then\n @call_seq\n elsif @params then\n \"#{name}#{param_seq}\"\n end\n end", "def arguments(required, *optional)\n puts \"required: #{required}\"\n puts \"optional: #{optional}\"\nend", "def arguments=(_arg0); end", "def args() return @args end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args()\n #This is a stub, used for indexing\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def method(arg_1, arg_2)\n p arg_1\n p arg_2\nend", "def priority _args\n \"priority _args;\" \n end", "def deco_args; end", "def probers=(_arg0); end", "def entry_order=(_arg0); end", "def args=(_arg0); end", "def args=(_arg0); end", "def args=(_arg0); end", "def args=(_arg0); end", "def args=(_arg0); end", "def get_parameters; end", "def get_parameters; end", "def sort_params; end", "def sort_params; end", "def method(arg1, arg2)\n p arg1\n p arg2\nend", "def test_Method_InstanceMethods_parameters\n\t\tdef m(a,b=1,*c,&d); end\n\t\t# TODO, assert_equal([[:req,:a],[:opt,:b],[:rest,:c],[:block,:d]], method(:m).parameters)\n\tend", "def params(*); {}; end", "def foo(a, b)\n :two_args\n end", "def args\n @args \n end", "def extra_args; end", "def args\n @args\n end", "def railties_order=(_arg0); end", "def railties_order=(_arg0); end", "def hello(place=\"world\", *args)\n #...\n end", "def order; end", "def order; end", "def parameters=(_); end", "def arguments(method)\n\n\n\n # 211:7: first_argument[method] ( other_arguments[method] )*\n first_argument(method)\n\n # 211:30: ( other_arguments[method] )*\n while true\n alt30 = 2\n # ()* loopback of 211:30: ( other_arguments[method] )*\n look_ahead30_0 = look_ahead(1)\n if look_ahead30_0 == :COMMA \n alt30 = 1\n end\n case alt30\n when 1\n # 211:32: other_arguments[method]\n other_arguments(method)\n\n else\n break\n end\n end\n\n\n\n end", "def __get_params(data)\n \n # If named arguments used, assigns keys as symbols\n # but keeps numeric arguments as integers\n \n if @params.kind_of? Hash\n @params = @params.dup\n @keyword_params = JsonRpcObjects::Utils::Hash.remove!(@params) do |k, v|\n not JsonRpcObjects::Utils::String.numeric? k\n end\n \n @params = @params.sort_by { |i| i[0].to_i }.map { |i| i[1] }\n else\n @keyword_params = { }\n end\n \n JsonRpcObjects::Utils::Hash.keys_to_sym! @keyword_params\n \n end", "def use_all_parameters\n params = valid_parameters.each {|parameter| add_parameters(parameter)}\n sort_symbols(params)\n end", "def args\n @function.args\n end", "def order(*args)\n with_opts(:order=>args.freeze)\n end", "def inflamed _args\n \"inflamed _args;\" \n end", "def xx(arg1, arg2) \n puts arg2+arg1 \nend", "def meth(\n\n\n\n *args)\n\nend", "def print_arguments(arg_1, arg_2)\n puts arg_1 # We can then use the argument in the method\n puts arg_2\nend", "def arguments\n @arguments ||= Launchr::OrderedHash.new\n @arguments\n end", "def foo2(arg1, arg2, *other_arg) \n print arg1 \n print other_arg \n p other_arg[0]\nend" ]
[ "0.73288155", "0.7008551", "0.7008551", "0.7008551", "0.6931688", "0.68859166", "0.6869446", "0.6869446", "0.6698249", "0.6657472", "0.6657472", "0.66568214", "0.66568214", "0.66568214", "0.66568214", "0.66568214", "0.66568214", "0.66568214", "0.66568214", "0.66183573", "0.66183573", "0.65464896", "0.6540843", "0.6521302", "0.6480029", "0.6480029", "0.6480029", "0.6480029", "0.6480029", "0.6480029", "0.6480029", "0.6480029", "0.6480029", "0.6480029", "0.6480029", "0.6480029", "0.6480029", "0.6480029", "0.6480029", "0.6480029", "0.6480029", "0.6480029", "0.6480029", "0.6480029", "0.64718145", "0.63895315", "0.63895315", "0.63895315", "0.63895315", "0.63895315", "0.63895315", "0.63895315", "0.63895315", "0.63895315", "0.63895315", "0.63895315", "0.63895315", "0.63895315", "0.63895315", "0.63895315", "0.63895315", "0.63895315", "0.6254761", "0.62493616", "0.62423515", "0.62381846", "0.62330264", "0.62027675", "0.62027675", "0.62027675", "0.62027675", "0.62027675", "0.6191482", "0.6191482", "0.61819786", "0.61819786", "0.6174828", "0.61687225", "0.6167143", "0.61511666", "0.6149123", "0.61482316", "0.61482", "0.6131125", "0.6131125", "0.6122939", "0.61150575", "0.61150575", "0.60997206", "0.6097929", "0.6094977", "0.60805583", "0.6058851", "0.6053154", "0.6052231", "0.6046853", "0.60376847", "0.6018766", "0.6017078", "0.6016788" ]
0.6227152
67
TODO move logic to a background worker
def new_client user_params = params[:user] new_client = User.new new_client.role = "client" new_client.email = user_params[:email] temp_password = Devise.friendly_token.first(8) new_client.password = temp_password new_client.password_confirmation = temp_password #TODO Send mail to new registered user with login credentials new_client.save new_client end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run() end", "def running; end", "def running; end", "def thread; end", "def thread; end", "def thread; end", "def executor; end", "def executor; end", "def executor; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def do_work\n end", "def thread()\n #This is a stub, used for indexing\n end", "def perform\n \n end", "def queue_job; end", "def run\n \n end", "def run\n \n end", "def run\n end", "def enqueue_pending_output; end", "def in_new_thread; end", "def running?; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def sync() end", "def sync() end", "def sync() end", "def process\n end", "def queue; end", "def queue; end", "def sync; end", "def post_process; end", "def run\n end", "def started; end", "def process!\n end", "def execute_in_background(args); end", "def reserve_and_run_one_job; end", "def post_loop; end", "def run\n end", "def waiting; end", "def waiting; end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def perform; end", "def perform; end", "def run\n end", "def run\n end", "def run(_); end", "def run(_); end", "def lock; end", "def lock; end", "def lock; end", "def finished; end", "def worker_pool; end", "def worker_pool; end", "def run()\n end", "def run_job\n end", "def sleepy_run; end", "def monitor; end", "def perform\n @worker.call\n @last_result\n end", "def refork; end", "def wait; end", "def wait; end", "def wait; end", "def post_process\n end", "def loop\n end", "def loop\n end", "def progress; end", "def progress; end", "def progress; end", "def progress; end", "def progress; end", "def running?; !!@thread end", "def task\n end", "def worker_begin(worker)\n end", "def perform_io; end", "def work_pool; end", "def pausable; end", "def future; end", "def process\n raise \"Must be implemented\"\n end", "def run_loop\n end", "def wait_for_pending_sends; end", "def perform_background_tasks\n self.check_clipboard\n self.check_resolvers\n self.check_downloads\n self.check_captchas\n self.refresh_task_table\n self.update_download_buttons\n end", "def done; end" ]
[ "0.68930656", "0.6844638", "0.6844638", "0.67075616", "0.67075616", "0.67075616", "0.6621894", "0.6621894", "0.6621894", "0.65741915", "0.65741915", "0.65741915", "0.65741915", "0.65741915", "0.65741915", "0.65741915", "0.65741915", "0.65741915", "0.6554338", "0.6546333", "0.6500737", "0.63424206", "0.6293877", "0.6293877", "0.62925744", "0.62723064", "0.62417245", "0.6226778", "0.619434", "0.619434", "0.619434", "0.619434", "0.619434", "0.619434", "0.619434", "0.619434", "0.6190888", "0.6190888", "0.6190888", "0.6165301", "0.6128632", "0.6128632", "0.610786", "0.6075466", "0.60681015", "0.60494345", "0.6040492", "0.6035849", "0.60251963", "0.6016958", "0.6012363", "0.6011932", "0.6011932", "0.6006858", "0.6006858", "0.6006858", "0.6006858", "0.6006858", "0.6006858", "0.6006858", "0.59846044", "0.59846044", "0.597931", "0.597931", "0.59513384", "0.59513384", "0.5943339", "0.5943339", "0.5943339", "0.5941558", "0.5934531", "0.5934531", "0.5914316", "0.5889867", "0.58719945", "0.5871185", "0.58628136", "0.5857209", "0.58432114", "0.58432114", "0.58432114", "0.58238953", "0.5815202", "0.5815202", "0.5811251", "0.5811251", "0.5811251", "0.5811251", "0.5811251", "0.58062756", "0.5788137", "0.5784621", "0.57841784", "0.57813156", "0.57772255", "0.5775025", "0.5751027", "0.57493085", "0.57477164", "0.57299644", "0.5718601" ]
0.0
-1
GET /institutions GET /institutions.json
def check_privilege(institution) unless current_user.institution == @institution redirect_to welcome_index_path return end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_institutions\r\n # Prepare query url.\r\n _path_url = '/institutions'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| Institution.from_hash(element) }\r\n end", "def institutions(pageIndex=0, options={})\n options.merge!({:query => {:pageIndex => pageIndex}})\n self.class.get(\"/Institutions.json\", options)\n end", "def index\n @institutions = current_user.institutions\n end", "def index\n @one_reg_institutions = OneRegInstitution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @one_reg_institutions }\n end\n end", "def show\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institution }\n end\n end", "def show\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institution }\n end\n end", "def institution(institution, options={})\n self.class.get(\"/Institution/#{institution}.json\", options)\n end", "def show\n @institution = Institution.find(params[:id])\n\n render json: @institution\n\n rescue ActiveRecord::RecordNotFound\n render json: {message: 'Resource not found'}, status: 404\n\n end", "def index\n @issuing_institutions = IssuingInstitution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @issuing_institutions }\n end\n end", "def search\n @institutions = Institution.order(:nome).where(\"nome ilike ?\", \"%#{params[:term]}%\")\n render json: @institutions.map{|institution| {:label => institution.nome, :value => institution.id}}\n end", "def show\n institution = Institution.find(params[:id])\n render json: { status: '200', message: \"Loaded Institution with id #{params[:id]}\", data: institution }, status: :ok\n rescue ActiveRecord::RecordNotFound\n render json: { status: '404', error: \"No Institution with id #{params[:id]}\", data: institution }, status: :not_found\n end", "def show\n @institution_ad = InstitutionAd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institution_ad }\n end\n end", "def show\n @institucional = Institucional.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institucional }\n end\n end", "def create\n @institution = current_user.institutions.new(institution_params)\n\n if @institution.save\n render :show, status: :created\n else\n render json: @institution.errors.full_messages, status: :unprocessable_entity\n end\n end", "def show\n @institutions = @tesda_course.institutions\n end", "def new\n @institution = Institution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @institution }\n end\n end", "def show\n @one_reg_institution = OneRegInstitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @one_reg_institution }\n end\n end", "def show\n @institute_admin = InstituteAdmin.includes(:profile).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institute_admin }\n end\n end", "def show\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @institution }\n format.json {render :json => {\"success\"=>true,\"data\"=>@institution} }\n \n end\n end", "def index\n @educational_institutions = EducationalInstitution.all\n end", "def institution(id = nil)\n res = Connection.get('institutions', id)\n id.nil? ? Institution.all(res) : Institution.new(res)\n end", "def index\n @institucions = Institucion.search(params[:search], params[:page])\n end", "def index\n if params[:term] != nil\n if params[:type] != nil\n @institutions = Institution.find(:all, :conditions => [\"LOWER(nom) LIKE LOWER(?) and type_institution_id=?\", \"%#{params[:term]}%\", \"#{params[:type]}\"])\n else\n @institutions = Institution.find(:all, :conditions => [\"LOWER(nom) LIKE LOWER(?)\", \"%#{params[:term]}%\"])\n end\n else\n @institutions = current_user.parametres_cabinet.institutions.all\n end\n \n \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @institutions }\n format.js {render :json => @institutions.map {|p| { :label => p.nom , :value => p.id}} }\n format.json {render :json => {\"success\"=>true,\"data\"=>@institutions} }\n \n end\n end", "def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end", "def index\n authorize HigherEducationInstitution\n @higher_education_institutions = HigherEducationInstitution.order(:name).search(params[:search]).page(params[:page])\n end", "def index\n if(current_user.super_admin?)\n @institutions = Institution.all.paginate(page: params[:page], per_page: 15)\n else\n @institutions = Institution.all.where(id: current_institution.id).paginate(page: params[:page], per_page: 15)\n end\n end", "def get_institution(id)\r\n # Prepare query url.\r\n _path_url = '/institutions/{id}'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'id' => id\r\n )\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n Institution.from_hash(decoded)\r\n end", "def index\n @universities = University.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @universities }\n end\n end", "def names\n sql = 'SELECT DISTINCT resources.name '\\\n 'FROM resources '\\\n 'LEFT JOIN locations ON locations.id = resources.location_id '\\\n 'LEFT JOIN repositories ON locations.repository_id = repositories.id '\\\n 'LEFT JOIN institutions ON repositories.institution_id = institutions.id '\\\n 'WHERE institutions.id = ' + params[:institution_id].to_i.to_s\n conn = ActiveRecord::Base.connection\n results = conn.execute(sql)\n render json: results.map{ |r| r['name'] }\n end", "def show\n @jurisdiction = Jurisdiction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jurisdiction }\n end\n end", "def new\n @institucional = Institucional.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @institucional }\n end\n end", "def set_institution\n @institution = current_user.institutions.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render json: { errors: [I18n.t('api.institution.not_found')] }, status: :not_found\n end", "def show\n @country = Country.includes(:regions).find(params[:id])\n @tours = Tour.search(params.merge({ region: @country.region_ids}))\n @attractions = @country.regions.map { |i| i.attractions }.flatten\n @hotels = @country.regions.map { |i| i.hotels }.flatten\n @photos = @country.regions.map { |i| i.gallery.photos if i.gallery }.flatten.uniq.compact\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @country }\n end\n end", "def new\n @institution_ad = InstitutionAd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @institution_ad }\n end\n end", "def index\n @institute_admins = case current_user.rc\n when 'EA'\n InstituteAdmin.includes(:profile).page(params[:page])\n when 'IA'\n InstituteAdmin.includes(:profile).where(:id=>current_user.institute_admin).page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @institute_admins }\n end\n end", "def show\n @instituicao = Instituicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instituicao }\n end\n end", "def show\n @issuing_institution = IssuingInstitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @issuing_institution }\n end\n end", "def get_region\n respond_to do |format|\n format.json{ render :json => { :region => Region.all } }\n end\n end", "def load_institutions\n # Get Solr institution pids from the SQL db.\n pid_for = {}\n query = \"select id, identifier from institutions\"\n if @inst_query.nil?\n @inst_query = @db.prepare(query)\n end\n result_set = @inst_query.execute\n result_set.each_hash do |row|\n # Sample entry: pids['miami.edu'] = 'aptrust-test:350660'\n pid_for[row['identifier']] = row['id']\n @name_of[row['id']] = row['identifier']\n end\n\n # Load institutions from Pharos and map old Solr pid to new id\n url = @base_url + '/api/v2/institutions'\n resp = api_get(url, nil)\n if resp.code != '200'\n @log.write(\"Error getting institutions from Pharos\\n\")\n @log.write(resp.body)\n exit(1)\n end\n data = JSON.parse(resp.body)\n data['results'].each do |inst|\n solr_pid = pid_for[inst['identifier']]\n @new_id_for[solr_pid] = inst['id']\n @id_for_name[inst['identifier']] = inst['id']\n puts \"#{inst['identifier']} has id #{inst['id']}\"\n end\n end", "def show\n @financial_institution = FinancialInstitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_institution }\n end\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def show\n @inschool = Inschool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inschool }\n end\n end", "def institution(id=nil)\n @institution = Plaid::Institution.new\n res = self.get('institutions',id)\n id.nil? ? @institution.instantiate_all_institutions(res) : @institution.instantiate_one_institution(res)\n end", "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end", "def index\n @registrations = Tournament.find(params[:tournament_id]).registrations\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registrations }\n end\n end", "def test_test_get_institutions()\r\n\r\n # Perform the API call through the SDK function\r\n result = self.class.controller.get_institutions()\r\n\r\n # Test response code\r\n assert_equal(@response_catcher.response.status_code, 200)\r\n\r\n # Test headers\r\n expected_headers = {}\r\n expected_headers['content-type'] = 'application/json'\r\n\r\n assert(TestHelper.match_headers(expected_headers, @response_catcher.response.headers))\r\n end", "def institution\n ::HubEdos::StudentApi::V2::StudentRecord::Institution.new(@data['institution']) if @data['institution']\n end", "def show\n @solutions = @profile.solutions.paginate(page: params[:page], per_page: 10 ).order('created_at DESC')\n respond_with @profile\n end", "def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\n end\n end", "def show\n @constitution = Constitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @constitution }\n end\n end", "def institutions\n @delegated_to_object\n end", "def show\n render json: @laboratory\n end", "def index\n @institutions = Institution.all\n @pets = Institution.all.limit(3)\n end", "def show\n @admin_interview = Interview.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_interview }\n end\n end", "def new\n @one_reg_institution.institution_id = @institution\n @one_reg_institution = OneRegInstitution.new\n 1.times {@one_reg_institution.document_by_institutions.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @one_reg_institution }\n end\n end", "def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university }\n end\n end", "def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university }\n end\n end", "def index\n @infrastructures = getmydata(\"Infrastructure\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @infrastructures }\n end\n end", "def index\n @projects = current_institute.projects\n end", "def create\n @institution = Institution.new(params[:institution])\n\n respond_to do |format|\n if @institution.save\n format.html { redirect_to @institution, notice: 'Institution was successfully created.' }\n format.json { render json: @institution, status: :created, location: @institution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @institution = Institution.new(params[:institution])\n\n respond_to do |format|\n if @institution.save\n format.html { redirect_to @institution, notice: 'Institution was successfully created.' }\n format.json { render json: @institution, status: :created, location: @institution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @people = search Person.involved_in(@conference)\n\n respond_to do |format|\n format.html { @people = @people.paginate page: page_param }\n format.json\n end\n end", "def index\n @solutions = @idea.solutions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solutions }\n end\n end", "def create\n @institution = Institution.new(params[:institution])\n @institution.parametres_cabinet_id = current_user.parametres_cabinet.id\n respond_to do |format|\n if @institution.save\n format.html { redirect_to(@institution, :notice => 'Institution was successfully created.') }\n format.xml { render :xml => @institution, :status => :created, :location => @institution }\n format.json {render :json => {\"success\"=>true,\"data\"=>@institutions} }\n \n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @institution.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @condolence = Condolence.find(params[:id])\n @orbituarysite = current_user.orbituarysites.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condolence }\n end\n end", "def show\n @initiative = Initiative.find(params[:id])\n\n respond_to do |format|\n format.html # _show.html.erb\n format.json { render json: @initiative }\n end\n end", "def show\n @interview = Interview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interview }\n end\n end", "def get_affiliation\n render( json: TeamAffiliation.find_by(season_id: params[:season_id], team_id: params[:id]) )\n end", "def show\n @hospitalization = Hospitalization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospitalization }\n end\n end", "def index\n render :json => UserInterest.all\n end", "def catalog\n if @sub_service_request\n @institutions = Institution.where(id: @sub_service_request.organization.parents.select{|x| x.type == 'Institution'}.map(&:id))\n else\n @institutions = Institution.order('`order`')\n end\n\n setup_catalog_calendar\n setup_catalog_news_feed\n end", "def index\n locations = @project.locations.all\n render json: { locations: locations }\n end", "def show\n @research = Research.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @research }\n end\n end", "def show\n id = params[:id]\n @physician = Physician.find(id)\n render json: @physician, :include => [:patients => {:include => [:surveys]}]\n end", "def show\n @inspiration = Inspiration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inspiration }\n end\n end", "def index\n @citations = Citation.all\n\n render json: @citations\n end", "def show\n @incident_kind = IncidentKind.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident_kind }\n end\n end", "def show\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person_interest }\n end\n end", "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interest }\n end\n end", "def create\n @institution = Institution.new(institution_params)\n\n respond_to do |format|\n if @institution.save\n format.html { redirect_to @institution, notice: 'Instituição cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @institution }\n else\n format.html { render :new }\n format.json { render json: @institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @collections = @institution.collections.order(:name)\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @collections }\n end\n end", "def show\n @interview = Interview.find_by_slug(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interview }\n end\n end", "def show\n @incident = Incident.find(params[:id])\n\n render json: @incident\n end", "def index\n @regiones = Region.all\n\n render json: @regiones\n end", "def index\n @communities = @district.communities.page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @communities }\n end\n end", "def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end", "def show\n @showItin = Itinerary.find(itin_params)\n render json: @showItin, status: 200\n end", "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @interest }\n end\n end", "def index\n @interviews = Interview.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interviews }\n end\n end", "def index\n @capacites = Capacite.paginate(page: params[:page], per_page: 25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @capacites }\n end\n end", "def index\n @people = Person.includes(:registry).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end", "def index\n @division_syns = DivisionSyn.all\n\n render json: @division_syns\n end", "def uni_years\n @uni_years = UniYear.where(university_id: params[:university_id])\n \n respond_to do |format|\n format.json { render json: @uni_years }\n end\n end", "def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end", "def new\n @orbituarysite = current_user.orbituarysites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orbituarysite }\n end\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @life_insurances }\n end\n end", "def dame_institucion\n i = Metamares::Institucion.new\n i.nombre_institucion = params[:nombre_institucion]\n\n respond_to do |format|\n format.json { render json: i.busca_institucion.map{ |i| { id: i.id, value: i.nombre_institucion } } }\n format.html { @institucion = i }\n end\n end", "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @interest }\n end\n end", "def show\n render json: @inciting_incident\n end", "def index\n @registries = Registry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registries }\n end\n end", "def index\n @devises = Devise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @devises }\n end\n end" ]
[ "0.79272056", "0.77259904", "0.7252765", "0.69552505", "0.69063497", "0.69063497", "0.67578834", "0.6611987", "0.65452427", "0.648086", "0.6465456", "0.6464098", "0.64571357", "0.6444813", "0.63845617", "0.6334052", "0.6330156", "0.62656885", "0.62276524", "0.6150121", "0.6114119", "0.60763586", "0.60392743", "0.6014095", "0.60066754", "0.59875697", "0.5977834", "0.5975575", "0.59362614", "0.5919698", "0.59157306", "0.5912006", "0.59102476", "0.5906632", "0.5883377", "0.58702826", "0.585038", "0.58498156", "0.5843047", "0.5828066", "0.5798054", "0.5785587", "0.5782232", "0.5770604", "0.57412565", "0.5738766", "0.5736806", "0.5730693", "0.5723474", "0.5702567", "0.56983936", "0.56916434", "0.56877285", "0.5674292", "0.56709933", "0.5661146", "0.5661146", "0.5659545", "0.56539154", "0.5643068", "0.5643068", "0.56323594", "0.5626262", "0.56189966", "0.5614038", "0.5613184", "0.5611947", "0.5607447", "0.5600976", "0.5600558", "0.5595759", "0.5588073", "0.55832213", "0.55807894", "0.5579246", "0.55784065", "0.5560071", "0.5558779", "0.55523014", "0.555208", "0.55479693", "0.5544236", "0.5539465", "0.5539133", "0.55385345", "0.55225295", "0.5519956", "0.5515407", "0.5514042", "0.5512201", "0.55121046", "0.55066353", "0.55035", "0.5499119", "0.549891", "0.5495547", "0.5493574", "0.54902965", "0.5488808", "0.5488521", "0.54880935" ]
0.0
-1
GET /institutions GET /institutions.json
def search @institutions = Institution.order(:nome).where("nome ilike ?", "%#{params[:term]}%") render json: @institutions.map{|institution| {:label => institution.nome, :value => institution.id}} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_institutions\r\n # Prepare query url.\r\n _path_url = '/institutions'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| Institution.from_hash(element) }\r\n end", "def institutions(pageIndex=0, options={})\n options.merge!({:query => {:pageIndex => pageIndex}})\n self.class.get(\"/Institutions.json\", options)\n end", "def index\n @institutions = current_user.institutions\n end", "def index\n @one_reg_institutions = OneRegInstitution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @one_reg_institutions }\n end\n end", "def show\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institution }\n end\n end", "def show\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institution }\n end\n end", "def institution(institution, options={})\n self.class.get(\"/Institution/#{institution}.json\", options)\n end", "def show\n @institution = Institution.find(params[:id])\n\n render json: @institution\n\n rescue ActiveRecord::RecordNotFound\n render json: {message: 'Resource not found'}, status: 404\n\n end", "def index\n @issuing_institutions = IssuingInstitution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @issuing_institutions }\n end\n end", "def show\n institution = Institution.find(params[:id])\n render json: { status: '200', message: \"Loaded Institution with id #{params[:id]}\", data: institution }, status: :ok\n rescue ActiveRecord::RecordNotFound\n render json: { status: '404', error: \"No Institution with id #{params[:id]}\", data: institution }, status: :not_found\n end", "def show\n @institution_ad = InstitutionAd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institution_ad }\n end\n end", "def show\n @institucional = Institucional.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institucional }\n end\n end", "def create\n @institution = current_user.institutions.new(institution_params)\n\n if @institution.save\n render :show, status: :created\n else\n render json: @institution.errors.full_messages, status: :unprocessable_entity\n end\n end", "def show\n @institutions = @tesda_course.institutions\n end", "def new\n @institution = Institution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @institution }\n end\n end", "def show\n @one_reg_institution = OneRegInstitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @one_reg_institution }\n end\n end", "def show\n @institute_admin = InstituteAdmin.includes(:profile).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institute_admin }\n end\n end", "def show\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @institution }\n format.json {render :json => {\"success\"=>true,\"data\"=>@institution} }\n \n end\n end", "def index\n @educational_institutions = EducationalInstitution.all\n end", "def institution(id = nil)\n res = Connection.get('institutions', id)\n id.nil? ? Institution.all(res) : Institution.new(res)\n end", "def index\n @institucions = Institucion.search(params[:search], params[:page])\n end", "def index\n if params[:term] != nil\n if params[:type] != nil\n @institutions = Institution.find(:all, :conditions => [\"LOWER(nom) LIKE LOWER(?) and type_institution_id=?\", \"%#{params[:term]}%\", \"#{params[:type]}\"])\n else\n @institutions = Institution.find(:all, :conditions => [\"LOWER(nom) LIKE LOWER(?)\", \"%#{params[:term]}%\"])\n end\n else\n @institutions = current_user.parametres_cabinet.institutions.all\n end\n \n \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @institutions }\n format.js {render :json => @institutions.map {|p| { :label => p.nom , :value => p.id}} }\n format.json {render :json => {\"success\"=>true,\"data\"=>@institutions} }\n \n end\n end", "def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end", "def index\n authorize HigherEducationInstitution\n @higher_education_institutions = HigherEducationInstitution.order(:name).search(params[:search]).page(params[:page])\n end", "def index\n if(current_user.super_admin?)\n @institutions = Institution.all.paginate(page: params[:page], per_page: 15)\n else\n @institutions = Institution.all.where(id: current_institution.id).paginate(page: params[:page], per_page: 15)\n end\n end", "def get_institution(id)\r\n # Prepare query url.\r\n _path_url = '/institutions/{id}'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'id' => id\r\n )\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n Institution.from_hash(decoded)\r\n end", "def index\n @universities = University.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @universities }\n end\n end", "def names\n sql = 'SELECT DISTINCT resources.name '\\\n 'FROM resources '\\\n 'LEFT JOIN locations ON locations.id = resources.location_id '\\\n 'LEFT JOIN repositories ON locations.repository_id = repositories.id '\\\n 'LEFT JOIN institutions ON repositories.institution_id = institutions.id '\\\n 'WHERE institutions.id = ' + params[:institution_id].to_i.to_s\n conn = ActiveRecord::Base.connection\n results = conn.execute(sql)\n render json: results.map{ |r| r['name'] }\n end", "def show\n @jurisdiction = Jurisdiction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jurisdiction }\n end\n end", "def new\n @institucional = Institucional.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @institucional }\n end\n end", "def set_institution\n @institution = current_user.institutions.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render json: { errors: [I18n.t('api.institution.not_found')] }, status: :not_found\n end", "def show\n @country = Country.includes(:regions).find(params[:id])\n @tours = Tour.search(params.merge({ region: @country.region_ids}))\n @attractions = @country.regions.map { |i| i.attractions }.flatten\n @hotels = @country.regions.map { |i| i.hotels }.flatten\n @photos = @country.regions.map { |i| i.gallery.photos if i.gallery }.flatten.uniq.compact\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @country }\n end\n end", "def new\n @institution_ad = InstitutionAd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @institution_ad }\n end\n end", "def index\n @institute_admins = case current_user.rc\n when 'EA'\n InstituteAdmin.includes(:profile).page(params[:page])\n when 'IA'\n InstituteAdmin.includes(:profile).where(:id=>current_user.institute_admin).page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @institute_admins }\n end\n end", "def show\n @instituicao = Instituicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instituicao }\n end\n end", "def show\n @issuing_institution = IssuingInstitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @issuing_institution }\n end\n end", "def get_region\n respond_to do |format|\n format.json{ render :json => { :region => Region.all } }\n end\n end", "def load_institutions\n # Get Solr institution pids from the SQL db.\n pid_for = {}\n query = \"select id, identifier from institutions\"\n if @inst_query.nil?\n @inst_query = @db.prepare(query)\n end\n result_set = @inst_query.execute\n result_set.each_hash do |row|\n # Sample entry: pids['miami.edu'] = 'aptrust-test:350660'\n pid_for[row['identifier']] = row['id']\n @name_of[row['id']] = row['identifier']\n end\n\n # Load institutions from Pharos and map old Solr pid to new id\n url = @base_url + '/api/v2/institutions'\n resp = api_get(url, nil)\n if resp.code != '200'\n @log.write(\"Error getting institutions from Pharos\\n\")\n @log.write(resp.body)\n exit(1)\n end\n data = JSON.parse(resp.body)\n data['results'].each do |inst|\n solr_pid = pid_for[inst['identifier']]\n @new_id_for[solr_pid] = inst['id']\n @id_for_name[inst['identifier']] = inst['id']\n puts \"#{inst['identifier']} has id #{inst['id']}\"\n end\n end", "def show\n @financial_institution = FinancialInstitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_institution }\n end\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def show\n @inschool = Inschool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inschool }\n end\n end", "def institution(id=nil)\n @institution = Plaid::Institution.new\n res = self.get('institutions',id)\n id.nil? ? @institution.instantiate_all_institutions(res) : @institution.instantiate_one_institution(res)\n end", "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end", "def index\n @registrations = Tournament.find(params[:tournament_id]).registrations\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registrations }\n end\n end", "def test_test_get_institutions()\r\n\r\n # Perform the API call through the SDK function\r\n result = self.class.controller.get_institutions()\r\n\r\n # Test response code\r\n assert_equal(@response_catcher.response.status_code, 200)\r\n\r\n # Test headers\r\n expected_headers = {}\r\n expected_headers['content-type'] = 'application/json'\r\n\r\n assert(TestHelper.match_headers(expected_headers, @response_catcher.response.headers))\r\n end", "def institution\n ::HubEdos::StudentApi::V2::StudentRecord::Institution.new(@data['institution']) if @data['institution']\n end", "def show\n @solutions = @profile.solutions.paginate(page: params[:page], per_page: 10 ).order('created_at DESC')\n respond_with @profile\n end", "def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\n end\n end", "def show\n @constitution = Constitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @constitution }\n end\n end", "def institutions\n @delegated_to_object\n end", "def show\n render json: @laboratory\n end", "def index\n @institutions = Institution.all\n @pets = Institution.all.limit(3)\n end", "def show\n @admin_interview = Interview.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_interview }\n end\n end", "def new\n @one_reg_institution.institution_id = @institution\n @one_reg_institution = OneRegInstitution.new\n 1.times {@one_reg_institution.document_by_institutions.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @one_reg_institution }\n end\n end", "def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university }\n end\n end", "def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university }\n end\n end", "def index\n @infrastructures = getmydata(\"Infrastructure\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @infrastructures }\n end\n end", "def index\n @projects = current_institute.projects\n end", "def create\n @institution = Institution.new(params[:institution])\n\n respond_to do |format|\n if @institution.save\n format.html { redirect_to @institution, notice: 'Institution was successfully created.' }\n format.json { render json: @institution, status: :created, location: @institution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @institution = Institution.new(params[:institution])\n\n respond_to do |format|\n if @institution.save\n format.html { redirect_to @institution, notice: 'Institution was successfully created.' }\n format.json { render json: @institution, status: :created, location: @institution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @people = search Person.involved_in(@conference)\n\n respond_to do |format|\n format.html { @people = @people.paginate page: page_param }\n format.json\n end\n end", "def index\n @solutions = @idea.solutions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solutions }\n end\n end", "def create\n @institution = Institution.new(params[:institution])\n @institution.parametres_cabinet_id = current_user.parametres_cabinet.id\n respond_to do |format|\n if @institution.save\n format.html { redirect_to(@institution, :notice => 'Institution was successfully created.') }\n format.xml { render :xml => @institution, :status => :created, :location => @institution }\n format.json {render :json => {\"success\"=>true,\"data\"=>@institutions} }\n \n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @institution.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @condolence = Condolence.find(params[:id])\n @orbituarysite = current_user.orbituarysites.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condolence }\n end\n end", "def show\n @initiative = Initiative.find(params[:id])\n\n respond_to do |format|\n format.html # _show.html.erb\n format.json { render json: @initiative }\n end\n end", "def show\n @interview = Interview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interview }\n end\n end", "def get_affiliation\n render( json: TeamAffiliation.find_by(season_id: params[:season_id], team_id: params[:id]) )\n end", "def show\n @hospitalization = Hospitalization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospitalization }\n end\n end", "def index\n render :json => UserInterest.all\n end", "def catalog\n if @sub_service_request\n @institutions = Institution.where(id: @sub_service_request.organization.parents.select{|x| x.type == 'Institution'}.map(&:id))\n else\n @institutions = Institution.order('`order`')\n end\n\n setup_catalog_calendar\n setup_catalog_news_feed\n end", "def index\n locations = @project.locations.all\n render json: { locations: locations }\n end", "def show\n @research = Research.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @research }\n end\n end", "def show\n id = params[:id]\n @physician = Physician.find(id)\n render json: @physician, :include => [:patients => {:include => [:surveys]}]\n end", "def show\n @inspiration = Inspiration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inspiration }\n end\n end", "def index\n @citations = Citation.all\n\n render json: @citations\n end", "def show\n @incident_kind = IncidentKind.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident_kind }\n end\n end", "def show\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person_interest }\n end\n end", "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interest }\n end\n end", "def create\n @institution = Institution.new(institution_params)\n\n respond_to do |format|\n if @institution.save\n format.html { redirect_to @institution, notice: 'Instituição cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @institution }\n else\n format.html { render :new }\n format.json { render json: @institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @collections = @institution.collections.order(:name)\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @collections }\n end\n end", "def show\n @interview = Interview.find_by_slug(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interview }\n end\n end", "def show\n @incident = Incident.find(params[:id])\n\n render json: @incident\n end", "def index\n @regiones = Region.all\n\n render json: @regiones\n end", "def index\n @communities = @district.communities.page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @communities }\n end\n end", "def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end", "def show\n @showItin = Itinerary.find(itin_params)\n render json: @showItin, status: 200\n end", "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @interest }\n end\n end", "def index\n @interviews = Interview.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interviews }\n end\n end", "def index\n @capacites = Capacite.paginate(page: params[:page], per_page: 25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @capacites }\n end\n end", "def index\n @people = Person.includes(:registry).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end", "def index\n @division_syns = DivisionSyn.all\n\n render json: @division_syns\n end", "def uni_years\n @uni_years = UniYear.where(university_id: params[:university_id])\n \n respond_to do |format|\n format.json { render json: @uni_years }\n end\n end", "def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end", "def new\n @orbituarysite = current_user.orbituarysites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orbituarysite }\n end\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @life_insurances }\n end\n end", "def dame_institucion\n i = Metamares::Institucion.new\n i.nombre_institucion = params[:nombre_institucion]\n\n respond_to do |format|\n format.json { render json: i.busca_institucion.map{ |i| { id: i.id, value: i.nombre_institucion } } }\n format.html { @institucion = i }\n end\n end", "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @interest }\n end\n end", "def show\n render json: @inciting_incident\n end", "def index\n @registries = Registry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registries }\n end\n end", "def index\n @devises = Devise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @devises }\n end\n end" ]
[ "0.79272056", "0.77259904", "0.7252765", "0.69552505", "0.69063497", "0.69063497", "0.67578834", "0.6611987", "0.65452427", "0.6465456", "0.6464098", "0.64571357", "0.6444813", "0.63845617", "0.6334052", "0.6330156", "0.62656885", "0.62276524", "0.6150121", "0.6114119", "0.60763586", "0.60392743", "0.6014095", "0.60066754", "0.59875697", "0.5977834", "0.5975575", "0.59362614", "0.5919698", "0.59157306", "0.5912006", "0.59102476", "0.5906632", "0.5883377", "0.58702826", "0.585038", "0.58498156", "0.5843047", "0.5828066", "0.5798054", "0.5785587", "0.5782232", "0.5770604", "0.57412565", "0.5738766", "0.5736806", "0.5730693", "0.5723474", "0.5702567", "0.56983936", "0.56916434", "0.56877285", "0.5674292", "0.56709933", "0.5661146", "0.5661146", "0.5659545", "0.56539154", "0.5643068", "0.5643068", "0.56323594", "0.5626262", "0.56189966", "0.5614038", "0.5613184", "0.5611947", "0.5607447", "0.5600976", "0.5600558", "0.5595759", "0.5588073", "0.55832213", "0.55807894", "0.5579246", "0.55784065", "0.5560071", "0.5558779", "0.55523014", "0.555208", "0.55479693", "0.5544236", "0.5539465", "0.5539133", "0.55385345", "0.55225295", "0.5519956", "0.5515407", "0.5514042", "0.5512201", "0.55121046", "0.55066353", "0.55035", "0.5499119", "0.549891", "0.5495547", "0.5493574", "0.54902965", "0.5488808", "0.5488521", "0.54880935" ]
0.648086
9
GET /institutions/1 GET /institutions/1.json
def show if current_user.type != 'Administrator' check_privilege(@institution) end @campus = Campu.where(institution_id: @institution.id).find_each @campu = Campu.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def institutions(pageIndex=0, options={})\n options.merge!({:query => {:pageIndex => pageIndex}})\n self.class.get(\"/Institutions.json\", options)\n end", "def get_institutions\r\n # Prepare query url.\r\n _path_url = '/institutions'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| Institution.from_hash(element) }\r\n end", "def show\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institution }\n end\n end", "def show\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institution }\n end\n end", "def index\n @one_reg_institutions = OneRegInstitution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @one_reg_institutions }\n end\n end", "def show\n @institution = Institution.find(params[:id])\n\n render json: @institution\n\n rescue ActiveRecord::RecordNotFound\n render json: {message: 'Resource not found'}, status: 404\n\n end", "def index\n @institutions = current_user.institutions\n end", "def show\n @one_reg_institution = OneRegInstitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @one_reg_institution }\n end\n end", "def show\n @institucional = Institucional.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institucional }\n end\n end", "def show\n institution = Institution.find(params[:id])\n render json: { status: '200', message: \"Loaded Institution with id #{params[:id]}\", data: institution }, status: :ok\n rescue ActiveRecord::RecordNotFound\n render json: { status: '404', error: \"No Institution with id #{params[:id]}\", data: institution }, status: :not_found\n end", "def show\n @institution_ad = InstitutionAd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institution_ad }\n end\n end", "def institution(institution, options={})\n self.class.get(\"/Institution/#{institution}.json\", options)\n end", "def new\n @institution = Institution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @institution }\n end\n end", "def show\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @institution }\n format.json {render :json => {\"success\"=>true,\"data\"=>@institution} }\n \n end\n end", "def index\n @issuing_institutions = IssuingInstitution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @issuing_institutions }\n end\n end", "def show\n @institute_admin = InstituteAdmin.includes(:profile).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institute_admin }\n end\n end", "def show\n @jurisdiction = Jurisdiction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jurisdiction }\n end\n end", "def create\n @institution = current_user.institutions.new(institution_params)\n\n if @institution.save\n render :show, status: :created\n else\n render json: @institution.errors.full_messages, status: :unprocessable_entity\n end\n end", "def show\n @instituicao = Instituicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instituicao }\n end\n end", "def get_institution(id)\r\n # Prepare query url.\r\n _path_url = '/institutions/{id}'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'id' => id\r\n )\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n Institution.from_hash(decoded)\r\n end", "def search\n @institutions = Institution.order(:nome).where(\"nome ilike ?\", \"%#{params[:term]}%\")\n render json: @institutions.map{|institution| {:label => institution.nome, :value => institution.id}}\n end", "def show\n @institutions = @tesda_course.institutions\n end", "def institution(id = nil)\n res = Connection.get('institutions', id)\n id.nil? ? Institution.all(res) : Institution.new(res)\n end", "def new\n @institucional = Institucional.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @institucional }\n end\n end", "def new\n @one_reg_institution.institution_id = @institution\n @one_reg_institution = OneRegInstitution.new\n 1.times {@one_reg_institution.document_by_institutions.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @one_reg_institution }\n end\n end", "def show\n @issuing_institution = IssuingInstitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @issuing_institution }\n end\n end", "def new\n @institution_ad = InstitutionAd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @institution_ad }\n end\n end", "def show\n @admin_interview = Interview.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_interview }\n end\n end", "def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end", "def show\n @initiative = Initiative.find(params[:id])\n\n respond_to do |format|\n format.html # _show.html.erb\n format.json { render json: @initiative }\n end\n end", "def set_institution\n @institution = current_user.institutions.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render json: { errors: [I18n.t('api.institution.not_found')] }, status: :not_found\n end", "def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\n end\n end", "def show\n @financial_institution = FinancialInstitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_institution }\n end\n end", "def show\n @website = Website.find(params[:id])\n\n render json: @website\n end", "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end", "def show\n @constitution = Constitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @constitution }\n end\n end", "def show\n @incident = Incident.find(params[:id])\n\n render json: @incident\n end", "def show\n @incident_kind = IncidentKind.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident_kind }\n end\n end", "def show\n @interview = Interview.find_by_slug(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interview }\n end\n end", "def institution(id=nil)\n @institution = Plaid::Institution.new\n res = self.get('institutions',id)\n id.nil? ? @institution.instantiate_all_institutions(res) : @institution.instantiate_one_institution(res)\n end", "def show\n @capacite = Capacite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacite }\n end\n end", "def show\n @interview = Interview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interview }\n end\n end", "def show\n @inspiration = Inspiration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inspiration }\n end\n end", "def show\n render json: Festival.build_for(params[:id]).to_json\n end", "def index\n @institucions = Institucion.search(params[:search], params[:page])\n end", "def index\n if params[:term] != nil\n if params[:type] != nil\n @institutions = Institution.find(:all, :conditions => [\"LOWER(nom) LIKE LOWER(?) and type_institution_id=?\", \"%#{params[:term]}%\", \"#{params[:type]}\"])\n else\n @institutions = Institution.find(:all, :conditions => [\"LOWER(nom) LIKE LOWER(?)\", \"%#{params[:term]}%\"])\n end\n else\n @institutions = current_user.parametres_cabinet.institutions.all\n end\n \n \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @institutions }\n format.js {render :json => @institutions.map {|p| { :label => p.nom , :value => p.id}} }\n format.json {render :json => {\"success\"=>true,\"data\"=>@institutions} }\n \n end\n end", "def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university }\n end\n end", "def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university }\n end\n end", "def show\n @installation_site = InstallationSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @installation_site }\n end\n end", "def show\n @hospitalization = Hospitalization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospitalization }\n end\n end", "def load_institutions\n # Get Solr institution pids from the SQL db.\n pid_for = {}\n query = \"select id, identifier from institutions\"\n if @inst_query.nil?\n @inst_query = @db.prepare(query)\n end\n result_set = @inst_query.execute\n result_set.each_hash do |row|\n # Sample entry: pids['miami.edu'] = 'aptrust-test:350660'\n pid_for[row['identifier']] = row['id']\n @name_of[row['id']] = row['identifier']\n end\n\n # Load institutions from Pharos and map old Solr pid to new id\n url = @base_url + '/api/v2/institutions'\n resp = api_get(url, nil)\n if resp.code != '200'\n @log.write(\"Error getting institutions from Pharos\\n\")\n @log.write(resp.body)\n exit(1)\n end\n data = JSON.parse(resp.body)\n data['results'].each do |inst|\n solr_pid = pid_for[inst['identifier']]\n @new_id_for[solr_pid] = inst['id']\n @id_for_name[inst['identifier']] = inst['id']\n puts \"#{inst['identifier']} has id #{inst['id']}\"\n end\n end", "def show\n @inspiration = Inspiration.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inspiration }\n end\n end", "def show\n @collection = @institution.collections.find(params[:id])\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# show.html.erb\n format.json { render json: @collection }\n end\n end", "def show\n @research = Research.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @research }\n end\n end", "def index\n @universities = University.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @universities }\n end\n end", "def show\n render json: @laboratory\n end", "def show\n @showItin = Itinerary.find(itin_params)\n render json: @showItin, status: 200\n end", "def index\n @institutions = Institution.all\n @pets = Institution.all.limit(3)\n end", "def index\n @institucion = Institucion.where(:id => params[:institucion_id]).first\n @institucioncatalogos = Institucioncatalogo.where(:institucion_id => params[:institucion_id])\n end", "def show\n @condolence = Condolence.find(params[:id])\n @orbituarysite = current_user.orbituarysites.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condolence }\n end\n end", "def show\n @petition = Petition.friendly.find(params[:id])\n\n render json: @petition\n end", "def show\n @intermediary = Intermediary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @intermediary }\n end\n end", "def dame_institucion\n i = Metamares::Institucion.new\n i.nombre_institucion = params[:nombre_institucion]\n\n respond_to do |format|\n format.json { render json: i.busca_institucion.map{ |i| { id: i.id, value: i.nombre_institucion } } }\n format.html { @institucion = i }\n end\n end", "def show\n @interview = Interview.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interview }\n end\n end", "def names\n sql = 'SELECT DISTINCT resources.name '\\\n 'FROM resources '\\\n 'LEFT JOIN locations ON locations.id = resources.location_id '\\\n 'LEFT JOIN repositories ON locations.repository_id = repositories.id '\\\n 'LEFT JOIN institutions ON repositories.institution_id = institutions.id '\\\n 'WHERE institutions.id = ' + params[:institution_id].to_i.to_s\n conn = ActiveRecord::Base.connection\n results = conn.execute(sql)\n render json: results.map{ |r| r['name'] }\n end", "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interest }\n end\n end", "def index\n if(current_user.super_admin?)\n @institutions = Institution.all.paginate(page: params[:page], per_page: 15)\n else\n @institutions = Institution.all.where(id: current_institution.id).paginate(page: params[:page], per_page: 15)\n end\n end", "def show\n @optician = Optician.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @optician }\n end\n end", "def get_affiliation\n render( json: TeamAffiliation.find_by(season_id: params[:season_id], team_id: params[:id]) )\n end", "def show\n id = params[:id]\n @physician = Physician.find(id)\n render json: @physician, :include => [:patients => {:include => [:surveys]}]\n end", "def show\n @produktion_site = ProduktionSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produktion_site }\n end\n end", "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @interest }\n end\n end", "def show\n @insure_result = InsureResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @insure_result }\n end\n end", "def index\n @educational_institutions = EducationalInstitution.all\n end", "def show\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person_interest }\n end\n end", "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @interest }\n end\n end", "def show\n @inschool = Inschool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inschool }\n end\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def show\n @institucion = Institucion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @institucion }\n end\n end", "def show\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident }\n end\n end", "def show\n @impgen = Impgen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @impgen }\n end\n end", "def index\n @institute_admins = case current_user.rc\n when 'EA'\n InstituteAdmin.includes(:profile).page(params[:page])\n when 'IA'\n InstituteAdmin.includes(:profile).where(:id=>current_user.institute_admin).page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @institute_admins }\n end\n end", "def new\n @jurisdiction = Jurisdiction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jurisdiction }\n end\n end", "def show\n return if auth(\"website_administrator\")\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @incident }\n end\n end", "def show\n @solutions = @profile.solutions.paginate(page: params[:page], per_page: 10 ).order('created_at DESC')\n respond_with @profile\n end", "def show\n @colaboration = Colaboration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colaboration }\n end\n end", "def index\n @projects = current_institute.projects\n end", "def show\n @university_profile = UniversityProfile.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university_profile }\n end\n end", "def show\n @country = Country.includes(:regions).find(params[:id])\n @tours = Tour.search(params.merge({ region: @country.region_ids}))\n @attractions = @country.regions.map { |i| i.attractions }.flatten\n @hotels = @country.regions.map { |i| i.hotels }.flatten\n @photos = @country.regions.map { |i| i.gallery.photos if i.gallery }.flatten.uniq.compact\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @country }\n end\n end", "def index\n @collections = @institution.collections.order(:name)\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @collections }\n end\n end", "def index\n authorize HigherEducationInstitution\n @higher_education_institutions = HigherEducationInstitution.order(:name).search(params[:search]).page(params[:page])\n end", "def index\n @infrastructures = getmydata(\"Infrastructure\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @infrastructures }\n end\n end", "def index\n @registrations = Tournament.find(params[:tournament_id]).registrations\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registrations }\n end\n end", "def show\n @interruption = Interruption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interruption }\n end\n end", "def show\n @apprentice = Apprentice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apprentice }\n end\n end", "def find_institute\n @institute = Institute.find(params[:id])\n end", "def show\n @regulation = Regulation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @regulation }\n end\n end", "def show\n @sitecity = Sitecity.find_by_url(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitecity }\n end\n end", "def new\n @initiative = Initiative.new\n @user = User.find_by_id(current_user2)\n @city = City.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @initiative }\n end\n end", "def create\n @institution = Institution.new(params[:institution])\n\n respond_to do |format|\n if @institution.save\n format.html { redirect_to @institution, notice: 'Institution was successfully created.' }\n format.json { render json: @institution, status: :created, location: @institution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @institution = Institution.new(params[:institution])\n\n respond_to do |format|\n if @institution.save\n format.html { redirect_to @institution, notice: 'Institution was successfully created.' }\n format.json { render json: @institution, status: :created, location: @institution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @institution.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.73840606", "0.7286049", "0.71233416", "0.71233416", "0.6982147", "0.691304", "0.688314", "0.6787256", "0.67385817", "0.6691514", "0.6679087", "0.6622589", "0.64964294", "0.64018685", "0.63874114", "0.63370776", "0.62976146", "0.6257077", "0.62363815", "0.6204932", "0.6203438", "0.6191574", "0.6183964", "0.61294967", "0.61286926", "0.6112818", "0.6074732", "0.6055636", "0.6038001", "0.60292673", "0.6025702", "0.6019326", "0.6000338", "0.5999004", "0.5990546", "0.59865355", "0.5983845", "0.5965744", "0.59606385", "0.5954608", "0.5934142", "0.5929162", "0.5907494", "0.59027994", "0.5901936", "0.5900264", "0.58830875", "0.58830875", "0.58740383", "0.58735794", "0.58248496", "0.5824536", "0.58100677", "0.5794855", "0.57938516", "0.57859355", "0.5783186", "0.57757044", "0.57741463", "0.5768548", "0.57653177", "0.576498", "0.5764211", "0.5762803", "0.5762793", "0.57552046", "0.5747289", "0.572641", "0.57252574", "0.57234186", "0.5723415", "0.57223374", "0.5721589", "0.5721153", "0.57205606", "0.5716223", "0.57091296", "0.57082367", "0.5700156", "0.5688934", "0.5686629", "0.5681291", "0.56785065", "0.5677553", "0.56687504", "0.5667414", "0.56660885", "0.5662121", "0.5660601", "0.5658066", "0.5648982", "0.56474954", "0.56432056", "0.56400603", "0.5637967", "0.5635311", "0.5632396", "0.56315625", "0.5627736", "0.56204116", "0.56204116" ]
0.0
-1
POST /institutions POST /institutions.json
def create @institution = Institution.new(institution_params) respond_to do |format| if @institution.save format.html { redirect_to @institution, notice: 'Instituição cadastrada com sucesso.' } format.json { render :show, status: :created, location: @institution } else format.html { render :new } format.json { render json: @institution.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @institution = current_user.institutions.new(institution_params)\n\n if @institution.save\n render :show, status: :created\n else\n render json: @institution.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n @one_reg_institution.institution_id = @institution\n @one_reg_institution = @institution.one_reg_institutions.build(params[:one_reg_institution])\n\n\n respond_to do |format|\n if @one_reg_institution.save\n format.html { redirect_to @institution, notice: 'Reg-Inst.1/R01 Creado Exitosamente.' }\n format.json { render json: @one_reg_institution, status: :created, location: @one_reg_institution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @one_reg_institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @institution = Institution.new(params[:institution])\n\n respond_to do |format|\n if @institution.save\n format.html { redirect_to @institution, notice: 'Institution was successfully created.' }\n format.json { render json: @institution, status: :created, location: @institution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @institution = Institution.new(params[:institution])\n\n respond_to do |format|\n if @institution.save\n format.html { redirect_to @institution, notice: 'Institution was successfully created.' }\n format.json { render json: @institution, status: :created, location: @institution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @institution = Institution.new(params[:institution])\n @institution.parametres_cabinet_id = current_user.parametres_cabinet.id\n respond_to do |format|\n if @institution.save\n format.html { redirect_to(@institution, :notice => 'Institution was successfully created.') }\n format.xml { render :xml => @institution, :status => :created, :location => @institution }\n format.json {render :json => {\"success\"=>true,\"data\"=>@institutions} }\n \n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @institution.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @institution = Institution.new(institution_params)\n\n respond_to do |format|\n if @institution.save\n format.html { redirect_to @admin_institution, notice: 'Institution was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_institution }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @institucional = Institucional.new(params[:institucional])\n\n respond_to do |format|\n if @institucional.save\n format.html { redirect_to @institucional, notice: 'Institucional was successfully created.' }\n format.json { render json: @institucional, status: :created, location: @institucional }\n else\n format.html { render action: \"new\" }\n format.json { render json: @institucional.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @institution = Institution.find params[:site][:institution_id]\n return unless authorize_resource(@institution, CREATE_INSTITUTION_SITE)\n\n @site = @institution.sites.new(site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to sites_path, notice: 'Site was successfully created.' }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @one_reg_institution.institution_id = @institution\n @one_reg_institution = OneRegInstitution.new\n 1.times {@one_reg_institution.document_by_institutions.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @one_reg_institution }\n end\n end", "def create\n @counselor = Counselor.new(params[:counselor])\n @counselor.institution = @institution\n flash[:notice] = 'Counselor was successfully created.' if @counselor.save\n respond_with([@institution, @counselor], :location => institution_url(@institution))\n end", "def get_institutions\r\n # Prepare query url.\r\n _path_url = '/institutions'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| Institution.from_hash(element) }\r\n end", "def create\n @holding_institution = HoldingInstitution.new(params[:holding_institution])\n\n respond_to do |format|\n if @holding_institution.save\n format.html { redirect_to @holding_institution, notice: 'Holding institution was successfully created.' }\n format.json { render json: @holding_institution, status: :created, location: @holding_institution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @holding_institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @educational_institution = EducationalInstitution.new(educational_institution_params)\n\n respond_to do |format|\n if @educational_institution.save\n format.html { redirect_to @educational_institution, notice: 'Educational institution was successfully created.' }\n format.json { render :show, status: :created, location: @educational_institution }\n else\n format.html { render :new }\n format.json { render json: @educational_institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def institutions(pageIndex=0, options={})\n options.merge!({:query => {:pageIndex => pageIndex}})\n self.class.get(\"/Institutions.json\", options)\n end", "def create\n @institution_ad = InstitutionAd.new(params[:institution_ad])\n\n respond_to do |format|\n if @institution_ad.save\n format.html { redirect_to ([:administrator, @institution_ad]), notice: 'Institution ad was successfully created.' }\n format.json { render json: @institution_ad, status: :created, location: @institution_ad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @institution_ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @institution = Institution.new(institution_params)\n @record = @institution\n respond_to do |format|\n if @institution.save\n format.html { redirect_to @institution, notice: 'Institution was successfully created.' }\n format.json { render :show, status: :created, location: @institution }\n format.js { render :file => \"/basic/create.js.erb\" }\n else\n format.html { render :new }\n format.json { render json: @institution.errors, status: :unprocessable_entity }\n format.js { render :file => \"/basic/faulty_create.js.erb\" }\n end\n end\n end", "def create\n @institution = @navigation_context.institution\n return unless authorize_resource(@institution, CREATE_INSTITUTION_SITE)\n @site = @institution.sites.new(site_params(true))\n @sites = check_access(@institution.sites, READ_SITE)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to sites_path, notice: I18n.t('sites.create.success') }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @insta_post = InstaPost.new(insta_post_params)\n\n respond_to do |format|\n if @insta_post.save\n format.html { redirect_to @insta_post, notice: 'Insta post was successfully created.' }\n format.json { render :show, status: :created, location: @insta_post }\n else\n format.html { render :new }\n format.json { render json: @insta_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @institution = Institution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @institution }\n end\n end", "def create\n @instituto = Instituto.new(instituto_params)\n\n respond_to do |format|\n if @instituto.save\n format.html { redirect_to @instituto, notice: 'O instituto foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @instituto }\n else\n format.html { render :new }\n format.json { render json: @instituto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instancium = Instancium.new(instancium_params)\n\n respond_to do |format|\n if @instancium.save\n format.html { redirect_to @instancium, notice: 'Instancium was successfully created.' }\n format.json { render :show, status: :created, location: @instancium }\n else\n format.html { render :new }\n format.json { render json: @instancium.errors, status: :unprocessable_entity }\n end\n end\n end", "def current_or_create_new_institutions\n Institution.current_or_create_new(name: 'Demo Institution', street_address: '1234 Main St.', city: 'Williamstown', state: 'MA', country: 'USA', gps_longitude: -73.202887, gps_latitude: 42.710570, range: 0.002, configuration_id: 1, api_key: 'DEMO01267')\n Institution.current_or_create_new(name: 'Development', street_address: '123 Main St.', city: 'Anytown', state: 'NY', country: 'USA', gps_longitude: -74.062958, gps_latitude: 40.869911, range: 0.005, configuration_id: 2, api_key: 'DEVELOPMENT')\n Institution.current_or_create_new(name: 'Williams', street_address: '880 Main St.', city: 'Williamstown', state: 'MA', country: 'USA', gps_longitude: -73.202887, gps_latitude: 42.710570, range: 0.001, configuration_id: 3, api_key: 'WILLIAMS')\nend", "def create\n @institucion = Institucion.new(institucion_params)\n\n respond_to do |format|\n if @institucion.save\n format.html { redirect_to @institucion, notice: 'Empresa se ha creado correctamente.' }\n format.json { render :show, status: :created, location: @institucion }\n else\n format.html { render :new }\n format.json { render json: @institucion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @interest = Interest.new(params[:interest])\n \n respond_to do |format|\n if @interest.save\n format.json { render :json => @interest,\n :status => :created, :location => @interest }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def create\n @issuing_institution = IssuingInstitution.new(params[:issuing_institution])\n\n respond_to do |format|\n if @issuing_institution.save\n format.html { redirect_to @issuing_institution, :notice => 'Orgão Emissor criado com sucesso.' }\n format.json { render :json => @issuing_institution, :status => :created, :location => @issuing_institution }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @issuing_institution.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @instituicao = Instituicao.new(params[:instituicao])\n\n respond_to do |format|\n if @instituicao.save\n format.html { redirect_to @instituicao, notice: 'Instituicao was successfully created.' }\n format.json { render json: @instituicao, status: :created, location: @instituicao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instituicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_institution(inst_name, inst_site, inst_number, inst_email)\n Institution.transaction do\n new_institution = Institution.new(name: inst_name,\n website: inst_site,\n phone_number: inst_number,\n email: inst_email)\n new_institution.id = @inst_id\n @inst_id += 1 if new_institution.save!\n @institutions << new_institution\n end\n end", "def create\n @inschool = Inschool.new(params[:inschool])\n\n respond_to do |format|\n if @inschool.save\n format.html { redirect_to @inschool, notice: 'Inschool was successfully created.' }\n format.json { render json: @inschool, status: :created, location: @inschool }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inschool.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @regional = Regional.new(regional_params.map{|k,v| {k.to_sym => v.class == ActionController::Parameters ? [v.to_hash] : v.to_s}}.reduce({}, :merge))\n\n respond_to do |format|\n if @regional.save\n format.html { redirect_to @regional, notice: 'Regional was successfully created.' }\n format.json { render :show, status: :created, location: @regional }\n else\n format.html { render :new }\n format.json { render json: @regional.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instagrampic = Instagrampic.new(instagrampic_params)\n\n respond_to do |format|\n if @instagrampic.save\n format.html { redirect_to @instagrampic, notice: 'Instagrampic was successfully created.' }\n format.json { render :show, status: :created, location: @instagrampic }\n else\n format.html { render :new }\n format.json { render json: @instagrampic.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @financial_institution = FinancialInstitution.new(financial_institution_params)\n\n respond_to do |format|\n if @financial_institution.save\n format.html { redirect_to @financial_institution, notice: 'Financial institution was successfully created.' }\n format.json { render json: @financial_institution, status: :created, location: @financial_institution }\n else\n format.html { render action: \"new\" }\n format.json { render json: @financial_institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @institutions = current_user.institutions\n end", "def create\n @institute = Institute.new(params[:institute])\n\n respond_to do |format|\n if @institute.save\n format.html { redirect_to(@institute, :notice => 'Institute was successfully created.') }\n format.xml { render :xml => @institute, :status => :created, :location => @institute }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @institute.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @indivisual = Indivisual.new(indivisual_params)\n\n respond_to do |format|\n if @indivisual.save\n format.html { redirect_to @indivisual, notice: 'Indivisual was successfully created.' }\n format.json { render :show, status: :created, location: @indivisual }\n else\n format.html { render :new }\n format.json { render json: @indivisual.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if(current_user.super_admin?)\n @institution = Institution.new(institution_params)\n if @institution.save\n redirect_to @institution, notice: \"Institution was successfully created.\"\n else\n render :new, status: :unprocessable_entity\n end\n end\n end", "def index\n @one_reg_institutions = OneRegInstitution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @one_reg_institutions }\n end\n end", "def create\n @institute = Institute.new(institute_params)\n authorize @institute\n respond_to do |format|\n if @institute.save\n format.html { redirect_to @institute, notice: 'Institute was successfully created.' }\n format.json { render :show, status: :created, location: @institute }\n else\n format.html { render :new }\n format.json { render json: @institute.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @institution_ad = InstitutionAd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @institution_ad }\n end\n end", "def create\n @injury = Injury.new(injury_params)\n\n respond_to do |format|\n if @injury.save\n format.html { redirect_to injuries_url, notice: 'Injury was successfully created.' }\n # format.json { render :show, status: :created, location: @injury }\n else\n format.html { render :new }\n format.json { render json: @injury.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize HigherEducationInstitution\n @higher_education_institution = HigherEducationInstitution.new(higher_education_institution_params)\n\n respond_to do |format|\n if @higher_education_institution.save\n format.html { redirect_to @higher_education_institution, notice: 'Visokošolski zavod uspešno dodan.' }\n format.json { render :show, status: :created, location: @higher_education_institution }\n else\n format.html { render :new }\n format.json { render json: @higher_education_institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident = Incident.new(incident_params)\n\n if @incident.save\n render json: @incident, status: :created, location: @incident\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end", "def create\n @institution_app_pages_section = InstitutionAppPagesSection.new(institution_app_pages_section_params)\n\n respond_to do |format|\n if @institution_app_pages_section.save\n format.html { redirect_to @institution_app_pages_section, notice: 'Institution app pages section was successfully created.' }\n format.json { render action: 'show', status: :created, location: @institution_app_pages_section }\n else\n format.html { render action: 'new' }\n format.json { render json: @institution_app_pages_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @information = Information.new(information_params)\n\n if @information.save\n render json: :ok\n else\n render json: @information.errors, status: :unprocessable_entity\n end\n end", "def create\n @inst = Institute.new\n @inst.name = params[:institute][:name]\n @inst.url = params[:institute][:url]\n\n # we need the model persisted before we set the manager and logo\n if @inst.save\n set_manager_settings\n\n if params[:institute][:logo].present?\n add_logo(params[:institute][:logo])\n flash[:error] = t('dri.flash.error.unable_to_save_logo') unless @inst.save\n end\n\n flash[:notice] = t('dri.flash.notice.organisation_created')\n\n respond_to do |format|\n format.html { redirect_to organisation_url(@inst) }\n end\n else\n flash[:error] = t('dri.flash.error.unable_to_save_organisation')\n end\n end", "def create\n @industria = Industria.new(industria_params)\n\n respond_to do |format|\n if @industria.save\n format.html { redirect_to @industria, notice: 'Industria was successfully created.' }\n format.json { render :show, status: :created, location: @industria }\n else\n format.html { render :new }\n format.json { render json: @industria.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @institucional = Institucional.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @institucional }\n end\n end", "def create\n @society_recuritment = SocietyRecuritment.new(society_recuritment_params)\n\n respond_to do |format|\n if @society_recuritment.save\n format.html { redirect_to @society_recuritment, notice: 'Society recuritment was successfully created.' }\n format.json { render :show, status: :created, location: @society_recuritment }\n else\n format.html { render :new }\n format.json { render json: @society_recuritment.errors, status: :unprocessable_entity }\n end\n end\n end", "def build_resource_params\n params[:action] == 'new' ? [] : [params.require(:institution).permit(:name, :identifier, :brief_name, :dpn_uuid)]\n end", "def create\n user_params = params[:witness][:user]\n user = User.find(user_params[:id])\n @witness = Witness.where(user_id: user.id).first\n if @witness\n respond_to do |format|\n format.html { redirect_to @witness, notice: 'Witness found.' }\n format.json { render :show, status: :created, location: @witness }\n end\n return\n end\n\n @witness = Witness.new(witness_params)\n puts @witness.to_json\n @witness[:user_id] = user.id\n @witness[:country_region_city_id] = params[:witness][:country_region_city][:city_id]\n\n puts @witness.to_json\n\n respond_to do |format|\n if @witness.save\n format.html { redirect_to @witness, notice: 'Witness was successfully created.' }\n format.json { render :show, status: :created, location: @witness }\n else\n format.html { render :new }\n format.json { render json: @witness.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @interest = Interest.new(params[:interest])\n\n respond_to do |format|\n if @interest.save\n format.html { redirect_to @interest, :notice => 'Interest was successfully created.' }\n format.json { render :json => @interest, :status => :created, :location => @interest }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_region\n Region.create!(params[:record])\n render :json => {}\n end", "def create\n @orbituarysite = Orbituarysite.new(params[:orbituarysite])\n\n respond_to do |format|\n if @orbituarysite.save\n format.html { redirect_to @orbituarysite, notice: 'Orbituarysite was successfully created.' }\n format.json { render json: @orbituarysite, status: :created, location: @orbituarysite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orbituarysite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inciting_incident = IncitingIncident.new(inciting_incident_params)\n\n if @inciting_incident.save\n render json: @inciting_incident, status: :created, location: @inciting_incident\n else\n render json: @inciting_incident.errors, status: :unprocessable_entity\n end\n end", "def institution_params\n params.require(:institution).permit(:name, :description, :phone, :email, :language, :website, :firstname_of_official, :lastname_of_official, :anrede_of_official, :functionality_list => [], :target_group_list => [])\n end", "def create\n @person_interest = PersonInterest.new(params[:person_interest])\n\n respond_to do |format|\n if @person_interest.save\n format.html { redirect_to @person_interest, notice: 'Person interest was successfully created.' }\n format.json { render json: @person_interest, status: :created, location: @person_interest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @instarter = Instarter.new(instarter_params)\n\n respond_to do |format|\n if @instarter.save\n format.html { redirect_to @instarter, notice: 'Instarter was successfully created.' }\n format.json { render :show, status: :created, location: @instarter }\n else\n format.html { render :new }\n format.json { render json: @instarter.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @institucion = Institucion.new(params[:institucion])\n\n respond_to do |format|\n if @institucion.save\n flash[:notice] = 'Institucion se ha creado con exito.'\n format.html { redirect_to(admin_institucions_url) }\n format.xml { render :xml => @institucion, :status => :created, :location => @institucion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @institucion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @collection = @institution.collections.new(params[:collection])\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to [@collection.institution, @collection], notice: 'Collection was successfully created.' }\n format.json { render json: @collection, status: :created, location: @collection }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stage_population = StagePopulation.new(params[:stage_population])\n\n respond_to do |format|\n if @stage_population.save\n format.html { redirect_to @stage_population, notice: 'Stage population was successfully created.' }\n format.json { render json: @stage_population, status: :created, location: @stage_population }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stage_population.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @interno_unidad = InternoUnidad.new(interno_unidad_params)\n\n respond_to do |format|\n if @interno_unidad.save\n format.html { redirect_to @interno_unidad, notice: 'Interno unidad was successfully created.' }\n format.json { render :show, status: :created, location: @interno_unidad }\n else\n format.html { render :new }\n format.json { render json: @interno_unidad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @intervenant = Intervenant.new(intervenant_params)\n\n respond_to do |format|\n if @intervenant.save\n format.html { redirect_to @intervenant, notice: 'Intervenant was successfully created.' }\n format.json { render :show, status: :created, location: @intervenant }\n else\n format.html { render :new }\n format.json { render json: @intervenant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subdivision = Subdivision.new\n @subdivision.type_subdivision_id=params['type_id'].to_i\n @subdivision.institution = params['institution']\n @subdivision.chairisting = params['chairisting']\n if @subdivision.save\n return render :json => {'status' => 'ok', 'subdivision'=>@subdivision}\n end\n render :json => {'status' => 'fail', 'subdivision' => nil}\n end", "def institution_params\n params.require(:institution).permit(:name, :cnpj, :kind)\n end", "def create\n @inspection = Inspection.new(inspection_params)\n @clients = @inspection.try(:appointment).try(:insp_request).try(:property).try(:clients)\n create_documents\n respond_to do |format|\n if @inspection.save\n format.html { redirect_to @inspection, notice: 'Inspection was successfully created.' }\n format.json { render json: @inspection }\n else\n format.html { render :new }\n format.json { render json: @inspection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident_kind = IncidentKind.new(params[:incident_kind])\n\n respond_to do |format|\n if @incident_kind.save\n format.html { redirect_to @incident_kind, notice: 'Incident kind was successfully created.' }\n format.json { render json: @incident_kind, status: :created, location: @incident_kind }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident_kind.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @national = National.new(national_params)\n\n respond_to do |format|\n if @national.save\n format.html { redirect_to @national, notice: 'National was successfully created.' }\n format.json { render :show, status: :created, location: @national }\n else\n format.html { render :new }\n format.json { render json: @national.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #raise \"breakpoint\"\n \n @initiary = Initiary.new(params[:initiary])\n @initiary.save\n\n params[:country].each do |c|\n country = Country.find c\n \n r = Initiarization.new :country_id => country.id, :initiary_id => @initiary.id\n r.save\n\n monetizations = Monetization.where :country_id => country.id\n\n monetizations.each do |m|\n m.update_attribute :collected, true\n end\n end\n\n respond_to do |format|\n if @initiary.save\n format.html { redirect_to(@initiary, :notice => 'Initiary was successfully created.') }\n format.xml { render :xml => @initiary, :status => :created, :location => @initiary }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @initiary.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @population = Population.new(population_params)\n\n respond_to do |format|\n if @population.save\n format.html { redirect_to @population, notice: 'Population was successfully created.' }\n format.json { render :show, status: :created, location: @population }\n else\n format.html { render :new }\n format.json { render json: @population.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jurisdiction = Jurisdiction.new(params[:jurisdiction])\n\n respond_to do |format|\n if @jurisdiction.save\n format.html { redirect_to jurisdictions_url, notice: 'Jurisdiction was successfully created.' }\n format.json { render json: @jurisdiction, status: :created, location: @jurisdiction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @jurisdiction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n @project.institute = current_institute\n \n respond_to do |format|\n if @project.save\n format.html { redirect_to add_path(@project), notice: 'Project was successfully created.' }\n format.json { render :add, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @white_institution_ids = params[:publisher][:white_institution_ids].present? ? params[:publisher][:white_institution_ids] : []\n @white_center_ids = params[:publisher][:white_center_ids].present? ? params[:publisher][:white_center_ids] : []\n publisher_params = params[:publisher].except(:white_institution_ids,:white_center_ids)\n @publisher = Publisher.new(publisher_params)\n puts @publisher.inspect\n\n respond_to do |format|\n if @publisher.save\n @publisher.white_institution_ids = @white_institution_ids\n @publisher.white_center_ids = @white_center_ids\n format.html { redirect_to @publisher, notice: 'Publisher was successfully created.' }\n format.json { render json: @publisher, status: :created, location: @publisher }\n else\n # @publisher.build_profile unless @publisher.profile_loaded?\n @centers = Center.all\n @institutions= Institution.all\n format.html { render action: \"new\", notice: \"#{@publisher.errors.full_messages}\" }\n format.json { render json: @publisher.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @intranet_substituto = Intranet::Substituto.new(intranet_substituto_params)\n\n respond_to do |format|\n if @intranet_substituto.save\n format.html { redirect_to @intranet_substituto, notice: \"Substituto was successfully created.\" }\n format.json { render :show, status: :created, location: @intranet_substituto }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @intranet_substituto.errors, status: :unprocessable_entity }\n end\n end\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 institution_params\n params.require(:institution).permit(:name, :street, :postcode, :city, :website, :comment)\n end", "def create\n @sitio = Sitio.new(params[:sitio])\n\n respond_to do |format|\n if @sitio.save\n format.html { redirect_to @sitio, notice: 'Sitio was successfully created.' }\n format.json { render json: @sitio, status: :created, location: @sitio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sitio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @proj_insp = ProjInsp.new(proj_insp_params)\n\n respond_to do |format|\n if @proj_insp.save\n format.html { redirect_to @proj_insp, notice: 'Project inspection was successfully created.' }\n format.json { render :show, status: :created, location: @proj_insp }\n else\n format.html { render :new }\n format.json { render json: @proj_insp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n plant = Plant.create(plant_params)\n render json: plant, status: :created\n end", "def dame_institucion\n i = Metamares::Institucion.new\n i.nombre_institucion = params[:nombre_institucion]\n\n respond_to do |format|\n format.json { render json: i.busca_institucion.map{ |i| { id: i.id, value: i.nombre_institucion } } }\n format.html { @institucion = i }\n end\n end", "def create\n @injurytype = Injurytype.new(injurytype_params)\n\n respond_to do |format|\n if @injurytype.save\n format.html { redirect_to injurytypes_path, notice: 'Injurytype was successfully created.' }\n format.json { render :show, status: :created, location: @injurytype }\n else\n format.html { render :new }\n format.json { render json: @injurytype.errors, status: :unprocessable_entity }\n end\n end\n end", "def institution_params\n # params.require(:institution).permit(:organisation_id, :name, :description, :work_area, :start_date, :end_date, :positions_count, :address, :contact, :applying, :housing)\n params.require(:institution).permit(\n :name, :organisation_id, :description, :work_area, :in_search,\n applying: %i(by_phone by_mail by_email documents),\n housing: %i(provided costs),\n contact: %i(person email phone fax mobile homepage),\n address: %i(street zip city)\n )\n end", "def create\n @seihinn = Seihinn.new(seihinn_params)\n\n respond_to do |format|\n if @seihinn.save\n format.html { redirect_to @seihinn, notice: \"Seihinn was successfully created.\" }\n format.json { render :show, status: :created, location: @seihinn }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @seihinn.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resolution = current_user.resolutions.new(resolution_params)\n\n respond_to do |format|\n if @resolution.save\n format.html { redirect_to root_url, notice: 'Resolution was successfully created.' }\n format.js\n format.json { render action: 'show', status: :created, location: @resolution }\n else\n format.html { render action: 'new' }\n format.json { render json: @resolution.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @interest = Interest.new(params[:interest])\n\n respond_to do |format|\n if @interest.save\n format.html { redirect_to @interest, notice: 'Interest was successfully created.' }\n format.json { render json: @interest, status: :created, location: @interest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @university = University.new(params[:university])\n\n respond_to do |format|\n if @university.save\n format.html { redirect_to @university, notice: 'University was successfully created.' }\n format.json { render json: @university, status: :created, location: @university }\n else\n format.html { render action: \"new\" }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @university = University.new(params[:university])\n\n respond_to do |format|\n if @university.save\n format.html { redirect_to @university, notice: 'University was successfully created.' }\n format.json { render json: @university, status: :created, location: @university }\n else\n format.html { render action: \"new\" }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @instum = current_user.insta.build(instum_params)\n # @instum.user_id = current_user.id\n\n respond_to do |format|\n if @instum.valid?\n @instum.save\n # binding.pry\n # redirect_to insta_path, notice: \"写真を投稿しました!\"\n # NoticeMailer.sendmail_insta(@instum).deliver\n format.html { redirect_to @instum, notice: '投稿が成功しました!' }\n format.json { render :show, status: :created, location: @instum }\n else\n format.html { render :new }\n format.json { render json: @instum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_interview = Interview.new(params[:interview])\n\n respond_to do |format|\n if @admin_interview.save\n format.html { redirect_to [:admin, @admin_interview], notice: 'Entrevista criada com sucesso.' }\n format.json { render json: [:admin, @admin_interview], status: :created, location: @admin_interview }\n else\n format.html { render action: \"new\" }\n format.json { render json: [:admin, @admin_interview.erros], status: :unprocessable_entity }\n end\n end\n end", "def create\n @industrium = Industrium.new(industrium_params)\n\n respond_to do |format|\n if @industrium.save\n format.html { redirect_to @industrium, notice: 'Industrium was successfully created.' }\n format.json { render :show, status: :created, location: @industrium }\n else\n format.html { render :new }\n format.json { render json: @industrium.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expertise = Expertise.new(expertise_params)\n\n if @expertise.save\n render json: @expertise, status: :created, location: @expertise\n else\n render json: @expertise.errors, status: :unprocessable_entity\n end\n end", "def create\n divesite = Divesites.new(divesite_params)\n if divesite.save\n render json: divesite\n else\n render json: {message: divesite.errors}, status: 400\n end\n end", "def create\n @signupsurvey = Signupsurvey.new(signupsurvey_params)\n\n respond_to do |format|\n if @signupsurvey.save\n format.html { redirect_to @signupsurvey, notice: 'Signupsurvey was successfully created.' }\n format.json { render action: 'show', status: :created, location: @signupsurvey }\n else\n format.html { render action: 'new' }\n format.json { render json: @signupsurvey.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @institute_admin = InstituteAdmin.new(params[:institute_admin])\n\n respond_to do |format|\n if @institute_admin.save\n # createuser @institute_admins\n #creategroupuser @institute_admins\n format.html { redirect_to @institute_admin, notice: 'InstituteAdmin was successfully created.' }\n format.json { render json: @institute_admin, status: :created, location: @institute_admins }\n else\n # @institute_admins.build_profile unless @institute_admin.profile_loaded?\n format.html { render action: \"new\" }\n format.json { render json: @institute_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v1_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end", "def 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 create\n @region = Region.new(region_params)\n\n if @region.save\n render json: @region, status: :created, location: @region\n else\n render json: @region.errors, status: :unprocessable_entity\n end\n end", "def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end", "def create\n @site_editorial = SiteEditorial.new(site_editorial_params)\n\n respond_to do |format|\n if @site_editorial.save\n format.html { redirect_to @site_editorial, notice: 'Site editorial was successfully created.' }\n format.json { render json: @site_editorial, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @site_editorial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plant_soil = PlantSoil.new(plant_soil_params)\n\n respond_to do |format|\n if @plant_soil.save\n format.html { redirect_to @plant_soil, notice: 'Plant soil was successfully created.' }\n format.json { render :show, status: :created, location: @plant_soil }\n else\n format.html { render :new }\n format.json { render json: @plant_soil.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @solution = current_user.solutions.build(solution_params)\n\n respond_to do |format|\n if @solution.save\n format.html { redirect_to @solution, notice: '¡ La solución ha sido enviada !' }\n format.json { render action: 'show', status: :created, location: @solution }\n else\n format.html { render action: 'new' }\n format.json { render json: @solution.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @insure_result = InsureResult.new(params[:insure_result])\n\n respond_to do |format|\n if @insure_result.save\n format.html { redirect_to @insure_result, :notice => 'Insure result was successfully created.' }\n format.json { render :json => @insure_result, :status => :created, :location => @insure_result }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @insure_result.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.7291733", "0.67325234", "0.67197955", "0.67197955", "0.6673974", "0.65303195", "0.64795274", "0.6473473", "0.625068", "0.61106586", "0.6094738", "0.60886306", "0.6083806", "0.6068993", "0.60682595", "0.6013215", "0.5988667", "0.5986374", "0.59598637", "0.59416246", "0.5934988", "0.5933616", "0.5861525", "0.58416575", "0.5838498", "0.5799121", "0.57857555", "0.57823586", "0.57300043", "0.57233375", "0.57167625", "0.56972337", "0.5694773", "0.5680181", "0.5669561", "0.5667936", "0.5655819", "0.5655417", "0.5654938", "0.5609677", "0.55802596", "0.5572908", "0.5569262", "0.55627245", "0.5560681", "0.5558111", "0.55542713", "0.554035", "0.55272484", "0.5516175", "0.5515572", "0.5514724", "0.5510203", "0.5502891", "0.55014706", "0.55008453", "0.5498741", "0.5489637", "0.5488438", "0.54868907", "0.54785305", "0.54773974", "0.5473698", "0.5471946", "0.54710346", "0.54693043", "0.5463088", "0.5462158", "0.5461441", "0.5459467", "0.545909", "0.54567075", "0.54563046", "0.5448942", "0.5448503", "0.5447052", "0.54434055", "0.543858", "0.54309607", "0.54274285", "0.54239905", "0.54180586", "0.54165244", "0.541469", "0.541469", "0.5414325", "0.5413992", "0.5412343", "0.54118794", "0.54113454", "0.5410957", "0.5400694", "0.53992677", "0.5394988", "0.5393895", "0.53936607", "0.5393352", "0.53907156", "0.5387632", "0.53870875" ]
0.6646293
5
PATCH/PUT /institutions/1 PATCH/PUT /institutions/1.json
def update respond_to do |format| if @institution.update(institution_params) format.html { redirect_to @institution, notice: 'Instituição atualizada com sucesso.' } format.json { render :show, status: :ok, location: @institution } else format.html { render :edit } format.json { render json: @institution.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n if @institution.update_attributes(params[:institution])\n format.html { redirect_to(@institution, :notice => 'Institution was successfully updated.') }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>@institutions} }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @institution.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @one_reg_institution = OneRegInstitution.find(params[:id])\n\n respond_to do |format|\n if @one_reg_institution.update_attributes(params[:one_reg_institution])\n format.html { redirect_to @one_reg_institution, notice: 'One reg institution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one_reg_institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n if @institution.update_attributes(params[:institution])\n format.html { redirect_to @institution, notice: 'Institution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n @institucional = Institucional.find(params[:id])\n\n respond_to do |format|\n if @institucional.update_attributes(params[:institucional])\n format.html { redirect_to @institucional, notice: 'Institucional was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @institucional.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @institution.update(institution_params)\n format.html { redirect_to @admin_institution, notice: 'Institution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interview = Interview.find_by_slug(params[:id])\n\n respond_to do |format|\n if @interview.update_attributes(params[:interview])\n format.html { redirect_to admin_interviews_path, notice: 'Interview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interview.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 set_api_v1_initiative_update\n @api_v1_initiative_update = Api::V1::InitiativeUpdate.find(params[:id])\n end", "def update\n if @institution.update(institution_params)\n render :show, status: :ok, location: @institution\n else\n render json: @institution.errors, status: :unprocessable_entity\n end\n end", "def update\n enforce_permissions!('manage_collection', params[:id])\n\n @object = retrieve_object!(params[:id])\n\n # If a cover image was uploaded, remove it from the params hash\n cover_image = params[:batch].delete(:cover_image)\n\n @institutes = Institute.all\n @inst = Institute.new\n\n supported_licences\n\n doi.update_metadata(params[:batch].select { |key, _value| doi.metadata_fields.include?(key) }) if doi\n\n @object.object_version ||= '1'\n @object.increment_version\n\n updated = @object.update_attributes(update_params)\n\n if updated\n if cover_image.present?\n flash[:error] = t('dri.flash.error.cover_image_not_saved') unless Storage::CoverImages.validate_and_store(cover_image, @object)\n end\n\n # Do the preservation actions\n preservation = Preservation::Preservator.new(@object)\n preservation.preserve(false, false, ['descMetadata','properties'])\n\n else\n flash[:alert] = t('dri.flash.alert.invalid_object', error: @object.errors.full_messages.inspect)\n end\n\n # purge params from update action\n purge_params\n\n respond_to do |format|\n if updated\n version_and_record_committer(@object, current_user)\n update_doi(@object, doi, \"metadata update\") if doi && doi.changed?\n\n flash[:notice] = t('dri.flash.notice.updated', item: params[:id])\n format.html { redirect_to controller: 'my_collections', action: 'show', id: @object.id }\n else\n format.html { render action: 'edit' }\n end\n end\n end", "def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update\n @institute_admin = InstituteAdmin.find(params[:id])\n respond_to do |format|\n if @institute_admin.update_attributes(params[:institute_admin])\n format.html { redirect_to @institute_admin, notice: 'InstituteAdmin was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @institute_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n institution = Institution.find(params[:id])\n if institution.update(institution_params)\n render json: { status: '200', message: \"Updated Institution with id #{params[:id]}\", data: institution }, status: :ok\n else\n render json: { status: '422', error: 'Institution not updated', data: institution.errors }, status: :unprocessable_entity\n end\n rescue ActiveRecord::RecordNotFound\n render json: { status: '404', error: \"No Institution with id #{params[:id]}\", data: institution }, status: :not_found\n end", "def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end", "def update\n respond_to do |format|\n if @inst.update(inst_params)\n format.html { redirect_to @inst, notice: 'Inst was successfully updated.' }\n format.json { render :show, status: :ok, location: @inst }\n else\n format.html { render :edit }\n format.json { render json: @inst.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.json { head :no_content }\n else\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instituto.update(instituto_params)\n format.html { redirect_to @instituto, notice: 'O instituto foi atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @instituto }\n else\n format.html { render :edit }\n format.json { render json: @instituto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n authorize @institute\n respond_to do |format|\n if @institute.update(institute_params)\n format.html { redirect_to @institute, notice: 'Institute was successfully updated.' }\n format.json { render :show, status: :ok, location: @institute }\n else\n format.html { render :edit }\n format.json { render json: @institute.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n if @incident.update(incident_params)\n head :no_content\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end", "def update\n @admin_interview = Interview.find(params[:id])\n\n respond_to do |format|\n if @admin_interview.update_attributes(params[:interview])\n format.html { redirect_to [:admin, @admin_interview], notice: 'Entrevista atualizada com sucesso' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: [:admin, @admin_interview.erros], status: :unprocessable_entity }\n end\n end\n end", "def update\n @solution = @idea.solutions.find(params[:id])\n\n if @solution.update_attributes(params[:solution])\n render json: { text: \"success\" }\n else\n render json: { text: \"fail\"}\n end\n end", "def update\n @instituicao = Instituicao.find(params[:id])\n\n respond_to do |format|\n if @instituicao.update_attributes(params[:instituicao])\n format.html { redirect_to @instituicao, notice: 'Instituicao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instituicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @issuing_institution = IssuingInstitution.find(params[:id])\n\n respond_to do |format|\n if @issuing_institution.update_attributes(params[:issuing_institution])\n format.html { redirect_to @issuing_institution, :notice => 'Orgão Emissor atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @issuing_institution.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n if @institution.update_attributes(params[:institution])\n format.html { redirect_to(institutions_url, :notice => 'Institution was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @institution.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_field.update(api_v1_initiative_field_params)\n format.html { redirect_to @api_v1_initiative_field, notice: 'Initiative field was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_field }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update\n\n @laboratory = Laboratory.find(params[:id])\n\n if @laboratory.update!(laboratory_params)\n render json: @laboratory\n else \n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end", "def 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 @record = @institution\n respond_to do |format|\n if @institution.update(institution_params)\n format.html { redirect_to @institution, notice: 'Institution was successfully updated.' }\n format.json { render :show, status: :ok, location: @institution }\n format.js { render :file => \"/basic/update.js.erb\" }\n else\n format.html { render :edit }\n format.json { render json: @institution.errors, status: :unprocessable_entity }\n format.js { render :file => \"/basic/update.js.erb\" }\n end\n end\n end", "def update\n params.permit!\n @interviews_it = Interviews::It.find(params[:id])\n\n respond_to do |format|\n if @interviews_it.update_attributes(params[:interviews_it])\n format.html { redirect_to(@interviews_it, :notice => 'It was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interviews_it.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n\n respond_to do |format|\n if @instrument_version.update_attributes(params[:instrument_version])\n flash[:notice] = 'InstrumentVersion was successfully updated.'\n format.html { redirect_to(@instrument_version) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instrument_version.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @institute = Institute.find(params[:id])\n\n respond_to do |format|\n if @institute.update_attributes(params[:institute])\n format.html { redirect_to(@institute, :notice => 'Institute was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @institute.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.html { redirect_to incident_plans_path(@incident) }\n format.json { render :show, status: :ok, location: @incident }\n else\n format.html { redirect_to incident_plans_path(@incident) }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n if @sitio.update_attributes(params[:sitio])\n format.html { redirect_to @sitio, notice: 'Sitio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invent.update(invent_params)\n format.html { redirect_to @invent, notice: 'Invent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to polymorphic_path(complex_namespace_helper + [@resource]), notice: \"#{@resource_class} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end", "def update\n if @physician.update(survey_params)\n head :no_content\n else\n render json: @physician.errors, status: :unprocessable_entity\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def patch!\n request! :patch\n end", "def update\n @initiative = Initiative.find(params[:id])\n @initiative.phase_id=params[:phase_id]\n\n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n format.html { render :nothing => true }\n #format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident_kind = IncidentKind.find(params[:id])\n\n respond_to do |format|\n if @incident_kind.update_attributes(params[:incident_kind])\n format.html { redirect_to @incident_kind, notice: 'Incident kind was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident_kind.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @opportunity = Opportunity.find(params[:id])\n\n if @opportunity.update(opportunity_params)\n head :no_content\n else\n render json: @opportunity.errors, status: :unprocessable_entity\n end\n end", "def update\n @infrastructure = Infrastructure.find(params[:id])\n checkaccountobject(\"infrastructures\",@infrastructure)\n\n respond_to do |format|\n if @infrastructure.update_attributes(params[:infrastructure])\n format.html { redirect_to @infrastructure, notice: 'Infrastructure was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @infrastructure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_resource.update(api_v1_resource_params)\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_resource }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_update(options = {})\n options[:id] ||= @website.id\n options[:website] ||= @attributes\n\n put :update,options\n end", "def update_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n\n respond_to do |format|\n if @entry_instrument.update_attributes(params[:entry_instrument])\n flash[:notice] = 'EntryInstrument was successfully updated.'\n format.html { redirect_to(@entry_instrument) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_instrument.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.html { redirect_to @interest, :notice => 'Интересот е успешно ажуриран.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @collection = @institution.collections.find(params[:id])\n\n respond_to do |format|\n if @collection.update_attributes(params[:collection])\n format.html { redirect_to [@collection.institution, @collection], notice: 'Collection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @inspiration = Inspiration.find(params[:id])\n @project = Project.find(@inspiration.project_id)\n respond_to do |format|\n if @inspiration.update_attributes(params[:inspiration])\n format.html { redirect_to @project, notice: 'Inspiration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inspiration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @institution_ad = InstitutionAd.find(params[:id])\n\n respond_to do |format|\n if @institution_ad.update_attributes(params[:institution_ad])\n format.html { redirect_to ([:administrator, @institution_ad]), notice: 'Institution ad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @institution_ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expertise = Expertise.find(params[:id])\n\n if @expertise.update(expertise_params)\n head :no_content\n else\n render json: @expertise.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @representative.update(representative_params)\n format.html { redirect_to admin_organization_path(@representative.organization,:locale => I18n.locale), notice: 'Representative was successfully updated.' }\n #format.json { head :no_content }\n else\n #format.html { render action: 'edit' }\n format.json { render json: @representative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n authorize @specialization\n\n respond_to do |format|\n if @specialization.update(specialization_update_params)\n format.html { redirect_to @specialization, notice: I18n.t(\"activerecord.notice.specialization.success_update\") }\n format.json { render :show, status: :ok, location: @specialization }\n else\n format.html { render :edit }\n format.json { render json: @specialization.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.html { redirect_to @interest, :notice => 'Interest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end", "def update\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n if @person_interest.update_attributes(params[:person_interest])\n format.html { redirect_to @person_interest, notice: 'Person interest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n standard_update(Interest, params[:id], interest_params)\n end", "def update\n @optician = Optician.find(params[:id])\n\n respond_to do |format|\n if @optician.update_attributes(params[:optician])\n format.html { redirect_to @optician, notice: 'Optician was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @optician.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "def update\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.html { redirect_to @interest, notice: 'Interest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end", "def update\n return if auth(\"website_administrator\")\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to @incident, :notice => 'Incident was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @institucion.update(institucion_params)\n format.html { redirect_to @institucion, notice: 'Empresa se ha actualizado correctamente.' }\n format.json { render :show, status: :ok, location: @institucion }\n else\n format.html { render :edit }\n format.json { render json: @institucion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @solution.update(solution_params)\n format.html { redirect_to @solution, notice: '¡ Has editado la solución !' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solution.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @rest.update(rest_params)\n format.html { redirect_to @rest, notice: 'Rest was successfully updated.' }\n format.json { render :show, status: :ok, location: @rest }\n else\n format.html { render :edit }\n format.json { render json: @rest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @intranet_substituto.update(intranet_substituto_params)\n format.html { redirect_to @intranet_substituto, notice: \"Substituto was successfully updated.\" }\n format.json { render :show, status: :ok, location: @intranet_substituto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @intranet_substituto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instagrampic.update(instagrampic_params)\n format.html { redirect_to @instagrampic, notice: 'Instagrampic was successfully updated.' }\n format.json { render :show, status: :ok, location: @instagrampic }\n else\n format.html { render :edit }\n format.json { render json: @instagrampic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_ministry = MyMinistry.find(params[:id])\n\n respond_to do |format|\n if @my_ministry.update_attributes(params[:my_ministry])\n format.html { redirect_to @my_ministry, notice: 'My ministry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_ministry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instum.update(instum_params)\n format.html { redirect_to @instum, notice: '投稿が更新されました' }\n format.json { render :show, status: :ok, location: @instum }\n else\n format.html { render :edit }\n format.json { render json: @instum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @intermediary = Intermediary.find(params[:id])\n\n respond_to do |format|\n if @intermediary.update_attributes(params[:intermediary])\n format.html { redirect_to @intermediary, notice: 'Intermediary was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @intermediary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lunch.update(lunch_params)\n format.html { redirect_to @lunch, notice: 'Lunch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lunch.errors, status: :unprocessable_entity }\n end\n end\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 update\n enforce_permissions!('manage_collection', params[:id])\n\n @object = retrieve_object!(params[:id])\n # If a cover image was uploaded, remove it from the params hash\n cover_image = params[:digital_object]&.delete(:cover_image)\n\n @institutes = Institute.all\n @inst = Institute.new\n\n supported_licences\n\n @object.assign_attributes(update_params)\n unless @object.valid?\n flash[:alert] = t('dri.flash.alert.invalid_object', error: @object.errors.full_messages.inspect)\n render :edit\n return\n end\n\n @object.increment_version\n\n if cover_image.present?\n url = Storage::CoverImages.validate_and_store(cover_image, @object)\n if url\n @object.cover_image = url\n else\n flash[:error] = t('dri.flash.error.cover_image_not_saved')\n end\n end\n\n respond_to do |format|\n if save_and_index\n post_save do\n mint_or_update_doi(@object, doi) if doi\n end\n\n flash[:notice] = t('dri.flash.notice.updated')\n format.html { redirect_to controller: 'my_collections', action: 'show', id: @object.alternate_id }\n format.json { render json: @object }\n else\n flash[:alert] = t('dri.flash.error.unable_to_persist')\n format.html { render action: 'edit' }\n end\n end\n end", "def update\n respond_to do |format|\n if @intervention.update(intervention_params)\n format.html { redirect_to index_url, notice: \"Intervention was successfully updated.\" }\n format.json { render :show, status: :ok, location: @intervention }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @intervention.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @therapist_consent = TherapistConsent.find(params[:id])\n respond_to do |format|\n format.html { render action: 'edit' }\n format.json { render :status => 200, :json => { action: 'edit', therapist_consent: @therapist_consent}}\n end\n end", "def update\n @apprentice = Apprentice.find(params[:id])\n\n respond_to do |format|\n if @apprentice.update_attributes(params[:apprentice])\n format.html { redirect_to @apprentice, notice: 'Apprentice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @apprentice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @interview.update(interview_params)\n format.html { redirect_to interviews_url, notice: 'Interview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @induction_template.update(induction_template_params)\n format.html { redirect_to @induction_template, notice: 'Induction template was successfully updated.' }\n format.json { render :show, status: :ok, location: @induction_template }\n else\n format.html { render :edit }\n format.json { render json: @induction_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @plant_soil.update(plant_soil_params)\n format.html { redirect_to @plant_soil, notice: 'Plant soil was successfully updated.' }\n format.json { render :show, status: :ok, location: @plant_soil }\n else\n format.html { render :edit }\n format.json { render json: @plant_soil.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @intervention.update(intervention_params)\n format.html { redirect_to @intervention, notice: 'Intervention was successfully updated.' }\n format.json { render :show, status: :ok, location: @intervention }\n else\n format.html { render :edit }\n format.json { render json: @intervention.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @intervention.update(intervention_params)\n format.html { redirect_to @intervention, notice: 'Intervention was successfully updated.' }\n format.json { render :show, status: :ok, location: @intervention }\n else\n format.html { render :edit }\n format.json { render json: @intervention.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6688653", "0.657614", "0.65370816", "0.6461901", "0.642117", "0.635045", "0.6344537", "0.63197863", "0.6258921", "0.6217157", "0.6182376", "0.61377233", "0.6133963", "0.6121836", "0.6116916", "0.6112635", "0.61020315", "0.60730284", "0.60678965", "0.6061148", "0.6057935", "0.60542303", "0.60457814", "0.60312665", "0.60107887", "0.5999042", "0.59977245", "0.59967715", "0.59920746", "0.5977586", "0.5968941", "0.5968338", "0.59461176", "0.593865", "0.5935969", "0.5932312", "0.59295154", "0.59289354", "0.592754", "0.5922949", "0.5915304", "0.5906108", "0.5900836", "0.58979267", "0.58832085", "0.58765966", "0.5871293", "0.5866544", "0.5866472", "0.5862956", "0.5862114", "0.5861239", "0.5860918", "0.58574605", "0.5851692", "0.5850324", "0.5848537", "0.584536", "0.5844458", "0.5841088", "0.5837616", "0.58365875", "0.5835948", "0.5834938", "0.5830364", "0.58241117", "0.58228123", "0.58211505", "0.58204806", "0.58125293", "0.5796683", "0.57963973", "0.5794273", "0.5792795", "0.5792556", "0.57870597", "0.5781195", "0.57793665", "0.5779179", "0.57741314", "0.5773131", "0.5771807", "0.57674885", "0.5766897", "0.5765617", "0.57596344", "0.5755344", "0.5752642", "0.57516795", "0.57503307", "0.5745863", "0.5744851", "0.5744281", "0.57413197", "0.574068", "0.5737335", "0.573442", "0.57342064", "0.57340264", "0.57340264" ]
0.61573786
11
DELETE /institutions/1 DELETE /institutions/1.json
def destroy @institution.destroy respond_to do |format| format.html { redirect_to institutions_url, notice: 'Institution deletada com sucesso.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @one_reg_institution = OneRegInstitution.find(params[:id])\n @one_reg_institution.destroy\n\n respond_to do |format|\n format.html { redirect_to one_reg_institutions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @institution = Institution.find(params[:id])\n @institution.destroy\n\n respond_to do |format|\n format.html { redirect_to institutions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @institucional = Institucional.find(params[:id])\n @institucional.destroy\n\n respond_to do |format|\n format.html { redirect_to institucionals_url }\n format.json { head :ok }\n end\n end", "def destroy\n @institution.destroy\n respond_to do |format|\n format.html { redirect_to admin_institutions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @institution = Institution.find(params[:id])\n @institution.destroy\n\n respond_to do |format|\n format.html { redirect_to(institutions_url) }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>[]} }\n \n end\n end", "def destroy\n @institution.destroy\n respond_to do |format|\n format.html { redirect_to institutions_url, notice: 'Institution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @institution = Institution.find(params[:id])\n authorize! :destroy, @institution\n @institution.destroy\n\n respond_to do |format|\n format.html { redirect_to institutions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @institution.destroy\n respond_to do |format|\n format.html { redirect_to institutions_url, notice: 'Institution wurde erfolgreich gelöscht.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @inst.destroy\n respond_to do |format|\n format.html { redirect_to insts_url, notice: 'Inst was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @institution = Institution.find(params[:id])\n @institution.destroy\n\n respond_to do |format|\n format.html { redirect_to(institutions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @institution_ad = InstitutionAd.find(params[:id])\n @institution_ad.destroy\n\n respond_to do |format|\n format.html { redirect_to administrator_institution_ads_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @admin_interview = Interview.find(params[:id])\n @admin_interview.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_interviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_initiative.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiatives_url, notice: 'Initiative was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instituicao = Instituicao.find(params[:id])\n @instituicao.destroy\n\n respond_to do |format|\n format.html { redirect_to instituicoes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @institucion = Institucion.find(params[:id])\n @institucion.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_institucions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @institucion.destroy\n respond_to do |format|\n format.html { redirect_to institucions_url, notice: 'Empresa se ha eliminado correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instagrampic.destroy\n respond_to do |format|\n format.html { redirect_to instagrampics_url, notice: 'Instagrampic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @orbituarysite = Orbituarysite.find(params[:id])\n @orbituarysite.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @initiative = Initiative.find(params[:id])\n @initiative.destroy\n\n respond_to do |format|\n format.html { redirect_to initiatives_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sitio = Sitio.find(params[:id])\n @sitio.destroy\n\n respond_to do |format|\n format.html { redirect_to sitios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_initiative_update.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiative_updates_url, notice: 'Initiative update was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instum.destroy\n respond_to do |format|\n format.html { redirect_to insta_url, notice: '投稿が削除されました' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hospitalization = Hospitalization.find(params[:id])\n @hospitalization.destroy\n\n respond_to do |format|\n format.html { redirect_to client_hospitalizations_url(@client) }\n format.json { head :ok }\n end\n end", "def destroy\n @constitution = Constitution.find(params[:id])\n @constitution.destroy\n\n respond_to do |format|\n format.html { redirect_to constitutions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n return if auth(\"website_administrator\")\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :ok }\n end\n end", "def destroy\n @interview = Interview.find_by_slug(params[:id])\n @interview.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_interviews_path, notice: 'Interview was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @initiative = Initiative.find(params[:id])\n @initiative.destroy\n\n respond_to do |format|\n format.html { render :nothing => true }\n #format.html { redirect_to initiatives_url }\n format.json { head :ok }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n id = @slideshow.id\n @slideshow.delete\n render :json => {:id => id}\n end", "def destroy\n @educational_institution.destroy\n respond_to do |format|\n format.html { redirect_to educational_institutions_url, notice: 'Educational institution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instancium.destroy\n respond_to do |format|\n format.html { redirect_to instancia_url, notice: 'Instancium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def destroy\n @optin_contestant = OptinContestant.find(params[:id])\n @optin_contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to optin_contestants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @intermediary = Intermediary.find(params[:id])\n @intermediary.destroy\n\n respond_to do |format|\n format.html { redirect_to intermediaries_url }\n format.json { head :ok }\n end\n end", "def destroy\n @interest = Interest.find(params[:id])\n @interest.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end \n end", "def destroy\n @institute = Institute.find(params[:id])\n @institute.destroy\n\n respond_to do |format|\n format.html { redirect_to(institutes_url) }\n format.xml { head :ok }\n end\n end", "def destroy_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n @entry_instrument.destroy\n\n respond_to do |format|\n format.html { redirect_to(entry_instruments_url) }\n format.xml { head :ok }\n end\n end", "def delete\n api_client.delete(url)\n end", "def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def delete\n super \"/templates/#{template_id}.json\", {}\n end", "def destroy\n @instituto.destroy\n respond_to do |format|\n format.html { redirect_to institutos_url, notice: 'O instituto foi deletado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @aliexpress = Aliexpress.find(params[:id])\n @aliexpress.destroy\n\n respond_to do |format|\n format.html { redirect_to aliexpresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @addimition = Addimition.find(params[:id])\n @addimition.destroy\n\n respond_to do |format|\n format.html { redirect_to addimitions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @financial_institution = FinancialInstitution.find(params[:id])\n @financial_institution.destroy\n\n respond_to do |format|\n format.html { redirect_to financial_institutions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @society.destroy\n respond_to do |format|\n format.html { redirect_to societies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @urlshortner.destroy\n respond_to do |format|\n format.html { redirect_to urlshortners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n @instrument_version.destroy\n\n respond_to do |format|\n format.html { redirect_to(instrument_versions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @collection = @institution.collections.find(params[:id])\n @collection.destroy\n\n respond_to do |format|\n format.html { redirect_to institution_collections_url(@institution) }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident_kind = IncidentKind.find(params[:id])\n @incident_kind.destroy\n\n respond_to do |format|\n format.html { redirect_to incident_kinds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @jedi = Jedi.find(params[:id])\n @jedi.destroy\n\n respond_to do |format|\n format.html { redirect_to jedis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @society_recuritment.destroy\n respond_to do |format|\n format.html { redirect_to society_recuritments_url, notice: 'Society recuritment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end", "def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @infrastructure = Infrastructure.find(params[:id])\n checkaccountobject(\"infrastructures\",@infrastructure)\n @infrastructure.send_delete\n\n respond_to do |format|\n format.html { redirect_to infrastructures_url }\n format.json { head :ok }\n end\n end", "def destroy\n @continent = Continent.find(params[:id])\n @continent.destroy\n\n respond_to do |format|\n format.html { redirect_to continents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @visitation = Visitation.find(params[:id])\n @visitation.destroy\n\n respond_to do |format|\n format.html { redirect_to visitations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inspiration.destroy\n render json: @inspiration\n end", "def destroy\n @contestant = Contestant.find(params[:id])\n @contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to contestants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inspiration.destroy\n respond_to do |format|\n format.html { redirect_to inspirations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @solution.destroy\n render json: {solutions: @solution}, status: 200\n end", "def destroy\n @vocalium = Vocalium.find(params[:id])\n @vocalium.destroy\n\n respond_to do |format|\n format.html { redirect_to vocalia_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\n format.json { head :no_content }\n end\n end", "def destroy\n @life_insurance.destroy\n\n respond_to do |format|\n format.html { redirect_to life_insurances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @induction_template.destroy\n respond_to do |format|\n format.html { redirect_to induction_templates_url, notice: 'Induction template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @intervenant.destroy\n respond_to do |format|\n format.html { redirect_to intervenants_url, notice: 'Intervenant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sivic_discipulo.destroy\n respond_to do |format|\n format.html { redirect_to sivic_discipulos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @iso.destroy\n respond_to do |format|\n format.html { redirect_to isos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @interview.destroy\n respond_to do |format|\n format.html { redirect_to interviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ubication = Ubication.find(params[:id])\n @ubication.destroy\n\n respond_to do |format|\n format.html { redirect_to ubications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invent.destroy\n respond_to do |format|\n format.html { redirect_to invents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incidence.destroy\n respond_to do |format|\n format.html { redirect_to incidences_url, notice: 'Incidencia eliminada exitosamente.' }\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 @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n @gethotelstaticdatagd.destroy\n\n respond_to do |format|\n format.html { redirect_to gethotelstaticdatagds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @institute\n @institute.destroy\n respond_to do |format|\n format.html { redirect_to institutes_url, notice: 'Institute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n render_json_auto @survey.delete_filter(params[:id].to_i) and return\n end", "def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @anything.destroy\n respond_to do |format|\n format.html { redirect_to anythings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end", "def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end", "def destroy\n @my_configuration = MyConfiguration.find(params[:id])\n @my_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to my_configurations_url }\n format.json { head :no_content }\n end\n end", "def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend", "def destroy\n @capthurit.destroy\n respond_to do |format|\n format.html { redirect_to capthurits_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7285626", "0.7173043", "0.71103877", "0.70918524", "0.69288975", "0.68833745", "0.6876366", "0.6865835", "0.68426985", "0.6822752", "0.6816554", "0.6763527", "0.67336565", "0.67256993", "0.6721798", "0.670704", "0.6670279", "0.6650756", "0.6650578", "0.6650107", "0.6648286", "0.66456294", "0.6645184", "0.66444254", "0.6625187", "0.6618877", "0.6618117", "0.66132784", "0.6604944", "0.6604273", "0.65928197", "0.6585524", "0.6583905", "0.6576072", "0.657344", "0.65501976", "0.6546464", "0.6541155", "0.6536864", "0.65349764", "0.6532471", "0.6532471", "0.6529813", "0.65283823", "0.65238273", "0.6519907", "0.6519907", "0.65129334", "0.6511657", "0.6511373", "0.6510155", "0.65058273", "0.6498041", "0.64879584", "0.6486775", "0.6484505", "0.64817977", "0.64729446", "0.6467455", "0.64658135", "0.6464681", "0.64625585", "0.64599395", "0.64599395", "0.64599395", "0.64599395", "0.64567333", "0.64566875", "0.6450872", "0.6448947", "0.6446896", "0.6445237", "0.64422554", "0.6436738", "0.6432352", "0.64297456", "0.6427356", "0.6425605", "0.6424606", "0.64239895", "0.6423881", "0.64186794", "0.6417731", "0.64150685", "0.6413893", "0.64125264", "0.64100045", "0.64089185", "0.6407172", "0.64051706", "0.6403043", "0.6401532", "0.63993156", "0.63934124", "0.6393154", "0.6393154", "0.6391951", "0.63910073", "0.63862026", "0.6383726" ]
0.69337094
4
Use callbacks to share common setup or constraints between actions.
def set_institution @institution = Institution.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def 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 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 event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def callback_phase\n super\n end", "def advice\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def duas1(action)\n action.call\n action.call\nend", "def _handle_action_missing(*args); end" ]
[ "0.6164095", "0.6046031", "0.5945298", "0.59179014", "0.58890367", "0.58341795", "0.5776118", "0.5700777", "0.5700777", "0.5656277", "0.56218207", "0.5423995", "0.5411516", "0.5411516", "0.5411516", "0.5395004", "0.53783494", "0.53593004", "0.53412604", "0.534078", "0.5332865", "0.53135896", "0.52999926", "0.5297309", "0.5296569", "0.5261449", "0.5247048", "0.52376497", "0.52376497", "0.52376497", "0.52376497", "0.52376497", "0.52323204", "0.52310973", "0.523081", "0.5225785", "0.5219039", "0.52136266", "0.5208033", "0.520763", "0.5177365", "0.5175224", "0.5173357", "0.5166104", "0.5162502", "0.51573396", "0.5154547", "0.5153531", "0.51502854", "0.51436496", "0.5142863", "0.51330835", "0.5115634", "0.5115634", "0.511527", "0.5109693", "0.51076853", "0.5093146", "0.5090683", "0.50829846", "0.50819314", "0.50670373", "0.5055505", "0.5053398", "0.50504035", "0.50504035", "0.5037765", "0.5027292", "0.5024484", "0.50150335", "0.5014069", "0.50022113", "0.5001542", "0.49981874", "0.49915564", "0.49915564", "0.49880967", "0.4982312", "0.49787375", "0.49786067", "0.49687737", "0.49676532", "0.49602765", "0.49565676", "0.49550772", "0.495342", "0.49522525", "0.49463704", "0.49447197", "0.49362713", "0.49328062", "0.49280638", "0.49272856", "0.4927058", "0.49221697", "0.4919526", "0.49185994", "0.49184805", "0.49170163", "0.49168405", "0.49167764" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def institution_params params.require(:institution).permit(:nome, :cnpj, :logradouro, :numero, :bairro, :cep, :cidade, :estado, :tel, :organizacao_academica, :categoria_administrativa, :site, :avatar) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def valid_params_request?; end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def 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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def url_whitelist; end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def url_params\n params[:url].permit(:full)\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6979893", "0.6781746", "0.6746611", "0.6742344", "0.6735229", "0.6592651", "0.65027124", "0.6498011", "0.648163", "0.647716", "0.64556813", "0.64386255", "0.63784456", "0.63756156", "0.636574", "0.6319542", "0.63004524", "0.6299559", "0.62925464", "0.62923217", "0.6289894", "0.6289475", "0.62831545", "0.6242381", "0.6240358", "0.6217451", "0.6214354", "0.62098235", "0.61918235", "0.6177287", "0.61755854", "0.61712915", "0.61620486", "0.6151379", "0.61510575", "0.6145169", "0.61207956", "0.6115647", "0.6107701", "0.61030304", "0.60909295", "0.60797", "0.60701567", "0.6062068", "0.60203075", "0.60167485", "0.60125494", "0.6009718", "0.6007027", "0.6007027", "0.6000283", "0.59990394", "0.5996995", "0.59915864", "0.59914654", "0.59912056", "0.5979621", "0.596686", "0.5959418", "0.59585625", "0.59583765", "0.5958032", "0.5952298", "0.5951678", "0.5941885", "0.59378815", "0.59376645", "0.59376645", "0.5933908", "0.59302104", "0.5924862", "0.5923981", "0.59165645", "0.5909916", "0.590986", "0.5908378", "0.5904956", "0.5897421", "0.58970135", "0.5894611", "0.5893914", "0.58927566", "0.5891277", "0.5885355", "0.58825094", "0.58783555", "0.58728755", "0.58686864", "0.5867015", "0.58660764", "0.58659357", "0.5864526", "0.58634263", "0.5861585", "0.5861255", "0.5858771", "0.58579147", "0.5854071", "0.5853147", "0.58498794", "0.58492327" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def payment_params params.require(:payment).permit(:custid, :payment_amount) 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
initializes with a species
def initialize(species) @species = species #is initialized with a pets attribute as a hash with 3 keys @pets = {:fishes => [], :dogs => [], :cats => []} #keeps track of the owners that have been created @@owners << self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(species)\n @species = species\n @@all << self\n @pets = {fishes: [], dogs: [], cats: []}\n end", "def initialize(species)\n @species = species\n @pets = {fishes: [], cats: [], dogs: []}\n @name = name\n @@all << self \n end", "def initialize species, name=nil\n\n # go into parent and treat name how it would be treated if this were an Animal:\n super(name)\n\n @species = species\n end", "def initialize(species)\n #super() #parentheses are indicating super is being called with no argument\n @species = species\n #@owner = owner #reader/writer methods are created above, don't need anything here\n #@name = name\n #@mood = mood\n @pets = {fishes: [], dogs: [], cats: []}\n # @pets = {:fishes => [], :dogs => [], :cats => []}\n ALL << self #keeps track of the owners (species?) that have been created\n end", "def initialize(species)\n @pets={\n :fishes => [],\n :dogs => [],\n :cats => []\n }\n @species = species\n @@owners << self\n end", "def set_species\n @species = Species.find(params[:id])\n end", "def set_species\n @species = Species.find(params[:id])\n end", "def set_species\n @species = Species.find(params[:id])\n end", "def set_species\n @species = Fishery.friendly.find(params[:id]).species\n end", "def initialize(species) #Automatically executes the code in the method body\n @species = species #Requires Owner to define the pets' species\n @name = name #Requires Owner to define the pet's name\n @@all << self #Adds new instance of Owner to the collection @@all = []\n @pets = {:fishes => [], :dogs => [], :cats => []} #Stores all of the owner's pets\n end", "def initialize(name)\n @pets = {fishes: [], cats: [], dogs: []}\n @@owners << self\n @species = \"human\" \n end", "def initialize(name, species=['cat', 'dog', 'bunny wearing backpack'].sample, options = {})\n @name = name\n @species = species\n @num_teeth = options[:num_teeth]\n @num_claws = options[:num_claws]\n @num_backpacks = options[:num_backpacks]\n end", "def species; end", "def add_species(name, initvalue = 0, description = \"\")\n\t\t\tif (@parameters.key? name) or (@species.key? name)\n\t\t\t\traise \"duplicate symbol #{name}\"\n\t\t\tend\n\n\t\t\tmax_matlab_no = @species.inject(1) do |mval, s|\n\t\t\t\t[mval, s[1].matlab_no].max\n\t\t\tend\n\n\t\t\t@species[name] = Species.new(name, initvalue, max_matlab_no+1)\n\n\t\t\tself.validate\n\t\tend", "def initialize(name, age, species)\n self.name = name\n self.age = age\n @species = species\n @@all << self\n end", "def initialize(name)\n @name = name\n @species = \"human\"\n @cats = []\n @dogs = []\n @@all << self\n end", "def initialize(species, weight, nickname, zoo)\n @species = species\n @weight = weight\n @nickname = nickname\n @zoo = zoo\n @@all << self\n end", "def species=(species)\n @species = species\n return @species\n end", "def set_species\n @species_selected = Species.friendly.find(params[:id])\n end", "def initialize(name) # takes name as input\n @name = name # instance variable for person name\n @species = \"human\" # set species to human\n @@all << self # pushes each instance to @@all array\n end", "def initialize(shoes)\n self.shoes = shoes\n end", "def initialize(shoes)\n self.shoes = shoes\n end", "def initialize(owner)\n @owner = owner\n @species = \"human\"\n @@owners << self\n @pets = {:fishes => [], :dogs => [], :cats => []}\n end", "def initialize(animal_name, age, gender, species)\n @animal_name = animal_name\n @age = age\n @gender = gender\n @species = species\n @toys = []\n @pets = {}\n\n end", "def set_Species(value)\n set_input(\"Species\", value)\n end", "def initialize(name, age, species, gender, toys)\n @name = name\n @age = age\n @species = species\n @gender = gender\n @toys = Array.new\n\n end", "def make_species\n EndangeredSpecies::Scraper.new.make_species\n end", "def initialize\n self.class.traits.each do |k,v| # passing the values to each new instance of \n instance_variable_set \"@#{k}\",v # Creature and its subclasses\n end\n end", "def species\n @species\n end", "def name\n self.species\n end", "def initialize(species, weight, nickname, zoo)\n @species = species\n @weight = weight\n @nickname = nickname\n @zoo = zoo\n @@all << self\n\n #everytime a new animal object is created, its shoveled into the Animal class\n\nend", "def parameter_to_species(pname)\n\t\t\traise \"Unknown parameter #{pname}\" if not @parameters.key?(pname)\n\t\t\tmatlab_number = @species.values.inject (1) { |mem, var| mem < var.matlab_no ? var.matlab_no + 1 : mem }\n\t\t\traise \"Species #{pname} already exists, cannot replace.\" if @species.key?(pname)\n\n\t\t\tp = @parameters.delete pname\n\t\t\tspec = Species.new(pname, p.value, matlab_number)\n\t\t\t@species[pname] = spec\n\n\t\t\tself.validate\n\t\t\tspec\n\t\tend", "def species_params\n params.require(:species).permit(:name, :scientific_name)\n end", "def initialize(name, number_of_lives)\n puts \"Cat INIT\"\n super(name)\n # Animal#initialize(name)\n @number_of_lives = number_of_lives\n end", "def init_city\n\n @city = City.new(5900, 70)\n\n house = Seitch.new()\n init_building(house,34,24)\n init_building(house,35,24)\n init_building(house,34,25)\n init_building(house,33,36)\n init_building(house,34,37)\n init_building(house,35,37)\n init_building(house,36,37)\n init_building(house,37,34)\n\n starport = Starport.new()\n init_building(starport ,30,30)\n\n farm = FarmA.new()\n init_building(farm ,37,24)\n\n atmo = AtmoGen.new()\n init_building(atmo ,34,30)\n end", "def create_species_and_data\n # Entrance message\n puts \"** Creating new species from lifeviz/ubiota files using hagrid_ubid as the bridge\"\n puts \" Note! New species are species with data imported from lifeviz. Orphaned species \"\n puts \" are ubiota species with no associated lifeviz data.\"\n new_species = []\n orphaned_species = []\n \n # Open files\n lifeviz, ubiota, map = nil\n seed \"Opening data files\" do\n lifeviz = IO.popen(\"bunzip2 -c #{LIFEVIZ}\")\n ubiota = IO.popen(\"bunzip2 -c #{UBIOTA}\")\n map = IO.readlines(LIFEVIZ_UBIOTA)\n lifeviz && ubiota && map ? true : false\n end\n\n # Dump all species\n seed \"Removing existing species.\"\n progress \"Deleting\", Species.count do |progress_bar|\n Species.all.each do |species|\n species.delete\n progress_bar.inc\n end\n end\n\n # Dump all related data\n seed \"Removing any existing age, litter sizes, adult weights, birth weights data\" do\n Lifespan.delete_all && LitterSize.delete_all && AdultWeight.delete_all && BirthWeight.delete_all ? true : false\n end\n\n # Load taxon from lifeviz, let's use hpricot\n lifeviz_species, lifeviz_ages, lifeviz_development, lifeviz_refs = nil\n seed \"Loading lifeviz data with hpricot\" do\n doc = Hpricot::XML(lifeviz)\n lifeviz_species = (doc/'names')\n lifeviz_ages = (doc/'age')\n lifeviz_development = (doc/'development')\n lifeviz_refs = (doc/'refs')\n (lifeviz_species.size > 0 && lifeviz_ages.size > 0 && lifeviz_development.size > 0 && lifeviz_refs.size > 0) ? true : false\n end\n notice \"#{lifeviz_species.size} species loaded with #{lifeviz_ages.size} ages\"\n\n # Create new species array to load lifeviz species and attributes we want\n seed \"Loading new species and storing lifeviz data from lifeviz dump\"\n development_index = ref_index = 0\n progress \"Storing\", lifeviz_species.length do |progress_bar|\n lifeviz_species.each_with_index do |s, index|\n hagrid = (s/'id_hagr').inner_html.to_i\n x = {}\n x[:synonyms] = (s/'name_common').inner_html\n x[:age] = (lifeviz_ages[index]/'tmax').inner_html\n x[:context] = (lifeviz_ages[index]/'phenotype').inner_html\n x[:hagrid] = hagrid\n x[:references] = x[:context].scan(/\\[(\\d*)\\]/).flatten\n \n while lifeviz_development[development_index] && (lifeviz_development[development_index]/'hagrid').inner_html.to_i < hagrid\n notice \"#{(lifeviz_development[development_index]/'hagrid').inner_html} is less than #{hagrid}\"\n development_index += 1\n end\n # development attributes matches the current species id\n if lifeviz_development[development_index] && (lifeviz_development[development_index]/'hagrid').inner_html.to_i == hagrid\n development = lifeviz_development[development_index]\n if development && (development/'hagrid').inner_html.to_i == hagrid\n x[:adult_weight] = (development/'adult_weight').inner_html.blank? ? \"\" : (development/'adult_weight').inner_html.to_f\n x[:birth_weight] = (development/'birth_weight').inner_html.blank? ? \"\" : (development/'birth_weight').inner_html.to_f\n x[:litter_size] = (development/'litter_size').inner_html.blank? ? \"\" : (development/'litter_size').inner_html.to_f\n else\n x[:adult_weight] = \"\"\n x[:birth_weight] = \"\"\n x[:litter_size] = \"\"\n end\n development_index += 1\n end\n new_species << x\n progress_bar.inc\n end\n end\n notice \"#{new_species.length} new species stored\"\n\n # Load ubid ids into new species from mapping\n seed \"Loading mapped ubiota ids into new species\" do\n new_species_pointer = 0\n map.each do |line|\n hagrid, ubid = line.split(/\\s+/)\n while new_species[new_species_pointer] && hagrid.to_i != new_species[new_species_pointer][:hagrid]\n new_species_pointer += 1\n end\n new_species[new_species_pointer][:ubid] = ubid.to_i if new_species[new_species_pointer]\n end\n end\n\n # Remove any new species that have no ubid from mapping\n count = new_species.size\n seed \"Delete any new species that do not have a ubiota id mapped\", \n :success => \"Mappings completed\", \n :failure => \"No species had mappings\" do\n new_species.delete_if { |species| species[:ubid] == nil }\n new_species.length != 0 ? true : false\n end\n notice \"deleted #{count - new_species.size} species, #{new_species.size} remaining\"\n\n # Sort species by ubid\n seed \"Sorting new species by ubid\" do\n new_species = new_species.sort_by { |each| each[:ubid] }\n true\n end\n\n # Find and load ubiota genus ids and species name for each species\n # Ensure the rank is 6 (species level)\n # Set taxon_id to nil if the species inside ubiota doesn't exist\n seed \"Looking up and loading each new species' genus id from the ubiota data\"\n x = 0\n a_couple = 0\n num_lines = num_lines_bz2(UBIOTA)\n progress \"Matching\", num_lines do |progress_bar|\n ubiota.each do |line|\n id, term, rank, hierarchy, parent_id, num_children, hierarchy_ids = line.split(\"|\")\n # skip if we're not looking at a species level taxon\n if rank.to_i != 6\n progress_bar.inc\n next\n end\n if new_species[x].nil? || id.to_i != new_species[x][:ubid]\n y = {:taxon_id => parent_id.to_i, :name => term.to_s}\n orphaned_species << y\n if !new_species[x].nil? then new_species[x][:taxon_id] = nil end\n if !new_species[x].nil? && id.to_i > new_species[x][:ubid] then x += 1 end\n else\n new_species[x][:taxon_id] = parent_id.to_i\n new_species[x][:name] = term.to_s\n x += 1\n end\n progress_bar.inc\n end\n end\n notice \"traversed #{x} new species and #{orphaned_species.size} orphaned species\"\n\n # Remove any new species that has no genus in ubiota\n count = new_species.size\n seed \"Delete any species that had no genus id\" do\n new_species.delete_if { |species| species[:taxon_id] == nil }\n end\n notice success_string(\"deleted #{count - new_species.size} species, #{new_species.size} remaining\")\n\n # Remove any orphaned species that has no genus in ubiota\n count = orphaned_species.size\n seed \"Delete any orphaned species that had no genus id\" do\n orphaned_species.delete_if { |species| species[:taxon_id] == 0 }\n end\n notice success_string(\"deleted #{count - orphaned_species.size} species, #{orphaned_species.size} remaining\")\n\n # Create species with all the new species stored in memory\n count = species_without_parents = 0\n seed \"Saving all of the new species.\"\n\n progress \"Species\", new_species.length do |progress_bar|\n new_species.each_with_index do |taxon, index|\n s = new_species[index]\n species = Taxon.new(:name => s[:name], :parent_id => s[:taxon_id], :rank => 6, :id => s[:ubid])\n species.send(:create_without_callbacks)\n # # This was commented out because we're using Cera's lifespan data now.\n # unless s[:age].blank?\n # s[:references].each do |reference_id|\n # lifespan = Lifespan.new(:value_in_days => (s[:age].to_f * 365), :units => \"Years\", :species_id => species.id)\n # lifespan.context = s[:context]\n # lifespan.citation = Reference.find(reference_id).to_s\n # lifespan.created_by = ANAGE_USER_ID\n # lifespan.created_by_name = ANAGE_USER_NAME\n # lifespan.send(:create_without_callbacks)\n # end\n # end\n BirthWeight.new(\n :value_in_grams => (s[:birth_weight]),\n :units => \"Grams\",\n :species_id => species.id,\n :created_by => ANAGE_USER_ID,\n :created_by_name => ANAGE_USER_NAME\n ).send(:create_without_callbacks) unless s[:birth_weight].blank?\n AdultWeight.new(\n :value_in_grams => (s[:adult_weight]),\n :units => \"Grams\",\n :species_id => species.id,\n :created_by => ANAGE_USER_ID,\n :created_by_name => ANAGE_USER_NAME\n ).send(:create_without_callbacks) unless s[:adult_weight].blank?\n LitterSize.new (\n :value => (s[:litter_size]),\n :species_id => species.id,\n :created_by => ANAGE_USER_ID,\n :created_by_name => ANAGE_USER_NAME\n ).send(:create_without_callbacks) unless s[:litter_size].blank?\n count = index\n progress_bar.inc\n end\n end\n notice success_string(\"saved #{count - species_without_parents} species\")\n notice success_string(\"saved #{Lifespan.count} ages\")\n notice success_string(\"saved #{AdultWeight.count} adult weights\")\n notice success_string(\"saved #{BirthWeight.count} birth weights\")\n notice success_string(\"saved #{LitterSize.count} litter sizes\")\n notice failure_string(\"#{species_without_parents} species didn't have taxons matching taxon_id in our database\") if species_without_parents != 0\n\n # Create orphaned species with all the species stored in memory\n count = 0\n species_without_parents = 0\n seed \"Saving all the orphaned species\"\n progress \"Saving orphans\", orphaned_species.length do |progress_bar|\n orphaned_species.each_with_index do |s, index|\n taxon = Taxon.find_by_id(s[:taxon_id])\n if taxon == nil\n # notice failure_string(\"no taxon found with an id of #{s[:taxon_id].to_s} for species with ubid of #{s[:ubid].to_s}\")\n species_without_parents += 1\n else\n species = Taxon.new(:name => s[:name], :parent_id => taxon.id, :rank => 6)\n species.send(:create_without_callbacks)\n end\n count = index\n progress_bar.inc\n end\n end\n notice success_string(\"Phew!... saved #{count - species_without_parents} species\")\n notice failure_string(\"#{species_without_parents} species didn't have taxons matching taxon_id in our database\") if species_without_parents != 0\n\n seed \"Rebuilding heirarchical tree\" do\n Taxon.rebuild!\n end\n\n seed \"Vacuuming database\" do\n SQL.execute \"VACUUM ANALYZE;\"\n end\n\n notice \"Species creation is completed.\"\nend", "def initializePesos\r\n \[email protected] do\r\n\t patron = @patrones[rand(@patrones.count-1)]\r\n @neuronas << {:class=>rand(@cantClases), :pesos => initPesos}\r\n\tend\r\n end", "def initialize(i, fen, snps=[])\n self.id = i\n self.fenotype = fen\n self.snp_list = snps\n end", "def species\n @species = \"human\" #expect(owner.species).to eq(\"human\")\n #expect { owner.species = \"hamster\" }.to raise_error\n end", "def species\n # taxonomy sentence:\n # TODO: this assumes perfect coverage of A1 and A2 for all species, which is a bad idea. Have contingencies.\n what = a1\n family = a2\n species_parts = []\n\n if match = growth_habit_matches.by_type(:x_species)\n species_parts << trait_sentence_part(\n \"#{name_clause} is \"\\\n \"#{a_or_an(match.trait[:object_term][:name])} %s \"\\\n \"species of #{what}\",\n match.trait\n )\n elsif match = growth_habit_matches.by_type(:species_of_x)\n species_parts << trait_sentence_part(\n \"#{name_clause} is a species of %s\",\n match.trait\n )\n else\n species_parts << \"#{name_clause} is a species of #{what}\"\n end\n\n if family\n species_parts << \" in the family #{a2}\"\n end\n\n if match = growth_habit_matches.by_type(:and_a_x)\n species_parts << trait_sentence_part(\n \", and #{a_or_an(match.trait[:object_term][:name])} %s\",\n match.trait\n )\n elsif match = growth_habit_matches.by_type(:x_growth_habit)\n species_parts << trait_sentence_part(\n \", with #{a_or_an(match.trait[:object_term][:name])} %s growth habit\",\n match.trait\n )\n end\n\n species_parts << \".\"\n @sentences << species_parts.join(\"\")\n\n if is_it_extinct?\n term_sentence(\"This species is %s.\", \"extinct\", Eol::Uris.extinction, Eol::Uris.extinct)\n elsif @page.iucn_status_key && IucnKeys.include?(@page.iucn_status_key.to_sym)\n handle_iucn @page.iucn_status_key.to_sym\n end\n\n # If the species [is extinct], insert an extinction status sentence between the taxonomy sentence\n # and the distribution sentence. extinction status sentence: This species is extinct.\n\n # If the species [is marine], insert an environment sentence between the taxonomy sentence and the distribution\n # sentence. environment sentence: \"It is marine.\" If the species is both marine and extinct, insert both the\n # extinction status sentence and the environment sentence, with the extinction status sentence first.\n term_sentence(\"It is found in %s.\", \"marine habitat\", Eol::Uris.environment, Eol::Uris.marine) if is_it_marine?\n\n # Distribution sentence: It is found in [G1].\n @sentences << \"It is found in #{g1}.\" if g1\n end", "def initialize (name) #when a fish is created in CL ie. f1 = Fish.new('nemo'), this method will autorun, and you have to give it a name\n puts 'new fish is born'\n # health = 10 # local\n @health = 10 # increases to an instance variable\n @speed = 5\n @name = name\n stomach = [ ]\n\n end", "def create_taxonomy_node\n Taxonomite::Species.new(name: self.name)\n end", "def initialize(shelfname)\n \t@shelfname = shelfname\n @shelved = {}\n fillshelf()\n end", "def create\n @species = Species.new(species_params)\n\n respond_to do |format|\n if @species.save\n format.html { redirect_to @species, notice: 'Species was successfully created.' }\n format.json { render :show, status: :created, location: @species }\n else\n format.html { render :new }\n format.json { render json: @species.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(n) # The state of a season is just its\n@n = n # index in the NAMES and INSTANCES arrays\nend", "def initialize()\n @mano = $sin_jugada\n end", "def initialize (make, model, miles, type, color, year, used)\n\t\t@make = make\n\t\t@model = model\n\t\t@miles = miles\n\t\t@type = type\n\t\t@color = color\n\t\t@year = year\n\t\t@used = used\n\t\tputs \"New car created.\"\n\tend", "def species_params\n params.require(:species).permit(:name, :classification, :designation, :average_height, :average_lifespan, :eye_colors, :hair_colors, :skin_colors, :language, :homeworld)\n end", "def species\r\n villagers.map{ |villager| villager.species}\r\n end", "def initialize(n) # The state of a season is just its \n @n = n # index in the NAMES and INSTANCES arrays\n end", "def initialize(n) # The state of a season is just its \n @n = n # index in the NAMES and INSTANCES arrays\n end", "def initialize(n) # The state of a season is just its\n @n = n # index in the NAMES and INSTANCE arrays\n end", "def create\n\t\trespond_with Species.create(species_params)\n\tend", "def initialize(name)\n\t\t@name = name\n\t\t@people = []\n\t\t@animals = []\n\tend", "def initialize(n)\n\t\t@name = n\n\t\t@people = [] #here we are telling ruby that people and animals are empty arrays\n\t\t@animals = []\n\t\t\n\tend", "def new\n @animal = Animal.new\n @zoo = Zoo.find(params[:zoo_id])\n @species = ['Lion', 'Koala', 'Panda']\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @animal }\n end\n end", "def initialize(santa_number, name, age, cookie_preference, beard_style)\n @santa_number = santa_number # I add this feature so that the list of santas at the end are easier to keep track of\n @name = name.capitalize\n @age = age # unlike in prior releases, in this release I updated age upon initialization\n @cookie_preference = cookie_preference.capitalize\n @beard_style = beard_style.capitalize \n end", "def initialize(gender, ethnicity)\n\t# \tputs \"Initializing Santa instance...\"\n\t\t@gender = gender\n\t\t@ethnicity = ethnicity\n\t\t#these could be used, but i chose not to use these santa defaults\n\t\t@reindeer_ranking = [\"Rudolph\", \"Dasher\", \"Dancer\", \"Prancer\", \"Vixen\", \"Comet\", \"Cupid\", \"Donner\", \"Blitzen\"]\n\t\t@age = 0 \n\t\t# @santa_profile = []\n\tend", "def initialize(name)\r\n @name = name \r\n @recipes = [] #all recipes that use this ingredients \r\n \r\n @@all << self \r\n end", "def initialize\n create_boss_hp_bar \n bosses_initialize \n end", "def initialize(name) #gender, ethnicity)\n\t\tputs \"Initializing Santa instance ....\"\n\t\t@name = name \n\t\t@location = \"the North Pole\"\n\t\t@gender = gender \n\t\t@ethnicity = ethnicity \n\t\t#@drink = drink\n\t\t# age, which is not passed in on initialization and defaults to 0\n\t\t@age = 0\n\t\t@reindeer = reindeer = [\"Rudolph\", \"Dasher\", \"Dancer\", \"Prancer\", \"Vixen\", \"Comet\", \"Cupid\", \"Donner\", \"Blitzen\"]\n\tend", "def initialize (nombre, saturadas, monoinsaturadas, polinsaturadas, azucares, polialcoles, almidon, fibra, proteinas, sal)\n\t\t@nombre, @saturadas, @monoinsaturadas, @polinsaturadas, @azucares, @polialcoles, @almidon, @fibra, @proteinas, @sal = nombre, saturadas, monoinsaturadas, polinsaturadas, azucares, polialcoles, almidon, fibra, proteinas, sal\n\tend", "def initialize(temperature,\n max_population,\n starting_population,\n *genomes_for_environment)\n\n # Some simple sanity checks on passed in arguments\n #unless genomes_for_environment.inject(0) {|total, gfe|\n # Rational(total + Rational(gfe.population_frequency))\n #} == 1.0\n # raise ArgumentError, \"population frequencies of genomes must total 1\"\n #end\n if starting_population > max_population\n raise ArgumentError, \"The starting population must be less than the\n maximum population\"\n end\n\n # Set the environments parameters\n @temperature = temperature\n @max_population = max_population\n @organisms = []\n\n # Populate the environment\n genomes_for_environment.each do |genome_for_species|\n (starting_population * genome_for_species.population_frequency)\n .round.times do\n genome = genome_for_species.genome.dup\n genome.added_nucleotides = rand(genome.length)\n @organisms << Organism.new(genome, self)\n end\n end\n end", "def species_request(pokemon_data)\n\t\tspecies_request = HTTParty.get(pokemon_data.species_url)\n\t\tspecies = PokeapiSpecies.new(species_request)\n\t\treturn species\n\tend", "def initialize(state_of_origin, population_density, population)\n puts \"creating\"\n @state = state_of_origin\n @population = population\n @population_density = population_density\n\n end", "def new\n @species = Species.new\n\n respond_with(@species)\n end", "def initialize (gender, ethnicity, age)\n\t\t#puts \"Initializing Santa instance ...\"\n\t\t@gender = gender\n\t\t@ethnicity = ethnicity\n\t\t@age = age\n#\t\t@beard_description = beard_description\n#\t\t@weight = weight\n\tend", "def initialize(name)\n @foods = Array.new()\n @name = name\n @calories = 0;\n end", "def initialize(name, proteins, glucids, fats)\n @name = name\n @proteins = proteins\n @glucids = glucids \n @fats = fats\n end", "def init(container)\n @entities = []\n @entities += Array.new(3) { Giant.new(container, self) }\n @entities += Array.new(20) { Goblin.new(container, self) }\n @entities += Array.new(20) { Human.new(container, self) }\n end", "def initialize(shoe_description)\n @brand = shoe_description[:brand]\n @color = shoe_description[:color]\n @price = shoe_description[:price]\n end", "def initialize (gender, ethnicity)\n\t\tputs \"\\nInitializing Santa instance ...\"\n\t\t@gender = gender\n\t\t@ethnicity = ethnicity\n\t\t@reindeer_ranking = [\"Rudolph\", \"Dasher\", \"Dancer\", \"Prancer\", \"Vixen\", \"Comet\", \"Cupid\", \"Donner\", \"Blitzen\"]\n\t\t@age = 0\n\tend", "def initialize(in_all_planets, in_system, in_formation)\n @system = in_system #name of system\n @all_planets = in_all_planets\n @formation = in_formation\n end", "def initialize(name)\n @planets = []\n @name = name\n @constellation = nil\n @type = nil\n @age = 0\n end", "def initialize(nombre, platos)\n\t\t@nombre = nombre\n\t\t@platos = List.new\n\t\tfor plato in platos do\n\t\t\t@platos << plato\n\t\tend\n\tend", "def initialize(state_of_origin, population_density, population)\n @state = state_of_origin\n @population = population\n @population_density = population_density\n end", "def initialize( name, typus)\n\t\t@name, @typus = name, typus\n\tend", "def species\n return text_get(1, id)\n end", "def initialize name, chip_number\n @number_of_legs = 4 # you can't choose how many legs has a dog. This is an instance attribute (or variable), and you cannot modify it.\n @number_of_eyes = 2 # you can't choose how many eyes has a dog. This is an instance attribute (or variable), and you cannot modify it.\n @name = name # you can change your dog name all the times you want (poor dog!). This is an instance attribute (or variable), and it can be accessed from other methods of the class. Because of the attr_accessor, it can be accessed from outside the class.\n @chip_number = chip_number # you need the chip number to track the dog if it's lost. This is an instance attribute (or variable), and it can be accessed from other methods of the class.\n @speed = 0 # you need to access the dog speed to see how faster is he/she going. This is an instance attribute (or variable)\n end", "def initialize(name, proteins, glucids, fats, group)\n super(name, proteins, glucids, fats)\n @group = group\n end", "def initialize(gender, ethnicity)\n\n\t\tp \"initializing Santa instance...\"\n\t\t@gender = gender\n\t\t@ethnicity = ethnicity\n\t\t@reindeer_ranking = [\"Rudolph\", \"Dasher\", \"Dancer\", \"Prancer\", \"Vixen\", \"Comet\",\n\t\t \"Cupid\", \"Donner\", \"Blitzen\"]\n\t\t@age = 1\n\tend", "def initialize(name) #when an artist is created the name is mandatory\n @name = name #writes/sets a name attribute to the new artist\n @@all << self #pushes that artist into all array. all artist instances go here\n end", "def initialize( name, id, colors, qualities, map, color, quality )\n\t\tsuper( name, id, colors, qualities, map )\n\t\t\n\t\tself.color = color\n\t\tself.quality = quality\n\t\t\n\tend", "def initialize(name) # All tech has a name, no?\n @name = name\n @labs = []\n end", "def initialize(name) end", "def initialize(state_of_origin, population_density, population)\r\n @state = state_of_origin\r\n @population = population\r\n @population_density = population_density\r\n end", "def my_initialize\n\t\t@classes = 1\n\t\t@toys = 0\n\t\t@books = 0\t\t\n\t\tsrand seed.to_i\n\t\t@location = nil\n\t\tnext_spot()\n\t\t@random_number = 0\n\t\ttrue\n\tend", "def initialize#(gender, ethincity)\n\t\tputs \"Initializing Santa instance\"\n\t\t@gender = gender\n\t\t@ethincity = ethincity\n\t\t@reindeer_ranking = ['Rudolph', 'Dasher', 'Dancer', 'Prancer', 'Vixen', \n\t\t'Comet', 'Cupid', 'Donner', 'Blitzen']\n\t\t@age = 0\n\tend", "def alien_species\n # 2. for those Colonies, get the information about the species\n self.colonies.map do |colony_instance|\n colony_instance.alien_species\n end\n end", "def species_params\n params.require(:species).permit(:name, :ferociousness, :vegetarian)\n end", "def initialize(name, location, founding_year, slogan)\n @name = name\n @location = location\n @founding_year = founding_year\n @slogan = slogan\n @@all << self # on init, add self to all instances of Cult\n end", "def init_players\n\t\t@human = Human.new(\"Jack\", Field.new)\n\t\t@computer = Computer.new(Field.new)\n\t\tinit_fields\n\tend", "def initialize(nombre,peso,talla,edad,sexo,imc,estados,rcc,rcca) #constructor\n super(nombre,peso,talla,edad,sexo,imc,estados,rcc,rcca)\n end", "def initialize(gender, ethnicity)\n\t\tputs \"initializing Santa instance...\"\n\t\t@gender = gender\n\t\t@ethnicity = ethnicity\n\t\t@reindeer_ranking = [\"Rudolph\", \"Dasher\", \"Dancer\", \"Prancer\", \"Vixen\", \"Comet\", \"Cupid\", \"Donner\", \"Blitzen\"]\n\t\t@age = age\n \tend", "def initialize(mano)\n\t\t@jugada = mano\n\tend", "def initialize (solar_system)\n @planet_list = solar_system\n end", "def initialize (name, gene)\n\t\t@name = name\n\t\t@gene = gene\n\tend", "def init_rubies\n @table = [\n [1, 1], # Enumerable Canyon ==> 0\n [1, 1], # Monkey Patch City ==> 1\n [2, 2], # Duck Type Beach ==> 2\n [3, 0], # Matzburg ==> 3\n [0, 3], # Nil Town ==> 4\n [2, 2], # Hash Crossing ==> 5\n [2, 2] # Dynamic Palisades ==> 6\n ]\n end", "def initialize\n peg = Peg.new\n @pegs = Array.new(6) { |i| peg.color(i) }\n @breaker = Breaker.new\n @maker = Maker.new\n end", "def initialize\n # create and locate the shovel\n shovel.location = start_room\n end" ]
[ "0.7714453", "0.75028056", "0.74939793", "0.7416047", "0.7341853", "0.7268634", "0.7268634", "0.7055479", "0.6833998", "0.68307877", "0.67734057", "0.6773343", "0.66505164", "0.6649406", "0.6560231", "0.6521497", "0.64565206", "0.64520854", "0.6433007", "0.6411387", "0.6390334", "0.6390334", "0.62810326", "0.6224974", "0.6143207", "0.6031838", "0.5928767", "0.5925225", "0.5902259", "0.5814112", "0.57709455", "0.5770817", "0.571789", "0.5689717", "0.56835103", "0.5681825", "0.56706774", "0.56624573", "0.5652197", "0.5635922", "0.5627516", "0.5589361", "0.55789423", "0.55739594", "0.5557164", "0.5552923", "0.5530319", "0.55247843", "0.55202585", "0.5510485", "0.5510485", "0.5509563", "0.5505164", "0.54855406", "0.5485119", "0.5481163", "0.5455723", "0.5455258", "0.54517436", "0.5448723", "0.5447653", "0.54419065", "0.5418963", "0.5402155", "0.5396766", "0.5388357", "0.53854114", "0.53815967", "0.538091", "0.53780866", "0.5373141", "0.53724617", "0.5356854", "0.53535205", "0.53464353", "0.5346396", "0.5346246", "0.5344162", "0.5336826", "0.53330964", "0.53321403", "0.5332068", "0.5324108", "0.5323736", "0.5323441", "0.53222096", "0.53212535", "0.5316673", "0.5316563", "0.5316333", "0.53144795", "0.5311803", "0.53098655", "0.53093904", "0.5307134", "0.5306098", "0.530184", "0.5300177", "0.5297737", "0.52972156" ]
0.7005821
8
can say its species
def say_species "I am a #{species}." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def species; end", "def species\n @species\n end", "def name\n self.species\n end", "def species\n return \"human\"\n end", "def species\n return text_get(1, id)\n end", "def species\n # taxonomy sentence:\n # TODO: this assumes perfect coverage of A1 and A2 for all species, which is a bad idea. Have contingencies.\n what = a1\n family = a2\n species_parts = []\n\n if match = growth_habit_matches.by_type(:x_species)\n species_parts << trait_sentence_part(\n \"#{name_clause} is \"\\\n \"#{a_or_an(match.trait[:object_term][:name])} %s \"\\\n \"species of #{what}\",\n match.trait\n )\n elsif match = growth_habit_matches.by_type(:species_of_x)\n species_parts << trait_sentence_part(\n \"#{name_clause} is a species of %s\",\n match.trait\n )\n else\n species_parts << \"#{name_clause} is a species of #{what}\"\n end\n\n if family\n species_parts << \" in the family #{a2}\"\n end\n\n if match = growth_habit_matches.by_type(:and_a_x)\n species_parts << trait_sentence_part(\n \", and #{a_or_an(match.trait[:object_term][:name])} %s\",\n match.trait\n )\n elsif match = growth_habit_matches.by_type(:x_growth_habit)\n species_parts << trait_sentence_part(\n \", with #{a_or_an(match.trait[:object_term][:name])} %s growth habit\",\n match.trait\n )\n end\n\n species_parts << \".\"\n @sentences << species_parts.join(\"\")\n\n if is_it_extinct?\n term_sentence(\"This species is %s.\", \"extinct\", Eol::Uris.extinction, Eol::Uris.extinct)\n elsif @page.iucn_status_key && IucnKeys.include?(@page.iucn_status_key.to_sym)\n handle_iucn @page.iucn_status_key.to_sym\n end\n\n # If the species [is extinct], insert an extinction status sentence between the taxonomy sentence\n # and the distribution sentence. extinction status sentence: This species is extinct.\n\n # If the species [is marine], insert an environment sentence between the taxonomy sentence and the distribution\n # sentence. environment sentence: \"It is marine.\" If the species is both marine and extinct, insert both the\n # extinction status sentence and the environment sentence, with the extinction status sentence first.\n term_sentence(\"It is found in %s.\", \"marine habitat\", Eol::Uris.environment, Eol::Uris.marine) if is_it_marine?\n\n # Distribution sentence: It is found in [G1].\n @sentences << \"It is found in #{g1}.\" if g1\n end", "def species\r\n villagers.map{ |villager| villager.species}\r\n end", "def say_species\n\t\t\"I am a #{self.species}.\"\n\tend", "def set_species\n @species = Fishery.friendly.find(params[:id]).species\n end", "def alien_species\n # 2. for those Colonies, get the information about the species\n self.colonies.map do |colony_instance|\n colony_instance.alien_species\n end\n end", "def species_name\n self.taxon.present? ? self.taxon.common_name : nil\n end", "def animal_species(species)\n #animal.species\n self.animals.select do | animal |\n animal.species == species \n end \n end", "def species\n self.waters.map{|water| water.species.map{|s| s.name } }.flatten.uniq.sort\n end", "def say_name_and_species\n puts \"#{name} is a #{self.class.species}\"\n end", "def animal_species()\n self.animals().map() { | animal | animal.species() }.uniq\n end", "def animal_species\n Animals.uniq.select { |animal| animal.species }\n end", "def animal_species\n animals.map { |animal| animal.species}.uniq\n end", "def animal_species\n Animal.all.map do |animal|\n animal.specie\n end.uniq\n end", "def species\n \"#{@species}\"\n end", "def is_species?\n is_rank?('r_species')\n end", "def species=(species)\n @species = species\n return @species\n end", "def species\n species = Array.new\n\n mobs.each do |mob|\n species << mob.specie\n end\n\n return species.uniq\n end", "def say_species\n return \"I am a #{@species}.\"\n end", "def say_species\n return \"I am a #{@species}.\"\n end", "def say_species\n return \"I am a #{@species}.\"\n end", "def say_species\n p \"I am a #{@species}.\"\n end", "def say_species\n \"I am a #{@species}.\"\n end", "def say_species\n \"I am a #{@species}.\"\n end", "def say_species\n \"I am a #{@species}.\"\n end", "def asexual_species\n species = Array.new\n\n mobs.each do |mob|\n species << mob.specie if mob.asexual?\n end\n\n return species.uniq\n end", "def get_genus_species(genus_option, self_option)\n # see Protonym\n true\n end", "def all_animal_species\n #binding.pry\n all_animals.select{|species|species.zoo == self }.uniq\n end", "def animal_species\n animal_arr = self.animals.map do |animal|\n animal.species\n end.uniq\n end", "def say_species\n \"I am a #{self.species}.\"\n end", "def pbHasFatefulSpecies?(species)\n if species.is_a?(String) || species.is_a?(Symbol)\n species = getID(PBSpecies,species)\n end\n for pokemon in $Trainer.pokemonParty\n return true if pokemon.species==species && pokemon.obtainMode==4\n end\n return false\nend", "def pbHasSpecies?(species)\n if species.is_a?(String) || species.is_a?(Symbol)\n species = getID(PBSpecies,species)\n end\n for pokemon in $Trainer.pokemonParty\n return true if pokemon.species==species\n end\n return false\nend", "def set_species\n @species = Species.find(params[:id])\n end", "def set_species\n @species = Species.find(params[:id])\n end", "def find_by_species(given_specie)\n Animal.all.select do |animal|\n animal.zoo == self && animal.specie == given_specie\n end\n\n end", "def species\n @species = \"human\" #expect(owner.species).to eq(\"human\")\n #expect { owner.species = \"hamster\" }.to raise_error\n end", "def set_species\n @species_selected = Species.friendly.find(params[:id])\n end", "def set_species\n @species = Species.find(params[:id])\n end", "def sexual_species\n species = Array.new\n\n mobs.each do |mob|\n species << mob.specie if not mob.asexual?\n end\n\n return species.uniq\n end", "def specieslist\n temp = Species.all\n array = []\n temp.each do |r|\n if r.english_name.present?\n array.push(r.english_name.to_s + \"/\" + r.scientific_name.to_s)\n else \n array.push(\"No common name/\" + r.scientific_name.to_s)\n end\n end\n sorted = array.sort\n return sorted.insert(0,\"Select species\")\n end", "def species_list_from_criteria\n show_seen = Settings::SPECIES_SHOWN == 'Seen'\n show_captured = Settings::SPECIES_SHOWN == 'Owned'\n return (1..GameData::Pokemon::LAST_ID).select do |i|\n next(false) if show_seen && !$pokedex.has_seen?(i)\n next(false) if show_captured && !$pokedex.has_captured?(i)\n next(false) if Settings::BLACK_LIST.include?(i) || Settings::BLACK_LIST.include?(GameData::Pokemon.db_symbol(i))\n\n next(true)\n end\n end", "def species(year = Time.zone.now.year)\n bg_species = Species.joins(birds: {user: :subscriptions})\n .with_translations([I18n.locale])\n .where(\"(birds.published = 'true') AND (birds.species_id IS NOT NULL) AND (birds.expert_id IS NOT NULL) \")\n .where('birds.big_year = ?', year)\n .where('subscriptions.year = ?', year)\n .distinct('species.id')\n bg_species.sort_by { |s| s.name } #TODO:: user sql order\n end", "def say_species \n \"I am a \" + \"#{@species}\" + \".\"\n end", "def initialize(species)\n @species = species\n @@all << self\n @pets = {fishes: [], dogs: [], cats: []}\n end", "def initialize(species)\n @species = species\n @pets = {fishes: [], cats: [], dogs: []}\n @name = name\n @@all << self \n end", "def find_by_species(species)\n self.animals.select do |animal|\n #binding.pry\n animal.species == species \n end\n end", "def make_species\n EndangeredSpecies::Scraper.new.make_species\n end", "def find_by_species(spec)\n animals.select {|animal| animal.species == spec}.uniq\n end", "def find_by_species(species)\n Animals.select {|animal| animal.species == species }\n end", "def set_Species(value)\n set_input(\"Species\", value)\n end", "def colonies\n # look at the single src of truth for the colonies\n Colony.all.select do |colony_instance|\n # pick the ones that belong to me\n colony_instance.alien_species == self\n end\n end", "def pbHasEgg?(species)\n if species.is_a?(String) || species.is_a?(Symbol)\n species=getID(PBSpecies,species)\n end\n evospecies=pbGetEvolvedFormData(species)\n compatspecies=(evospecies && evospecies[0]) ? evospecies[0][2] : species\n dexdata=pbOpenDexData\n pbDexDataOffset(dexdata,compatspecies,31)\n compat1=dexdata.fgetb # Get egg group of this species\n dexdata.close\n return false if compat1==13 || compat1==15 # Ditto or can't breed\n baby=pbGetBabySpecies(species)\n return true if species==baby # Is a basic species\n baby=pbGetNonIncenseLowestSpecies(baby)\n return true if species==baby # Is an egg species without incense\n return false\nend", "def initialize(species)\n #super() #parentheses are indicating super is being called with no argument\n @species = species\n #@owner = owner #reader/writer methods are created above, don't need anything here\n #@name = name\n #@mood = mood\n @pets = {fishes: [], dogs: [], cats: []}\n # @pets = {:fishes => [], :dogs => [], :cats => []}\n ALL << self #keeps track of the owners (species?) that have been created\n end", "def all_species\n return species if species.present?\n Species.joins(:geo_entities).where(geo_entities: { id: countries.map(&:id) })\n end", "def find_by_species(species)\n self.animals().select() { | animal | animal.species == species }\n end", "def supply_implicit_species(str)\n if str.sub!(/^(subsp|ssp)\\.? +/, '')\n @@last_species ? @@last_species + ' subsp. ' + str : ''\n elsif str.sub!(/^(var|v)\\.? +/, '')\n @@last_subspecies ? @@last_subspecies + ' var. ' + str :\n @@last_species ? @@last_species + ' var. ' + str : ''\n elsif str.sub!(/^(forma?|f)\\.? +/, '')\n @@last_variety ? @@last_variety + ' f. ' + str :\n @@last_subspecies ? @@last_subspecies + ' f. ' + str :\n @@last_species ? @@last_species + ' f. ' + str : ''\n else\n str\n end\n end", "def get_name(pokemon)\n pokemon['species']['name']\nend", "def disp_animals\n @animals.each do |animal|\n puts \"Name: #{animal.name}\"\n puts \"Species: #{animal.species}\"\n end\n end", "def page_kind\n \"species\"\n end", "def add_species(name, initvalue = 0, description = \"\")\n\t\t\tif (@parameters.key? name) or (@species.key? name)\n\t\t\t\traise \"duplicate symbol #{name}\"\n\t\t\tend\n\n\t\t\tmax_matlab_no = @species.inject(1) do |mval, s|\n\t\t\t\t[mval, s[1].matlab_no].max\n\t\t\tend\n\n\t\t\t@species[name] = Species.new(name, initvalue, max_matlab_no+1)\n\n\t\t\tself.validate\n\t\tend", "def say_species\n return \"I am a human.\" #expect(owner.say_species).to eq(\"I am a human.\")\n end", "def get_type(dinosaur_objects)\n Array(dinosaur_objects).map do |d|\n CARNIVORES.include?(d.species) ? 'carnivore' : 'herbivore'\n end\n end", "def nature; end", "def pbHasEgg?(species)\n if species.is_a?(String) || species.is_a?(Symbol)\n species = getID(PBSpecies,species)\n end\n # species may be unbreedable, so check its evolution's compatibilities\n evospecies = pbGetEvolvedFormData(species)\n compatspecies = (evospecies && evospecies[0]) ? evospecies[0][2] : species\n dexdata = pbOpenDexData\n pbDexDataOffset(dexdata,compatspecies,31)\n compat1 = dexdata.fgetb # Get egg group 1 of this species\n compat2 = dexdata.fgetb # Get egg group 2 of this species\n dexdata.close\n return false if isConst?(compat1,PBEggGroups,:Ditto) ||\n isConst?(compat1,PBEggGroups,:Undiscovered) ||\n isConst?(compat2,PBEggGroups,:Ditto) ||\n isConst?(compat2,PBEggGroups,:Undiscovered)\n baby = pbGetBabySpecies(species)\n return true if species==baby # Is a basic species\n baby = pbGetBabySpecies(species,0,0)\n return true if species==baby # Is an egg species without incense\n return false\nend", "def sites_by_species\n respond_to do |format|\n format.html \n end\n end", "def birds\n nests.map do |nest|\n nest.bird.species\n end\n end", "def initialize species, name=nil\n\n # go into parent and treat name how it would be treated if this were an Animal:\n super(name)\n\n @species = species\n end", "def index\n @species = Species.all\n end", "def index\n @species = Species.all\n end", "def initialize(species)\n @pets={\n :fishes => [],\n :dogs => [],\n :cats => []\n }\n @species = species\n @@owners << self\n end", "def species_params\n params.require(:species).permit(:name, :scientific_name)\n end", "def species_url()\n\t\t@species = @pokemon_api[\"species\"][\"url\"]\n\t\treturn @species\n\tend", "def variety; end", "def variety; end", "def show\n @species = Specie.find(params[:id])\n\n @pets = Pet.where(:specie_id => @species).all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:secie => @species, :pets => @pets } }\n end\n end", "def initialize(species)\n @species = species\n#is initialized with a pets attribute as a hash with 3 keys\n @pets = {:fishes => [], :dogs => [], :cats => []}\n #keeps track of the owners that have been created\n @@owners << self\n end", "def show\n @species = Species.find(params[:id])\n @animals = Animal.where(:species_id => @species.id).order(\"name ASC\")\n \n respond_with(@species)\n end", "def species_request(pokemon_data)\n\t\tspecies_request = HTTParty.get(pokemon_data.species_url)\n\t\tspecies = PokeapiSpecies.new(species_request)\n\t\treturn species\n\tend", "def visible_families\n # right now the count is the number of species\n TaxonName.find_by_sql(\n \"SELECT p.*, count(*) as count FROM \n (SELECT * FROM taxon_names t WHERE t.iczn_group = 'family' AND RIGHT(t.name,4) = 'idae') AS p\n LEFT JOIN \n (SELECT id, l, r FROM taxon_names t2 WHERE #{self.sql_for_taxon_names('t2', :public)} AND iczn_group = 'species') AS c \n ON p.l < c.l AND p.r > c.r\n WHERE c.id IS NOT NULL \n GROUP BY p.id ORDER BY name\") \n end", "def show\n @species = Species.find_by_name(params[:species_name])\n @pet = Pet.first(:conditions => ['species_id = ? AND regid = ?', @species.id, params[:regid]])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pet }\n end\n end", "def species_params\n params.require(:species).permit(:name, :ferociousness, :vegetarian)\n end", "def show\n @species = Species.find(params[:id])\n @animals = Animal.where(species_id: @species.id).order('name ASC')\n\n respond_with(@species)\n end", "def parameter_to_species(pname)\n\t\t\traise \"Unknown parameter #{pname}\" if not @parameters.key?(pname)\n\t\t\tmatlab_number = @species.values.inject (1) { |mem, var| mem < var.matlab_no ? var.matlab_no + 1 : mem }\n\t\t\traise \"Species #{pname} already exists, cannot replace.\" if @species.key?(pname)\n\n\t\t\tp = @parameters.delete pname\n\t\t\tspec = Species.new(pname, p.value, matlab_number)\n\t\t\t@species[pname] = spec\n\n\t\t\tself.validate\n\t\t\tspec\n\t\tend", "def new\n @animal = Animal.new\n @zoo = Zoo.find(params[:zoo_id])\n @species = ['Lion', 'Koala', 'Panda']\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @animal }\n end\n end", "def my_pets_name(a)\n a.each do |name|\n if name[0] == \"S\" \n puts \"My name starts with an S for super!\"\n else\n puts \"I'm still pretty special too!\"\n end\n end\nend", "def unusual_sport; end", "def show\n dinosaurs = Dinosaur.filter_by_species(params[:species])\n\n if dinosaurs\n render json: dinosaurs\n else\n render json: dinosaurs.errors, status: :unprocessable_entity\n end\n end", "def species_params\n params.require(:species).permit(:name, :classification, :designation, :average_height, :average_lifespan, :eye_colors, :hair_colors, :skin_colors, :language, :homeworld)\n end", "def initialize(name)\n @pets = {fishes: [], cats: [], dogs: []}\n @@owners << self\n @species = \"human\" \n end", "def feruchemist; end", "def half_life(species=nil)\n n_end = @seq[0].chr.to_sym\n if species\n HALFLIFE[species][n_end]\n else\n {\n :ecoli => HALFLIFE[:ecoli][n_end],\n :mammalian => HALFLIFE[:mammalian][n_end],\n :yeast => HALFLIFE[:yeast][n_end]\n }\n end\n end", "def breed; end", "def masteries; end", "def create_species_and_data\n # Entrance message\n puts \"** Creating new species from lifeviz/ubiota files using hagrid_ubid as the bridge\"\n puts \" Note! New species are species with data imported from lifeviz. Orphaned species \"\n puts \" are ubiota species with no associated lifeviz data.\"\n new_species = []\n orphaned_species = []\n \n # Open files\n lifeviz, ubiota, map = nil\n seed \"Opening data files\" do\n lifeviz = IO.popen(\"bunzip2 -c #{LIFEVIZ}\")\n ubiota = IO.popen(\"bunzip2 -c #{UBIOTA}\")\n map = IO.readlines(LIFEVIZ_UBIOTA)\n lifeviz && ubiota && map ? true : false\n end\n\n # Dump all species\n seed \"Removing existing species.\"\n progress \"Deleting\", Species.count do |progress_bar|\n Species.all.each do |species|\n species.delete\n progress_bar.inc\n end\n end\n\n # Dump all related data\n seed \"Removing any existing age, litter sizes, adult weights, birth weights data\" do\n Lifespan.delete_all && LitterSize.delete_all && AdultWeight.delete_all && BirthWeight.delete_all ? true : false\n end\n\n # Load taxon from lifeviz, let's use hpricot\n lifeviz_species, lifeviz_ages, lifeviz_development, lifeviz_refs = nil\n seed \"Loading lifeviz data with hpricot\" do\n doc = Hpricot::XML(lifeviz)\n lifeviz_species = (doc/'names')\n lifeviz_ages = (doc/'age')\n lifeviz_development = (doc/'development')\n lifeviz_refs = (doc/'refs')\n (lifeviz_species.size > 0 && lifeviz_ages.size > 0 && lifeviz_development.size > 0 && lifeviz_refs.size > 0) ? true : false\n end\n notice \"#{lifeviz_species.size} species loaded with #{lifeviz_ages.size} ages\"\n\n # Create new species array to load lifeviz species and attributes we want\n seed \"Loading new species and storing lifeviz data from lifeviz dump\"\n development_index = ref_index = 0\n progress \"Storing\", lifeviz_species.length do |progress_bar|\n lifeviz_species.each_with_index do |s, index|\n hagrid = (s/'id_hagr').inner_html.to_i\n x = {}\n x[:synonyms] = (s/'name_common').inner_html\n x[:age] = (lifeviz_ages[index]/'tmax').inner_html\n x[:context] = (lifeviz_ages[index]/'phenotype').inner_html\n x[:hagrid] = hagrid\n x[:references] = x[:context].scan(/\\[(\\d*)\\]/).flatten\n \n while lifeviz_development[development_index] && (lifeviz_development[development_index]/'hagrid').inner_html.to_i < hagrid\n notice \"#{(lifeviz_development[development_index]/'hagrid').inner_html} is less than #{hagrid}\"\n development_index += 1\n end\n # development attributes matches the current species id\n if lifeviz_development[development_index] && (lifeviz_development[development_index]/'hagrid').inner_html.to_i == hagrid\n development = lifeviz_development[development_index]\n if development && (development/'hagrid').inner_html.to_i == hagrid\n x[:adult_weight] = (development/'adult_weight').inner_html.blank? ? \"\" : (development/'adult_weight').inner_html.to_f\n x[:birth_weight] = (development/'birth_weight').inner_html.blank? ? \"\" : (development/'birth_weight').inner_html.to_f\n x[:litter_size] = (development/'litter_size').inner_html.blank? ? \"\" : (development/'litter_size').inner_html.to_f\n else\n x[:adult_weight] = \"\"\n x[:birth_weight] = \"\"\n x[:litter_size] = \"\"\n end\n development_index += 1\n end\n new_species << x\n progress_bar.inc\n end\n end\n notice \"#{new_species.length} new species stored\"\n\n # Load ubid ids into new species from mapping\n seed \"Loading mapped ubiota ids into new species\" do\n new_species_pointer = 0\n map.each do |line|\n hagrid, ubid = line.split(/\\s+/)\n while new_species[new_species_pointer] && hagrid.to_i != new_species[new_species_pointer][:hagrid]\n new_species_pointer += 1\n end\n new_species[new_species_pointer][:ubid] = ubid.to_i if new_species[new_species_pointer]\n end\n end\n\n # Remove any new species that have no ubid from mapping\n count = new_species.size\n seed \"Delete any new species that do not have a ubiota id mapped\", \n :success => \"Mappings completed\", \n :failure => \"No species had mappings\" do\n new_species.delete_if { |species| species[:ubid] == nil }\n new_species.length != 0 ? true : false\n end\n notice \"deleted #{count - new_species.size} species, #{new_species.size} remaining\"\n\n # Sort species by ubid\n seed \"Sorting new species by ubid\" do\n new_species = new_species.sort_by { |each| each[:ubid] }\n true\n end\n\n # Find and load ubiota genus ids and species name for each species\n # Ensure the rank is 6 (species level)\n # Set taxon_id to nil if the species inside ubiota doesn't exist\n seed \"Looking up and loading each new species' genus id from the ubiota data\"\n x = 0\n a_couple = 0\n num_lines = num_lines_bz2(UBIOTA)\n progress \"Matching\", num_lines do |progress_bar|\n ubiota.each do |line|\n id, term, rank, hierarchy, parent_id, num_children, hierarchy_ids = line.split(\"|\")\n # skip if we're not looking at a species level taxon\n if rank.to_i != 6\n progress_bar.inc\n next\n end\n if new_species[x].nil? || id.to_i != new_species[x][:ubid]\n y = {:taxon_id => parent_id.to_i, :name => term.to_s}\n orphaned_species << y\n if !new_species[x].nil? then new_species[x][:taxon_id] = nil end\n if !new_species[x].nil? && id.to_i > new_species[x][:ubid] then x += 1 end\n else\n new_species[x][:taxon_id] = parent_id.to_i\n new_species[x][:name] = term.to_s\n x += 1\n end\n progress_bar.inc\n end\n end\n notice \"traversed #{x} new species and #{orphaned_species.size} orphaned species\"\n\n # Remove any new species that has no genus in ubiota\n count = new_species.size\n seed \"Delete any species that had no genus id\" do\n new_species.delete_if { |species| species[:taxon_id] == nil }\n end\n notice success_string(\"deleted #{count - new_species.size} species, #{new_species.size} remaining\")\n\n # Remove any orphaned species that has no genus in ubiota\n count = orphaned_species.size\n seed \"Delete any orphaned species that had no genus id\" do\n orphaned_species.delete_if { |species| species[:taxon_id] == 0 }\n end\n notice success_string(\"deleted #{count - orphaned_species.size} species, #{orphaned_species.size} remaining\")\n\n # Create species with all the new species stored in memory\n count = species_without_parents = 0\n seed \"Saving all of the new species.\"\n\n progress \"Species\", new_species.length do |progress_bar|\n new_species.each_with_index do |taxon, index|\n s = new_species[index]\n species = Taxon.new(:name => s[:name], :parent_id => s[:taxon_id], :rank => 6, :id => s[:ubid])\n species.send(:create_without_callbacks)\n # # This was commented out because we're using Cera's lifespan data now.\n # unless s[:age].blank?\n # s[:references].each do |reference_id|\n # lifespan = Lifespan.new(:value_in_days => (s[:age].to_f * 365), :units => \"Years\", :species_id => species.id)\n # lifespan.context = s[:context]\n # lifespan.citation = Reference.find(reference_id).to_s\n # lifespan.created_by = ANAGE_USER_ID\n # lifespan.created_by_name = ANAGE_USER_NAME\n # lifespan.send(:create_without_callbacks)\n # end\n # end\n BirthWeight.new(\n :value_in_grams => (s[:birth_weight]),\n :units => \"Grams\",\n :species_id => species.id,\n :created_by => ANAGE_USER_ID,\n :created_by_name => ANAGE_USER_NAME\n ).send(:create_without_callbacks) unless s[:birth_weight].blank?\n AdultWeight.new(\n :value_in_grams => (s[:adult_weight]),\n :units => \"Grams\",\n :species_id => species.id,\n :created_by => ANAGE_USER_ID,\n :created_by_name => ANAGE_USER_NAME\n ).send(:create_without_callbacks) unless s[:adult_weight].blank?\n LitterSize.new (\n :value => (s[:litter_size]),\n :species_id => species.id,\n :created_by => ANAGE_USER_ID,\n :created_by_name => ANAGE_USER_NAME\n ).send(:create_without_callbacks) unless s[:litter_size].blank?\n count = index\n progress_bar.inc\n end\n end\n notice success_string(\"saved #{count - species_without_parents} species\")\n notice success_string(\"saved #{Lifespan.count} ages\")\n notice success_string(\"saved #{AdultWeight.count} adult weights\")\n notice success_string(\"saved #{BirthWeight.count} birth weights\")\n notice success_string(\"saved #{LitterSize.count} litter sizes\")\n notice failure_string(\"#{species_without_parents} species didn't have taxons matching taxon_id in our database\") if species_without_parents != 0\n\n # Create orphaned species with all the species stored in memory\n count = 0\n species_without_parents = 0\n seed \"Saving all the orphaned species\"\n progress \"Saving orphans\", orphaned_species.length do |progress_bar|\n orphaned_species.each_with_index do |s, index|\n taxon = Taxon.find_by_id(s[:taxon_id])\n if taxon == nil\n # notice failure_string(\"no taxon found with an id of #{s[:taxon_id].to_s} for species with ubid of #{s[:ubid].to_s}\")\n species_without_parents += 1\n else\n species = Taxon.new(:name => s[:name], :parent_id => taxon.id, :rank => 6)\n species.send(:create_without_callbacks)\n end\n count = index\n progress_bar.inc\n end\n end\n notice success_string(\"Phew!... saved #{count - species_without_parents} species\")\n notice failure_string(\"#{species_without_parents} species didn't have taxons matching taxon_id in our database\") if species_without_parents != 0\n\n seed \"Rebuilding heirarchical tree\" do\n Taxon.rebuild!\n end\n\n seed \"Vacuuming database\" do\n SQL.execute \"VACUUM ANALYZE;\"\n end\n\n notice \"Species creation is completed.\"\nend", "def list_all_animals(shelter)\n\n if shelter.animals.any?\n puts \"*** List of all animals ***\"\n shelter.animals.each do |key, x|\n puts \"Name: #{x.name}, Breed: #{x.breed}, Gender: #{x.gender}, Age: #{x.age}, Toys: #{x.toys.join(', ')}, Adoption: #{x.adoption}\"\n end\n else\n puts \"We have no animals left!\"\n end\n\nend", "def report_fitness_species\n {\n best: nil,\n worst: nil,\n }\n end" ]
[ "0.84190065", "0.7744776", "0.75514287", "0.74733233", "0.7355666", "0.7302519", "0.72231865", "0.71760464", "0.6984552", "0.6973812", "0.6934181", "0.69275105", "0.6919332", "0.68672186", "0.6851043", "0.68190217", "0.6774306", "0.67444944", "0.6736337", "0.668365", "0.6671612", "0.66606826", "0.66575724", "0.66575724", "0.66575724", "0.6642338", "0.65170026", "0.65170026", "0.65170026", "0.6511183", "0.6510704", "0.65010583", "0.6485833", "0.6418712", "0.6406173", "0.6394453", "0.63285613", "0.63285613", "0.6305344", "0.62688303", "0.6259909", "0.6235105", "0.6224077", "0.6201084", "0.6166451", "0.61110055", "0.6110391", "0.61099464", "0.6100527", "0.6040596", "0.60022104", "0.59922236", "0.596323", "0.59577984", "0.59555614", "0.5941879", "0.59288716", "0.59122133", "0.5871169", "0.5850664", "0.58390194", "0.5835169", "0.5816077", "0.5805359", "0.57989216", "0.5768659", "0.57625747", "0.5715097", "0.5705717", "0.5700066", "0.5690394", "0.56809574", "0.56809574", "0.5669064", "0.5647716", "0.5642084", "0.5636742", "0.5636742", "0.55874896", "0.55773735", "0.5569486", "0.5529357", "0.55106014", "0.5496604", "0.54955006", "0.54890287", "0.546357", "0.54552114", "0.5396194", "0.5392398", "0.5378562", "0.5372095", "0.53424084", "0.5340276", "0.5324589", "0.5317003", "0.5307156", "0.53037626", "0.52898425", "0.5281313" ]
0.64362246
33
can buy a fish that is an instance of the Fish class
def buy_fish(name) #knows about its fishes pets[:fishes] << Fish.new(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buy_fish(name)\n new_fish = Fish.new(name)\n if new_fish.class == Fish\n @pets[:fishes] << new_fish\n end \n end", "def buy_fish(name) # expect(owner.pets[:fishes].count).to eq(0)\n new_fish = Fish.new(name) # owner.buy_fish(\"Bubbles\")\n self.pets[:fishes] << new_fish # owner.pets[:fishes].each { |fish| expect(fish).to be_a(Fish)}\n new_fish # expect(owner.pets[:fishes].count).to eq(1)\n # = knows about its fishes; Owner knows all about its pets - Owner sets name of pet, the pet can\\'t change its name\n # owner.buy_fish(\"Bubbles\")\n # expect(owner.pets[:fishes][0].name).to eq(\"Bubbles\")\n end", "def buy_fish(fish_name)\n fish = Fish.new(fish_name)\n self.pets[:fishes] << fish\n end", "def buy_fish(name)\n fish = Fish.new(name)\n @pets[:fishes] << fish\n end", "def buy_fish(name)\n fish = Fish.new(name)\n @pets[:fishes] << fish\n end", "def buy_fish(name)\n pets[:fishes] << Fish.new(name)\n end", "def buy_fish(name)\n @pets[:fishes] << Fish.new(name)\n end", "def buy_fish(name)\n new_fish = Fish.new(name)\n self.pets[:fishes] << new_fish \n end", "def buy_fish(name)\n pets[:fishes] << Fish.new(name)\nend", "def new\n @fish.Fish.new\n end", "def eat_fish(fish)\n @stomach << fish\n end", "def test_bear_take_fish\n @river1.add_fish(@fish1)\n @river1.add_fish(@fish2)\n @bear1.bear_take_fish(@fish1)\n assert_equal(1,@bear1.check_stomach)\n end", "def buy_dog(dog_name)\n new_dog = Dog.new(dog_name, self)\nend", "def test_bear_take_fish\n @bear1 = Bears.new(\"Nate\",\"brown\")\n @river1.add_fish(@fish1)\n @river1.add_fish(@fish2)\n @bear1.bear_take_fish(@fish1)\n @river1.lose_fish(@fish1)\n assert_equal(1,@river1.check_fish)\n assert_equal(1,@bear1.check_stomach)\n end", "def set_fish\n @fish = Fish.find(params[:id])\n end", "def set_fish\n @fish = Fish.find(params[:id])\n end", "def set_fish\n @fish = Fish.find(params[:id])\n end", "def set_fish\n @fish = Fish.find(params[:id])\n end", "def set_fish\n @fish = Fish.find(params[:id])\n end", "def set_fish\n @fish = Fish.find(params[:id])\n end", "def buy_dog(name)\n Dog.new(name,self)\n end", "def buy_cat(name)\n Cat.new(name, self)\nend", "def test_bear_can_Add_fish_to_stomach\n fish = Fish.new(\"Marley\") # take in a new fish\n @bear.eats_fish(fish) #bear is going to take in the fish it wants to eat\n assert_equal(1, @bear.count_stomach)\n # remove fish from River\n end", "def buy_dog(name)\n new_dog = Dog.new(name,self)\n end", "def add_food\n srand\n self << FishFood.new(Position.new([randomFloatSigned*2,1,randomFloatSigned]))\n end", "def buy_dog(name)\n Dog.new(name, self)\n end", "def buy_dog(name)\n Dog.new(name, self)\n end", "def buy_cat(name)\n new_cat = Cat.new(name, self)\nend", "def get_fish\n\t# Return the current fish to eat\n\treturn $cur_fish\nend", "def test_take_fish_from_river\n @bear.take_fish_from_river(@river)\n assert_equal(1, @bear.food_count)\n end", "def loose_fish_when_bear_takes_it(fish)\n\n end", "def add_fish (fish)\n @fish_population << fish\n\n end", "def buy_dog(name)\n dog = Dog.new(name, self)\n end", "def cook\n @burger.thaw\n @burger.make_patty\n @burger.grill\n end", "def buy_dog(dog_name)\n new_dog = Dog.new(dog_name, self)\n # tommy.buy_cat(\"Garfield\")\n end", "def river_held_fish(fish)\n @fish << Fish_name\nend", "def take_fish_from_river(river)\n fish = river.get_fish()\n @stomach << fish if !fish.nil?\n end", "def buy_dog(name)\n dog = Dog.new(name, self)\n @dogs << dog\n end", "def buy_dog(dog)\n new_dog = Dog.all.find do |dog_instance|\n dog_instance.name == dog \n end\n if new_dog \n Dog.new(new_dog.name, self)\n else \n brand_new_dog = Dog.new(dog, self)\n end \n end", "def look_for_food(fish)\n fish.stop_turn\n food_range = fish.food_perception\n food = food_around(fish.position, food_range)\n if food.size > 0 && !(fish.status==Escaping)\n food_found = food[0]\n if fish.position.distance(food_found.position) <= EatingAndMatingRange\n fish.consume(food_found)\n @food.delete(food_found)\n @food.compact!\n else\n fish.spot_food(food_found)\n end\n end\n end", "def test_bear_takes_fish_out_of_river\n @bear1.bear_catches_and_eats_fish(@river1)\n assert_equal(1,@bear1.amount_in_stomach())\n assert_equal(1,@river1.number_of_fishes())\n end", "def create\n if params[:tournament_id].present?\n @tournament = Tournament.find(params[:tournament_id])\n @fish = @tournament.fish.new(fish_params)\n else\n @fish = Fish.new(fish_params)\n end\n @fish.member = @current_member\n respond_to do |format|\n if @fish.save\n format.html { redirect_to @fish.tournament, notice: 'Fish was successfully created.' }\n format.json { render :show, status: :created, location: @fish }\n else\n format.html { render :new }\n format.json { render json: @fish.errors, status: :unprocessable_entity }\n end\n end\n end", "def fish_params\n params.require(:fish).permit(:name, :description, :price, :user_id)\n end", "def spot_food(food)\n @fish.direction = @fish.move_towards(food)\n @fish.status = Pursuing\n @fish.target = food\n end", "def take_fish_from_river(river)\n fish = river.get_fish#fish is a variable created just for function it grabs something from the 'get fish method in river'\n @bear_food<< fish unless fish.nil? #it then pushes it to the @food array\n end", "def new\n @dish_in_basket = DishInBasket.new\n end", "def can_buy?(item)\r\n item.buyable_by?(self)\r\n end", "def set_fish_product\n @fish_product = FishProduct.find(params[:id])\n end", "def create\n @fish = Fish.new(fish_params)\n\n respond_to do |format|\n if @fish.save\n format.html { redirect_to @fish, notice: 'Fish was successfully created.' }\n format.json { render :show, status: :created, location: @fish }\n else\n format.html { render :new }\n format.json { render json: @fish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fish = Fish.new(fish_params)\n\n respond_to do |format|\n if @fish.save\n format.html { redirect_to @fish, notice: 'Fish was successfully created.' }\n format.json { render :show, status: :created, location: @fish }\n else\n format.html { render :new }\n format.json { render json: @fish.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_buy_drink_from_pub\n pub = Pub.new(\"McCulls\", 0)\n drink = Drink.new(\"gin\", 5)\n\n @customer.buy_drink(drink)\n pub.serve_drink(drink)\n\n assert_equal(45, @customer.amount)\n assert_equal(5, pub.till)\n\n end", "def owner=(owner)\n @owner = owner\n owner.buy_fish(self) unless owner.pets[:fishes].include?(self)\n end", "def create\n @fish = Fish.new(fish_params)\n\n respond_to do |format|\n if @fish.save\n format.html { redirect_to @fish, notice: \"Fish was successfully created.\" }\n format.json { render :show, status: :created, location: @fish }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @fish.errors, status: :unprocessable_entity }\n end\n end\n end", "def buy_cat(name)\n Cat.new(name,self)\n end", "def buy_dog(dog_name)\n self.dogs << Dog.new(dog_name,self)\n end", "def buy!(qty, price)\n order = Fyb::Order.new qty, price, :buy\n order.perform\n end", "def loose_fish_when_bear_takes_it()\n @bear.add_to_stomach(@fish1)\n @river.loose_fish(@fish1)\n assert_equal(0,@river.fish_count())\n end", "def set_fish_type\n @fish_type = FishType.find(params[:id])\n end", "def buy_dog(name)\n#know sabout its dogs\n pets[:dogs] << Dog.new(name)\n end", "def create\n @fish = Fish.new(fish_params)\n @fish.user_id = current_user.id\n\n respond_to do |format|\n if @fish.save\n format.html { redirect_to @fish, notice: 'Fish was successfully created.' }\n format.json { render :show, status: :created, location: @fish }\n else\n format.html { render :new }\n format.json { render json: @fish.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_can_afford_buy_drink__true()\n customer = Customer.new(\"Jane\", 10, 25)\n drink = Drink.new(\"Beer\", 2, 6.4)\n assert_equal(true, customer.can_afford_buy_drink(drink))\nend", "def can_buy?(item)\n item.buyable_by?(self)\n end", "def buy_dog(new_name)\n # @dogs << Dog.new(name, self)\n Dog.new(new_name, self)\n end", "def feed_fish\n @pets[:fishes].each {|fish| fish.mood = \"happy\"}\n end", "def buy(movie)\n end", "def buy_dog(dog_name)\n dog = Dog.new(dog_name)\n self.pets[:dogs] << dog\n end", "def buy_car(customer_instance)\n self.customer_id = customer_instance.id\n self\n end", "def catch_fish\n inventory[:fish] += @skills[:fish]\n end", "def pick_up(item)\n @items.push(item) unless items_weight + item.weight > CAPACITY\n @equipped_weapon = item if item.is_a?(Weapon) \n if item.is_a?(BoxOfBolts) \n item.feed(self) if self.health <= 80\n end\n end", "def set_frozen_fish\n @frozen_fish = FrozenFish.find(params[:id])\n end", "def feed_fish\n self.pets[:fishes].each do |fish|\n fish.mood = \"happy\"\n end\n end", "def feed_fish\n @pets[:fishes].each { |fish| fish.mood = \"happy\"}\n end", "def feed_fish\n pets[:fishes].each do |fish|\n fish.mood = \"happy\"\n end\n end", "def buy_cat(name)\n #passing a name and this owner object into the cat object\n cat = Cat.new(name, self) \n @cats << cat\n \n end", "def eat_fish(fish)\n @empty_stomach << fish\n return @empty_stomach.count\n end", "def bought?\n # paym\n end", "def take_fish_from_river\n @stomach.concact(fish_count)\n end", "def initialize(name)\n @name = name\n @fishes = []\n end", "def hit_ebay\n self.gimmie_the_goods(self.ebay_grab)\n end", "def food_and_drink; end", "def eat(food)\n @stomach << food \n end", "def eat\n inventory[:fish] -= @daily_appetite = 10\n\n if inventory[:fish] < 0\n @alive = false\n inventory[:fish] = 0\n end\n end", "def attemp_buying\n\n end", "def eat_fish_from_river(fish, river)\n @stomach.push(fish)\n river.lose_fish(fish)\n end", "def test_bear_food_count\n @river.add_fish(@fish1)\n @river.add_fish(@fish2)\n @bear.fishes_for_fish(@river)\n @bear.bear_food_count\n assert_equal(1, @bear.stomach.count)\n end", "def action(**args)\n\t\t\targs[:player].decide(:consider_purchase, property: self) if args[:player].balance >= cost unless @owner\n\t\t\tsuper\n\t\tend", "def pick_up(item)\n expected_weight = items_weight + item.weight\n if expected_weight <= 250\n item.is_a?(Weapon) ? @equipped_weapon = item : items << item \n else\n return false\nend\nend", "def make_bike\n new_bike = Bike.new\n new_bike.brand = self\n end", "def buy_cat(name) # expect(owner.pets[:cats].count).to eq(0)\n new_cat = Cat.new(name) # owner.buy_cat(\"Crookshanks\")\n self.pets[:cats] << new_cat # owner.pets[:cats].each { |cat| expect(cat).to be_a(Cat) }\n new_cat # expect(owner.pets[:cats].count).to eq(1)\n # = knows about its cats; Owner knows all about its pets - Owner sets name of pet, the pet can\\'t change its name\n # owner.buy_cat(\"Crookshanks\")\n # expect(owner.pets[:cats][0].name).to eq(\"Crookshanks\")\n end", "def buy_cat(cat)\n new_cat = Cat.all.find do |cat_instance|\n cat_instance.name == cat \n end\n if new_cat \n Cat.new(new_cat.name, self)\n else \n brand_new_cat = Cat.new(cat, self)\n end \n end", "def buy_cat(cat_name)\n cat = Cat.new(cat_name)\n self.pets[:cats] << cat\n\n end", "def buy_new_item(item_to_buy, quantity, account)\n return false if item_to_buy.auction\n preowner = item_to_buy.owner\n\n if (Integer(item_to_buy.price*quantity) > self.credits and item_to_buy.currency == \"credits\") or Integer(item_to_buy.quantity)<quantity\n Activity.log(account, \"item_bought_failure\", item_to_buy, self)\n Activity.log(account, \"item_sold_failure\", item_to_buy, preowner)\n return false\n end\n\n\n if !item_to_buy.wishlist_users.empty? and item_to_buy.quantity == quantity and !item_to_buy.permanent\n item_to_buy.wishlist_users.each {|trader| trader.remove_from_wishlist(item_to_buy); item_to_buy.wishlist_users.delete(trader)}\n end\n\n Holding.ship_item(item_to_buy, item_to_buy.owner, self, quantity)\n Activity.log(account, \"item_bought_success\", item_to_buy, self)\n Activity.log(account, \"item_sold_success\", item_to_buy, preowner)\n Mailer.item_sold(preowner.e_mail, \"Hi #{preowner.name}, \\n #{self.name} bought your Item #{item_to_buy.name}.\n Please Contact him for completing the trade. His E-Mail is: #{self.e_mail}\")\n\n return true\n end", "def fish_params\n params.require(:fish).permit(:name, :age, :enjoys, :species)\n end", "def fish_params\n params.require(:fish).permit(:color_id, :weight, :over_28, :tournament_id, :member_id, :returned, :image, :remove_image)\n end", "def release_bike\n Bike.new\n end", "def buy_dog(name)\n dog = Dog.new(name)\n @pets[:dogs] << dog\n end", "def create\n @fishing_method = FishingMethod.new(params[:fishing_method])\n\n respond_to do |format|\n if @fishing_method.save\n format.html { redirect_to @fishing_method, notice: 'Fishing method was successfully created.' }\n format.json { render json: @fishing_method, status: :created, location: @fishing_method }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fishing_method.errors, status: :unprocessable_entity }\n end\n end\n end", "def fish_eaten(eat_fish)\n fish = find_fish(eat_fish)\n fishes.delete(fish)\nend", "def initialize (name) #when a fish is created in CL ie. f1 = Fish.new('nemo'), this method will autorun, and you have to give it a name\n puts 'new fish is born'\n # health = 10 # local\n @health = 10 # increases to an instance variable\n @speed = 5\n @name = name\n stomach = [ ]\n\n end", "def buy_tower(tower_class, position)\n Game.scene.selected_tower = Game.scene.create_tower(tower_class, position)\n @cash -= Game.scene.selected_tower.cost\n end" ]
[ "0.7967161", "0.78944397", "0.77852994", "0.75455475", "0.75455475", "0.7482519", "0.7419028", "0.7349827", "0.70923173", "0.649563", "0.62074906", "0.613948", "0.61235803", "0.6082435", "0.60732806", "0.60732806", "0.60732806", "0.60732806", "0.60732806", "0.60732806", "0.60529876", "0.6003487", "0.5994364", "0.5969084", "0.5960365", "0.5874293", "0.5874293", "0.5865911", "0.586451", "0.58630705", "0.5860917", "0.5851242", "0.5838083", "0.5812906", "0.58104646", "0.57951915", "0.5759274", "0.5755503", "0.5750249", "0.572429", "0.57165354", "0.57091516", "0.5675671", "0.5662667", "0.56478965", "0.5633105", "0.5624615", "0.56090915", "0.5607681", "0.5607681", "0.560654", "0.5597009", "0.5593217", "0.55919474", "0.5587251", "0.55861646", "0.5567657", "0.55540967", "0.55538017", "0.55482566", "0.5543201", "0.5540285", "0.553791", "0.55369073", "0.5535203", "0.55336106", "0.55291617", "0.55285794", "0.5525067", "0.5524974", "0.5523881", "0.55167645", "0.55161536", "0.55143714", "0.5511831", "0.5505302", "0.54979324", "0.54885685", "0.54777265", "0.5476174", "0.5464242", "0.5449801", "0.5448697", "0.5447118", "0.54458636", "0.54396343", "0.5438095", "0.54322433", "0.543186", "0.54287916", "0.5420453", "0.54193985", "0.5401388", "0.53885096", "0.53873515", "0.53819287", "0.53755975", "0.537479", "0.5368369", "0.5367256" ]
0.7594734
3
can buy a cat that is an instance of the Cat class
def buy_cat(name) #knows about its cats pets[:cats] << Cat.new(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buy_cat(name)\n Cat.new(name, self)\nend", "def buy_cat(name)\n Cat.new(name,self)\n end", "def buy_cat(name)\n new_cat = Cat.new(name, self)\nend", "def buy_cat(cat)\n new_cat = Cat.all.find do |cat_instance|\n cat_instance.name == cat \n end\n if new_cat \n Cat.new(new_cat.name, self)\n else \n brand_new_cat = Cat.new(cat, self)\n end \n end", "def buy_cat(name)\n Cat.new(name, self)\n end", "def buy_cat(name)\n Cat.new(name, self)\n end", "def buy_cat(name)\n Cat.new(name, self)\n end", "def buy_cat(name)\n Cat.new(name, self)\n end", "def buy_cat(name)\n #passing a name and this owner object into the cat object\n cat = Cat.new(name, self) \n @cats << cat\n \n end", "def buy_cat(name) # expect(owner.pets[:cats].count).to eq(0)\n new_cat = Cat.new(name) # owner.buy_cat(\"Crookshanks\")\n self.pets[:cats] << new_cat # owner.pets[:cats].each { |cat| expect(cat).to be_a(Cat) }\n new_cat # expect(owner.pets[:cats].count).to eq(1)\n # = knows about its cats; Owner knows all about its pets - Owner sets name of pet, the pet can\\'t change its name\n # owner.buy_cat(\"Crookshanks\")\n # expect(owner.pets[:cats][0].name).to eq(\"Crookshanks\")\n end", "def buy_cat(cat_name)\n Cat.new(cat_name, self)\n end", "def buy_cat(cat_name)\n cat = Cat.new(cat_name)\n self.pets[:cats] << cat\n\n end", "def buy_cat(cat_name)\n self.cats << Cat.new(cat_name,self)\n end", "def buy_cat(name)\n Cat.new(name, self)\n end", "def buy_cat(cat_name)\n new_cat = Cat.new(cat_name, self)\n # self.cats << new_cat\n # binding.pry\n end", "def buy_cat(name)\n cat = Cat.new(name)\n @pets[:cats] << cat\n end", "def buy_cat(name)\n pets[:cats] << Cat.new(name)\n end", "def meow # Define a method that allows any instance of Cat to meow\n puts \"meow!\"\n end", "def buy_dog(dog_name)\n new_dog = Dog.new(dog_name, self)\n # tommy.buy_cat(\"Garfield\")\n end", "def buy_dog(name)\n Dog.new(name,self)\n end", "def buy_dog(name)\n new_dog = Dog.new(name,self)\n end", "def buy_dog(dog_name)\n new_dog = Dog.new(dog_name, self)\nend", "def buy_dog(name)\n Dog.new(name, self)\n end", "def buy_dog(name)\n Dog.new(name, self)\n end", "def buy_dog(name)\n dog = Dog.new(name, self)\n @dogs << dog\n end", "def buy_fish(name)\n new_fish = Fish.new(name)\n if new_fish.class == Fish\n @pets[:fishes] << new_fish\n end \n end", "def buy_dog(name)\n dog = Dog.new(name, self)\n end", "def find_cat\n @cat = Cat.find(params[:cat_id])\n end", "def new\n @cat = Cat.new\n end", "def new\n @cat = Cat.new\n end", "def set_cat\n @cat = Cat.find(params[:id])\n end", "def buy_dog(name)\n#know sabout its dogs\n pets[:dogs] << Dog.new(name)\n end", "def buy_dog(dog_name)\n dog = Dog.new(dog_name)\n self.pets[:dogs] << dog\n end", "def set_cat\n @cat = Cat.find(params[:id])\n end", "def set_cat\n @cat = Cat.find(params[:id])\n end", "def cats\n #loop through .all class method for the class Cat\n #select the value for variable cat and return it to a new array\n #every time cat.owner == self is true\n Cat.all.select do |cat|\n #block determines true value\n cat.owner == self #returns if true\n end\n end", "def printCat(cat)\n puts cat.name \n puts cat.breed \n puts cat.poopSize \nend", "def buy_dog(dog_name)\n self.dogs << Dog.new(dog_name,self)\n end", "def buy_dog(dog)\n new_dog = Dog.all.find do |dog_instance|\n dog_instance.name == dog \n end\n if new_dog \n Dog.new(new_dog.name, self)\n else \n brand_new_dog = Dog.new(dog, self)\n end \n end", "def buy_dog(name)\n dog = Dog.new(name)\n @pets[:dogs] << dog\n end", "def cats \n Cat.all.select do |cat_instance|\n cat_instance.owner == self \n end\n end", "def cats\n\t\t# Note that you call upon the other class within this class.\n\t\tCat.all.select do |cat|\n\t\t\tcat.owner == self\n\t\tend\n\tend", "def buy_dog(name)\n pets[:dogs] << Dog.new(name)\n end", "def new\n @catogory = Catogory.new\n end", "def cats \n Cat.all.select {|one_cat| one_cat.owner == self} \n end", "def buy_dog(new_name)\n # @dogs << Dog.new(name, self)\n Dog.new(new_name, self)\n end", "def new\n @cat = Category.new\n end", "def cats_at_this_cafe\n Cat.all.select do |cat| \n cat.cafe == self \n end\n end", "def buy_fish(name)\n new_fish = Fish.new(name)\n self.pets[:fishes] << new_fish \n end", "def is_animal?\n @category_id == 1\n end", "def buy_fish(name) # expect(owner.pets[:fishes].count).to eq(0)\n new_fish = Fish.new(name) # owner.buy_fish(\"Bubbles\")\n self.pets[:fishes] << new_fish # owner.pets[:fishes].each { |fish| expect(fish).to be_a(Fish)}\n new_fish # expect(owner.pets[:fishes].count).to eq(1)\n # = knows about its fishes; Owner knows all about its pets - Owner sets name of pet, the pet can\\'t change its name\n # owner.buy_fish(\"Bubbles\")\n # expect(owner.pets[:fishes][0].name).to eq(\"Bubbles\")\n end", "def find_owner_cat\n @cat = @owner.cats.find_by!(id: params[:id]) if @owner\n end", "def cats\n Cat.all.select do |cat| \n cat.owner == self \n end \n end", "def set_cat_item\n @cat_item = CatItem.find(params[:id])\n end", "def new\n # category instance\n @category = Category.new\n end", "def category\n adventure.category\n end", "def cats\n Cat.all.select {|cat| cat.owner == self}\n end", "def buy_fish(fish_name)\n fish = Fish.new(fish_name)\n self.pets[:fishes] << fish\n end", "def test_multiples_non_objectable_types_with_default_new_method\n cat1 = 'Amelia'\n cat2 = 'Gorbypuff'\n cats = [cat1, cat2]\n test_object = ObjTestClasses::TestObject.new(menagerie: cats)\n\n test_object.menagerie.each do |animal|\n assert_instance_of(ObjTestClasses::Cat, animal)\n end\n\n cats.each do |cat|\n assert_includes(test_object.menagerie, ObjTestClasses::Cat.new(cat))\n end\n end", "def cats\n Cat.all.select do |cat|\n cat.owner == self\n end\n end", "def create\n @cat = Cat.new(catparams)\n if @cat.save\n redirect_to @cat\n else\n render 'new'\n end\n end", "def set_category\n @category = GoodCategory.find(params[:id])\n end", "def buy_pet(pet)\n self.pets.push(pet)\n pet.owner = self\n end", "def set_cat2\n @cat2 = Cat2.find(params[:id])\n end", "def can_sell_drug?(drug)\n drug.can_be_sold?\n end", "def buy_fish(name)\n fish = Fish.new(name)\n @pets[:fishes] << fish\n end", "def buy_fish(name)\n fish = Fish.new(name)\n @pets[:fishes] << fish\n end", "def find_cat_fact\n @fact = @cat.facts.find_by!(id: params[:id]) if @cat\n end", "def cats\n Cat.all.select { |cats| cats.owner == self }\n end", "def check_category!\n if self.category and (not self.category.saved?) and loaded = BookingCategory.get(self.category.code)\n self.category = loaded\n end\n if self.rental_storage and (not self.rental_storage.saved?) and loaded = RentalStorage.get(self.rental_storage.id)\n self.rental_storage = loaded\n end\n end", "def category_new\n @finance_transaction_category = FinanceTransactionCategory.new\n end", "def category_type\n object.category.main_cat\n end", "def type\n self.category\n end", "def valid_fee_amort_category?(cat)\n cats = Ext::FeeAmortization::FEES.map(&:classify).map(&:to_s)\n cats << \"TranchePeggedItem\"\n cats.include?(cat.to_s)\n end", "def buy_fish(name)\n#knows about its fishes\n pets[:fishes] << Fish.new(name)\n end", "def buy_fish(name)\n @pets[:fishes] << Fish.new(name)\n end", "def create\n\t\t@cat = Cat.new(cat_params)\n\n\t\tif @cat.save\n\t\t\t# cat_url(@cat) == /cat/{@cat.id}\n\t\t\tredirect_to cat_url(@cat)\n\t\telse\n\t\t\trender :new\n\t\t\t# render json: @cat.errors.full_messages, status: :unprocessable_entity\n\t\tend \n\tend", "def set_vendor_cat\n @vendor_cat = VendorCat.find(params[:id])\n end", "def create\n @cat = Cat.new(cat_params)\n if @cat.save # this actually runs the cat.save function and then asks whether or not it is true or false\n redirect_to cat_path(@cat)\n else\n render :new\n end\n end", "def set_cat_blok\n @cat_blok = CatBlok.find(params[:id])\n end", "def category_produits?()\n return (self.category.code.eql?('produits_phyto')) \n end", "def create\n @cat = Cat.new(cat_params)\n @cat.user = current_user\n respond_to do |format|\n if @cat.save\n format.html { redirect_to @cat, notice: 'Cat was successfully created.' }\n format.json { render :show, status: :created, location: @cat }\n else\n format.html { redirect_to new_cat_path }\n format.json { render json: @cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def category\n\n User.find(@toko.user_id).produks.each do |produk|\n @cat = produk.category_id\n end\n end", "def make_bike\n new_bike = Bike.new\n new_bike.brand = self\n end", "def new\n \t@category =Category.new\n end", "def category\n self.item.category\n end", "def buy_fish(name)\n pets[:fishes] << Fish.new(name)\nend", "def new\n \t@category = Category.new\n end", "def category; end", "def create\n @cat = Cat.new(params[:cat])\n\n respond_to do |format|\n if @cat.save\n format.html { redirect_to @cat, notice: 'Cat was successfully created.' }\n format.json { render json: @cat, status: :created, location: @cat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def sell_pet_to_customer(petshop,pet,customer)\n\n if (customer[:cash] >= pet[:price]) #&& (petshop[:pets][:name] == pet[:name])\n customer[:pets].push(pet[:name])\n end\n # return customer[:pets].count()\n end", "def can_buy?(item)\r\n item.buyable_by?(self)\r\n end", "def cards_in_category(sel_category)\n @cards.select do |card|\n card.category == sel_category\n end\n end", "def category\n ActiveModel::SerializableResource.new(object.category, each_serializer: CategoriesSerializer)\n end", "def set_cathegory\n @cathegory = Cathegory.find(params[:id])\n end", "def get_category\n @category = Category.find(params[:id])\nend", "def initialize(type)\n @type = type\n @age = 0\n @@cats_count += 1 # it will plus 1 each time Cat class is initialized.\n end", "def show\n @catogory = Catogory.find(params[:id])\n end", "def show\n @category = @item.category\n end", "def add_cat(name_en, name_nl)\n c = Category.new(name_en: name_en, name_nl: name_nl)\n c.save!\nend" ]
[ "0.8031626", "0.80213755", "0.7957559", "0.7927969", "0.78073686", "0.78073686", "0.78073686", "0.78073686", "0.77966946", "0.76843864", "0.767793", "0.7645743", "0.7633575", "0.75818765", "0.7540874", "0.7491801", "0.73057586", "0.6704045", "0.6449017", "0.63298976", "0.6223923", "0.6223242", "0.6143673", "0.6143673", "0.61368126", "0.6120572", "0.61107415", "0.61092293", "0.6102639", "0.6102639", "0.60892653", "0.6034222", "0.60253257", "0.6025071", "0.6025071", "0.60100865", "0.6005032", "0.6002362", "0.5988458", "0.59528553", "0.593769", "0.5902124", "0.5831739", "0.58267146", "0.58132315", "0.581152", "0.5768435", "0.576587", "0.5742228", "0.5726477", "0.5718299", "0.57125443", "0.5689005", "0.5670808", "0.56472886", "0.5643754", "0.5630674", "0.5617609", "0.55683607", "0.5566006", "0.5556273", "0.55434024", "0.549425", "0.5475819", "0.5475615", "0.5467513", "0.5467513", "0.5458183", "0.5430512", "0.5429596", "0.54243326", "0.5420506", "0.5416266", "0.54095185", "0.5408325", "0.5406707", "0.5395824", "0.5390781", "0.53721035", "0.5361144", "0.5355211", "0.53409374", "0.531663", "0.53136367", "0.53124446", "0.5307307", "0.5291121", "0.5288884", "0.527829", "0.52739197", "0.52697164", "0.5264571", "0.5262077", "0.524805", "0.52435946", "0.52397335", "0.52391523", "0.52318996", "0.522772", "0.52039844" ]
0.74742305
16
can buy a dog that is an instance of the Dog class
def buy_dog(name) #know sabout its dogs pets[:dogs] << Dog.new(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buy_dog(name)\n Dog.new(name,self)\n end", "def buy_dog(name)\n new_dog = Dog.new(name,self)\n end", "def buy_dog(name)\n Dog.new(name, self)\n end", "def buy_dog(name)\n Dog.new(name, self)\n end", "def buy_dog(name)\n dog = Dog.new(name, self)\n end", "def buy_dog(dog_name)\n new_dog = Dog.new(dog_name, self)\nend", "def buy_dog(name)\n dog = Dog.new(name, self)\n @dogs << dog\n end", "def buy_dog(dog_name)\n new_dog = Dog.new(dog_name, self)\n # tommy.buy_cat(\"Garfield\")\n end", "def buy_dog(dog_name)\n self.dogs << Dog.new(dog_name,self)\n end", "def buy_dog(dog)\n new_dog = Dog.all.find do |dog_instance|\n dog_instance.name == dog \n end\n if new_dog \n Dog.new(new_dog.name, self)\n else \n brand_new_dog = Dog.new(dog, self)\n end \n end", "def buy_dog(dog_name)\n dog = Dog.new(dog_name)\n self.pets[:dogs] << dog\n end", "def buy_dog(name)\n dog = Dog.new(name)\n @pets[:dogs] << dog\n end", "def buy_dog(new_name)\n # @dogs << Dog.new(name, self)\n Dog.new(new_name, self)\n end", "def buy_dog(name)\n pets[:dogs] << Dog.new(name)\n end", "def meow # Define a method that allows any instance of Cat to meow\n puts \"meow!\"\n end", "def buy_fish(name)\n new_fish = Fish.new(name)\n if new_fish.class == Fish\n @pets[:fishes] << new_fish\n end \n end", "def initialize(name, dog)\n @name = name\n @dog = dog\n end", "def run #instance method, you chain it to an instance of a Dog\n # binding.pry\n puts \"#{@name} the #{@breed} is running fast as the wind\"\n end", "def initialize(name)\n @name = name\n @@all << self # adds the new dog instance to the @@all array\n end", "def set_dog\n @dog = Dog.find(params[:id])\n end", "def dog\n Fitbark::Data::DogInfo.new(self[:dog])\n end", "def dogs\n\t\t# Note that you call upon the other class within this class.\n\t\tDog.all.select do |dog|\n\t\t\tdog.owner == self\n\t\tend\n\tend", "def initialize(name, breed, owner_name)\n @name = name # this returns name of the dog\n @breed = breed # returns the breed classification\n @owner = Owner.new(owner_name, self) # returns Owner when #class is called on #owner \n end", "def set_dog\n @dog = Dog.find(params[:id])\n end", "def set_dog\n @dog = Dog.find(params[:id])\n end", "def set_dog\n @dog = Dog.find(params[:id])\n end", "def set_dog\n @dog = Dog.find(params[:id])\n end", "def set_dog\n @dog = Dog.find(params[:id])\n end", "def set_dog\n @dog = Dog.find(params[:id])\n end", "def set_dog\n @dog = Dog.find(params[:id])\n end", "def dogs\n Dog.doggies.select { |dogs| dogs.owner == self }\n end", "def dogs\n Dog.all.select do |dog_instance|\n dog_instance.owner == self \n end\n end", "def buy_fish(name) # expect(owner.pets[:fishes].count).to eq(0)\n new_fish = Fish.new(name) # owner.buy_fish(\"Bubbles\")\n self.pets[:fishes] << new_fish # owner.pets[:fishes].each { |fish| expect(fish).to be_a(Fish)}\n new_fish # expect(owner.pets[:fishes].count).to eq(1)\n # = knows about its fishes; Owner knows all about its pets - Owner sets name of pet, the pet can\\'t change its name\n # owner.buy_fish(\"Bubbles\")\n # expect(owner.pets[:fishes][0].name).to eq(\"Bubbles\")\n end", "def buy_cat(name)\n Cat.new(name, self)\nend", "def dogs\n Dog.all.select {|d| d.owner == self}\n end", "def doom(entity); @doomed << entity; end", "def set_dog\n @dog = Dog.find(params[:dog_id])\n end", "def buy_cat(name)\n new_cat = Cat.new(name, self)\nend", "def buy_fish(name)\n new_fish = Fish.new(name)\n self.pets[:fishes] << new_fish \n end", "def set_doggy\n @doggy = Doggy.find(params[:id])\n end", "def buy_cat(name) # expect(owner.pets[:cats].count).to eq(0)\n new_cat = Cat.new(name) # owner.buy_cat(\"Crookshanks\")\n self.pets[:cats] << new_cat # owner.pets[:cats].each { |cat| expect(cat).to be_a(Cat) }\n new_cat # expect(owner.pets[:cats].count).to eq(1)\n # = knows about its cats; Owner knows all about its pets - Owner sets name of pet, the pet can\\'t change its name\n # owner.buy_cat(\"Crookshanks\")\n # expect(owner.pets[:cats][0].name).to eq(\"Crookshanks\")\n end", "def buy_cat(cat_name)\n cat = Cat.new(cat_name)\n self.pets[:cats] << cat\n\n end", "def initialize(name, owner)\n @name = name\n @owner = owner\n @mood = \"nervous\"\n @@all << self\n @owner.dogs << self\n end", "def show \n @my_dog = Dog.find(params[:id])\n end", "def buy_fish(fish_name)\n fish = Fish.new(fish_name)\n self.pets[:fishes] << fish\n end", "def dogs\n Dog.all.select do |dog|\n dog.owner == self\n end\n end", "def buy_cat(name)\n #passing a name and this owner object into the cat object\n cat = Cat.new(name, self) \n @cats << cat\n \n end", "def initialize (name) \n #has a name \n @name = name \n #gets called inside initialize when a new Dog is created \n self.save\n end", "def walk_dogs #walks the dogs which makes the dogs' moods happy\n # dog = Dog.new(\"Daisy\")\n # owner.pets[:dogs] << dog\n # owner.walk_dogs\n # expect(dog.mood).to eq(\"happy\")\n pets[:dogs].each do |dog|\n dog.mood = \"happy\"\n end\n end", "def walks\n Walk.all.select { |walk_instance| walk_instance.dog == self }\n end", "def buy_cat(name)\n Cat.new(name,self)\n end", "def happy_walker?\n @dog_walker.favorite_breed == @dog.breed \n end", "def dogs\nDog.all.find_all do |dog|\n dog.owner == self\nend\n\nend", "def buy_cat(name)\n cat = Cat.new(name)\n @pets[:cats] << cat\n end", "def add_animal(animal)\n # binding.pry\n animal.zoo = self\n end", "def buy_fish(name)\n fish = Fish.new(name)\n @pets[:fishes] << fish\n end", "def buy_fish(name)\n fish = Fish.new(name)\n @pets[:fishes] << fish\n end", "def breed; end", "def buy_fish(name)\n#knows about its fishes\n pets[:fishes] << Fish.new(name)\n end", "def buy_fish(name)\n @pets[:fishes] << Fish.new(name)\n end", "def buy_cat(name)\n #knows about its cats\n pets[:cats] << Cat.new(name)\n end", "def walk_dogs\n Dog.all.each do |dog|\n if dog.owner == self\n dog.mood = \"happy\"\n end\n end \n end", "def dogs\n collection_of_dogs = []\n Dog.all.each do |dog|\n if dog.owner == self\n collection_of_dogs << dog\n end \n end \n return collection_of_dogs\n end", "def demo1\n a = Animal.new\n c = Cephalopod.new\n o = Octopus.new\n m = MutantOctopus.new\n puts a.description\n puts c.description\n puts o.description \n puts m.description \n puts o.tentacles\n puts m.tentacles\nend", "def create\n @dog = Dog::Dog.new(params[:dog_dog])\n\n respond_to do |format|\n if @dog.save\n format.html { redirect_to @dog, notice: 'Dog was successfully created.' }\n format.json { render json: @dog, status: :created, location: @dog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dog.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_animal(name)\n animal = nil\n\n if @type == \"cow\"\n animal = Cow.new name\n elsif @type == \"pig\"\n animal = Pig.new name\n end\n\n return animal\n end", "def name\n @named_dog\n end", "def make_bike\n new_bike = Bike.new\n new_bike.brand = self\n end", "def buy_cat(cat)\n new_cat = Cat.all.find do |cat_instance|\n cat_instance.name == cat \n end\n if new_cat \n Cat.new(new_cat.name, self)\n else \n brand_new_cat = Cat.new(cat, self)\n end \n end", "def buy_cat(name)\n Cat.new(name, self)\n end", "def buy_cat(name)\n Cat.new(name, self)\n end", "def buy_cat(name)\n Cat.new(name, self)\n end", "def buy_cat(name)\n Cat.new(name, self)\n end", "def dogs \n dogs = self.walks.map {|walk| walk.dog}\n dogs.uniq\n end", "def buy_fish(name)\n pets[:fishes] << Fish.new(name)\nend", "def buy_pet(pet)\n self.pets.push(pet)\n pet.owner = self\n end", "def initialize(name, owner)\n @name = name\n @owner = owner\n @mood = \"nervous\"\n @owner.dogs << self\n @@all << self\n end", "def buy_cat(cat_name)\n new_cat = Cat.new(cat_name, self)\n # self.cats << new_cat\n # binding.pry\n end", "def make_it_swim(duck)\n duck.swim\nend", "def buy_fish(name)\n pets[:fishes] << Fish.new(name)\n end", "def test_you_can_define_methods_on_individual_objects\n fido = Dog.new\n def fido.wag\n :fidos_wag\n end\n assert_equal :fidos_wag, fido.wag\n end", "def feedPet\n @pet.eat\n end", "def buy_cat(name)\n pets[:cats] << Cat.new(name)\n end", "def walk_dogs\n self.dogs.each {|dog| dog.mood = \"happy\"}\n end", "def set_found_dog\n @found_dog = FoundDog.find(params[:id])\n end", "def dog_params\n params.require(:dog).permit(:name, :image, :breed)\n end", "def new_dog\n system 'clear'\n dog_name = TTY::Prompt.new.ask('Enter the name of your dog')\n\n if dog_exist?(dog_name)\n puts 'That name already exists.'\n sleep(2)\n new_dog\n end\n\n new_dog = Dog.create(name: dog_name)\n dogs << new_dog\n puts \"#{dog_name} has been added to your account.\"\n sleep(2)\n end", "def speak\n #useses the name variable that all GoodDog objects are assigned at creation. Different for each instance\n \"#{@name} says Arf!\"\n end", "def initialize(species, weight, nickname, zoo)\n @species = species\n @weight = weight\n @nickname = nickname\n @zoo = zoo\n @@all << self\n\n #everytime a new animal object is created, its shoveled into the Animal class\n\nend", "def walk_dogs\n pets[:dogs].each do |dog|\n dog.mood = \"happy\"\n end\n end", "def dog_name\n end", "def walk_dogs\n self.pets[:dogs].each do |dog|\n dog.mood = \"happy\"\n end\n end", "def walk_dogs\n\n self.dogs.each do |dog|\n dog.mood = \"happy\"\n end\n end", "def test_choose_bun_returns_a_string\n assert_kind_of(String, @hot_dog.meat = @meat)\n end", "def walk_dogs \n self.dogs.each do |dog|\n dog.mood = \"happy\"\n end \n end", "def transfer_dog\n if guest_user.dog.present?\n guest_dog = guest_user.dog\n current_user.dog.destroy if current_user.dog.present?\n guest_dog.user_id = current_user.id\n guest_dog.save!\n end\n end", "def buy_cat(name)\n Cat.new(name, self)\n end", "def breed=(dog_breed)\n @breed = dog_breed\n end", "def walk_dogs\n @pets[:dogs].each {|dog| dog.mood = \"happy\"}\n end", "def show\n @dog = Dog.find(params[:id])\n @user = @dog.user\n @title = @dog.name\n @playdates = Playdate.joins(:dogs).where(\"dogs.id\" => @dog.id).where(\"play_date > ?\", Time.now)\n @other_dogs = Dog.where(\"breed = ? and dogs.id <> ?\", @dog.breed,@dog.id).limit(3).order(\"random()\")\n \n end" ]
[ "0.8285269", "0.81746185", "0.8170991", "0.8170991", "0.8115555", "0.8005482", "0.7780977", "0.7758128", "0.7733242", "0.75769824", "0.75739086", "0.74389356", "0.7396316", "0.7341653", "0.64403903", "0.63818246", "0.6367875", "0.6319512", "0.6287678", "0.62735015", "0.6253146", "0.6252492", "0.62158024", "0.6215232", "0.6215232", "0.6215232", "0.6215232", "0.6215232", "0.6215232", "0.6215232", "0.62010014", "0.61691713", "0.6136705", "0.6115886", "0.6097711", "0.60706156", "0.6050092", "0.6048885", "0.601019", "0.59553385", "0.5951483", "0.5946869", "0.59240776", "0.5923436", "0.59092057", "0.587903", "0.5869646", "0.5835308", "0.58283836", "0.58252686", "0.5814968", "0.5803839", "0.57924426", "0.5789581", "0.57716215", "0.57576144", "0.57576144", "0.574305", "0.5725526", "0.5714891", "0.5696774", "0.56774884", "0.5658296", "0.56413364", "0.56304854", "0.56151223", "0.5604722", "0.55920136", "0.5586355", "0.5584586", "0.5584586", "0.5584586", "0.5584586", "0.5575633", "0.55755883", "0.5572599", "0.557234", "0.55717903", "0.55208427", "0.5493116", "0.5480883", "0.54720914", "0.54710335", "0.54556835", "0.5435935", "0.54163694", "0.5390506", "0.53889155", "0.5372782", "0.53612924", "0.5360122", "0.53576833", "0.53477687", "0.534052", "0.5338127", "0.5335931", "0.53273404", "0.5324288", "0.5323146", "0.5321916" ]
0.7331838
14
plays with the cats
def play_with_cats #makes each of the cat's moods happy when played with pets[:cats].each do |cat| cat.mood = "happy" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play\r\n\t\t[FOLD]\r\n\tend", "def play\n beats = list.to_string\n `say -r #{rate} -v #{voice} #{beats}`\n end", "def play\r\n while !over?\r\n turn\r\n end\r\n if won?\r\n puts \"Congratulations #{winner}!\"\r\n elsif draw?\r\n puts \"Cats Game!\"\r\n end\r\n end", "def play\n until self.over? do\n turn\n end\n\n if self.won?\n puts \"Congratulations #{self.winner}!\"\n elsif self.draw?\n puts \"Cat's Game!\"\n end\n end", "def play\n until over?\n turn\n end\n if winner\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cats Game!\"\n end\n end", "def draw_cat\n\t\tputs \"\\n\\n=^.^=\"\n\t\[email protected]_board\n\t\tputs \"=^.^=\"\n\t\tputs \"cat's game! game over!\"\n\tend", "def play\n \n end", "def play\n while over? == false\n turn\n end\n if won?\n puts \"Congratulations #{winner}!\"\n elsif draw?\n puts \"Cat's Game!\"\n end\n end", "def play\n\n until over?\n turn\n end\n\n if self.won?\n puts \"Congratulations #{self.winner}!\"\n elsif self.draw?\n puts \"Cat's Game!\"\n end\n\n end", "def play\n while !over?\n \t turn\n end\n if won?\n \t puts \"Congratulations \"+ winner() +\"!\"\n else\n \t puts \"Cat's Game!\"\n end\n end", "def play\n turn until over?\n if won?\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cats Game!\"\n end\n end", "def play\n # counter = 0\n # until counter == 9\n # turn\n # counter += 1\n # end\n\n until over?\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n elsif draw?\n puts \"Cat's Game!\"\n end\n end", "def play\n until over? == true\n turn\n end\n if self.winner == nil\n puts \"Cats Game!\"\n else\n puts \"Congratulations #{self.winner}!\"\n #Congradulate the winner of the game, using the person with the most X or O combinations\n #Code in a play again option, so players don't have to re enter name\n board.display\n end\n end", "def play_with_cats\n pets[:cats].each do |cat|\n cat.mood = \"happy\"\n end\n end", "def play\r\n self.display_board\r\n while !self.over? do\r\n self.turn\r\n end\r\n if self.draw? \r\n puts \"Cat's Game!\"\r\n else\r\n puts \"Congratulations #{self.winner}!\"\r\n end\r\n end", "def play; end", "def play\n end", "def play\n end", "def play\n end", "def play\n end", "def play\n end", "def play\n while !over?\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n elsif draw?\n puts \"Cat's Game!\"\n end\n end", "def play\n while !over?\n #binding.pry\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cats Game!\"\n end\n end", "def play\n while !over?()\n turn()\n end\n\n if won?()\n puts \"Congratulations #{winner()}!\"\n elsif draw?()\n puts \"Cat's Game!\"\n end\n end", "def play()\n \n while !over?()\n turn()\n end\n \n if won?()\n puts \"Congratulations #{winner()}!\"\n elsif draw?()\n puts \"Cat's Game!\"\n end\n end", "def play \n end", "def play\n\tend", "def play\n puts \"#{name} got zoomies playing fetch!\"\n @hungry = true\n end", "def play\n while !over?\n turn\n end\n if won?\n puts \"Congratulations #{ winner }!\"\n elsif draw?\n puts \"Cat's Game!\"\n else\n puts \"Game over\"\n end\n end", "def play\n while !over?\n turn\n end\n won? ? (puts \"Congratulations #{@winner}!\") : (puts \"Cat's Game!\")\n\n end", "def play_with_cats\n self.pets[:cats].each do |cat|\n cat.mood = \"happy\"\n end\n end", "def play\n until over?\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n elsif draw?\n puts \"Cat's Game!\"\n end\n end", "def play\n\n until self.over?\n self.turn\n end\n\n if self.won?\n self.board.display\n puts \"Congratulations #{self.winner}!\"\n elsif self.draw?\n self.board.display\n puts \"Cat's Game!\"\n end\n end", "def play\n while !over?\n turn\n end\n if won?\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cat's Game!\"\n end\n end", "def play\n while !over?\n turn\n board.display\n end\n if won?\n puts \"Congratulations #{winner}!\" \n elsif draw?\n puts \"Cats Game!\" \n end\n end", "def plays(h)\n\th.each do |bros, inst|\n\t\tputs \"#{bros.capitalize} Marx plays the #{inst}\"\n\tend\nend", "def plays(h)\n\th.each do |bros, inst|\n\t\tputs \"#{bros.to_s.capitalize} Marx plays the #{inst}\"\n\tend\nend", "def play_with_cats\n @pets[:cats].each { |cat| cat.mood = \"happy\"}\n end", "def play\n until over? do\n turn;\n end\n\n if won?\n puts \"Congratulations #{winner}!\";\n replay\n elsif draw?\n puts \"Cat's Game!\";\n replay\n end\n end", "def play\n\n\t\tif ran_out_of_options?\n \t\t\tputs \"SORRY, YOU ARE HOPELESSLY INDECISIVE\".red.blink\n \t\t\texit\n \tend\n\n\t\t@winner = select_winner\n\n\t until self.set_of_ten_dup.length == 1 do\n\t \t@challenger = select_challenger\n\t \n\t system \"clear\"\n\n\t\tCLI.intro_image\n\t\tdisplay_choices\n\t\tinput = input_prompt\n\t \n\t\tmatch_arr = add_businesses\n\n\t\tadd_to_winner_loser_tables(match_arr[0],match_arr[1]) if input == '1' || input == '1!'\n\t\tadd_to_winner_loser_tables(match_arr[1],match_arr[0]) if input == '2' || input == '2!'\n\t\tremove_from_match_options(input)\n\t\t@winner = @challenger if input == '2' || input == '2!'\n\t\tself.url = @winner[:url]\n\t\tbreak if input == '1!' || input == '2!'\n\t end\n\t puts \"We recommend you go to \" + \"#{@winner[:name]}\".green + \"!\" \n end", "def play\n congrats = Proc.new { |player| puts \"Congratulations #{player}!\" }\n tie = Proc.new { puts \"Cat's Game!\" }\n \n until over?\n turn\n end\n\n congrats.call(winner) if won?\n tie.call if draw?\nend", "def play\n until over?\n @board.display\n turn\n end\n @board.display\n puts draw? ? \"Cat's Game!\" : \"Congratulations #{winner}!\"\n end", "def play\n until over?\n turn\n end\n\n if won?\n puts \"Congratulations #{winner}!\"\n\n else draw?\n puts \"Cat's Game!\"\n\n end\n end", "def play_as_master_second\r\n \r\n end", "def play()\n c=1\n p=\"X\"\n while !over?()\n turn()\n end\n if won?()\n puts \"Congratulations #{winner()}!\"\n elsif draw?()\n puts \"Cats Game!\"\n else\n end\nend", "def play()\n until over?() == true\n turn()\n end\n if draw?() != true\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cat's Game!\"\n end\n end", "def play\n Audio::Out.add @cpg\n @is_playing = true\n #Audio::Out.add @actuator\n end", "def feed_cats\n self.cats.each do |cat|\n cat.mood = \"happy\"\n end \n end", "def play\n# \tThere are 3 players in Knuckleheads: \n\t\tputs \"There are #{to_s} players in #{@title}\"\n# \tI'm Moe with a health of 100 and a score of 103.\n# \tI'm Larry with a health of 60 and a score of 65.\n# \tI'm Curly with a health of 125 and a score of 130.\n\t\[email protected] do |spieler|\n\t\t\tputs \"I'm #{spieler} with a health of #{@health} and a score of #{score}\"\n\t\t\tend\n# \tMoe got blammed!\n# \tMoe got w00ted!\n# \tMoe got w00ted!\n# \tI'm Moe with a health of 120 and a score of 123.\n# \tLarry got blammed!\n# \tLarry got w00ted!\n# \tLarry got w00ted!\n# \tI'm Larry with a health of 80 and a score of 85.\n# \tCurly got blammed!\n# \tCurly got w00ted!\n# \tCurly got w00ted!\n# \tI'm Curly with a health of 145 and a score of 150.\n\t\tend", "def play\n until over?\n turn\n end\n\n if draw?\n puts \"Cat's Game!\"\n elsif WIN_COMBINATIONS.include?(won?)\n puts \"Congratulations #{winner}!\"\n end\nend", "def play\nuntil over? do\n turn\n end\nif won?\n puts \"Congratulations #{winner}!\"\nelsif draw?\nputs \"Cats Game!\"\nend\nend", "def play\n while !over?\n turn\n end\n if won?\n puts \"Congratulations #{winner}!\"\n else draw?\n puts \"Cat's Game!\"\n end\n end", "def pbPlayCry(pokemon,volume=90,pitch=nil)\n return if !pokemon\n if pokemon.is_a?(Numeric)\n pbPlayCrySpecies(pokemon,0,volume,pitch)\n elsif !pokemon.egg?\n if pokemon.respond_to?(\"chatter\") && pokemon.chatter\n pokemon.chatter.play\n else\n pkmnwav = pbCryFile(pokemon)\n if pkmnwav\n pbSEPlay(RPG::AudioFile.new(pkmnwav,volume,\n (pitch) ? pitch : (pokemon.hp*25/pokemon.totalhp)+75)) rescue nil\n end\n end\n end\nend", "def play\r\n turn until over?\r\n \r\n if won?\r\n puts \"Congratulations #{winner}!\"\r\n \r\n else\r\n puts \"Cat's Game!\"\r\n end\r\nend", "def play\n puts \"buzz\"\n end", "def play\n display_welcome_message\n loop do \n human.choose #.choose is an instance method on the Player class, since human is an object of the Player class\n computer.choose\n display_winner\n break unless play_again? #could put play again loop here, but easier to not have double loop here\n end \n display_goodbye_message\n end", "def buz; Sound.play_buzzer; end", "def play\n while !over?\n turn\n end\n if won?\n puts \"Congratulations #{winner}!\"\n elsif draw?\n puts \"Cats Game!\"\n end\nend", "def sonic_play\n melody = melody()\n if melody.respond_to?(:key)\n melody.values().each do |m|\n play_melody(m)\n end\n elsif melody.respond_to?(:length)\n play_melody(melody)\n end\nend", "def play\n greeting\n get_tiles\n move_sequence\n end", "def play\n while(true)\n answer1 = @human.choose\n answer2 = @computer.choose\n puts self.win?(answer1,answer2)\n self.continue?\n end\n end", "def play\n until over? == true\n turn\n end\n\n if won? != false\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cat's Game!\"\n end\n end", "def play\n until over?|| draw?\n @board = turn\n end\n unless winner.nil?\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cat's Game!\"\n end\n end", "def play_sports\n end", "def play\n @hungry = true\n end", "def play\n @hungry = true\n end", "def play\n @hungry = true\n end", "def play\n display_welcome_message\n loop do\n human.choose\n computer.choose\n display_moves\n display_winner\n keep_score\n break unless play_again?\n end\n display_goodbye_message\n end", "def play\n until over?\n turn\n end\n if draw?\n puts \"Cat's Game!\"\n elsif won?\n puts \"Congratulations #{winner}!\"\n end\nend", "def play\n \"We're rockiinnggg\"\n end", "def play\n until over? do\n turn\n end\n if draw?\n puts \"Cat's Game!\"\n else\n puts \"Congratulations #{winner}!\"\n end\nend", "def play_random_clip()\n 0.upto(8){\n\tid = rand($full_sample_filelist.size)\n=begin\t\n\t# Theses variables are used by the sample playing - affected to the last line of knobs\n\t$sample_volume = 1.0\n\t$sample_speed = 1.0\n\t$sample_reverse = false\n\t$sample_sampling_rate = 44100\n\t$sample_start_pos = 0.0\n\t$sample_phaser = [ false, 0.95, 0.95, 3, 0.6, 2, \"-t\" ] # active gain-in gain-out delay decay speed [-s(inusoid)|-t(riangle)]\n\t$sample_flanger = [ false, 3, 9.5, 0, 70, 2, \"sin\", 100, \"quadratic\" ] # [active, delay depth regen width speed shape phase interp]\n\t$sample_reverb = [ false, 99, 99, 100, 100, 0, 0, ] # active, reverb, HF-damping, room-scale, stereo-depth, pre-delay, wet-gain\n=end\n\tcmd = \"play -v #{$sample_volume} \\\"#{$full_sample_filelist[id]}\\\" \"\n\tcmd += \"rate #{$sample_sampling_rate} \"\n\tcmd += \"speed #{$sample_speed} \"\n\tcmd += \"#{$sample_reverse == true ? \"reverse\" : \"\"} \"\n\tcmd += \"trim =0.0 \"\n\t\n\tcmd += $sample_phaser[0] == true ? \"phaser #{$sample_phaser[1].round(2)} #{$sample_phaser[2].round(2)} #{$sample_phaser[3].round(2)} #{$sample_phaser[4].round(2)} #{$sample_phaser[5].round(2)} #{$sample_phaser[6]} \" : \"\"\n\tcmd += $sample_flanger[0] == true ? \"flanger #{$sample_flanger[1].round(2)} #{$sample_flanger[2].round(2)} #{$sample_flanger[3].round(2)} #{$sample_flanger[4].round(2)} #{$sample_flanger[5].round(2)} #{$sample_flanger[6]} #{$sample_flanger[7].round(2)} #{$sample_flanger[8]} \" : \"\"\n\tcmd += $sample_reverb[0] == true ? \"reverb #{$sample_reverb[1].round(2)} #{$sample_reverb[2].round(2)} #{$sample_reverb[3].round(2)} #{$sample_reverb[4].round(2)} #{$sample_reverb[5].round(2)} #{$sample_reverb[6].round(2)} \" : \"\"\n\t\n\tcmd += \" > /dev/null 2>&1\" #[ false, 3, 9.5, 0, 70, 2, \"sin\", 100, \"quadratic\" ]\n\n\tputs cmd\n \tThread.new(){\n\t\tif(rand(2) < 1) then # thread it and jump to next sample instantly\n\t\t\tThread.new(){\n\t\t\t\tsystem(cmd)\n\t\t\t}\n\t\telse\n\t\t\tsystem(cmd)\n\t\tend\n \t####sleep(rand(1.0))\n \t}\n\n }\nend", "def feed_cats\n self.cats.each {|c| c.mood = \"happy\"}\n end", "def play\n @hungry = true\n #p \"play method called\" #print notification to console\n end", "def play\n #calls to all the methods that produce game!\n end", "def play_sweet_riff\n puts \"You played a face melting riff!\"\n take_a_drink\n end", "def turn\n array = [\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"]\n firstshow = Show.new\n firstshow.show(array)\n puts \"What do you want to play ? \" #ask the player what he choose to play\n end", "def play\n self\n end", "def play\n @@plays += 1\n end", "def play\n abort %(None from #{@user}. Fuck off.).magenta if @recordings.empty?\n stdout = preface\n @recordings.each do |r|\n stdout += \"\\n#{r[:time]} : \".cyan + \"@#{r[:user]}\".yellow\n stdout += \"\\n#{r[:message]}\\n\\n\"\n end\n puts stdout\n stdout\n end", "def cook_sink_eat\n delay = 4\n refresh\n HowMuch.amount(6) if click_on 'Mix/Add Honey'\n sleep delay\n refresh\n HowMuch.amount(1) if click_on 'Mix/Add Coconut'\n\n sleep delay\n refresh\n click_on 'Cook'\n popup = PopupWindow.find\n popup.click_on 'OK' if popup\n sleep delay\n\n # Eat!\n refresh\n click_on 'Enjoy'\n sleep delay\n end", "def arriba\n case @selection\n when 2\n mesaje_select(@play_message)\n @selection = 1\n @select_song.play\n when 3\n mesaje_select(@difficulty_message)\n @selection = 2\n @select_song.play\n when 4\n mesaje_select(@music_message)\n @selection = 3\n @select_song.play\n when 5\n mesaje_select(@about_message)\n @selection = 4\n @select_song.play\n end\n sleep(0.15)\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 play socket\n end", "def easy\n g = Game.new(Deck.new(Deck.all_cards[0..11]))\n sets = g.play\n \n sets\nend", "def play\n\t\twelcome\n\t\task_name\n\t\task_name2 \n\t\task_input\n\t\tturns\n\tend", "def play()\n \n begin\n \n @computer_choice = get_computer_choice()\n @player_choice = get_player_choice()\n \n result = logic(@computer_choice, @player_choice)\n\n get_choices()\n \n case result\n\n when \"tie\"\n @rounds -= 1\n @ties += 1\n puts \"[~] it's a tie !\"\n \n when \"player win\"\n @rounds -= 1\n @player_wins += 1\n puts \"[$] Player win this round (#{@player_wins}/3)!\"\n\n when \"computer win\"\n @rounds -= 1\n @computer_wins += 1\n puts \"[$] Computer win this round (#{@computer_wins}/3)!\"\n\n end\n\n rescue Interrupt\n\n puts \"\\n\\n[!] Keyboard interrupt, Exting.\"; exit()\n \n \n end\n \n\n end", "def play\r\n display_welcome_message\r\n human_choose_move\r\n computer_choose_move\r\n display_winner\r\n display_goodbye_message\r\nend", "def feed_cats\n self.cats.each do |cat|\n cat.mood = \"happy\"\n end\n end", "def scream (*exclamations)\n\t\trandom_exclamations = [\"No way!\", \"AAAAAAHHHHHH!\", \"Please help me!\", \"OOOOOHHHHHHH!\", \"Ouch!\", \"SO UNFAIR!\", \"Ouchie ouchie ouchie ouchie...\", \"DUDE!\"]\n\t\trandom_exclamation_a = random_exclamations.sample\n\t\trandom_exclamation_b = random_exclamations.sample\n\n\t\tdef print_scream(random_exclamation_a, random_exclamation_b, *exclamations)\n\t\t\tif sufficient_caffeine_level(1)\n\t\t\t\tprint \"#{@name} is screaming: #{random_exclamation_a} \"\n\t\t\t\texclamations.each {|x| print \"WOOOOAAAHH! #{x} \"}\n\t\t\t\tputs \" #{random_exclamation_b}\"\n\t\t\t\t@caffeine_level -= 1\n\t\t\t\tcheck_caffeine_level()\n\t\t\telse\n\t\t\t\tputs \"#{@name} doesn't have enough caffeine to scream. Drink coffee now!\"\n\t\t\tend\n\t\tend\n\t\tprint_scream(random_exclamation_a, random_exclamation_b, *exclamations)\n\tend", "def play()\n @ole.Play()\n end", "def play()\n @ole.Play()\n end", "def feed_cats\n cats.each do |cat|\n cat.mood = \"happy\"\n end\n end", "def feed_cats\n self.cats.each{ |cat|\n cat.mood = \"happy\"\n }\n end", "def pbPlayBuzzerSE()\n if $data_system && $data_system.respond_to?(\"buzzer_se\") &&\n $data_system.buzzer_se && $data_system.buzzer_se.name!=\"\"\n pbSEPlay($data_system.buzzer_se)\n elsif $data_system && $data_system.respond_to?(\"sounds\") &&\n $data_system.sounds && $data_system.sounds[3] && $data_system.sounds[3].name!=\"\"\n pbSEPlay($data_system.sounds[3])\n elsif FileTest.audio_exist?(\"Audio/SE/GUI sel buzzer\")\n pbSEPlay(\"GUI sel buzzer\",80)\n end\nend", "def play\n # Game play asks for players input on a turn of the game\n # Game play checks if the game is over after every turn\n # Game play plays the first turn of the game\n # Game play plays the first few turns of the game\n # Game play checks if the game is won after every turn\n # Game play checks if the game is a draw after every turn\n while !over?\n turn\n end\n # Game play stops playing if someone has won\n # Game play congratulates the winner X\n # Game play congratulates the winner O\n if won?\n puts \"Congratulations #{winner}!\"\n # Game play stops playing in a draw\n # Game play prints \"Cat's Game!\" on a draw\n elsif draw?\n puts \"Cat's Game!\"\n end\n end", "def play\n until over? !=false\n turn\n end\n if won? != false\n puts \"Congratulations #{winner}!\"\n elsif draw? == true\n puts \"Cats Game!\"\n end \nend", "def part1\n 2.times do\n \n 6.times do\n play :G4\n play :E4\n play :E2\n sleep 0.5\n end\n \n 2.times do\n play :A4\n play :E4\n play :E2\n sleep 0.5\n end\n end\nend", "def play_3_note_chord(note_one, note_two, note_three)\n play note_one\n play note_two\n play note_three\nend", "def play_melody(m)\n in_thread do\n set_volume! 5\n if defined? mybpm\n use_bpm mybpm()\n end\n if defined? mysynth\n use_synth mysynth()\n end\n \n (0..m[0].length-1).each do |i|\n if m.length > 2\n set_volume! m[2][i]\n end\n if m[0][i] != 0\n play m[0][i]\n end\n sleep m[1][i]\n end\n end\nend" ]
[ "0.6562972", "0.6517804", "0.6494751", "0.6459916", "0.645332", "0.64387316", "0.6408507", "0.6405676", "0.6341371", "0.63349265", "0.63340354", "0.6321883", "0.6296843", "0.627868", "0.6232409", "0.6215172", "0.6202884", "0.6199298", "0.6199298", "0.6199298", "0.6199298", "0.61987597", "0.6181869", "0.61725765", "0.6155946", "0.6149153", "0.61448395", "0.61336476", "0.61274874", "0.6107983", "0.6103882", "0.6088348", "0.6076409", "0.60670936", "0.6054632", "0.60414964", "0.6022193", "0.60167646", "0.6011293", "0.60077983", "0.5999464", "0.5992446", "0.59912777", "0.59889525", "0.59888303", "0.5988313", "0.5985257", "0.598111", "0.597443", "0.5972476", "0.59642357", "0.5960105", "0.5958394", "0.594905", "0.5930443", "0.59189683", "0.5912314", "0.58975834", "0.5895289", "0.58909774", "0.5880325", "0.58803", "0.5875107", "0.58570117", "0.58311427", "0.58311427", "0.58311427", "0.5809639", "0.580752", "0.5801715", "0.5801563", "0.57968616", "0.57965535", "0.5793331", "0.57836825", "0.5778282", "0.57490534", "0.5743455", "0.5738313", "0.5733651", "0.572517", "0.57248276", "0.5722506", "0.5712227", "0.5711019", "0.5696542", "0.56827205", "0.56752867", "0.56738055", "0.56728256", "0.56555206", "0.56555206", "0.56544", "0.5642364", "0.5619377", "0.56088006", "0.56033516", "0.55951333", "0.5589232", "0.55858994" ]
0.60856956
32
can sell all its pets
def sell_pets #this makes them all nervous pets.each do |species, animals| animals.each do |animal| animal.mood = "nervous" end animals.clear end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_sell?\n inventory.any? { |inv| inv.price > 0 }\n end", "def sell_pets\n pets.each {|kind, moods|\n moods.each {|pets| pets.mood=(\"nervous\")}\n moods.clear\n }\n end", "def sell\n \t\t\n \tend", "def sell_pets\n all_owner_pets = self.dogs + self.cats\n \n all_owner_pets.each do |pet|\n pet.mood = \"nervous\"\n pet.owner = nil\n end \n\n end", "def sell_pets\n pets.each do |type, all_type|\n all_type.each do |pet|\n pet.mood = \"nervous\"\n end\n end\n pets.clear\n end", "def sell_pet_to_customer(pet_shop, pet, customer)\n for l_pet_shop in pet_shop[:pets]\n if l_pet_shop == pet\n if customer_can_afford_pet(customer, pet) == true\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(pet_shop, pet[:price])\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n end\n end\n end\nend", "def sell_pet_to_customer(shop, pet, customer)\n for animal in shop[:pets]\n if animal == pet && customer_can_afford_pet(customer, pet) == true\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(shop, pet[:price])\n increase_pets_sold(shop,1)\n add_pet_to_customer(customer, pet)\n remove_pet_by_name(shop, pet)\n end\n end\nend", "def sell_pet_to_customer(shop,pet,customer)\n if pet != nil && customer_can_afford_pet(customer,pet) == true\n for animal in shop[:pets]\n if animal[:name] == pet[:name]\n amount = pet[:price]\n add_pet_to_customer(customer,pet)\n customer_pet_count(customer)\n increase_pets_sold(shop,1)\n remove_customer_cash(customer,amount)\n add_or_remove_cash(shop,amount)\n end\n end\n end\nend", "def sell_pets\n pets = dogs + cats\n\n pets.each do |pet|\n pet.mood = \"nervous\"\n pet.owner = nil\n end\n end", "def sell_pets #Owner can sell all its pets, which make them nervous\n # fido = Dog.new(\"Fido\")\n # tabby = Cat.new(\"Tabby\")\n # nemo = Fish.new(\"Nemo\")\n # [fido, tabby, nemo].each {|o| o.mood = \"happy\" }\n # owner.pets = {\n # :dogs => [fido, Dog.new(\"Daisy\")],\n # :fishes => [nemo],\n # :cats => [Cat.new(\"Mittens\"), tabby]\n # }\n # owner.sell_pets\n # owner.pets.each {|type, pets| expect(pets.empty?).to eq(true) }\n # [fido, tabby, nemo].each { |o| expect(o.mood).to eq(\"nervous\") }\n pets.each do |type, animals|\n animals.each do |animal|\n animal.mood = \"nervous\"\n end\n animals.clear\n end\n end", "def sell_pet_to_customer(shop, pet, customer)\n if find_pet_by_name(shop, pet) != nil\n then\n if customer_can_afford_pet(customer, pet)\n then\n add_pet_to_customer(customer, pet)\n # remove_pet_by_name(shop, pet)\n increase_pets_sold(shop, 1)\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(shop, pet[:price])\nend\nend\nend", "def sell_pets\n all_pets = []\n all_pets << self.cats \n all_pets << self.dogs \n all_pets.flatten.map do |each_pet|\n each_pet.mood = \"nervous\"\n each_pet.owner = nil\n end\n end", "def sell_pet_to_customer(pet_shop, pet_to_sell, customer)\n for pet_for_sale in pet_shop[:pets]\n if pet_for_sale[:name] == pet_to_sell\n customer[:pets].push(pet_to_sell)\n pet_shop[:admin][:pets_sold] += 1\n customer[:cash] -= pet_to_sell[:price]\n pet_shop[:admin][:total_cash] += pet_to_sell[:price]\n end\n end\nend", "def can_buy_any_from_market?(entity)\n @game.share_pool.shares.group_by(&:corporation).each do |corporation, shares|\n next unless corporation.ipoed\n return true if can_buy_shares?(entity, shares)\n end\n\n false\n end", "def sell_pet_to_customer(petshop,name,customer)\n for pet in petshop[:pets]\n if pet[:name] == name\n customers[:pets].push(pet)\n petshop[:admin][:pets_sold].push(pet)\n sold[:admin][:total_cash] += amount\n end\n end\n return nil\nend", "def sell_action(shopItems)\n for shop_item in shopItems\n $game_party.gain_gold(shop_item.item.price * shop_item.quantity)\n $game_party.lose_item(shop_item.item, shop_item.quantity)\n end\n end", "def sell_pets\n cats.each do |pet|\n pet.mood = \"nervous\"\n pet.owner = nil\n end\n dogs.each do |pet|\n pet.mood = \"nervous\"\n pet.owner = nil\n end\n \n\n end", "def market\n end", "def sell_pet_to_customer(pet_shop, pet, customer)\n if pet && customer_can_afford_pet(customer, pet) \n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend", "def sell_pets\n pets.each do |species, pet_array| #enumerate through pets hash...\n pet_array.each do |pet_object| #then enumerate through pet_array within pets hash...\n #binding.pry\n pet_object.mood = \"nervous\" #set each pet_object's mood to \"nervous\"\n end\n end #end loop\n self.pets.clear #and reset Owner instance .pets to an empty array, that is returned\n end", "def sell_pets\n Cat.all.collect do |cats|\n cats.mood=\"nervous\"\n cats.owner=nil\n end\n Dog.all.collect do |dogs|\n dogs.mood=\"nervous\"\n dogs.owner=nil\n end\n end", "def planets; end", "def sell_pet_to_customer(petshop,pet,customer)\n\n if (customer[:cash] >= pet[:price]) #&& (petshop[:pets][:name] == pet[:name])\n customer[:pets].push(pet[:name])\n end\n # return customer[:pets].count()\n end", "def sell_pets\n @pets.each do |type, pet| \n pet.each { |animal| animal.mood = \"nervous\"}\n end\n @pets.clear\n end", "def sell_pet_to_customer(pet_shop, pet, customer)\n\n\n if pet != nil && customer_can_afford_pet(customer, pet)\n\n add_pet_to_customer(customer, pet)\n customer_pet_count(customer)\n\n\n increase_pets_sold(pet_shop, customer_pet_count(customer))\n pets_sold(pet_shop)\n\n\n remove_customer_cash(customer, pet[:price])\n customer_cash(customer)\n\n add_or_remove_cash(pet_shop, pet[:price])\n total_cash(pet_shop)\n\n end\n\nend", "def index\n @shelter = Shelter.first\n @pets = Pet.get_available_pets.order(:pet_type)\n if (!@cart)\n set_cart\n end\n @selectedPets = @cart.selected_pets\n end", "def sell_pet_to_customer(pet_shop, pet, customer)\n if\n pet_shop[:admin][:total_cash] += pet[:price]\n customer[:cash] -= pet[:price]\n else\n p \"Not enough dough :( \"\n end\n customer[:pets] << pet\n pet_shop[:admin][:pets_sold] += [:pets].count()\nend", "def can_buy?(item)\r\n item.buyable_by?(self)\r\n end", "def can_buy_drug?(price, qty)\n wallet > (price * qty) \n end", "def sell_pet_to_customer(pet_shop, supplied_pet, supplied_customer)\n if supplied_pet != nil && customer_can_afford_pet(supplied_customer, supplied_pet) == true\n increase_pets_sold(pet_shop, 1)\n add_pet_to_customer(supplied_customer,supplied_pet)\n add_or_remove_cash(pet_shop, supplied_pet[:price])\n customer_pet_count(supplied_customer)\n remove_pet_by_name(pet_shop, supplied_pet[:name])\n end\nend", "def customer_can_afford_pet(customer,new_pet)\n customer_cash=customer[:cash]\n @pet_shop[:pets].push(new_pet)\n for pet in @pet_shop[:pets] do\n if customer_cash >= pet[:price] \n return true\n else\n return false\n end\n end\n end", "def sell_pet_to_customer(shop,pet,customer)\n if pet != nil && customer_can_afford_pet(customer,pet)#this result returns true anyway and so my ==true in my version was not needed\n add_pet_to_customer(customer,pet)\n remove_pet_by_name(shop,pet)\n remove_customer_cash(customer,pet[:price])\n add_or_remove_cash(shop,pet[:price])\n increase_pets_sold(shop,1)\n end\nend", "def pets #stores all of the owners pets\n @pets #expect(owner.pets).to eq({:fishes => [], :dogs => [], :cats => []})\n end", "def sell_pet_to_customer(pet_shop, pet, customer)\n if pet != nil && customer[:cash] >= pet[:price]\n customer[:pets].push(pet)\n pet_shop[:admin][:pets_sold] += 1\n customer[:cash] -= pet[:price]\n pet_shop[:admin][:total_cash] += pet[:price]\n end\nend", "def pets\n @pets\n end", "def sell_pet_to_customer(pet_shop, pet, customer)\n if ((pet != nil) && customer_can_afford_pet(customer, pet))\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, customer[:pets].count())\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend", "def sell_pet_to_customer(shop, pet, customer)\n return if (pet == nil)\n if customer_can_afford_pet(customer, pet)\n add_pet_to_customer(customer, pet)\n increase_pets_sold(shop,1)\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(shop,pet[:price])\nend\n\nend", "def sell_pet_to_customer(section, pet, customer)\n if pet && customer_can_afford_pet(customer, pet)\n add_pet_to_customer(customer, pet)\n increase_pets_sold(section, 1)\n add_or_remove_cash(section, pet[:price])\n end\nend", "def can_buy?(item)\n item.buyable_by?(self)\n end", "def pets\n\t\t@pets_list\n\tend", "def sell(item, count)\n wanted = Hash.new\n wanted[item] = count\n if total_inventory[item] >= wanted[item]\n return true\n elsif total_inventory[item] < wanted[item]\n then false\n else\n \"Error\"\n end\n end", "def buy_action(shopItems)\n for shop_item in shopItems\n $game_party.lose_gold(shop_item.item.price * shop_item.quantity)\n $game_party.gain_item(shop_item.item, shop_item.quantity)\n end\n end", "def sell_pets\n all_animals = self.pets.values\n\n all_animals.each do |species|\n species.each {|pet| pet.mood = \"nervous\"}\n species.clear\n end\n end", "def sell_pet_to_customer(pet_shop, pet, customer)\n # the customer pet count increases by 1\n if pet != nil\n customer_can_afford_pet(customer, pet)\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend", "def sell_pet_to_customer(pet_shop, pet, customer)\n customer[:pets].count\n pet_shop[:admin][:pets_sold]\n customer[:cash]\n pet_shop[:admin][:total_cash]\nend", "def sell_pet_to_customer(pet_shop, pet, customer)\n if pet != nil && customer_can_afford_pet(customer, pet)\n remove_pet_by_name(pet_shop, pet)\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend", "def buy!(buyer_planet, amount)\n raise GameLogicError.new(\"Cannot buy 0 or less! Wanted: #{amount}\") \\\n if amount <= 0\n amount = from_amount if amount > from_amount\n \n cost = (amount * to_rate).ceil\n buyer_source, bs_attr = self.class.resolve_kind(buyer_planet, to_kind)\n buyer_target, bt_attr = self.class.resolve_kind(buyer_planet, from_kind)\n if system?\n seller_target = nil\n else\n seller_target, _ = self.class.resolve_kind(planet, to_kind)\n end\n \n stats = CredStats.buy_offer(buyer_planet.player, cost) \\\n if seller_target.nil? && to_kind == KIND_CREDS\n \n buyer_has = buyer_source.send(bs_attr)\n raise GameLogicError.new(\"Not enough funds for #{buyer_source\n }! Wanted #{cost} #{bs_attr} but it only had #{buyer_has}.\"\n ) if buyer_has < cost\n \n # Used to determine whether to send notification or not.\n original_amount = from_amount\n \n # Subtract resource that buyer is paying with from him.\n buyer_source.send(:\"#{bs_attr}=\", buyer_has - cost)\n # Add resource that buyer has bought from seller.\n buyer_target.send(:\"#{bt_attr}=\", \n buyer_target.send(bt_attr) + amount)\n # Add resource that buyer is paying with to seller. Unless:\n # * its a system offer\n # * or #to_kind is creds and planet currently does not have an owner\n seller_target.send(\n :\"#{bs_attr}=\", seller_target.send(bs_attr) + cost\n ) unless seller_target.nil?\n # Reduce bought amount from offer.\n self.from_amount -= amount\n \n objects = [buyer_source, buyer_target]\n # We might not have seller target. See above.\n objects.push seller_target unless seller_target.nil?\n objects.uniq.each { |obj| self.class.save_obj_with_event(obj) }\n\n if from_amount == 0\n # Schedule creation of new system offer.\n CallbackManager.register(\n without_locking { galaxy },\n CALLBACK_MAPPINGS[from_kind],\n Cfg.market_bot_random_resource_cooldown_date\n ) if system?\n destroy!\n else\n save!\n end\n percentage_bought = amount.to_f / original_amount\n\n MarketRate.subtract_amount(galaxy_id, from_kind, to_kind, amount)\n\n # Create notification if:\n # * It's not a system notification\n # * Enough of the percentage was bought\n # * Sellers planet currently has a player.\n Notification.create_for_market_offer_bought(\n self, buyer_planet.player, amount, cost\n ) if ! system? &&\n percentage_bought >= CONFIG['market.buy.notification.threshold'] &&\n ! planet.player_id.nil?\n\n stats.save! unless stats.nil?\n\n amount\n end", "def sell_pet_to_customer(shop, pet, customer)\n if pet != nil\n if customer_can_afford_pet(customer, pet) == true\n add_pet_to_customer(customer, pet)\n add_or_remove_cash(shop, pet[:price])\n increase_pets_sold(shop, 1)\n remove_pet_by_name(shop, pet[:name])\n customer[:cash] -= pet[:price]\n end\n end\nend", "def sell_pet_to_customer(pet_shop, pet, customer)\n return if pet == nil\n if customer_can_afford_pet(customer, pet) == true\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend", "def buy_pet(pet)\n self.pets.push(pet)\n pet.owner = self\n end", "def sell_pet_to_customer(shop, pet, customer)\n customer[:cash] -= pet[:price]\n shop[:admin][:total_cash] += pet[:price]\n shop[:admin][:pets_sold] += 1\n customer[:pets] << shop[:pets][3]\nend", "def sell_pet_to_customer(shop_name, sold_pet, customer)\n #p find_pet_by_name(shop_name, sold_pet) != nil\n if sold_pet != nil\n if customer_can_afford_pet(customer, sold_pet) == true\n add_pet_to_customer(customer, sold_pet)\n increase_pets_sold(shop_name, 1)\n remove_customer_cash(customer, sold_pet[:price])\n add_or_remove_cash(shop_name, sold_pet[:price])\n end\n end\nend", "def sell_pets\n self.pets[:dogs].each do |dog|\n dog.mood = \"nervous\"\n end\n self.pets[:cats].each do |cat|\n cat.mood = \"nervous\"\n end\n self.pets[:fishes].each do |fish|\n fish.mood = \"nervous\"\n end\n self.pets[:fishes] = []\n self.pets[:dogs] = []\n self.pets[:cats] = []\n end", "def valuate_sell_article(article)\n return if article.unlimited?\n return if article.sell_locked?\n (0..article.quantity - 1).each {\n if rand(100) < depletion_rate\n deplenish_article(article)\n if article.rare?\n $game_shops.add_on_trade_flow(article.item)\n end\n end\n }\n end", "def sell_all_bot(profit_rate = 0.2)\n markets_url = get_url({ :api_type => \"public\", :action => \"markets\" })\n markets = call_api(markets_url)\n expected_worth = 0.0\n markets.each do |market|\n currency = market[\"MarketCurrency\"]\n base_currency = market[\"BaseCurrency\"]\n market_name = market[\"MarketName\"]\n if market[\"IsActive\"] and base_currency == \"BTC\"\n get_balance_url = get_url({ :api_type => \"account\", :action => \"currency_balance\", :currency => currency })\n balance_details = call_secret_api(get_balance_url)\n if balance_details[\"Available\"] and balance_details[\"Available\"] > 0.0 #purchased coins\n orders_history_url = get_url({ :api_type => \"account\", :action => \"market_orders_history\", :market => market_name })\n orders_history = call_secret_api(orders_history_url)\n net_value = 0.0\n orders_history.each do |order|\n net_value += order[\"Price\"] if order[\"OrderType\"] == \"LIMIT_BUY\"\n net_value -= order[\"Price\"] if order[\"OrderType\"] == \"LIMIT_SELL\"\n end\n if net_value > 0 # buys are more, we need to get more than this net value by selling available coins\n sell_price = (net_value + net_value*profit_rate)/balance_details[\"Available\"]\n sell_price = \"%.8f\" % sell_price\n sell_limit_url = get_url({ :api_type => \"market\", :action => \"sell\", :market => market_name, :quantity => balance_details[\"Available\"], :rate => sell_price })\n order_placed = call_secret_api(sell_limit_url)\n p [order_placed, \"for #{market_name} at #{sell_price}\"]\n end\n expected_worth += (net_value + net_value*profit_rate)\n end\n end\n end\n p [\"Expected Worth=\", expected_worth]\nend", "def sell(player)\n # The player has nothing to sell.\n if player.inventory.empty?\n print NOTHING_TO_SELL\n return\n end\n\n player.print_inventory\n\n print 'What would you like to sell? (or none): '\n input = player_input\n inventory_entry = player.inventory_entry(input)\n\n # The player does not want to sell an item.\n return if input.casecmp?('none')\n\n unless inventory_entry # non-existent item.\n print \"You can't sell what you don't have.\\n\\n\"\n return\n end\n\n item = inventory_entry.first\n item_count = inventory_entry.second\n\n unless item.disposable # non-disposable item (cannot sell/drop).\n print \"You cannot sell that item.\\n\\n\"\n return\n end\n\n puts \"I'll buy that for #{purchase_price(item)} gold.\"\n print 'How many do you want to sell?: '\n amount_to_sell = player_input.to_i\n\n if amount_to_sell > item_count # more than in the inventory.\n print \"You don't have that many to sell!\\n\\n\"\n return\n elsif amount_to_sell < 1 # non-positive amount specified.\n puts 'Is this some kind of joke?'\n print \"You need to sell a positive amount!\\n\\n\"\n return\n end\n\n player.adjust_gold_by((purchase_price(item) * amount_to_sell))\n player.remove_item(item, amount_to_sell)\n print \"Thank you for your patronage!\\n\\n\"\n end", "def have_planets(options={})\n options.assert_valid_keys(:count)\n\n options.reverse_merge! :count => 1\n @objectives.push([\n Objective::HavePlanets,\n {:key => PLANET_KEY, :count => options[:count]}\n ])\n end", "def sell(item, quantity)\n if total_inventory.has_key?(item) && quantity < total_inventory[item]\n @vendors.each do |vendor|\n if vendor.inventory.has_key?(item)\n if vendor.inventory[item] >= quantity\n vendor.inventory[item] -= quantity\n else\n vendor.inventory[item] -= quantity\n diff = vendor.inventory[item].abs\n vendor.inventory[item] = 0\n @vendors.each do |vendor|\n if vendor.inventory.has_key?(item)\n if vendor.inventory[item] != 0\n require \"pry\"\n binding.pry\n vendor.inventory[item] - diff\n end\n end\n end\n end\n end\n end\n return true\n else\n return false\n end\n end", "def all_items_for_sell\r\n list = Array.new\r\n items.each{ |item|\r\n if item.active == true\r\n list.push(item)\r\n end}\r\n list\r\n end", "def sell_pet_to_customer(pet_shop_hash, new_pet, customer_hash)\n if new_pet != nil\n if customer_can_afford_pet(customer_hash, new_pet)\n remove_pet_by_name(pet_shop_hash, new_pet[:name])\n add_pet_to_customer(customer_hash, new_pet)\n remove_customer_cash(customer_hash, new_pet[:price])\n increase_pets_sold(pet_shop_hash, 1)\n add_or_remove_cash(pet_shop_hash,new_pet[:price])\n end\n end\nend", "def buy_dog(name)\n#know sabout its dogs\n pets[:dogs] << Dog.new(name)\n end", "def can_buy_depot_train?(entity)\n entity.cash >= @depot.upcoming.first.price\n end", "def buyPack\n\t\[email protected](@store.buyPack)\n\n\t\textras_dust, n_extras = @collection.disenchantExtras\n\t\tgoldens_dust, n_goldens = @collection.disenchantGoldens\n\n\t\t@dust += extras_dust + goldens_dust\n\t\t@disenchanted += n_extras + n_goldens\n\n\t\t@dust, n_crafted = @collection.craftRarest(@dust)\n\t\t@crafted += n_crafted\n\t\tnew_cards = Store::CARDS_PER_PACK + n_crafted - (n_extras + n_goldens)\n\t\t@cards += new_cards\n\t\t@cards_record.push(@cards)\n\t\t@purchased += 1\n\t\treturn new_cards\n\tend", "def sell!(qty, price)\n order = Fyb::Order.new qty, price, :sell\n order.perform\n end", "def pets?\n pets.is_a?(Enumerable) && pets.count > 1\n end", "def sell_pending\n end", "def can_loot?\n false\n end", "def bought?\n # paym\n end", "def sell_pet_to_customer(shop_hash, wanted_pet_hash, customer_hash)\n # does the shop have the right pet? (BY PET HASH NOT NAME - we have no pre-defined function for this...)\n if shop_hash[:pets].include?(wanted_pet_hash)\n # nested if - if pet available, does customer have sufficient money?\n if customer_can_afford_pet?(customer_hash, wanted_pet_hash)\n # add pet to customer's pets list:\n add_pet_to_customer(customer_hash, wanted_pet_hash)\n # increment pets_sold count\n increase_pets_sold(shop_hash, 1)\n # customer spends cash:\n remove_customer_cash(customer_hash, wanted_pet_hash[:price])\n # shops earns cash:\n add_or_remove_cash(shop_hash, wanted_pet_hash[:price])\n else\n # insufficient funds\n end\n else\n # pet not found\n end\nend", "def sells\n orders[:sells]\n end", "def test_sell_pet_to_customer__pet_found\n customer = @customers[0]\n pet = find_pet_by_name(@pet_shop,\"Arthur\")\n\n sell_pet_to_customer(@pet_shop, pet, customer)\n\n assert_equal(1, customer_pet_count(customer)) #checks the customer pet count so we need to add the pet into the :pets array\n assert_equal(1, pets_sold(@pet_shop)) #checks the pet is sold so we need to add 1 to admin: pets_sold:\n assert_equal(100, customer_cash(customer)) #checks the cash has been deducted from the customers cash e.g. customer cash should = customer cash - cost of the pet\n assert_equal(1900, total_cash(@pet_shop)) #checks the price of the pet is added to the total total cash\n end", "def place_offer(proposer, amount)\n\t\t\tif proposer.balance >= amount\n\t\t\t\tsell_to(proposer, amount) if @owner.decide(:consider_proposed_trade, game: @owner.game, player: @owner, proposer: proposer, property: self, amount: amount).is_yes?\n\t\t\tend\n\t\tend", "def commodities_to_sell\n @trade_prefs.keys.select { |commodity| sells?(commodity) }\n end", "def buyable_items(_entity)\n []\n end", "def buy_cat(name)\n #knows about its cats\n pets[:cats] << Cat.new(name)\n end", "def sell!(amount, price)\n add_order!(:sell, amount, price)\n end", "def sell_pet_to_customer(pet_shop, pet, customer)\n pet_shop[:admin][:pets_sold] += pet\n customer[:pets] += pet\n customer[:cash] -= pet[:price]\n pet_shop[:admin][:total_cash] += pet[:price]\n pet_shop[:pets].delete(pet)\nend", "def sell_pet_to_customer(shop,the_pet,the_customer)\n if the_pet != nil\n add_pet_to_customer(the_customer,the_pet)\n shop[:admin][:pets_sold] +=1\n remove_customer_cash(the_customer,the_pet[:price])\n add_or_remove_cash(shop,the_pet[:price])\n # else\n # shop[:admin][:pets_sold] +=1\n end\nend", "def sell_pet_to_customer(pet_store, bought_pet, customer)\n if bought_pet != nil && (customer[:cash] >= bought_pet[:price])\n add_pet_to_customer(customer, bought_pet)\n increase_pets_sold(pet_store, 1)\n remove_customer_cash(customer, bought_pet[:price])\n add_or_remove_cash(pet_store, bought_pet[:price])\n end\nend", "def sell_pet_to_customer(hash, pet, customer)\n add_pet_to_customer(customer, pet)\n increase_pets_sold(hash, 1) #interger too specific why not pet.count.to_i?\n remove_customer_cash(customer, 900)\n add_or_remove_cash(hash, 900)\nend", "def attemp_buying\n\n end", "def check_buyable\n raise PermissionDeniedError, \"出品したアイテムはサポートできません\" if @item.owner?(current_user)\n end", "def pets_owned (x)\n @pets.push (x)\n end", "def choice_a_shop\n sell_item\n end", "def bet(chips)\n\n end", "def sell_pets\n self.cats.each{ |each_cat|\n each_cat.mood = \"nervous\"\n each_cat.owner = nil\n }\n \n self.dogs.each{ |each_dog|\n each_dog.mood = \"nervous\"\n each_dog.owner = nil\n }\n\n self.cats.clear\n self.dogs.clear\n end", "def pets_sold(petshop)\n return petshop[:admin][:pets_sold]\n end", "def customers_affordable_pets(pet_shop_details,customer)\n affordable_pets = []\n for pet in pet_shop_details[:pets]\n if can_customer_afford_pet?(customer,pet)\n affordable_pets.push(pet)\n end\n end\n return affordable_pets\nend", "def sell_pet_to_customer(pet_shop_details, wanted_pet, customer)\n return if wanted_pet == nil || !can_customer_afford_pet?(customer, wanted_pet)\n add_pet_to_owner(customer, wanted_pet)\n remove_customer_cash(customer, wanted_pet[:price])\n add_or_remove_cash(pet_shop_details, wanted_pet[:price])\n remove_pet_by_name(pet_shop_details, wanted_pet[:name])\n pet_shop_details[:admin][:sold_pets].push(wanted_pet)\nend", "def buy_fish(name)\n#knows about its fishes\n pets[:fishes] << Fish.new(name)\n end", "def buy_pet(pet_cost)\n sql = \"SELECT SUM (pets.cost) FROM pets INNER JOIN adoptions ON pets.id = adoptions.pet_id WHERE adoptions.owner_id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values).first\n @funds = @funds - result['sum'].to_i\n end", "def buyPack\n\t\tpack = Array.new(CARDS_PER_PACK)\n\t\tfor i in 0..CARDS_PER_PACK-2\n\t\t\tpack[i] = randomCard\n\t\tend\n\t\tcontains_rare = pack[0..CARDS_PER_PACK-2].any? {|card| atLeastRare? card}\n\t\tif !contains_rare\n\t\t\tpack[CARDS_PER_PACK-1] = randomRare\n\t\telse\n\t\t\tpack[CARDS_PER_PACK-1] = randomCard\n\t\tend\n\t\treturn pack\n\tend", "def inventory\n product=Product.find(params[:id])\n haveProduct = false\n if product.inventory && product.inventory > 0\n haveProduct = true;\n end\n render plain: haveProduct\n end", "def sell_at_any_cost(percent_decrease = 0.3)\n market_name = @market_name\n open_orders_url = get_url({ :api_type => \"market\", :action => \"open_orders\", :market => market_name })\n open_orders = call_secret_api(open_orders_url)\n #cancel all orders\n if open_orders.size > 0\n open_orders.each do |open_order|\n cancel_order_url = get_url({ :api_type => \"market\", :action => \"cancel_by_uuid\", :uuid => open_order[\"OrderUuid\"] })\n call_secret_api(cancel_order_url)\n end\n end\n # call sell bot again with lower profit\n sell_order = sell_bot(percent_decrease)\nend", "def take_bets\n @players.each do |p|\n @events.handle(:pre_player_bet, p)\n\n p.hand.bet = p.place_bet\n\n @events.handle(:post_player_bet, p, p.hand.bet)\n end\n end", "def buy_product\n products = @seller.show_product_info \n product_buy = @view.buy_product(products)\n @total_price = @seller.save_buy_a_product(product_buy)\n @view.buy_status(@total_price)\n input = @view.menu(\"2\")\n seller_actions(input) \n end", "def sell_to(player)\n return if @price > player.balance \n !player.subtract_balance(@price)\n @owner = player.piece\n @owned = true\n end", "def sell_all(ticker, timestamp)\n broker.sell_all(self, ticker, timestamp)\n end", "def pets_by_breed(petshop,breed)\n pets=[]\n petshop[:pets].each do\n |pet| \n if pet[:breed] == breed\n pets.push(breed) \n end\n end\n return pets\n end", "def pets\n pets = self.dogs + self.cats\n end" ]
[ "0.6725362", "0.65979195", "0.6569477", "0.6442688", "0.6432307", "0.6421552", "0.6413916", "0.6410542", "0.6361342", "0.6285658", "0.6207327", "0.61855274", "0.6183451", "0.61679745", "0.61597633", "0.61535054", "0.6153486", "0.6132886", "0.61115587", "0.6104465", "0.6102162", "0.60329884", "0.60279167", "0.60179716", "0.6000535", "0.5993809", "0.5972675", "0.596489", "0.5953373", "0.59496033", "0.59394866", "0.59209645", "0.5913856", "0.59083724", "0.59077346", "0.5897678", "0.58878267", "0.5878396", "0.5866264", "0.5865729", "0.58602184", "0.58582807", "0.5854216", "0.5850384", "0.5845327", "0.5839594", "0.5827732", "0.582523", "0.58224756", "0.58047134", "0.57664853", "0.57662445", "0.57661295", "0.5715344", "0.57142836", "0.5708374", "0.5691115", "0.56766456", "0.567097", "0.5668085", "0.56671464", "0.566691", "0.5659091", "0.56567115", "0.56534034", "0.56445366", "0.5638611", "0.5635692", "0.56350327", "0.5632191", "0.563189", "0.56296825", "0.56291384", "0.5606383", "0.56025994", "0.55976206", "0.5596987", "0.55890197", "0.5584362", "0.55766386", "0.5575951", "0.55751127", "0.5556966", "0.5556043", "0.55513984", "0.5548433", "0.5541812", "0.5517366", "0.5511984", "0.5511793", "0.55056745", "0.5494236", "0.548895", "0.5484356", "0.5481785", "0.54753685", "0.5469841", "0.5466248", "0.5464102", "0.5459993" ]
0.557549
81
can list off its pets
def list_pets "I have #{pets[:fishes].count} fish, #{pets[:dogs].count} dog(s), and #{pets[:cats].count} cat(s)." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pets\n\t\t@pets_list\n\tend", "def pets\n @pets\n end", "def index\n @shelter = Shelter.first\n @pets = Pet.get_available_pets.order(:pet_type)\n if (!@cart)\n set_cart\n end\n @selectedPets = @cart.selected_pets\n end", "def pets #stores all of the owners pets\n @pets #expect(owner.pets).to eq({:fishes => [], :dogs => [], :cats => []})\n end", "def index\n @pets = current_user.pets.all\n end", "def list_adopted_pets()\n sql = \"SELECT * FROM pets INNER JOIN adoptions ON pets.id = adoptions.pet_id WHERE adoptions.owner_id = $1\"\n values = [@id]\n pets = SqlRunner.run(sql, values)\n return pets.map{|pet| Pet.new(pet)}\n end", "def pets\n pet_owners.map do |pet_owner|\n pet_owner.pet\n end\n end", "def list_pets\n \"I have #{self.pets[:fishes].length} fish, #{self.pets[:dogs].length} dog(s), and #{self.pets[:cats].length} cat(s).\"\n end", "def planet_list\n return @planets\n end", "def get_list_of_planets\n planets = get_space_bodies.select{|body| body[\"isPlanet\"] == true}\n end", "def list_pets\n \"I have #{self.dogs.count} dog(s), and #{self.cats.count} cat(s).\"\n end", "def list_pets\n \"I have #{self.dogs.count} dog(s), and #{self.cats.count} cat(s).\"\n end", "def planets; end", "def list_pets\n \"I have #{@pets[:fishes].count} fish, #{@pets[:dogs].count} dog(s), and #{@pets[:cats].count} cat(s).\"\n end", "def pets?\n pets.is_a?(Enumerable) && pets.count > 1\n end", "def list_pets\n return \"I have #{@pets[:fishes].count} fish, #{@pets[:dogs].count} dog(s), and #{@pets[:cats].count} cat(s).\"\n end", "def list_planets\n list = \"Planets orbiting #{@star_name}:\\n\"\n @planets.each do |planet|\n list += \"* #{planet.name}\\n\"\n end\n list += \"\\n\"\n return list\n end", "def index\n @pets = Pet.all\n end", "def index\n @pets = Pet.all\n end", "def list_pets \n \"I have #{self.dogs.count} dog(s), and #{self.cats.count} cat(s).\"\n end", "def list_of_planets\n list = []\n @planets.length.times do |index|\n list << \"#{index+1}. #{@planets[index].name}\"\n end\n return list\n end", "def list_pokemons\n\n end", "def show\n # load all that users pets\n @pets = @user.pets.page(params[:page]).per(3)\n end", "def index\n @pet_items = PetItem.all\n end", "def list_pets\n dog_n = self.pets[:dogs].size\n cat_n = self.pets[:cats].size\n fish_n = self.pets[:fishes].size\n\n \"I have #{fish_n} fish, #{dog_n} dog(s), and #{cat_n} cat(s).\"\n #self.pets.each do |key,value|\n \n end", "def list_all_planets\n puts \"The #{ @system } system has these #{ @all_planets.length } planets:\"\n @all_planets.each do |planet|\n puts \"#{@all_planets.index(planet)+1}. #{planet.name}\"\n end\n end", "def vegetable_toppings()\n\tvegetable_toppings = [\"mushrooms\", \"spinach\", \"broccoli\", \"pineapple\", \"peppers\"]\nend", "def list_planets\n puts \"Planets orbiting #{star_name}:\"\n\n @planets.each_with_index do |planet, i|\n @list_of_planets << \"#{i+1}. #{planet.name}\"\n end\n return @list_of_planets\n end", "def list_pokemon\n puts \"\"\n puts \"See below for the list of the original Pokemon!\"\n puts \"\"\n @pokemon_objects.each.with_index(1) do |a, i|\n puts \"#{i}. #{a.name}\"\n end\n puts \"\"\n end", "def list_planets()\n\t\tplanets_list = @planets.each_with_index.map {|planet,index|\n\t\t\t\"#{index + 1}. #{planet.name}\"}\n\t\tplanets_list.unshift(\"Planets orbiting #{@star_name}:\\n\").to_s\n\t\t\n\t\treturn planets_list \n\tend", "def show_planets\n @planet_names = planets.keys{:name}\n end", "def list_planets\n list_planets = \"Planets orbiting #{star_name} \\n\"\n\n @planets.each_with_index do |planet, index|\n list_planets = \"#{list_planets}\" + \"#{index + 1}. #{planet.name}\\n\"\n end\n\n return list_planets\n end", "def sell_pets\n pets.each {|kind, moods|\n moods.each {|pets| pets.mood=(\"nervous\")}\n moods.clear\n }\n end", "def display_planet_list\n puts \"Here are the current planets in our solar system:\"\n @all_planets.each do |planet_info|\n puts planet_info.name\n end\n end", "def display_pets\n\t\tpets.join(\"\\n\")\n\tend", "def list_planets\n i = 1\n planets_list = \"\"\n @planets.each do |planet|\n planets_list += \"#{i}. #{planet.name}\\n\"\n i += 1\n end\n return \"Planets orbiting #{@star_name}:\\n#{planets_list}\"\n end", "def list_planets\n planet_list = \"Planets orbiting #{@star_name}:\"\n @planets.each_with_index do |planet, index|\n planet_list += \"\\n#{index + 1}. #{planet.name}\"\n end\n return planet_list\n end", "def index\n @adopted_pets = AdoptedPet.all\n end", "def index\n @adopted_pets = AdoptedPet.all\n end", "def index\n @bets = Bet.all\n end", "def show\n @team = Team.find(params[:id])\n @team_pets = @team.pets\n if @team_pets.length > 0\n @pets = current_user.pets.where('id not in (?)', @team_pets)\n else\n @pets = current_user.pets\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end", "def test\n\tvoters = [Voter.new(\"Ed\", \"Liberal\"), Voter.new(\"Juha\", \"Tea Party\"), Voter.new(\"Jo\", \"Socialist\")]\n\n\tworld = World.new\n\tworld.main_menu\n\n\tvoters = world.voters\n\tvoter = voters.first\n\tp voter.name, voter.politics\nend", "def list_planets\n planet_list = \"Planets orbiting #{ @star_name }\\n\"\n @planets.length.times do |add|\n planet_list += \"#{ add + 1 }. #{ @planets[add].name }\\n\"\n end\n\n return planet_list\n end", "def addpets\n\t\t@petowner = Petowner.find( params[:id] )\n\t\t@all_pets_in_system = Pettype.all\n\t\t\n\tend", "def index\n @title = 'Mascotas'\n @pets = Pet.where(adpted: 'f').page(params[:page]).per(3)\n end", "def list_planets\n planet_list = ''\n i = 0\n @planets.each do |planet|\n i += 1\n planet_list << \"#{i}. #{planet.name.capitalize}\\n\"\n end\n planet_list\n end", "def buy_dog(name)\n#know sabout its dogs\n pets[:dogs] << Dog.new(name)\n end", "def customers_affordable_pets(pet_shop_details,customer)\n affordable_pets = []\n for pet in pet_shop_details[:pets]\n if can_customer_afford_pet?(customer,pet)\n affordable_pets.push(pet)\n end\n end\n return affordable_pets\nend", "def list\n end", "def list\n end", "def list\n end", "def list_command\n age = get_param(\"age\\=\", \"(\\d+)\")\n type = get_param(\"type\\=\", \"([a-zA-Z]+)\")\n\n @app.list_animals(age, type)\n end", "def index\n @postulation_pets = PostulationPet.all\n end", "def index\n response = HTTParty.get('http://okta-api:8080/pets/v1/cats', {headers: {\"X-Token\"=> session[:oktastate][:credentials][:token]}})\n if response.code == 200\n @cats = JSON.parse(response.body)\n else\n @cats = []\n end\n end", "def index\n @typeofpets = Typeofpet.all\n end", "def index\n @pet_trues = PetTrue.all\n end", "def sell_pets\n all_pets = []\n all_pets << self.cats \n all_pets << self.dogs \n all_pets.flatten.map do |each_pet|\n each_pet.mood = \"nervous\"\n each_pet.owner = nil\n end\n end", "def list\n puts \"Here is a list of all the Voters!\"\n puts \"\"\n @voters.each do |voter|\n puts \"Voter: #{voter[:name]}, #{voter[:affiliation]}\"\n end\n puts \"Here is the list of all the Politicians!\"\n puts \"\"\n @politicians.each do |politician|\n puts \"Politician: #{politician[:name]}, #{politician[:affiliation]}\"\n end\n end", "def list\n\n end", "def list_of_pvas\n super\n end", "def index\n @pets = Pet.all\n # render 'index' => where render is a method call and 'index' is an argument\n # rails will implicitly try to render a view template with the same name as the action\n end", "def shelter_pets(options = {})\n defaults = {'id' => 1}\n options = defaults.merge(options)\n \n @petfinder.shelter_pets(options['id'], options)\n end", "def pets_owned (x)\n @pets.push (x)\n end", "def index\n @question_pets = QuestionPet.all\n end", "def list(*) end", "def pets_by_breed(pet_shop, breed)\n pets_of_type_breed = []\n for pet in pet_shop[:pets]\n pets_of_type_breed << pet[:name] if pet[:breed] == breed\n end\n return pets_of_type_breed\nend", "def pets_by_breed(petshop,breed)\n pets=[]\n petshop[:pets].each do\n |pet| \n if pet[:breed] == breed\n pets.push(breed) \n end\n end\n return pets\n end", "def list\n response = self.class.get('/droplets', headers: @header)\n tratar_response(response)\n end", "def index\n @lectures = Lecture.where(public: true)\n end", "def pets_by_breed(petshop,breed)\n pets=[]\n for pet in petshop[:pets] do\n if pet[:breed] == breed\n pets.push(breed) \n end\n end\n return pets\n end", "def list\n display_recipes\n end", "def list_all_animals(shelter)\n\n if shelter.animals.any?\n puts \"*** List of all animals ***\"\n shelter.animals.each do |key, x|\n puts \"Name: #{x.name}, Breed: #{x.breed}, Gender: #{x.gender}, Age: #{x.age}, Toys: #{x.toys.join(', ')}, Adoption: #{x.adoption}\"\n end\n else\n puts \"We have no animals left!\"\n end\n\nend", "def index\n @pets = []\n if current_user.role.name != 'cliente'\n @pets = Pet.all\n else\n if !current_user.nil?\n id = current_user.data_id\n if !id.nil?\n @client = Client.find(id)\n @pets = @client.pets\n end\n end\n end\n end", "def list_animals \n puts \"Here are the current animals in shelter: \"\n @animals_in_shelter.each do |animal|\n puts animal.get_animal_info\n end\n end", "def list_inventory\n\n # print the table header\n @gc.d_print(\"Inventory:\")\n\n # print each item with some indent\n @inventory.each do |object|\n @gc.display(\" > #{object.get_name}\")\n end\n\n # if there is nothing in the player's inventory, say so\n if @inventory.length == 0\n @gc.display(\" - Nothing\")\n end\n\n end", "def list_of_planets()\n counter = 0\n planet_names = \"\"\n @planets.each do |planet|\n planet_names += \"\\n#{counter+1}. #{planet.planet_details}\"\n counter+=1\n end\n return planet_names\n end", "def sell_pets\n all_owner_pets = self.dogs + self.cats\n \n all_owner_pets.each do |pet|\n pet.mood = \"nervous\"\n pet.owner = nil\n end \n\n end", "def listings\n authorize! :read, @user\n end", "def list_pets\n @owner.dogs.count\n @owner.cats.count\n end", "def adoption_list(shelter)\n\n if shelter.animals.any?\n puts \"*** List of animals available for adoption ***\"\n shelter.animals.each do |key, x|\n if x.adoption == \"y\"\n puts \"Name: #{key}, Breed: #{x.breed}, Gender: #{x.gender}, Age: #{x.age}, Toys: #{x.toys.join(', ')}, Adoption: #{x.adoption}\"\n end\n end\n else\n puts \"We have no animals left!\"\n end\n\nend", "def list_planet_names\n list_planet_names = []\n planets_collection.each do |planet_name|\n list_planet_names << planet_name.name\n end\n return list_planet_names\n end", "def count_pet\n pets.count\n end", "def sell_pets\n pets = dogs + cats\n\n pets.each do |pet|\n pet.mood = \"nervous\"\n pet.owner = nil\n end\n end", "def list; end", "def list; end", "def list; end", "def list; end", "def list; end", "def list_pets\n # if @pets[:cats].size == 1\n # @catplural = \"\"\n # else\n # @catplural = \"'s\"\n # end\n # if @pets[:dogs].size == 1\n # @dogplural = \"\"\n # else\n # @dogplural = \"'s\"\n # end\n # \"I have #{pets[:fishes].size} fish, #{pets[:dogs].size} dog#{@dogplural}, and #{pets[:cats].size} cat#{@catplural}.\"\n \"I have #{pets[:fishes].size} fish, #{pets[:dogs].size} dog(s), and #{pets[:cats].size} cat(s).\"\n end", "def add_pet(pet)\n\t\t@pets_list << pet\n\tend", "def sell_pets\n Cat.all.collect do |cats|\n cats.mood=\"nervous\"\n cats.owner=nil\n end\n Dog.all.collect do |dogs|\n dogs.mood=\"nervous\"\n dogs.owner=nil\n end\n end", "def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end", "def index\n @peticions = Peticion.all\n end", "def list?\n false\n end", "def index\n @pet_breeds = PetBreed.all\n end", "def total_pets\n pets.count\n end", "def index\n @client = Client.find params[:client_id]\n @pets = @client.pets\n end", "def list_planets\n list = \"\"\n @planets.each do |planet|\n list += \"#{@planets.index(planet) + 1}. #{planet}\\n\"\n end\n return list\n end", "def find_pet_by_name(pet_shop, pet_name)\n\n for pets in pet_shop[:pets]\n\n if pets[:name] == pet_name\n\n\n return pets\n\n end\n end\n\n return\n end" ]
[ "0.7696536", "0.7180371", "0.6440963", "0.64260787", "0.6226749", "0.6151779", "0.61307096", "0.61043394", "0.60310346", "0.60158753", "0.59042734", "0.59042734", "0.5897309", "0.5894113", "0.5891176", "0.58812946", "0.58645076", "0.58613664", "0.58613664", "0.5797106", "0.5781384", "0.57677996", "0.5767289", "0.5753086", "0.5744314", "0.57338583", "0.5724737", "0.5716617", "0.5693115", "0.5671525", "0.5661435", "0.5653684", "0.5652435", "0.5639651", "0.56275284", "0.56225616", "0.560598", "0.55938745", "0.55938745", "0.55929583", "0.5591459", "0.5588628", "0.55881214", "0.55849713", "0.5571449", "0.5569515", "0.5560897", "0.5560814", "0.5552359", "0.5552359", "0.5552359", "0.5545983", "0.5528394", "0.5527722", "0.5525524", "0.55180085", "0.5516716", "0.5516127", "0.5515327", "0.5502254", "0.54972297", "0.54934186", "0.5489216", "0.54798985", "0.5472221", "0.5471439", "0.54533154", "0.54492205", "0.5445315", "0.54406977", "0.5440165", "0.54376674", "0.5436947", "0.54153556", "0.54117864", "0.5409822", "0.5406868", "0.5393911", "0.53917146", "0.53893006", "0.53866714", "0.5382636", "0.53754777", "0.5374898", "0.5374898", "0.5374898", "0.5374898", "0.5374898", "0.53648645", "0.5360426", "0.53592676", "0.53571594", "0.535455", "0.5351872", "0.5348705", "0.53479546", "0.53453124", "0.5341149", "0.5337002" ]
0.6023061
10
+xml_file+ : full path to taxonomy.xml
def initialize(xml_file) doc_taxonomies = LonelyPlanet::Doc.load xml_file taxonomies_fragement = doc_taxonomies.css 'taxonomy > node' @continents = [] set_continents(taxonomies_fragement) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_taxonomy\n\n parser = XML::Parser.file(@taxonomy_file_full_path, :encoding => XML::Encoding::UTF_8)\n taxonomy_document = parser.parse\n\n # root node\n root_node = taxonomy_document.find_first('//taxonomy_name')\n @taxonomy.add_node('0', root_node.content, nil)\n @logger.debug \"Root: #{root_node.content}\"\n\n # parsing the taxonomy doc into my Taxonomy class\n taxonomy_document.find('//node').each do |node|\n\n @logger.debug \"Node: #{node.attributes['atlas_node_id']}\"\n\n if node.children?\n\n node_id = node.attributes['atlas_node_id']\n node_name = node.find_first('./node_name').content\n @taxonomy.add_node(node_id, node_name, '0')\n\n node.find('./node').each do |child|\n\n @logger.debug \"Child #{child.attributes['atlas_node_id']}\"\n\n child_id = child.attributes['atlas_node_id']\n child_name = child.find_first('./node_name').content\n @taxonomy.add_node(child_id, child_name, node_id)\n\n end\n\n end\n\n end\n\n end", "def initialize(file_path)\n @document = nokogiri_xml(file_path)\n @root_node = TaxGenerator::TaxonomyNode.new('ROOT', 'ROOT')\n @taxonomies = []\n find_taxonomies\n end", "def nokogiri_xml(file_path)\n Nokogiri::XML(File.open(file_path), nil, 'UTF-8')\n end", "def xml\n File.read(\"#{@file_path}.xml\")\n end", "def load_xml file\n f = File.open file\n doc = Nokogiri::XML f\n f.close\n doc\n end", "def read(file)\n\t\tf = File.open file\n\t\t@doc = Nokogiri::XML(f)\n\t\t@current_node = @doc.root;\n\t\tf.close\n\tend", "def update_ncbi_info(file = nil)\n\t\t\tif length == 0\n\t\t\t\twarn \"WARNING: no taxons in the set [skipping]\"\n\t\t\t\treturn -1\n\t\t\tend\n\t\t\twarn \"* loading NCBI information\"\n\t\t\t\n\t\t\tBio::NCBI.default_email = \"[email protected]\"\n\t\t\tncbi = Bio::NCBI::REST::EFetch.new\n\t\t\t\n\t\t\tlist = []\n\t\t\teach_value do |taxon|\n\t\t\t\tlist << taxon.id\n\t\t\tend\n\t\t\tlist.join(\" \")\n\t\t\ttaxfile = ncbi.taxonomy(list, \"xml\")\n\t\t\t\n\t\t\tfile = config.dir_config + \"ncbi_taxonomy.xml\" if ! file\n\t\t\t# TODO: check the existence of the file and make backup.\n\t\t\t\n\t\t\tif file.exist?\n\t\t\t\twarn \"* file exist! making backup...\"\n\t\t\t\tFile.move(file, file.dirname + (file.basename.to_s + \"_ori\"))\n\t\t\tend\n\t\t\t\n\t\t\tf = File.open(file, \"w\")\n\t\t\tf.puts taxfile\n\t\t\tf.close\n\t\tend", "def from_file(file_path)\n from_xml(File.read(file_path))\n end", "def load_xml(file_path)\n # Read the source XML file.\n puts \"file_path: #{file_path}\"\n raw_xml = File.read(file_path)\n\n # Parse raw_xml using Nokogiri.\n parsed_doc = Nokogiri.XML(raw_xml)\nend", "def read(file) \n @file = Nokogiri::XML(file){ |cfg| cfg.noblanks } \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 ingest\n return \"filename is blank\" if @taxonomy_file == \"\"\n taxonomy_doc = read_taxonomy\n\n xpath = find_deepest_node(taxonomy_doc)\n destinations_lookup = {}\n get_place_info_and_parent_place_info_from_node_xpath(taxonomy_doc,xpath).each do |data_object|\n destinations_lookup = build_data_objects_from_place_info_data(destinations_lookup,data_object)\n end\n destinations_lookup\n end", "def xml_load(file_path)\n result = MultiXml.parse(File.read(file_path)).to_smash[:configuration]\n xml_format(result)\n end", "def extractDatabase(type)\n Nokogiri::XML(IO.read(\"#{$path}../../databases/taxonomy.xml\")).xpath(\"//taxon[@label=\\\"#{type}\\\"]//file/@URL\").to_s\nend", "def read_file(filename)\n File.open(filename, \"r\") {|f| load_xml(f.read)}\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 import(xmlfile)\n form_data = { \"action\" => \"import\",\n \"xml\" => File.new(xmlfile),\n \"token\" => get_token('import', 'Main Page'), # NB: dummy page name\n \"format\" => 'xml' }\n make_api_request(form_data)\n end", "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 import_qualys_xml_file(args={})\n\t\tfilename = args[:filename]\n\t\twspace = args[:wspace] || workspace\n\n\t\tf = File.open(filename, 'rb')\n\t\tdata = f.read(f.stat.size)\n\t\timport_qualys_xml(args.merge(:data => data))\n\tend", "def parse_xml(filename)\n @parser = Parser.new :pregenerated => filename\n @parser.parse\n end", "def read_file(file)\n build_xml(Ripper::SexpBuilder.new(IO.read(file)).parse)\n end", "def read_file(file)\n build_xml(Ripper::SexpBuilder.new(IO.read(file)).parse)\n end", "def update_xml_from_file(base='public/static/xml_downloads')\n filename = \"#{base}/#{nct_id}.xml\"\n if !File.exists?(filename)\n # update error\n return\n end\n\n content = File.read(filename)\n\n xml = Nokogiri::XML(content)\n if xml.xpath('//clinical_study').length > 0\n self.content = content\n return false unless changed?\n return update content: content\n else\n # add error\n end\n end", "def DataLoadFromFile(filename)\n file = File.new(filename)\n \n @xml_data = file\n self.ScrapAnalyse()\n end", "def load_ncbi_info(update = false)\n\t\t\tdef _parse_ncbi_taxonomy(file)\n\t\t\t\tdoc = REXML::Document.new(file.read)\n\t\t\t\t\n\t\t\t\ttax = {}\n\t\t\t\ttax['id'] = []\n\t\t\t\ttax['code'] = []\n\t\t\t\t#id = []\n\t\t\t\t#code = []\n\t\t\t\t\n\t\t\t\tdoc.elements.each('TaxaSet/Taxon/TaxId') do |item|\n\t\t\t\t\ttax['id'] << item.text\n\t\t\t\tend\n\t\t\t\tdoc.elements.each('TaxaSet/Taxon/GeneticCode/GCId') do |item|\n\t\t\t\t\ttax['code'] << item.text\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t#[id, code]\n\t\t\t\ttax\n\t\t\tend\n\t\t\t\n\t\t\t# Maybe do other way: check for each id in the TaxonSet.\n\t\t\tdef _parse_taxonomy(tax)\n\t\t\t\ttax['id'].each_index do |index|\n\t\t\t\t\ttaxon = get_item_by_id(tax['id'][index])\n\t\t\t\t\tif (! taxon.nil?) then\n\t\t\t\t\t\ttaxon.trans_table = tax['code'][index].to_i\n\t\t\t\t\telse\n\t\t\t\t\t\t# then there is a taxon not in the file: we need to update:\n\t\t\t\t\t\twarn \"[WARNING]\".red + \" a taxon not in the ncbi taxonomy (\" + tax['id'] + \") was detected. redownloading ncbi taxonomy file...\"\n\t\t\t\t\t\treturn nil\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\treturn true\n\t\t\tend\n\t\t\t\n\t\t\tres1 = update_ncbi_info if update\n\t\t\t\n\t\t\tfile = config.dir_config + \"ncbi_taxonomy.xml\"\n\t\t\tres1 = update_ncbi_info if ! file.exist?\n\t\t\t\n\t\t\t# OPTIONAL: maybe it is worth download the entire taxonomy? (maybe from ftp).\n\t\t\treturn if res1 == -1 # i.e. there are no taxons in taxon.txt\n\t\t\t\n\t\t\ttax = {}\n\t\t\ttax = _parse_ncbi_taxonomy(file)\n\t\t\tres2 = _parse_taxonomy(tax)\n\t\t\t\n\t\t\tif res2.nil?\n\t\t\t\tupdate_ncbi_info\n\t\t\t\ttax = _parse_ncbi_taxonomy(file)\n\t\t\t\tres2 = _parse_taxonomy(tax)\n\t\t\t\tif res2.nil?\n\t\t\t\t\twarn \"[ERROR]\".red + \" something is wrong with the ncbi taxonomy file.\"\n\t\t\t\t\texit\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def read_xml(xml)\n REXML::Document.new(File.read(xml)).root\nend", "def get_ncbi_taxonomy(exclude=nil)\n getTaxDump if !File.exists?(\"names.dmp\") && !File.exists?(\"ncbi_taxonomy.txt\")\n if !File.exists?(\"ncbi_taxonomy.txt\")\n ranks = Hash.new\n parents = Hash.new\n seen = Hash.new\n tax = File.new(\"ncbi_taxonomy.txt\", \"w\")\n STDERR << \"Loading nodes...\\n\"\n File.new(\"nodes.dmp\").each do |line|\n num, parent, rank = line.chomp.split(\"\\t|\\t\")\n num = num.to_i\n parent = parent.to_i\n ranks[num] = rank\n parents[num] = parent\n end\n File.new(\"names.dmp\").each do |line|\n num, name, foo, type = line.chomp.split(\"\\t|\\t\")\n type = type.split(\"\\t\").first\n num = num.to_i\n if type == \"scientific name\"\n if seen[num]\n seen[num] = 1\n end\n name.gsub!(\"Candidatus \",\"\")\n tax.print [num.to_s, name, parents[num].to_s, ranks[num]].join(\"\\t\") + \"\\n\"\n end\n end\n File.unlink(\"citations.dmp\", \"delnodes.dmp\", \"division.dmp\", \"gencode.dmp\", \"merged.dmp\",\n \"names.dmp\", \"nodes.dmp\", \"gc.prt\", \"readme.txt\", \"taxdump.tar.gz\")\n end\n excluded = Hash.new\n if exclude\n File.new(exclude).each do |line|\n num, rest = line.chomp.split(\"\\t\")\n excluded[num.to_i] = true\n end\n end\n ncbi = Hash.new\n ncbi_line = Hash.new\n STDERR << \"Loading ncbi taxonomy...\\n\"\n File.new(\"ncbi_taxonomy.txt\").each do |line|\n num, name, parent = line.chomp.split(\"\\t\")\n if !excluded[num.to_i]\n ncbi[name] = num.to_i\n ncbi_line[num.to_i] = [name, parent.to_i]\n end\n end\n [ncbi, ncbi_line]\nend", "def xml\n @xml ||= Nokogiri::XML(path).remove_namespaces!\n end", "def initialize(xml_file_name)\n @xml_file_name = xml_file_name\n @kinvars = Array.new\n doc = REXML::Document.new(File.new(xml_file_name)) \n kv_elem = doc.elements['kinematic-variables']\n kv_elem.elements.each('kinvar'){|kv| @kinvars.push Kinvar.new(kv)}\n @data_file = kv_elem.elements['dat-file'].attributes['file']\n @file = File.new(@data_file,'rb')\n end", "def parse_xml(file)\n\t\tdata = []\n\t\t# Break open XML and go through nodes\n\t\tbegin\n\t\t\tfile = file_sanitizer(file)\n\t\t\tdata = XmlSimple.xml_in(file, {'ForceArray' => false })\n\t\trescue Exception => e\n\t\t\traise e\n\t\tend\n\t\tdata\n\tend", "def set_indicate_taxonomy\n @indicate_taxonomy = Indicate::Taxonomy.find(params[:id])\n end", "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 read_XML_file(xfile)\n result_array = []\n if File.file?(xfile)\n puts \"\\n\\nOPENING #{xfile}\"\n f = File.open(xfile)\n doc = Nokogiri::XML(f)\n if is_squish?(doc)\n result_array = squish_parser(doc)\n else\n result_array = rspec_parser(doc)\n end\n else\n puts \"\\nNot a file: #{xfile} - verify options (-x for directory, -f for a specific file)\"\n end\n return result_array \n end", "def _parse_taxonomy(tax)\n\t\t\t\ttax['id'].each_index do |index|\n\t\t\t\t\ttaxon = get_item_by_id(tax['id'][index])\n\t\t\t\t\tif (! taxon.nil?) then\n\t\t\t\t\t\ttaxon.trans_table = tax['code'][index].to_i\n\t\t\t\t\telse\n\t\t\t\t\t\t# then there is a taxon not in the file: we need to update:\n\t\t\t\t\t\twarn \"[WARNING]\".red + \" a taxon not in the ncbi taxonomy (\" + tax['id'] + \") was detected. redownloading ncbi taxonomy file...\"\n\t\t\t\t\t\treturn nil\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\treturn true\n\t\t\tend", "def xml(path)\n Nokogiri::XML read path\n end", "def metadata_xml\n Nokogiri::XML(original_file.content)\n end", "def from_file(filename, encoding = nil, options = Nokogiri::XML::ParseOptions::DEFAULT_XML)\n file = File.open(filename)\n @mods_ng_xml = Nokogiri::XML(file)\n file.close\n normalize_mods\n end", "def create\n @indicate_taxonomy = Indicate::Taxonomy.new(indicate_taxonomy_params)\n\n respond_to do |format|\n if @indicate_taxonomy.save\n format.html { redirect_to @indicate_taxonomy, notice: 'Taxonomy was successfully created.' }\n format.json { render :show, status: :created, location: @indicate_taxonomy }\n else\n format.html { render :new }\n format.json { render json: @indicate_taxonomy.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload_xml_file(file_name, xml)\n # Creates directory if it doesn't exist\n create_upload_dir\n # Save file to server's uploads dir\n file_to_upload = File.open(Rails.root.join('public', 'uploads', file_name), \"wb\")\n file_to_upload.write(xml)\n file_to_upload.close()\n end", "def read_xml\n @epub.file.read_xml(abs_filepath)\n end", "def read\n Hash.from_xml(File.open(file_name))\n end", "def set_luxire_taxonomy\n @luxire_taxonomy = LuxireTaxonomy.find(params[:id])\n end", "def find_taxonomies\n @document.xpath('.//taxonomy').each do |taxonomy_node|\n taxonomy_name = taxonomy_node.at_xpath('.//taxonomy_name')\n tax_node = insert_node(SecureRandom.uuid, taxonomy_name.content, @root_node)\n @taxonomies << tax_node\n add_node(taxonomy_node, tax_node, skip_add: true)\n end\n end", "def source_taxonomy\n \"source_taxonomy\"\n end", "def publish\n File.open(full_xml_file_path, 'w') do |f|\n f.write self.to_xml\n end\n end", "def initialize(file)\n if file.is_a?(File)\n @gpx=Nokogiri::XML(File.open(file))\n else\n @gpx=Nokogiri::XML(file)\n end\n @creator = @gpx.at_css(\"gpx\")[\"creator\"] rescue nil\n @time = Time.parse(@gpx.at_css(\"metadata time\").text) rescue nil\n @tracks = []\n @gpx.css(\"trk\").each do |trk|\n trk = Track.new(trk)\n @tracks << trk\n end\n # get name spaces\n ns = @gpx.collect_namespaces\n # Strip the leading xmlns: from each namespace key, and store in a new hash\n @namespaces= {}\n ns.each_pair do |key, value|\n @namespaces[key.sub(/^xmlns:/, '')] = value\n end\n end", "def initialize(taxonomy_path, instance)\n @instance=instance\n @taxonomy_content=nil\n\n @taxonomy_file_basedir=nil\n unless taxonomy_path.nil?\n m=Benchmark.measure do\n begin\n @taxonomy_content=XmlParser.xml_in(taxonomy_path, {'ForceContent' => true})\n rescue Exception\n @taxonomy_content=XmlParser.xml_in(File.open(taxonomy_path).read.gsub(\"\\n\", \"\"), {'ForceContent' => true})\n end\n @taxonomy_file_basedir=File.dirname(taxonomy_path)+File::Separator\n end\n bm(\"Parsing [\" + taxonomy_path + \"] took\", m)\n end\n\n @taxonomy_def_instance=TaxonomyDefintion.new\n @taxonomy_content[\"element\"].each do |element|\n MetaUtil::introduce_instance_var(@taxonomy_def_instance, element[\"name\"].gsub(/[^a-zA-Z0-9_]/, \"_\"), element)\n end unless @taxonomy_content.nil? || @taxonomy_content[\"element\"].nil?\n\n @lablb=@deflb=@prelb=@callb=nil\n @ignore_lablb=@ignore_deflb=@ignore_prelb=@ignore_callb=false\n end", "def load_XML(file)\n begin\n xml_file = File.open(file)\n xml_obj = Document.new(xml_file)\n xml_file.close\n rescue => e\n puts \"ERROR: Unable to create XML object from file: #{file}\"\n puts e.message\n puts e.backtrace\n exit 1\n end\n return xml_obj\nend", "def import_nessus_xml_file(args={})\n\t\tfilename = args[:filename]\n\t\twspace = args[:wspace] || workspace\n\n\t\tf = File.open(filename, 'rb')\n\t\tdata = f.read(f.stat.size)\n\n\t\tif data.index(\"NessusClientData_v2\")\n\t\t\timport_nessus_xml_v2(args.merge(:data => data))\n\t\telse\n\t\t\timport_nessus_xml(args.merge(:data => data))\n\t\tend\n\tend", "def import_nmap_xml_file(args={})\n filename = args[:filename]\n\n data = \"\"\n ::File.open(filename, 'rb') do |f|\n data = f.read(f.stat.size)\n end\n import_nmap_xml(args.merge(:data => data))\n end", "def load_ingest_content( filename )\n xml_doc = TaskHelpers.load_xml_doc( filename )\n return xml_doc\n end", "def parse_document(file)\n\n hpricot_doc = create_doc(file)\n raise \"Feature not saved!\" if hpricot_doc.nil?\n\n feature = extract_feature(hpricot_doc)\n xml_document = store_xml_document(feature)\n\n feature_object_types = extract_feature_object_types(hpricot_doc, feature)\n feature_relations = extract_feature_relations(hpricot_doc, feature)\n\n #feature_names = extract_feature_names(hpricot_doc, feature)\n extract_feature_names(hpricot_doc, feature)\n\n # When a feature is saved, it caches all of its ancestor ids. \n # You need to make sure this happens for all of the features every time\n # a new batch has been imported. \n features = Feature.all\n features.each do |f|\n f.save\n end\n end", "def create\n @taxonomy = Taxonomy.new(params[:taxonomy])\n\n respond_to do |format|\n if @taxonomy.save\n format.html { redirect_to edit_admin_taxonomy_path(@taxonomy), notice: 'Taxonomy was successfully updated.' }\n format.json { render json: @taxonomy, status: :created, location: @taxonomy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxonomy.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer_taxonomy(tax)\n $stderr.puts 'Transferring taxonomy'\n return if tax.nil?\n\n pval = (project.metadata[:tax_pvalue] || 0.05).to_f\n tax_a = tax\n .select { |i| i[1] != '?' && i[2] <= pval }\n .map { |i| i[0, 2].join(':') }\n dataset.metadata[:tax] = MiGA::Taxonomy.new(tax_a)\n dataset.save\n end", "def to_xml(file)\n content = \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\" ?>\\n<gedcom>\"\n\n open_tags = [\"gedcom\"]\n\n prev_level = root_level = nil\n\n parser = Gedcom::Parser.new(file)\n content = parser.parse(content, open_tags, prev_level, root_level)\n\n while tag = open_tags.pop\n content << \"\\t\" * (open_tags.length) + \"</#{tag}>\\n\"\n end\n\n content\n end", "def queryxml(xmlfile, function)\n f = File.new(xmlfile, \"r\")\n doc = Nokogiri::XML(f)\n\n binaries = []\n doc.xpath(\"//test/calls/function[text()='#{function}']\").each { |e|\n test = e.parent.parent\n binary = test.xpath('binary').first\n binaries << [File.dirname(xmlfile), binary.text]\n }\n\n f.close\n\n return binaries\nend", "def parse(file)\n document = Nokogiri::XML(file).remove_namespaces!\n document.xpath('//types').each do |type|\n name = type.xpath('name').first.content\n key = name.underscore.to_sym\n type.xpath('members').each do |member|\n self[key] << member.content\n end\n end\n self\n end", "def initialize(path)\n @filename = path\n file = nil\n file = open(path)\n @errors = [] \n \n @document = Nokogiri::XML(file)\n @document.remove_namespaces!\n @node = @document.root\n unless self.valid?\n self.errors << {:xml => 'invalid xml passed in'}\n #raise \"Unable to load file. Is it in the correct format?\"\n end\n end", "def get_xml_of_type( asdcp_type, file )\n begin\n xml = Nokogiri::XML( open file )\n rescue Exception => e\n @logger.info \"#{ file }: #{ e.message }\"\n return FALSE\n end\n unless xml.errors.empty?\n xml.errors.each do |error|\n # expected errors from non-xml\n next if error.message =~ /Start tag expected/ or error.message =~ /Document is empty/\n @logger.info \"Syntax error: #{ file }: #{ error }\"\n end\n return FALSE\n end\n\n case xml.root.node_name\n when asdcp_type\n return xml\n else\n return FALSE\n end\nend", "def path\n \"/onca/xml\"\n end", "def parse_file_to_ar(f)\n pp_ok \"STARTING PARSE for file #{f}...\"\n\n @doc = Nokogiri::XML(File.open(f), 'UTF-8') do |config|\n config.options = Nokogiri::XML::ParseOptions::STRICT | Nokogiri::XML::ParseOptions::NOBLANKS\n end\n\n # Extend name space to include METS\n # couldn't get the following to work\n # example: node.xpath('.//foo:name', {'foo' => 'http://example.org/'})\n # example: node.xpath('.//xmlns:name', node.root.namespaces)\n # my try: puts @doc.xpath(\"xmlns:METS\", {\"METS\" => \"http://www.loc.gov/METS/\"})\n\n # The following actually modifies the xml, which we don't want. But it works.\n ns = @doc.root.add_namespace_definition(\"xmlns:METS\", \"http://www.loc.gov/METS/\")\n\n\n\n pp_ok \"Current file is: #{f}\"\n # issue information -------------\n # note: issue_id is autoincremented by the db\n # and we will want to select it from the last row created\n\n pp_ok \"ISSUE INFO:\"\n hathitrust = @doc.xpath(\"//MODS:identifier[@type='hathitrust']/text()\").to_s\n pp_ok \"hathitrust value is #{hathitrust}\"\n\n volume = @doc.xpath(\"//MODS:detail[@type='volume']/MODS:number/text()\").to_s\n pp_ok \"volume value is #{volume}\"\n\n issue_no = @doc.xpath(\"//MODS:detail[@type='issue']/MODS:number/text()\").to_s\n pp_ok \"issues value is #{issue_no}\"\n\n edition = @doc.xpath(\"//MODS:detail[@type='edition']/MODS:number/text()\").to_s\n pp_ok \"edition value is #{edition}\"\n\n date_issued = @doc.xpath(\"//MODS:dateIssued/text()\").to_s\n pp_ok \"dateIssued value is #{date_issued}\"\n\n newspaper = @doc.xpath(\"/METS:mets/@LABEL\").to_s\n newspaper = newspaper.split(\",\").first.strip\n pp_ok \"newspaper is #{newspaper}\"\n\n\n issue_id = add_data_issue_ar(hathitrust, volume, issue_no, edition, date_issued, newspaper)\n\n pp_ok \"ISSUE ID IS: #{issue_id}\"\n\n # page information -------------\n # note: page_id is autoincremented by the db\n\n pages_target = \"//METS:structMap/METS:div[@TYPE='np:issue'][@DMDID='issueModsBib']/METS:div[@TYPE='np:page']\"\n\n pages = @doc.xpath(pages_target)\n\n @doc.xpath(pages_target).each do |node|\n\n pp_ok \"PAGE INFO:\"\n\n pp_ok \"issue_id value is #{issue_id}\"\n\n page_no = node.xpath(\"@ORDERLABEL\").to_s\n pp_ok \"page_no value is #{page_no}\"\n\n sequence = node.xpath(\"@ORDER\").to_s.to_i\n pp_ok \"sequence value is #{sequence}\"\n\n text_link = node.xpath(\"METS:mptr[1]/@xlink:href\").to_s\n pp_ok \"text_link value is #{text_link}\"\n\n img_link = node.xpath(\"METS:mptr[2]/@xlink:href\").to_s\n pp_ok \"img_link value is #{img_link}\"\n\n add_data_page_ar(issue_id, page_no, sequence, text_link, img_link)\n\n end # each\n\n pp \"File #{f} processed\"\n\n end", "def makeKeggTaxonId(file)\n out = File.new(file, \"w\")\n keggtaxurl = \"http://www.genome.jp/kegg-bin/get_htext?query=&htext=Organisms&filedir=&option=-e&extend=F65F548C25-2E42-3&uploadfile=&format=&wrap=&length=&open=&close=&hier=18&oneclick=on\"\n out = File.new(\"kegg_taxon_ids.txt\", \"w\")\n File.new(open(keggtaxurl)).each do |line|\n if line =~/([^\\>]*)<\\/I>.*id=([0-9]*).*>([a-z]*)</\n sp, taxid, name = $1, $2, $3\n out.printf(\"%s\\t%d\\t%s\\n\", name, taxid, sp)\n end\n end\n out.close\nend", "def initialize( xml_file, *options )\n @node_name = \"00000\"\n\t @show_text = true\n\t @show_attributes = true\n\n if options and options[0]\n options[0].each do |xKey, xValue|\n case xKey.to_s\n when \"text\"\n @show_text = xValue\n\t\t options[0].delete( xKey )\n when \"attrs\"\n @show_attributes = xValue\n\t\t options[0].delete( xKey )\n end\n end\n end\n\n @rexml_document = REXML::Document::new( File::new( xml_file ) )\n @graph = GraphViz::new( \"XML\", *options )\n parse_xml_node( @rexml_document.root() )\n end", "def open_file(language)\n begin\n xml_file = File.open(file_path(language))\n doc = Nokogiri::XML(xml_file)\n yield doc\n rescue Errno::ENOENT => e\n abort(e.message)\n end\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 load_xml(xml_url)\n\t\t\tfile = File.new(xml_url)\n\t\t\tload_map(file)\n\t\t\tfile.close\n\t\tend", "def save_file(xml)\n\t\tFile.open(Rails.root.to_s + '/public/system/rsm.xml', \"w+\") do |f|\n\t\t\tf.write(xml)\t\n\t\tend\t\t\n\tend", "def init\n f = File.open(@pref_file)\n @doc = Nokogiri::XML(f)\n f.close\n @doc.remove_namespaces! \n end", "def get_xml_document(workflow_file)\n xml_file = File.new(workflow_file)\n document = Document.new(xml_file)\n end", "def import_nmap_xml_file(args={})\n\t\tfilename = args[:filename]\n\t\twspace = args[:wspace] || workspace\n\n\t\tf = File.open(filename, 'rb')\n\t\tdata = f.read(f.stat.size)\n\t\timport_nmap_xml(args.merge(:data => data))\n\tend", "def initialize(file)\n\t\t@file = file\n\t\t@doc = Hpricot.XML(file)\n\tend", "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 open(arg,force_encoding=nil)\n data=ONIX::Helper.arg_to_data(arg)\n\n xml=nil\n if force_encoding\n xml=Nokogiri::XML.parse(data,nil,force_encoding)\n else\n xml=Nokogiri::XML.parse(data)\n end\n\n xml.remove_namespaces!\n xml\n end", "def xml_file_to_hash(file_path)\n return File.open(file_path) do |f|\n # Convert file elements to ruby hash\n @parser.parse(Nokogiri::XML(f).to_s)\n end\n end", "def initialize(xFile)\n @xNodeName = \"00000\"\n\t @bShowText = true\n\t @bShowAttrs = true\n \n @oReXML = REXML::Document::new( File::new( xFile ) )\n @oGraph = \"digraph XML {\\n\"\n _init( @oReXML.root() )\n @oGraph << \"}\\n\"\n end", "def get_ncbi_taxonomy\n tax_id = get_ncbi_taxid or return\n\n lineage = { ns: 'ncbi' }\n doc = MiGA::RemoteDataset.download(:ncbi, :taxonomy, tax_id, :xml)\n doc.scan(%r{<Taxon>(.*?)</Taxon>}m).map(&:first).each do |i|\n name = i.scan(%r{<ScientificName>(.*)</ScientificName>}).first.to_a.first\n rank = i.scan(%r{<Rank>(.*)</Rank>}).first.to_a.first\n rank = nil if rank.nil? || rank == 'no rank' || rank.empty?\n rank = 'dataset' if lineage.size == 1 && rank.nil?\n lineage[rank] = name unless rank.nil? || name.nil?\n end\n MiGA.DEBUG \"Got lineage: #{lineage}\"\n MiGA::Taxonomy.new(lineage)\n end", "def load_xml( fileName )\r\n begin\r\n str = IO.read(fileName)\r\n load_xml_rules_as_string(str)\r\n rescue Exception => e\r\n raise RuleLoadingError, \"loading xml file\"\r\n end\r\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 category_taxon\n taxon = nil\n current_node = ::Spree::CategoryTaxon.root\n full_path.split(' > ').each do|cat_name|\n t = current_node.children.where(name: cat_name).first\n if t.nil?\n break\n else\n taxon = t\n current_node = t\n end\n end\n taxon\n end", "def import_nexpose_simplexml_file(args={})\n\t\tfilename = args[:filename]\n\t\twspace = args[:wspace] || workspace\n\n\t\tf = File.open(filename, 'rb')\n\t\tdata = f.read(f.stat.size)\n\t\timport_nexpose_simplexml(args.merge(:data => data))\n\tend", "def xml_fixture(name)\n File.read(File.join(File.dirname(__FILE__), 'fixtures', 'xml', \"#{name}.xml\"))\nend", "def output_xml(file_name = DEFAULT_OUTPUT_FILE_NAME + \".xml\")\n CukeSniffer::Formatter.output_xml(self, file_name)\n end", "def parse(file)\n doc = Nokogiri::XML( File.open( file ) )\n @type = doc.xpath(\"/probe/header/@type\").to_s\n @vendor = doc.xpath(\"/probe/header/@vendor\").to_s\n @services = \"<TODO>\"\n @indexes = \"<TODO>\"\n end", "def category_taxonomy\n @category_taxonomy ||= Spree::Taxonomy.find_or_create_by(name: 'Category')\n end", "def import(file_path)\n File.open(file_path) do |file|\n Nokogiri::XML::Reader(file).each do |node|\n if node.name == 'keyword' && node.node_type == Nokogiri::XML::Reader::TYPE_ELEMENT\n TopHits::Keyword::create!(name: node.inner_xml)\n end\n end\n end\n return true\n rescue Errno::ENOENT\n raise TopHits::FilePathError.new($!)\n rescue Nokogiri::SyntaxError\n raise TopHits::MalformedFile.new($!)\n end", "def assemble_xml_file # :nodoc:\n write_xml_declaration do\n # Write the c:chartSpace element.\n write_chart_space do\n # Write the c:lang element.\n write_lang\n # Write the c:style element.\n write_style\n # Write the c:protection element.\n write_protection\n # Write the c:chart element.\n write_chart\n # Write the c:spPr element for the chartarea formatting.\n write_sp_pr(@chartarea)\n # Write the c:printSettings element.\n write_print_settings if @embedded && @embedded != 0\n end\n end\n end", "def write_file(directory)\n xml = \"\"\n xml << taxon_xml\n xml << enzyme_xml\n xml << n_terminal_xml if n_terminal\n xml << c_terminal_xml if c_terminal\n xml << ion_xml\n xml << mass_xml\n xml << motif_xml\n \n File.open(directory + PARAMETER_FILENAME, \"w\") do |file|\n file.puts(xml)\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 search_xml(search_path)\n\t\t\tself.xml.search(search_path)\n\t\trescue Exception => e\n\t\t\tputs \"Error searching XML: #{e}\"\n\t\tend", "def create_taxonomy_node\n Taxonomite::Species.new(name: self.name)\n end", "def save_file(file, xml) \n File.open(file, \"w+\") do |f|\n gz = Zlib::GzipWriter.new(f)\n gz.write(xml) \n gz.close\n end \n end", "def import_retina_xml_file(args={})\n filename = args[:filename]\n\n data = \"\"\n ::File.open(filename, 'rb') do |f|\n data = f.read(f.stat.size)\n end\n import_retina_xml(args.merge(:data => data))\n end", "def set_taxon\n @taxon = Taxon.find(params[:id])\n end", "def set_taxon\n @taxon = Taxon.find(params[:id])\n end", "def node file\n system \"node #{file}\"\n end", "def create\n @luxire_taxonomy = LuxireTaxonomy.new(luxire_taxonomy_params)\n\n respond_to do |format|\n if @luxire_taxonomy.save\n format.html { redirect_to @luxire_taxonomy, notice: 'Luxire taxonomy was successfully created.' }\n format.json { render :show, status: :created, location: @luxire_taxonomy }\n else\n format.html { render :new }\n format.json { render json: @luxire_taxonomy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_tags_seealso(todays_filepath)\n \n px = Polyrex.new 'tags/tag[label]/entry[title, url]'\n px.save File.join(todays_filepath, 'tags-seealso.xml') \n px\n \n end", "def output_tax(refseq_data)\n rs = refseq_data\n taxid = rs[:taxid]\n gene_label_url = URI.escape(rs[:gene_label])\n\n $output_ttl.puts triple(\"<http://togogenome.org/gene/#{taxid}:#{gene_label_url}>\", \"rdfs:seeAlso\", \"tax:#{rs[:taxid]}\") unless $gene_list[rs[:gene_rsrc]]\n $output_ttl.puts triple(\"<http://togogenome.org/gene/#{taxid}:#{gene_label_url}>\", \"skos:exactMatch\", \"<http://identifiers.org/refseq/#{rs[:gene_rsrc]}>\") unless $gene_list[rs[:gene_rsrc]]\n $output_ttl.puts triple(\"tax:#{rs[:taxid]}\", \"rdf:type\", \"<http://identifiers.org/taxonomy>\") unless $tax_type_list[rs[:taxid]]\n $tax_type_list[rs[:taxid]] = true # to prevent duplicate output\n $gene_list[rs[:gene_rsrc]] = true # to prevent duplicate output\nend", "def load_unattend(xml_path)\n print_status(\"Reading #{xml_path}\")\n f = session.fs.file.new(xml_path)\n raw = \"\"\n until f.eof?\n raw << f.read\n end\n\n begin\n xml = REXML::Document.new(raw)\n rescue REXML::ParseException => e\n print_error(\"Invalid XML format\")\n vprint_line(e.message)\n return nil, raw\n end\n\n return xml, raw\n end", "def cmd_db_import_qualys_xml(*args)\n\t\t\treturn unless active?\n\t\t\tif not (args and args.length == 1)\n\t\t\t\tprint_status(\"Usage: db_import_qualys_xml <result.xml>\")\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tif not File.readable?(args[0])\n\t\t\t\tprint_status(\"Could not read the Qualys file\")\n\t\t\t\treturn\n\t\t\tend\n\t\t\tframework.db.import_qualys_xml_file(:filename => args[0])\n\t\tend" ]
[ "0.7329939", "0.7010682", "0.6454225", "0.63374114", "0.62953806", "0.6126629", "0.5947982", "0.58975494", "0.583087", "0.5774107", "0.5698248", "0.55799836", "0.554681", "0.5523157", "0.54865974", "0.54788697", "0.5470004", "0.54077315", "0.5382756", "0.5376184", "0.5344505", "0.5344505", "0.5336515", "0.53130746", "0.53104746", "0.52828765", "0.5260124", "0.52496904", "0.52478427", "0.5241738", "0.5239455", "0.52246666", "0.5223562", "0.5216735", "0.52106196", "0.52036333", "0.5201566", "0.52013695", "0.5183194", "0.5177395", "0.5162303", "0.5159976", "0.51572955", "0.5139278", "0.513683", "0.5120549", "0.5083094", "0.50782776", "0.5067213", "0.50628465", "0.50550723", "0.50501597", "0.5046199", "0.5038916", "0.5021843", "0.502068", "0.50116456", "0.501112", "0.4965317", "0.49630392", "0.495827", "0.4950393", "0.49458978", "0.4940606", "0.49316886", "0.49310178", "0.49208754", "0.49097046", "0.4892489", "0.48847747", "0.48791736", "0.48761055", "0.48717937", "0.48711142", "0.48687428", "0.4863048", "0.48608124", "0.48258948", "0.48252487", "0.48236203", "0.48222238", "0.4817091", "0.481367", "0.48061845", "0.47954303", "0.479274", "0.47851366", "0.47815645", "0.4773309", "0.47607544", "0.47591758", "0.47527227", "0.47407776", "0.47407776", "0.47359216", "0.47329134", "0.47327855", "0.46945745", "0.46867353", "0.46854487" ]
0.6785587
2
set up all the continents trees from the top(continent) level of nodes +taxonomies_fragement+ : the taxonomies fragement doc
def set_continents(taxonomies_fragement) taxonomies_fragement.each { |taxonomy| continent = build_tree(taxonomy) @continents << continent } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_taxonomies\n @document.xpath('.//taxonomy').each do |taxonomy_node|\n taxonomy_name = taxonomy_node.at_xpath('.//taxonomy_name')\n tax_node = insert_node(SecureRandom.uuid, taxonomy_name.content, @root_node)\n @taxonomies << tax_node\n add_node(taxonomy_node, tax_node, skip_add: true)\n end\n end", "def initialize(xml_file)\n doc_taxonomies = LonelyPlanet::Doc.load xml_file\n taxonomies_fragement = doc_taxonomies.css 'taxonomy > node'\n @continents = []\n set_continents(taxonomies_fragement)\n end", "def import_taxonomy\n\n parser = XML::Parser.file(@taxonomy_file_full_path, :encoding => XML::Encoding::UTF_8)\n taxonomy_document = parser.parse\n\n # root node\n root_node = taxonomy_document.find_first('//taxonomy_name')\n @taxonomy.add_node('0', root_node.content, nil)\n @logger.debug \"Root: #{root_node.content}\"\n\n # parsing the taxonomy doc into my Taxonomy class\n taxonomy_document.find('//node').each do |node|\n\n @logger.debug \"Node: #{node.attributes['atlas_node_id']}\"\n\n if node.children?\n\n node_id = node.attributes['atlas_node_id']\n node_name = node.find_first('./node_name').content\n @taxonomy.add_node(node_id, node_name, '0')\n\n node.find('./node').each do |child|\n\n @logger.debug \"Child #{child.attributes['atlas_node_id']}\"\n\n child_id = child.attributes['atlas_node_id']\n child_name = child.find_first('./node_name').content\n @taxonomy.add_node(child_id, child_name, node_id)\n\n end\n\n end\n\n end\n\n end", "def build_tree(nodes_fragement)\n nodes_element = LonelyPlanet::Node.new nodes_fragement\n node = LonelyPlanet::TreeNode.new(nodes_element.name, nodes_element.id)\n if nodes_element.has_child?\n nodes_element.children.all? { |child_frag|\n node << build_tree(child_frag)\n }\n end\n node\n end", "def setup_taxons(record, data)\n taxon_list = split_data(data)\n\n taxon_list.each do |taxon_str|\n taxon_names = taxon_str.split(/\\s*>\\s*/)\n taxonomy = Spree::Taxonomy.find_or_create_by(name: taxon_names.shift)\n parent = taxonomy.root\n associate(record, 'taxons', parent)\n\n taxon_names.each do |taxon_name|\n taxon = Spree::Taxon.find_or_create_by(name: taxon_name,\n taxonomy: taxonomy,\n parent: parent)\n associate(record, 'taxons', taxon)\n parent = taxon\n end\n end\n end", "def fill_cms_distributions\n species = Rank.where(:name => Rank::SPECIES).first\n subspecies = Rank.where(:name => Rank::SUBSPECIES).first\n cms = Taxonomy.where(:name => Taxonomy::CMS).first\n cites = Taxonomy.where(:name => Taxonomy::CITES_EU).first\n equal_to = TaxonRelationshipType.where(:name => TaxonRelationshipType::EQUAL_TO).first\n TaxonConcept.where(:rank_id => [species.id, subspecies.id],\n :taxonomy_id => cms.id).each do |taxon|\n matching_cites_taxon = TaxonConcept.where(:rank_id => taxon.rank_id,\n :full_name => taxon.full_name,\n :taxonomy_id => cites.id).first\n next unless matching_cites_taxon\n puts \"found a match for #{taxon.full_name} #{taxon.id} matches #{matching_cites_taxon.id}\"\n matching_cites_taxon.distributions.each do |dist|\n distribution = Distribution.find_or_initialize_by(\n taxon_concept_id: taxon.id, geo_entity_id: ist.geo_entity_id)\n distribution.tag_list = dist.tag_list\n distribution.save\n dist.distribution_references.each do |reference|\n DistributionReference.find_or_create_by(\n distribution_id: distribution.id, reference_id: reference.reference_id)\n end\n end\n puts \"creating taxon relationship\"\n TaxonRelationship.create(:taxon_concept_id => matching_cites_taxon.id,\n :other_taxon_concept_id => taxon.id,\n :taxon_relationship_type_id => equal_to.id)\n end\n end", "def order_tree\n @tree.each do | country, country_hash|\n if country != 'count'\n country_hash.each do | region, region_hash |\n @tree[country][region] = order_hash(@tree[country][region]) if region != 'count'\n end\n @tree[country] = order_hash(@tree[country])\n end\n end\n @tree = order_hash(@tree)\n end", "def set_taxonomy\n c = case self.class.base_class.name\n when 'CollectionObject'\n a = current_taxon_name\n\n # If we have no name, see if there is a Type reference and use it as proxy\n # !! Careful/TODO this is an arbitrary choice, technically can be only one primary, but not restricted in DB yet\n a ||= type_materials.primary.first&.protonym\n when 'Otu'\n taxon_name&.valid_taxon_name\n when 'AssertedDistribution'\n otu.taxon_name&.valid_taxon_name\n end\n\n if c\n @taxonomy = c.full_name_hash\n # Check for required 'Kingdom'\n if @taxonomy['kingdom'].blank?\n\n # Det is only to kingdom!\n if c.rank == 'kingdom'\n @taxonomy['kingdom'] = c.name\n else\n\n # Kindom is provided in ancestors\n if a = c.ancestor_at_rank(:kingdom)\n @taxonomy['kingdom'] = a.name\n else\n\n # TODO: re-add when dwc_fields merged\n # Very edge case for single kingom nomenclatures (almost none)\n # if c.rank_class::KINGDOM.size == 1\n # @taxonomy['kingdom'] = c.rank_class::KINGDOM.first\n # end\n\n end\n end\n end\n @taxonomy\n else\n @taxonomy ||= {}\n end\n end", "def create_tree(father,tree)\n tree.each do |name|\n n = Meta::create_class(father, name[0], name[1])\n create_tree(n, name[2])\n end\nend", "def initialize(nodes_fragement)\n @nodes_xml = nodes_fragement\n @children = set_children\n end", "def index\n @luxire_taxonomies = LuxireTaxonomy.all\n end", "def get_spree_taxonomies\n @spree_taxonomies = TaxonomySync.find(:all)\n end", "def load_test_taxa\n Rails.logger.debug \"\\n\\n\\n[DEBUG] loading test taxa\"\n @Life = Taxon.find_by_name( \"Life\" ) || Taxon.make!( name: 'Life', rank: \"state of matter\" )\n \n set_taxon_with_rank_and_parent( \"Animalia\", Taxon::KINGDOM, @Life, is_iconic: true )\n set_taxon_with_rank_and_parent( \"Chordata\", Taxon::PHYLUM, @Animalia )\n set_taxon_with_rank_and_parent( \"Amphibia\", Taxon::CLASS, @Chordata, is_iconic: true )\n set_taxon_with_rank_and_parent( \"Anura\", Taxon::ORDER, @Amphibia )\n set_taxon_with_rank_and_parent( \"Hylidae\", Taxon::FAMILY, @Anura )\n set_taxon_with_rank_and_parent( \"Pseudacris\", Taxon::GENUS, @Hylidae )\n set_taxon_with_rank_and_parent( \"Pseudacris regilla\", Taxon::SPECIES, @Pseudacris )\n\n set_taxon_with_rank_and_parent( \"Aves\", Taxon::CLASS, @Chordata, is_iconic: true )\n set_taxon_with_rank_and_parent( \"Apodiformes\", Taxon::ORDER, @Aves )\n set_taxon_with_rank_and_parent( \"Trochilidae\", Taxon::FAMILY, @Apodiformes )\n set_taxon_with_rank_and_parent( \"Calypte\", Taxon::GENUS, @Trochilidae )\n set_taxon_with_rank_and_parent( \"Calypte anna\", Taxon::SPECIES, @Calypte, common_name: \"Anna's Hummingbird\" )\n \n set_taxon_with_rank_and_parent( \"Plantae\", Taxon::KINGDOM, @Life, is_iconic: true )\n set_taxon_with_rank_and_parent( \"Magnoliophyta\", Taxon::PHYLUM, @Plantae )\n set_taxon_with_rank_and_parent( \"Magnoliopsida\", Taxon::CLASS, @Magnoliophyta )\n set_taxon_with_rank_and_parent( \"Myrtales\", Taxon::ORDER, @Magnoliopsida )\n set_taxon_with_rank_and_parent( \"Onagraceae\", Taxon::FAMILY, @Myrtales )\n set_taxon_with_rank_and_parent( \"Clarkia\", Taxon::GENUS, @Onagraceae )\n set_taxon_with_rank_and_parent( \"Clarkia amoena\", Taxon::SPECIES, @Clarkia )\n\n Taxon.reset_iconic_taxa_constants_for_tests\n\n Rails.logger.debug \"[DEBUG] DONE loading test taxa\\n\\n\\n\"\n end", "def ingest\n return \"filename is blank\" if @taxonomy_file == \"\"\n taxonomy_doc = read_taxonomy\n\n xpath = find_deepest_node(taxonomy_doc)\n destinations_lookup = {}\n get_place_info_and_parent_place_info_from_node_xpath(taxonomy_doc,xpath).each do |data_object|\n destinations_lookup = build_data_objects_from_place_info_data(destinations_lookup,data_object)\n end\n destinations_lookup\n end", "def get_place_info_and_parent_place_info_from_node_xpath(taxonomy_doc,xpath)\n data_objects = []\n while xpath.count(\"node\") > 1\n taxonomy_doc.xpath(\"/\" + xpath.join(\"/\")).each do |node|\n atlas_id = node.attributes[\"atlas_node_id\"].value\n parent_atlas_id = node.parent.attributes[\"atlas_node_id\"].value\n placename = get_place_name(node.children)\n parent_placename = get_place_name( node.parent.children)\n data_objects << {atlas_id: atlas_id, parent_atlas_id: parent_atlas_id, name: placename, parent_name: parent_placename}\n end\n xpath.pop\n end\n data_objects\n end", "def setup\n @root = Tree::TreeNode.new(\"ROOT\", \"Root Node\")\n\n @child1 = Tree::TreeNode.new(\"Child1\", \"Child Node 1\")\n @child2 = Tree::TreeNode.new(\"Child2\", \"Child Node 2\")\n @child3 = Tree::TreeNode.new(\"Child3\", \"Child Node 3\")\n @child4 = Tree::TreeNode.new(\"Child4\", \"Grand Child 1\")\n @child5 = Tree::TreeNode.new(\"Child5\", \"Child Node 4\")\n\n end", "def init_tranches(initial_tranches = [])\n @tranches = initial_tranches\n @current_tranch_index = @tranches.find_index { |tranch| tranch.any?(&:nil?) } || 0\n end", "def index\n @indicate_taxonomies = Indicate::Taxonomy.all\n @indicate_taxonomies = @indicate_taxonomies.by_towns(params['town_select']) unless params['town_select'].blank?\n end", "def rebuild_hierarchies!\n query(\"MATCH (:Page)-[parent:parent]->(:Page) DELETE parent\")\n query(\"MATCH (:Page)-[in_clade:in_clade]->(:Page) DELETE in_clade\")\n missing = {}\n related = {}\n # HACK HACK HACK HACK: We want to use Resource.native here, NOT ITIS!\n itis = Resource.where(name: \"Integrated Taxonomic Information System (ITIS)\").first\n raise \" I tried to use ITIS as the native node for the relationships, but it wasn't there.\" unless itis\n Node.where([\"resource_id = ? AND parent_id IS NOT NULL AND page_id IS NOT NULL\",\n itis.id]).\n includes(:parent).\n find_each do |node|\n page_id = node.page_id\n parent_id = node.parent.page_id\n next if missing.has_key?(page_id) || missing.has_key?(parent_id)\n page = page_exists?(page_id)\n page = page.first if page\n if page\n relate(\"in_clade\", page, page)\n end\n next if related.has_key?(page_id)\n parent = page_exists?(parent_id)\n parent = parent.first if parent\n if page && parent\n if page_id == parent_id\n puts \"** OOPS! Attempted to add #{page_id} as a parent of itself!\"\n else\n relate(\"parent\", page, parent)\n relate(\"in_clade\", page, parent)\n related[page_id] = parent_id\n # puts(\"#{page_id}-[:parent]->#{parent_id}\")\n end\n else\n missing[page_id] = true unless page\n missing[parent_id] = true unless parent\n end\n end\n related.each do |page, parent|\n puts(\"#{page}-[:in_clade*]->#{parent}\")\n end\n puts \"Missing pages in TraitBank: #{missing.keys.sort.join(\", \")}\"\n end", "def setup_taxons(record, data)\n taxon_list = split_data(data)\n\n taxon_list.each do |taxon_str|\n taxon_names = taxon_str.split(/\\s*>\\s*/)\n taxonomy = Spree::Taxonomy.find_or_create_by(name: taxon_names.shift)\n parent = taxonomy.root\n associate_to_product(record, 'taxons', parent)\n\n taxon_names.each do |taxon_name|\n taxon = Spree::Taxon.find_or_create_by(name: taxon_name,\n taxonomy: taxonomy,\n parent: parent)\n associate_to_product(record, 'taxons', taxon)\n parent = taxon\n end\n end\n end", "def init_simple_tree\n @root_org = Org.create(name: 'root')\n @lv1_child_org = Org.create(name: 'lv1')\n @lv1_child_org2 = Org.create(name: 'lv1-2')\n @lv2_child_org = Org.create(name: 'lv2')\n @lv2_child_org2 = Org.create(name: 'lv2-2')\n @lv2_child_org3 = Org.create(name: 'lv2-3')\n @lv2_child_org4 = Org.create(name: 'lv2-4')\n @lv3_child_org = Org.create(name: 'lv3')\n @lv3_child_org2 = Org.create(name: 'lv3-2')\n @lv4_child_org = Org.create(name: 'lv4')\n @lv4_child_org2 = Org.create(name: 'lv4-2')\n @lv5_child_org = Org.create(name: 'lv5')\n @lv5_child_org2 = Org.create(name: 'lv5-2')\n\n current_time = Time.now\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @root_org.id,\n distance: 0,\n start_time: 10.minutes.ago(current_time),\n end_time: 1000.years.from_now,\n scope_name: 'default'\n )\n\n # 10 minutes ago\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org.id,\n distance: 1,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org.id,\n distance: 2,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv1_child_org.id,\n distance: 1,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n # now\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv2_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv2_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org3.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org2.id,\n child_id: @lv2_child_org3.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org4.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org2.id,\n child_id: @lv2_child_org4.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv3_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv3_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv3_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv4_child_org.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv5_child_org.id,\n distance: 5,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv4_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv3_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv3_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv3_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv4_child_org2.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv4_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv4_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org2.id,\n child_id: @lv4_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv5_child_org2.id,\n distance: 5,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv5_child_org2.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv4_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\nend", "def populate_inheritance_heirarchy\n apps_and_templates = appTemplates + templates\n apps_and_templates.each do |temp| \n temp.attributes[:parent].to_s != '' ? app_or_temp = temp.attributes[:parent] :\n temp.attributes[:template].to_s != '' ? app_or_temp = temp.attributes[:template]:\n next\n next if app_or_temp == \"what the fuck?\"\n # if temp.attributes[:parent].is_a? String or temp.attributes[:template].is_a? String\n if not app_or_temp.empty?\n parent_template = self.templates.find { |template| template.name.downcase == app_or_temp.downcase }\n temp.child_of << parent_template\n parent_template.parent_of << temp\n end\n end \n end", "def initialize(file_path)\n @document = nokogiri_xml(file_path)\n @root_node = TaxGenerator::TaxonomyNode.new('ROOT', 'ROOT')\n @taxonomies = []\n find_taxonomies\n end", "def collect_tree_up_from (foliage,\n parents,\n except_homepage,\n except_page,\n except_with_children)\n ancestry_string = parents.collect {|x| x.id.to_s }.join(\"/\")\n name_prefix = parents.collect {|x| x.title }.join(\" / \")\n name_prefix += \" / \" if name_prefix.present?\n\n our_mans_indexes = []\n foliage.each_index do |indx|\n if foliage[indx].ancestry.to_s == ancestry_string\n our_mans_indexes << indx\n end\n end\n\n leaves = []\n\n our_mans_indexes.reverse!\n our_mans_indexes.each do |indx|\n leaves << foliage.delete_at(indx)\n end\n\n leaves.sort! {|a,b| (a.prior == b.prior) ? a.id <=> b.id : a.prior <=> b.prior }\n result = []\n\n leaves.each do |leaf|\n do_writing = true\n if (except_page && leaf == except_page) || (except_homepage && leaf.home?)\n do_writing = false\n end\n result << [ name_prefix + leaf.title, leaf.id ] if do_writing\n unless do_writing == false && except_with_children\n result += collect_tree_up_from foliage,\n (parents + [ leaf ]),\n except_homepage,\n except_page,\n except_with_children\n end\n end\n\n result\n end", "def parse_trees\n otus = cache[ attribute( 'otus' ) ]\n\n id = attribute( 'id' )\n label = attribute( 'label' )\n\n trees = NeXML::Trees.new( id, :otus => otus, :label => label )\n\n #a 'trees' element *will* have child nodes.\n while next_node\n case local_name\n when \"tree\"\n #parse child 'tree' element\n trees << parse_tree\n when \"network\"\n trees << parse_network\n when \"trees\"\n #end of current 'trees' element has been reached\n break\n end\n end\n\n #return the 'trees' object\n trees\n end", "def touch_taxons\n Amz::Taxon.where(id: taxon_and_ancestors.map(&:id)).update_all(updated_at: Time.current)\n Amz::Taxonomy.where(id: taxonomy_ids).update_all(updated_at: Time.current)\n end", "def waterfall\n children = @level.make_children\n names = if children.all? { |x| x.is_a? LevelZero }\n AffixSet.instance.sampler @name, children.size\n else\n Namer.instance\n end\n @contents = children.collect { |lvl| Node.new(names.sample, lvl) }\n @contents.each &:waterfall\n end", "def setup_test_tree\n @root << @child1\n @root << @child2\n @root << @child3 << @child4\n end", "def store_all_cities(json_obj)\n cities = json_obj['metros'].each{ |city|\n timezone = city['timezone']\n country = city['country']\n name = city['name']\n code = city['code']\n population = city['population']\n continent = city['continent']\n coordinates = city['coordinates']\n region = city['region']\n linked_cities = []\n new_node = Node.new(code,name,country,continent,timezone,coordinates,population,region, linked_cities)\n node_hash[code] = new_node\n continent_hash[continent] << name\n }\n end", "def index\n @user = current_user\n @restaurants = @user.restaurants\n @branches = Array.new\n @tables = Array.new\n\n @restaurants.each do |r|\n r.branches.each do |b|\n @branches.push(b)\n end \n end\n\n @restaurants.each do |r|\n r.branches.each do |b|\n b.tables.each do |t|\n @tables.push(t)\n end \n end \n end\n\n end", "def init\n for i in [email protected]\n @tree[i] = 0\n end\n end", "def setup_groups_and_restaurants\n @restaurants = Restaurant.all(:order => 'name').collect { |r| [r.name, r.id] }\n @restaurants.unshift ['*Optimized', -1]\n @groups = current_user.groups(:order => 'name').collect { |g| [g.name, g.id]}\n end", "def initial_setup\n # set initial values of vert_pos and sum\n vert_pos = 0\n @sum = @tree[0][0]\n\n # set initial children nodes\n @initial_child_1 = @tree[1][0]\n @initial_child_2 = @tree[1][1]\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 order_taxons_in_taxons_and_children(order)\n order_taxons(order).where(id: taxons_including_children_ids)\n end", "def grow_tree\n dataset.order_transaction_items(candidate_items).each do |transaction|\n add_transaction(transaction, root)\n end\n calculate_header_support\n end", "def index\n @title = Carmen.country_name(cookies[:country])\n @pages = @pages.where(:country => cookies[:country]).order('lft ASC', 'title ASC')\n end", "def flow_taxons_tree root_taxon, current_taxon\n return '' if root_taxon.children.empty?\n\n max_level = 1\n\n content_tag :ul, class: 'taxons-list' do\n taxons = root_taxon.children.map do |taxon|\n css_class = (current_taxon && current_taxon.self_and_ancestors.include?(taxon)) ? 'current' : nil\n content_tag :li, class: css_class do\n extra = nil\n extra = taxons_tree(taxon, current_taxon, max_level - 1) if @taxon && [current_taxon.parent.try(:id), current_taxon.id].include?(taxon.id)\n link_to(taxon.name, seo_url(taxon)) + extra\n end\n end\n safe_join(taxons, \"\\n\")\n end\n end", "def set_tree\n @tree = Tree\n .where(:root_uri => params[:root_uri])\n .first_or_create(:root_uri => params[:root_uri])\n end", "def process_all_geoname_hierachy\n File.open(@file) do |f|\n f.each_line do |line|\n tree_with_geoid = line.strip.split('|')\n begin\n geoname_id = tree_with_geoid.first\n trees = tree_with_geoid - [geoname_id]\n trees.each do |tree|\n tree = tree.split.include?(@earth) ? tree : nil\n GeonameHierarchy.find_or_create(geoname_id, tree)\n end\n rescue Exception => e\n logger.error(\"#{e.inspect}\")\n puts e.inspect\n end\n end\n end\n end", "def initialize\n @use_tree_model = :self\n @default_taxonomy_require_both = true\n end", "def index\n @traumatized_children = TraumatizedChild.all\n end", "def tree_nodes\n node_sets = completed_list.map.with_index do |item_set, index|\n item_set.map do |item|\n exclusive_index_at_which_substring_ends = index\n ParseForest::Node.new(item.production,\n item.position, \n exclusive_index_at_which_substring_ends)\n end\n end\n node_sets.flatten\n end", "def category_tree\n @category_tree = {}\n get_category_browse_nodes.each do |n|\n build_category_tree(n)\n end\n @category_tree\n end", "def taxons_including_children_ids\n taxons.inject([]) { |ids, taxon| ids += taxon.self_and_descendants.ids }\n end", "def initialize(country_name, region_name, city_name)\n @country_name = country_name\n @region_name = region_name\n @city_name = city_name\n @tree = {}\n @tree['count'] = 0\n end", "def taxonomies_json\n @taxons_json = []\n query_string = \"%#{params[:term]}%\"\n @taxons = Spree::Taxonomy.categories.taxons#.where(\"name like ? OR id like ?\", query_string, query_string)\n @taxons.collect{ |taxon|\n if (taxon.parent.present? && taxon.parent.parent.present? && taxon.parent.parent.parent.present?)\n name = (taxon.parent.parent.name+\" -> \"+taxon.parent.name+\" -> \"+taxon.name)\n @taxons_json << {'label' => name, 'id' => taxon.id} if name.downcase.include? params[:term].downcase\n end\n }\n render :json=>@taxons_json.to_json\n end", "def add_taxons\n # TODO smart column ordering to ensure always valid by time we get to associations\n product_load_object.save_if_new\n\n chain_list = value.to_s.split(multi_assoc_delim) # potentially multiple chains in single column (delimited by multi_assoc_delim)\n\n chain_list.each do |chain|\n\n # Each chain can contain either a single Taxon, or the tree like structure parent>child>child\n name_list = chain.split(/\\s*>\\s*/)\n\n parent_name = name_list.shift\n\n parent_taxonomy = taxonomy_klass.where(:name => parent_name).first_or_create\n\n raise DataShift::DataProcessingError.new(\"Could not find or create Taxonomy #{parent_name}\") unless parent_taxonomy\n\n parent = parent_taxonomy.root\n\n # Add the Taxons to Taxonomy from tree structure parent>child>child\n taxons = name_list.collect do |name|\n\n begin\n taxon = taxon_klass.where(:name => name, :parent_id => parent.id, :taxonomy_id => parent_taxonomy.id).first_or_create\n\n # pre Rails 4 - taxon = taxon_klass.find_or_create_by_name_and_parent_id_and_taxonomy_id(name, parent && parent.id, parent_taxonomy.id)\n\n unless(taxon)\n logger.warn(\"Missing Taxon - could not find or create #{name} for parent #{parent_taxonomy.inspect}\")\n end\n rescue => e\n logger.error(e.inspect)\n logger.error \"Cannot assign Taxon ['#{taxon}'] to Product ['#{product_load_object.name}']\"\n next\n end\n\n parent = taxon # current taxon becomes next parent\n taxon\n end\n\n taxons << parent_taxonomy.root\n\n unique_list = taxons.compact.uniq - (@product_load_object.taxons || [])\n\n logger.debug(\"Product assigned to Taxons : #{unique_list.collect(&:name).inspect}\")\n\n @product_load_object.taxons << unique_list unless(unique_list.empty?)\n # puts @product_load_object.taxons.inspect\n\n end\n\n end", "def build_up_frbr_tree(int_digital_edition_id, bln_primary)\n \t@arr_frbr_tree = Array.new\n \t\n \t\n \t@items = ItemsHasDigitalEditions.where(\"digital_edition_id = ?\", int_digital_edition_id).order(\"item_has_digital_edition_primary ASC\")\n \[email protected] do |items_item|\n \t\tint_assoc_man = 0\n \t\t@item = Item.where(\"id = ?\", items_item.item_id)\n \t\[email protected] do |item_item|\n \t\t\t\tint_item_id = item_item.id\n\t\t\t\tstr_item_name = \"I_\" + item_item.id + \": \" + item_item.item_siglum\n\t\t\t\tint_assoc_man = item_item.manifestation_id\n \t\tend\n \t\t@arr_manifestation_master = Array.new\n \t\t@manifestations = Manifestation.where(\"id = ?\", int_assoc_man).order(\"manifestation_name ASC\")\n \t\[email protected] do |man_item|\n \t\t\t@arr_expressions_master = Array.new\n \t\t\t@exp_man_joins = ExpressionsHasManifestations.where(\"manifestation_id = ?\", man_item.id)\n \t\t\t@exp_man_joins.each do |exp_join_item|\n \t\t\t\n \t\t\t\t# here is where I have to put in the logic whether to display all expressions and works\n \t\t\t\t# or just the primary ones\n \t\t\t\tif (bln_primary)\n \t\t\t\t\t@expressions = Expression.joins(:works).where(\"expressions.id = ?\", exp_join_item.expression_id).order(\"expression_name ASC\")\n \t\t\t\telse\n \t\t\t\t\t@expressions = Expression.where(\"id = ?\", exp_join_item.expression_id).order(\"expression_siglum ASC\")\n \t\t\t\tend\n \t\t\t\[email protected] do |expression_item|\n \t\t\t\t\n \t\t\t\t\n \t\t\t\t\t@arr_works_master = Array.new\n \t\t\t\t\tif (bln_primary)\n \t\t\t\t\t\t@works = Work.where(\"work_frbr = 1 AND id = ?\", expression_item.work_id).order(\"work_name ASC\")\n \t\t\t\t\telse\n \t\t\t\t\t\t@works = Work.where(\"id = ?\", expression_item.work_id).order(\"work_siglum ASC\")\n \t\t\t\t\tend\n \t\t\t\t\[email protected] do |work_item|\n \t\t\t\t\t\t@arr_work_item = Array.new\n \t\t\t\t\t\tif bln_primary\n \t\t\t\t\t\t\tstr_work_item = \"W_\" + work_item.id.to_s + \": \" + work_item.work_name + \" (\" + work_item.work_siglum + \")\"\n \t\t\t\t\t\telse\n \t\t\t\t\t\t\tstr_work_item = \"(\" + work_item.work_siglum + \") \" + work_item.work_name + \": W_\" + work_item.id.to_s\n \t\t\t\t\t\tend\n \t\t\t\t\t\t@arr_work_item.push(work_item.id)\n \t\t\t\t\t\t@arr_work_item.push(str_work_item)\n \t\t\t\t\t\t@arr_works_master.push(@arr_work_item)\n \t\t\t\t\tend\n\n \t\t\t\t\t@arr_expression_item = Array.new\n \t\t\t\t\tstr_expression_item = \"E_\" + expression_item.id.to_s + \": \" + expression_item.expression_name + \" (\" + expression_item.expression_siglum + \")\"\n \t\t\t\t\t@arr_expression_item.push(expression_item.id)\n \t\t\t\t\t@arr_expression_item.push(str_expression_item)\n \t\t\t\t\t@arr_expression_item.push(@arr_works_master)\n \t\t\t\t\t@arr_expressions_master.push(@arr_expression_item)\n \t\t\t\t\t\n \t\t\t\tend\n\n \t\t\tend\n \t\t\t\n \t\t\t\n \t\t\t\n \t\t\t\n \t\t\t@arr_manifestation_item = Array.new\n \t\t\tstr_manifestation_name = \"M_\" + man_item.id.to_s + \": \" + man_item.manifestation_name + \" (\" + man_item.manifestation_siglum + \")\"\n \t\t\t@arr_manifestation_item.push(man_item.id)\n \t\t\t@arr_manifestation_item.push(str_manifestation_name)\n \t\t\t@arr_manifestation_item.push(@arr_expressions_master)\n\n \t\tend\n\n \t\t#fill the items array and push to tree master\n\t\tif (items_item.item_has_digital_edition_primary)\n\t\t\tint_item_primary = 1\n\t\telse\n\t\t\tint_item_primary = 0\n\t\tend\n\t\tstr_item_name = \"I_\" + item_item.id.to_s + \": \" + item_item.item_siglum\n\t\t@arr_item_item = Array.new\n\t\t@arr_item_item.push(int_item_id)\n\t\t@arr_item_item.push(str_item_name)\n\t\t@arr_item_item.push(int_item_primary)\n\t\t@arr_item_item.push(@arr_manifestation_master)\n \t\tarr_frbr_tree.push(@arr_item_item)\n \tend\n \t\n \treturn @arr_frbr_tree\n end", "def create_children(&block)\n if block.(self, cv = ntants)\n unless @depth == 0\n @children = cv.map{|vupper, vlower| Node.new(vupper, vlower, @depth - 1)}\n @children.each{|child| child.create_children &block}\n end\n end\n end", "def tree\n @treetop = @proj.default_ontology_class\n @proj.ontology_classes.first if !@treetop\n redirect_to :action => :new, :controller => :ontology_classes and return if !@treetop\n @colored_object_relationships = @proj.object_relationships.with_color_set\n @all_object_relationships = @proj.object_relationships \n render :action => 'ontology/tree/index'\n end", "def set_node_continent(node_city, continent)\n @nodes[node_city].continent = continent\n end", "def reset_hierarchy(categories_to_reset = self.all)\n ids = categories_to_reset.collect(&:id)\n\n link_table_entries.where(\"parent_id IN (?) OR child_id IN (?)\", ids, ids).delete_all\n\n descendant_table_entries.where(\"descendant_id IN (?) OR ancestor_id IN (?)\", ids, ids).delete_all\n\n categories_to_reset.each do |category|\n category.send :initialize_dag\n end\n end", "def call\n add_fields(leeds_taxi: true)\n end", "def build_ast_in_forest(trees)\n if trees.empty?\n []\n else\n build_ast(trees.first) + build_ast_in_forest(trees.butfirst)\n end\n end", "def create_tax_charge!\n #puts \"Adjustments #{adjustments} TAX #{tax_total}\"\n #puts \"CREATE TAX for #{ship_address} \"\n all_rates = Spree::TaxRate.all\n matching_rates = all_rates.select { |rate| rate.zone.include?(ship_address) }\n if matching_rates.empty?\n matching_rates = all_rates.select{|rate| # get all rates that apply to default country \n rate.zone.country_list.collect{|c| c.id}.include?(Spree::Config[:default_country_id])\n }\n end\n adjustments.where(:originator_type => \"TaxRate\").each do |old_charge|\n old_charge.destroy\n end\n matching_rates.each do |rate|\n #puts \"Creating rate #{rate.amount}\" \n rate.create_adjustment( rate.tax_category.description , self, self, true)\n end\n end", "def flat_page_tree\n @flat_tree ||= ([{\n :key => \"page_#{self.root_page.id}\".to_sym,\n :name => self.root_page.menu_name,\n :url => self.root_page.url,\n :options => {:class => \"#{self.root_page.page_type} #{self.root_page.displayed ? '' : 'not-displayed'}\"},\n :items => []\n }] + self.root_page.children.collect {|page| page.tree_hash_value } )\n @flat_tree\n end", "def gen_tree\n new_tree = {}\n node_list = {}\n @json_tree.each do |k, v|\n if v['child_of'].nil?\n # top\n new_tree[k] = v\n node_list[k] = new_tree[k]\n else\n parent = v['child_of']\n if v['condition'] == 'and'\n node_list[parent]['and'] ||= {}\n node_list[parent]['and'][k] = v\n node_list[k] = node_list[parent]['and'][k]\n elsif v['condition'] == 'or'\n node_list[parent]['or'] ||= {}\n node_list[parent]['or'][k] = v\n node_list[k] = node_list[parent]['or'][k]\n else\n # TODO: sink?\n node_list[parent]['or'] ||= {}\n node_list[parent]['or'][k] = v\n node_list[k] = node_list[parent]['or'][k]\n end\n end\n end\n\n @json_tree_type = 'tree'\n @json_tree = new_tree\n end", "def explore_taxa\n @explore_taxa = RandomHierarchyImage.random_set(6, @session_hierarchy,\n {:language => current_user.language, :size => :medium})\n render :layout => false, :partial => 'explore_taxa'\n end", "def handle_taxa(data, import)\n print \"Handling taxa \"\n if import.metadata['taxa']\n print \"from database. Indexing OTUs by TaxonCode...\"\n Otu.includes(:identifiers).each do |o|\n # There is only one identifier added at this point, so we are safe here. If this changes specify here.\n data.otus.merge!(o.identifiers.first.identifier => o)\n end\n print \"done.\\n\" \n else\n print \"as newly parsed.\\n\"\n puts\n\n path = @args[:data_directory] + 'TXT/taxa_hierarchical.txt'\n raise 'file not found' if not File.exists?(path)\n\n parent_index = {}\n f = CSV.open(path, col_sep: \"\\t\", :headers => true)\n\n\n code = :iczn\n\n f.first(500).each_with_index do |row, i| #f.first(500).each_with_index\n name = row['Name']\n author = (row['Parens'] ? \"(#{row['Author']})\" : row['Author']) unless row['Author'].blank?\n author ||= nil\n code = :icn if code == :iczn && row['Name'] == 'Plantae'\n rank = Ranks.lookup(code, row['Rank'])\n rank ||= NomenclaturalRank\n\n p = Protonym.new(\n name: name,\n verbatim_author: author,\n year_of_publication: row['Year'],\n rank_class: rank,\n created_by_id: find_or_create_collection_user(row['CreatedBy'], data),\n updated_by_id: find_or_create_collection_user(row['ModifiedBy'], data),\n #creator: find_or_create_user(row['CreatedBy'], data),\n #updater: find_or_create_user(row['ModifiedBy'], data),\n created_at: time_from_field(row['CreatedOn']),\n updated_at: time_from_field(row['ModifiedOn'])\n )\n p.parent_id = parent_index[row['Parent'].to_s].id unless row['Parent'].blank? || parent_index[row['Parent'].to_s].nil?\n if rank == NomenclaturalRank || !p.parent_id.blank?\n bench = Benchmark.measure {\n p.save\n build_otu(row, p, data)\n }\n\n if p.valid?\n parent_index.merge!(row['ID'] => p)\n TAXA.merge!(row['TaxonCode'] => p)\n print \"\\r#{i}\\t#{bench.to_s.strip} #{name} \" # \\t\\t#{rank}\n else\n puts \"\\n#{p.name}\"\n puts p.errors.messages\n puts\n end\n else\n puts \"\\n No parent for #{p.name}.\\n\"\n end\n\n\n p.data_attributes.create(type: 'InternalAttribute', predicate: data.keywords['Taxa:Synonyms'], value: row['Synonyms']) unless row['Synonyms'].blank?\n p.data_attributes.create(type: 'InternalAttribute', predicate: data.keywords['Taxa:References'], value: row['References']) unless row['References'].blank?\n p.notes.create(text: row['Remarks']) unless row['Remarks'].blank?\n\n #p.parent_id = p.parent.id if p.parent && !p.parent.id.blank?\n\n end\n\n import.metadata['taxa'] = true\n end\n end", "def show\n @dossier = Dossier.find(params[:id])\n @acteurs = @dossier.acteurs\n @contact_acteurs = []\n tree = []\n @acteurs.each do |acteur|\n content = {:expanded => true, :cls => \"folder\", :id => acteur.id, :text => acteur.description, :qualite_procedurale => '', :institution=>'', :email => '', :telephone => ''}\n contact_acteurs = []\n acteur.contact_acteurs.each do |conact|\n @contact_acteurs.push(conact)\n if conact.contact\n contact_content = {:id => conact.id, :text => conact.contact.full_name_inc_civilite, :qualite_procedurale => conact.qualite_procedurale.try(:description), :institution=>conact.contact.institution.try(:nom), :email => conact.contact.try(:email), :telephone => conact.contact.try(:telephone), :leaf => true}\n contact_acteurs.push(contact_content)\n end\n end\n content[:children] = contact_acteurs\n tree.push(content)\n end\n \n\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dossier }\n format.json { render :json => {:dossier => @dossier.attributes.merge(:institution_nom => @dossier.institution.try(:nom), :type_etat_dossier_description => @dossier.type_etat_dossier.try(:description), :juge_mission_id => @dossier.juge_mission.try(:contact_id), :juge_controlleur_id => @dossier.juge_controlleur.try(:contact_id)), :activites => @dossier.activites, :expenses => @dossier.expenses.map {|p| p.attributes.merge(:total_ht => p.total, :total_ttc => p.total_ttc, :activite_name => p.activite.try(:description))}, :reminders => @dossier.reminders, :documents => @dossier.documents.map {|p| p.attributes.merge(:short_link => p.generate_link,:long_link => p.generate_long_link )}, :acteurs =>@acteurs, :communications => @dossier.communications, :contact_acteurs=>@contact_acteurs, :tree => tree, :consignations => @dossier.consignations}}\n format.pdf {\n html = render_to_string( :action => \"show\")\n kit = PDFKit.new(html, :page_size => 'A4')\n kit = kit.to_pdf\n send_data(kit, :filename => \"labels.pdf\", :type => 'application/pdf', :disposition => 'inline')\n return\n }\n end\n end", "def set_luxire_taxonomy\n @luxire_taxonomy = LuxireTaxonomy.find(params[:id])\n end", "def parse_category_tree\n dry_run_notification\n\n page_html = get_page_html @donor.url\n\n if page_html\n main_category_last = page_html.css('.content > .main-cat').last\n return false if main_category_last.nil?\n main_category_last.css('> .cat-item > .middle').each do |parent_category|\n parent_category_link = get_category_link(parent_category.at_css('a'))\n\n next if parent_category_link[:name].empty? && parent_category_link[:path].empty?\n\n category_parent = save_category(parent_category_link) unless DRY_RUN\n display_category_structure(parent_category_link, \"#{'-' * 80}\\n\")\n\n if parent_category\n parent_category.css('.main-cat > .cat-item > .middle').each do |subcategory_first_level_node|\n subcategory_first_level_link = get_category_link(subcategory_first_level_node.at_css('a'))\n\n subcategory_first_level = save_category(subcategory_first_level_link, category_parent.id) unless DRY_RUN\n display_category_structure(subcategory_first_level_link, ' ' * 2)\n\n subcategory_first_level_node.css('.main-cat > .cat-item > .middle').each do |subcategory_second_level_node|\n subcategory_second_level_link = get_category_link(subcategory_second_level_node.at_css('a'))\n\n save_category(subcategory_second_level_link, subcategory_first_level.id) unless DRY_RUN\n display_category_structure(subcategory_second_level_link, ' ' * 4)\n end\n end\n end\n end\n end\n end", "def index\n @page_hierarchies = PageHierarchy.all\n end", "def populate(array)\n @root = Node.new({type: :document}, [], nil, 0)\n @total_nodes += 1\n @max_depth = 0\n current_node = @root\n current_depth = 0\n array.each do |hash|\n # opening tag - create new node\n if NODE_DOWN.include? hash[:type]\n #if <> depth += 1\n new_node = Node.new(hash, [], current_node, current_node.depth + 1)\n current_node.children << new_node\n current_node = new_node\n current_depth += 1\n @total_nodes += 1\n else #hash[:type] == \"close\"\n #if </> depth -= 1\n new_node = Node.new(hash, [], current_node, current_node.depth)\n current_node.children << new_node\n current_node = current_node.parent\n current_depth -= 1\n @total_nodes += 1\n end\n\n if current_depth > @max_depth\n @max_depth = current_depth\n end\n\n if hash[:type] == :text && current_node.children.empty?\n current_depth -= 1\n current_node = current_node.parent\n end\n end\n self\n end", "def create_children!\n all_cities = TSP.cities.keys\n\n #rejects the cities which have already been visited\n all_cities.reject!{|city_id| self.visited_this_tour.include?(city_id)}\n all_cities.each do |city_id|\n @children << Node.new(city_id, self)\n end\n end", "def create_tree(items, rootpage)\n _, tree = visit_nodes(items, rootpage.lft + 1, rootpage.id, rootpage.depth + 1, {}, \"\", rootpage.restricted)\n tree\n end", "def add_taxons\n save_if_new\n chain_list = get_each_assoc\n chain_list.each do |chain|\n # Each chain can contain either a single Taxon,\n # or the tree like structure parent>child>child\n name_list = chain.split(/\\s*>\\s*/)\n taxonomy_name = name_list.shift\n taxonomy = @@taxonomy_klass.find_or_create_by_name(taxonomy_name)\n raise DataShift::DataProcessingError.new(\"Could not find or create Taxonomy #{taxonomy_name}\") unless taxonomy\n taxon = taxonomy.root\n name_list.each do |taxon_name|\n taxon = @@taxon_klass.find_or_create_by_name_and_parent_id_and_taxonomy_id(taxon_name, taxon.id, taxonomy.id)\n end\n\n if taxon\n @product.taxons << taxon\n puts \" Added to taxon #{taxon.pretty_name}\"\n else\n puts \" Taxon not found or created: #{name}\"\n end\n\n end\n end", "def transfer_taxonomy(tax)\n $stderr.puts 'Transferring taxonomy'\n return if tax.nil?\n\n pval = (project.metadata[:tax_pvalue] || 0.05).to_f\n tax_a = tax\n .select { |i| i[1] != '?' && i[2] <= pval }\n .map { |i| i[0, 2].join(':') }\n dataset.metadata[:tax] = MiGA::Taxonomy.new(tax_a)\n dataset.save\n end", "def destroy_tree_from_leaves\n self.subdirectories.each do |subdirectory|\n subdirectory.destroy_tree_from_leaves\n end\n self.subdirectories.reload\n self.cfs_files.each do |cfs_file|\n cfs_file.destroy!\n end\n self.cfs_files.reload\n self.destroy!\n end", "def home_page\n taxon = nil\n taxon_ids= template_resources.select{|template_resource|\n template_resource.source_class == SpreeTheme.taxon_class\n }.collect(&:source_id)\n if taxon_ids.present?\n taxons = SpreeTheme.taxon_class.where( id: taxon_ids )\n taxon = SpreeTheme.taxon_class.homes.where([\"taxonomy_id in (?)\", taxons.map(&:taxonomy_id ) ]).first\n end\n taxon\n end", "def assign_position\n gon.structure = build_pages_tree\n gon.position = @page.position\n gon.parent_id = @page.parent_id\n end", "def index\n @franchises = @location.franchises.order(:name)\n #@franchises = Franchise.all\n end", "def set_tree\n @organism = Tree.with_all.find(params[:id])\n end", "def index\n @breadcrumbs = [['Tax codes']]\n @tax_codes = current_organization.tax_codes.order(:code)\n @tax_codes = @tax_codes.page(params[:page])\n end", "def global_scope\n respond_to?(:scoped_object) && scoped_object ? scoped_object.taxonomies : Taxonomy\n end", "def index\n @taxons = Taxon.all\n end", "def clear_nodes\n\t\t\t@tree = []\n\t\t\t@node_stack = [ @tree ]\n\t\tend", "def set_census_tract_variables\n return unless land_use == 'residential' || land_use == 'office'\n\n tract_data = []\n tract_geoids = transportation_analysis.selected_census_tract_geoids\n\n if land_use == \"residential\" \n tract_data = CeqrData::NycAcs.version(\n data_package.table_for('nyc_acs')\n ).query.where(geoid: tract_geoids).all\n elsif land_use == \"office\"\n tract_data = CeqrData::CtppCensustractVariables.version(\n data_package.table_for('ctpp_censustract_variables')\n ).query.where(geoid: tract_geoids).all\n end\n\n self.census_tract_variables = tract_geoids.map do |geoid|\n tract = {}\n\n variables = tract_data.filter {|t| t[:geoid] == geoid}\n variables.each do |v|\n tract[v[:variable]] = v\n end\n\n tract\n end\n end", "def build_category_tree(n, child = nil)\n amz_node = BrowseNode.parse(n.to_s)\n amz_node.child = child unless child.nil?\n\n if n.search(\"./IsCategoryRoot\").size > 0\n @category_tree[amz_node.name] ||= []\n @category_tree[amz_node.name] << amz_node\n else\n parents = n.search(\"./Ancestors/BrowseNode\")\n if parents.size > 0\n build_category_tree(parents[0], amz_node)\n end\n end\n\n\n end", "def chargeVoisins\n for x in 0..(self.lignes-1)\n for y in 0..(self.colonnes-1)\n if (self.get_child_at(x,y).status == 'i')\n\n # DROITE\n for x2 in (x+1).upto(self.lignes-1)\n if (self.get_child_at(x2, y).status == 'i')\n self.get_child_at(x, y).eastNode = self.get_child_at(x2,y)\n break\n end\n end\n\n #BAS\n for y2 in (y+1).upto(self.colonnes-1)\n if (self.get_child_at(x,y2).status == 'i')\n self.get_child_at(x,y).southNode = self.get_child_at(x,y2)\n break\n end\n end\n \n #HAUT\n for y2 in (y-1).downto(0)\n if (self.get_child_at(x,y2).status == 'i')\n self.get_child_at(x,y).northNode = self.get_child_at(x,y2)\n break\n end\n end\n\n # Gauche\n for x2 in (x-1).downto(0)\n if (self.get_child_at(x2,y).status == 'i')\n self.get_child_at(x,y).westNode = self.get_child_at(x2,y)\n break\n end\n end\n end\n end \n end\n\n return self\n end", "def trees\n @trees ||= ApiFactory.new 'GitData::Trees'\n end", "def transform(tree); end", "def initialize_fringe\n [{\n city: @initial,\n path: [@initial],\n depth: 1,\n cost: 0\n }]\n end", "def renumber_full_tree\n indexes = []\n n = 1\n transaction do\n for r in roots # because we may have virtual roots\n n = r.calc_numbers(n, indexes)\n end\n for i in indexes\n base_set_class.update_all(\"#{left_col_name} = #{i[:lft]}, #{right_col_name} = #{i[:rgt]}\", \"#{self.class.primary_key} = #{i[:id]}\")\n end\n end\n ## reload?\n end", "def list_children(taxons_collection)\n taxons_collection.sort_by {|p| p.hierarchy}\n html_var = \"\"\n taxons_collection.each do |t|\n if not t.children.empty?\n html_var << \"<li><i class='icon-plus'> </i>\" << link_to(t.name, t) << \"<ul>\" << list_children(t.children) << \"</ul>\"\n else\n html_var << \"<li><i class='icon-white' style='visibility: hidden;'> </i>\" << link_to(t.name, t)\n end\n html_var << \"</li>\\n\"\n end\n return html_var.html_safe\nend", "def cti_register_ascendants(ascendants)\n @cti_ascendants = ascendants\n end", "def envia_taxones_query\n end", "def initialize(hsh, opener, content = nil)\n if content\n @hash_id, @opener = hsh, opener\n @type = 'tree'\n @content = content\n else\n super(hsh, opener)\n end\n parse!\n end", "def load_forest\n trees = []\n if File.exists?(@forest_file)\n begin\n trees = Psych.load(File.open @forest_file)\n rescue ArgumentError => e\n raise Nimbus::WrongFormatFileError, \"It was not posible to parse the random forest file (#{@forest_file}): \\r\\n#{e.message} \"\n end\n else\n raise Nimbus::InputFileError, \"Forest file not found (#{@forest_file})\"\n end\n forest = Nimbus::Forest.new self\n forest.trees = trees\n forest\n end", "def renumber_full_tree\n indexes = []\n n = 1\n transaction do\n for r in roots # because we may have virtual roots\n n = 1 + r.calc_numbers(n, indexes)\n end\n for i in indexes\n base_set_class.update_all(\"#{left_col_name} = #{i[:lft]}, #{right_col_name} = #{i[:rgt]}\", \"#{self.class.primary_key} = #{i[:id]}\")\n end\n end\n ## reload?\n end", "def make_municipalities\n Municipality.delete_all\n\n # STATES hash constant from environment.rb\n Constants::STATES.each do |state|\n make_municipalities_for_state(state)\n end\n\n #\n # Correct municipality slug names\n #\n\n # Vermont:\n # http://www.vt251.com/vt/town_links.php\n # http://www.census.gov/geo/www/maps/DC10_GUBlkMap/cousub/dc10blk_st50_cousub.html\n municipality = Municipality.find_by_slug('alburg-vt')\n municipality.name = 'Alburgh'\n municipality.slug = 'alburgh-vt'\n municipality.save!\n\n municipality = Municipality.find_by_code_fips('5001161675')\n municipality.name = 'St. Albans City'\n municipality.slug = 'st-albans-city-vt'\n municipality.save!\n\n municipality = Municipality.find_by_code_fips('5001161750')\n municipality.name = 'St. Albans Town'\n municipality.slug = 'st-albans-town-vt'\n municipality.save!\n\n municipality = Municipality.find_by_code_fips('5001948850')\n municipality.name = 'Newport City'\n municipality.slug = 'newport-city-vt'\n municipality.save!\n\n municipality = Municipality.find_by_code_fips('5001948925')\n municipality.name = 'Newport Town'\n municipality.slug = 'newport-town-vt'\n municipality.save!\n end", "def build_branches\n branches_collection(coverage[:branches] || {})\n end", "def travNav(navBar, &block)\n navBar.each { |nav|\n block.yield(nav)\n if nav['type'] == 'folder'\n travNav(nav['sub_nav'], &block)\n end\n }\nend", "def freshen_parent_and_child_indexes\n freshen_parent_and_child_indexes(0)\n end", "def create_taxonomy_node\n Taxonomite::Species.new(name: self.name)\n end", "def get_feature_values_roots()\n @trees ||= self.category.self_and_ancestors.collect { |cat| [cat, Feature.node_roots(:include => :feature_values, :conditions => [\"features.category_id=? AND feature_values.product_id =?\", cat.id, id])] }\n end", "def index\n @trees = Tree.all\n @single = false\n @new = false\n @width = 700\n @height = 1400\n @vx = 0\n @vy = 0\n @vw = 400\n @vh = 750\n end" ]
[ "0.6192606", "0.6052458", "0.5556622", "0.5433875", "0.5337591", "0.52480006", "0.51918113", "0.5172413", "0.51446563", "0.508069", "0.50770134", "0.5075848", "0.5064033", "0.50601155", "0.5044692", "0.50421494", "0.50010604", "0.5000898", "0.49971154", "0.49739376", "0.4915647", "0.48869604", "0.48762363", "0.48549017", "0.48416165", "0.48281312", "0.48064914", "0.47859067", "0.4759475", "0.47573054", "0.4754128", "0.4743863", "0.47198403", "0.47174123", "0.47174123", "0.4716113", "0.47115675", "0.4675394", "0.46512973", "0.46480647", "0.46457934", "0.46413988", "0.46167225", "0.46114543", "0.45902184", "0.45823044", "0.4577273", "0.45709124", "0.45637503", "0.45545936", "0.4551302", "0.45451877", "0.45443308", "0.45410663", "0.4524864", "0.45195264", "0.450924", "0.45059842", "0.45030433", "0.44973695", "0.44955674", "0.4483295", "0.4481504", "0.4480775", "0.44806924", "0.44785905", "0.44782144", "0.4475755", "0.44637656", "0.44591478", "0.44533092", "0.44399646", "0.44357875", "0.44319874", "0.44302076", "0.44229493", "0.44047785", "0.44038332", "0.4397333", "0.43946505", "0.43850815", "0.43834272", "0.4380212", "0.437671", "0.43758166", "0.43719608", "0.4370043", "0.43642312", "0.4359749", "0.4356834", "0.43555832", "0.43554032", "0.43514737", "0.43479103", "0.43454897", "0.43437818", "0.43436915", "0.43424204", "0.4340304", "0.4340161" ]
0.8426066
0
build tree from +nodes_fragement+ doc
def build_tree(nodes_fragement) nodes_element = LonelyPlanet::Node.new nodes_fragement node = LonelyPlanet::TreeNode.new(nodes_element.name, nodes_element.id) if nodes_element.has_child? nodes_element.children.all? { |child_frag| node << build_tree(child_frag) } end node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate(array)\n @root = Node.new({type: :document}, [], nil, 0)\n @total_nodes += 1\n @max_depth = 0\n current_node = @root\n current_depth = 0\n array.each do |hash|\n # opening tag - create new node\n if NODE_DOWN.include? hash[:type]\n #if <> depth += 1\n new_node = Node.new(hash, [], current_node, current_node.depth + 1)\n current_node.children << new_node\n current_node = new_node\n current_depth += 1\n @total_nodes += 1\n else #hash[:type] == \"close\"\n #if </> depth -= 1\n new_node = Node.new(hash, [], current_node, current_node.depth)\n current_node.children << new_node\n current_node = current_node.parent\n current_depth -= 1\n @total_nodes += 1\n end\n\n if current_depth > @max_depth\n @max_depth = current_depth\n end\n\n if hash[:type] == :text && current_node.children.empty?\n current_depth -= 1\n current_node = current_node.parent\n end\n end\n self\n end", "def initialize(nodes_fragement)\n @nodes_xml = nodes_fragement\n @children = set_children\n end", "def nodes; end", "def nodes; end", "def nodes; end", "def to_rexml\n require 'rexml/document'\n doc = REXML::Document.new\n doc << REXML::XMLDecl.default\n root_el=REXML::Element.new self.structure_node.node_name.to_s\n doc.add_element root_el\n mapping_hash={self => root_el}\n self.each_level do |level|\n level.sort! {|a, b| a.tokenstream <=> b.tokenstream}\n node_parent=level.first.parent # Parent will be the same for all on this level\n xml_parent = mapping_hash[node_parent]\n last_text_pos = node_parent.tokenstream.tokens.first.start_loc\n level.each do |node|\n xml_parent.add_text(node.parent.original_text[last_text_pos...node.tokenstream.tokens.first.start_loc])\n el = REXML::Element.new node.structure_node.node_name.to_s\n if node.children.empty?\n el.add_text node.to_s\n end\n mapping_hash[node.parent].add_element el\n mapping_hash[node]=el\n last_text_pos = node.tokenstream.tokens.last.end_loc\n end\n # Add any text at the end of the section of the document covered by this tree level\n pos_of_last_string=level.last.tokenstream.tokens.last.end_loc \n end_of_cur_level=node_parent.tokenstream.tokens.last.end_loc\n xml_parent.add_text(node_parent.original_text[pos_of_last_string..end_of_cur_level])\n end\n return doc\n end", "def build_tree(arr)\n\tend", "def parsed_tree; end", "def build(*nodes, attributes: {}, infos: nil, recursive: true)\n\t\t\tnodes.each do |node|\n\t\t\t\tcase node\n\t\t\t\twhen Hash\n\t\t\t\t\tnode.each do |name,children|\n\t\t\t\t\t\tadd_node(name,children: [*children], attributes: attributes, infos: infos, recursive: recursive)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tadd_node(node, attributes: attributes, infos: infos, recursive: recursive)\n\t\t\t\tend\n\t\t\tend\n\t\t\tself\n\t\tend", "def children_to_docx; end", "def doc_transformed(root)\n\n end", "def build_nodes(builder, root, child_ns)\n root.each(&->(k, v) { build_node builder, child_ns, k, v })\n end", "def generate_content_ncx(content,path)\n @builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n class_types_map = {\"Subject\" => \"course\", \"ContentYear\" => \"academic-class\", \"Subject\" => \"subject\", \"Chapter\" => \"chapter\", \"Topic\" => \"topic\", \"SubTopic\" => \"subtopic\"}\n xml.navMap do\n xml.navPoint(:id=>\"Curriculum\", :class=>\"curriculum\") do\n xml.content(:src=>\"curriculum\")\n xml.navPoint(:id=>\"Content\",:class=>\"content\")do\n xml.content(:src=>\"content\")\n\n ## The code for generating the inside xml string\n content_xml_string = ''\n parents = content.parents.reverse\n ## Generating the content node\n parents.each do |parent|\n content_data = Content.find(parent[\"ancestor\"])\n ## Getting the class for the current node\n node_class = class_types_map[content_data.type]\n ## Getting the src for the current node\n node_src = ''\n if content_data.type == 'Board'\n node_src = content_data.code+'_'+content.assets.first.publisher_id.to_s\n elsif content_data.type == 'ContentYear' or content_data.type == 'Subject'\n node_src = content_data.code\n else\n node_src = content.assets.first.src\n end\n # Reset the nav node and the content node\n nav_node = ''\n content_node = ''\n\n # Generating the nav node\n nav_node = nav_node+\"<navPoint id='#{content_data.name}' class='#{node_class}' >\"\n\n # Generating the content node\n content_node = content_node+\"<content src='#{node_src}' />\"\n\n ## Appending the nav node and the content node to the main xml\n content_xml_string = content_xml_string+nav_node+content_node\n end\n ## Appending the navpoint end tags to the string\n parents.length.times do\n content_xml_string = content_xml_string + \"</navPoint>\"\n end\n\n ## End of code for generating the xml string\n xml.__send__ :insert, Nokogiri::XML::DocumentFragment.parse(content_xml_string)\n end\n end\n end\n end\n xml_string = @builder.to_xml.to_s\n file = File.new(path+\"/\"+\"index.ncx\", \"w+\")\n File.open(file,'w') do |f|\n f.write(xml_string.to_s.gsub( \"\\n\", \"\" ).gsub(/>[ ]*</,'><'))\n end\n create_zip(\"content_#{content.id}\",path)\n end", "def produce_tree(ary); end", "def process_child_nodes(node); end", "def nodes_field\n define_nodes_field\n end", "def traverse_nav_tree_and_convert_to_xml(node)\n \n # traverse subfolders, go deep\n if node_has_children(node)\n node.children.items.each do |child|\n traverse_nav_tree_and_convert_to_xml(child)\n end\n end\n \n return if node.nav_level == 0\n \n mod = node.dup\n\n link = node.link\n full_link = node.full_link\n \n mod.parent_link = parent_link = node.link[0..(link.rindex(\"/\") - 1)] if node.nav_level > 1\n \n if CONTENT_LINK_PREFIX && CONTENT_LINK_PREFIX.length > 0\n full_link = mod.full_link = \"/\" + CONTENT_LINK_PREFIX + node.full_link unless node.full_link.start_with?(\"/#{CONTENT_LINK_PREFIX}\")\n end\n\n \n mod.delete :source_path\n mod.delete :parent_path\n mod.delete :children\n\n\n #puts \"storing [#{mod.nav_level}][#{mod.nav_order}][#{mod.nav_type}] - #{mod.nav_title}\"\n case mod.nav_type \n \n when \"folder\"\n\t\t# do nothing for these\n when \"markdown\"\n metadata, markdown = parse_markdown_file(node.source_path)\n\t\t\n\t\tfilepath_markdown = node.source_path.dup\t\t\n\t\tfilepath_markdown += \".markdown\"\tunless filepath_markdown.end_with? (\".markdown\")\t\t\n\t\tmod.updated_at = Chronic.parse(File.mtime(filepath_markdown).to_s).utc.to_i\n\t\t\n mod.metadata = metadata if metadata\n mod.markdown = markdown\n \n\t\thtml = MarkdownRender::render(mod.markdown)\n\t\tdoc = Nokogiri::HTML(html) \n\t\txml = doc.css('body')[0].serialize #(save_with: 0)\n\t\txml.gsub!(/^<p><img /, \"<img \")\n\t\txml = Nokogiri::XML(xml)\n\t\tb = xml.at_css \"body\"\n\t\tb.name = \"doc\"\n\t\t\n File.open(\"#{filepath_markdown.gsub(/.markdown/, \".xml\")}\", 'w') { |f| xml.write_xml_to f }\n\n when \"folder+markdown\"\n metadata, markdown = parse_markdown_file(node.source_path)\n\t\t\n\t\tfilepath_markdown = node.source_path.dup\t\t\n\t\tfilepath_markdown += \".markdown\"\tunless filepath_markdown.end_with? (\".markdown\")\t\t\n\t\tmod.updated_at = Chronic.parse(File.mtime(filepath_markdown).to_s).utc.to_i\n\t\t\n mod.metadata = metadata if metadata\n mod.markdown = markdown\n\n\t\thtml = MarkdownRender::render(mod.markdown)\n\t\tdoc = Nokogiri::HTML(html)\n\t\txml = doc.css('body')[0].serialize #(save_with: 0)\n\t\txml.gsub!(/^<p><img /, \"<img \")\n\t\txml = Nokogiri::XML(xml)\n\n img_sizes = {\n \"40%\" => \"min\",\n \"50%\" => \"small\",\n \"65%\" => \"medium\",\n \"100%\" => \"full\",\n \"600px\" => \"large\"\n }\n \n img_sizes.each do |size,name|\n img = xml.at_css \"img[width=\\\"#{size}\\\"]\"\n img['size'] = name if img\n puts img.inspect if img\n end\n\n\t\tb = xml.at_css \"body\"\n\t\tb.name = \"doc\"\n\t\t\n File.open(\"#{filepath_markdown.gsub(/.markdown/, \".xml\")}\", 'w') { |f| xml.write_xml_to f }\n end\n \nend", "def build_internal_nodes\n names.each do |tmp_geo_area|\n recurse_nodes(tmp_geo_area.parent_names, tmp_geo_area)\n end\n end", "def nodelist; end", "def nodelist; end", "def tree_results(word_data)\n #get the data ready for d3 view\n tree_data = {\"name\"=> (@topic.name), \"info\" => \"tst\", \"children\" => []}\n \n word_data.each do |text, v|\n tree_data[\"children\"].push({\"name\" => text.to_s, \"children\" => []})\n end\n \n tree_data[\"children\"][0][\"children\"] << Hash[\"name\", word_data[:word]]\n \n word_data[:definitions].each do |text|\n tree_data[\"children\"][1][\"children\"] << Hash[\"name\", text[\"text\"]]\n end\n \n word_data[:word_associations].each do |text|\n tree_data[\"children\"][2][\"children\"] << Hash[\"name\", text[\"relationshipType\"], \"children\", []]\n end \n if word_data[:reverse_definitions][\"results\"].nil? \n tree_data[\"children\"][3][\"children\"] << nil\n else\n word_data[:reverse_definitions][\"results\"].each do |result| \n tree_data[\"children\"][3][\"children\"] << Hash[\"name\", result[\"text\"]]\n end\n end\n i = 0\n word_data[:word_associations].each do |text|\n text[\"words\"].each do |word|\n tree_data[\"children\"][2][\"children\"][i][\"children\"] << Hash[\"name\", word]\n end\n i+=1\n end\n #reduce duplicates in word_association hash\n tree_data[\"children\"][3][\"children\"].uniq!\n tree_data[\"children\"][2][\"children\"].uniq!\n return tree_data\n end", "def build_tree(arr)\n @root = Node.new(arr.shift)\n arr.each { |data| insert_data(data, @root) }\n end", "def build_dom(entries); 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 if child.first.respond_to?(:first) and\n child.first.first == :assoc_new\n child.each do |c|\n n = Nokogiri::XML::Node.new(\n c.first.to_s.gsub(/[^a-z_]/, ''), doc)\n c.drop(1).each do |a|\n xml_node.add_child(build_xml(a, doc, n))\n end\n end\n else\n n = Nokogiri::XML::Node.new(\n child.first.to_s.gsub(/[^a-z_]/, ''), doc)\n xml_node.add_child(build_xml(child, doc, n))\n end\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 from_node(node); end", "def build(node)\n\n # add <node.name to write_array\n @write_array << \"<#{node.name}\"\n\n # if node has classes, append them to last element of write array\n unless node.classes == nil\n @write_array[-1] = @write_array[-1] + \" classes=\\\"#{node.classes.join(\" \")}\\\"\"\n end\n\n # if node has id's, append them to last element of write array. else append closing bracket\n if node.id == nil\n @write_array[-1] = @write_array[-1] + \">\\n\"\n else\n @write_array[-1] = @write_array[-1] + \" id=\\\"#{node.id}\\\">\\n\"\n end\n\n # add tag text to array if available\n unless node.text == \"\"\n @write_array << node.text + \"\\n\"\n end\n\n # build children\n unless node.children == []\n node.children.each do |child|\n build(child)\n end\n else\n @write_array << \"</#{node.name}>\\n\"\n return\n end\n\n # add closing tag e.g. </html>\n @write_array << \"</#{node.name}>\\n\"\n\n end", "def populate_dom(array)\n node_count = 0\n current_node = @root\n current_depth = 0\n array.each do |hash|\n if DEEP_NODE.include? hash[:type]\n new_node = Node.new(hash, [], current_node, current_node.depth + 1)\n current_node.children << new_node\n current_node = new_node\n current_depth += 1\n else #hash[:type] == \"close\"\n current_depth -= 1 \n current_node = current_node.parent\n end\n node_count += 1\n end\n node_count\n end", "def build_elements(node, obj)\n node.elements.each do |e|\n case\n when e.name == \"names\"\n obj << (build_names(e))\n when e.name == \"date\"\n obj << (build_date(e))\n when e.name == \"label\"\n obj << (build_label(e))\n when e.name == \"text\"\n obj << (build_text(e))\n when e.name == \"group\"\n obj << (build_group(e))\n when e.name == \"choose\"\n obj << (build_conditions(e))\n end\n end\n end", "def build_tree\n c1 = ComponentNode.new(110)\n c2 = ComponentNode.new(20)\n c3 = ComponentNode.new(20)\n c4 = ComponentNode.new(150)\n c5 = ComponentNode.new(80)\n c6 = ComponentNode.new(120, [c1, c2, c3])\n c7 = ComponentNode.new(180, [c4, c5])\n return(ComponentNode.new(200, [c6, c7]))\n end", "def build_nodes!\n @nodes.sort_by(&:key).each { |node| add_node(@graph, node) }\n end", "def build_nodes!\n @nodes.sort_by(&:key).each { |node| add_node(@graph, node) }\n end", "def build_tree_2(data_array)\n root = nil\n \n data_array.each do |elem|\n node = insert_node(root, nil, elem) \n\troot ||= node\n end\n \n root\nend", "def build_node(builder, child_ns, field, value)\n field = Zuora::Utils::Envelope.to_zuora_key field\n if value.respond_to?(:each)\n # Parent\n builder[:api].send(field) { build_nodes builder, value, child_ns }\n else\n # Child\n builder[child_ns].send(field, value)\n end\n end", "def build_tree\n root = Sass::SCSS::CssParser.new(@template).parse\n expand_commas root\n parent_ref_rules root\n remove_parent_refs root\n flatten_rules root\n fold_commas root\n root\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 build_tree array\n\t\t@root = Node.new array[0]\n\t\t@nodes += 1\n\t\tarray[1..-1].each do |var|\n\t\t\tinsert(@root,var)\n\t\tend\n\tend", "def tree_nodes\n node_sets = completed_list.map.with_index do |item_set, index|\n item_set.map do |item|\n exclusive_index_at_which_substring_ends = index\n ParseForest::Node.new(item.production,\n item.position, \n exclusive_index_at_which_substring_ends)\n end\n end\n node_sets.flatten\n end", "def build_tree(arr)\n @root = insert_node(nil, arr.shift)\n arr.each { |value| insert_node(@root, value) }\n end", "def tree\r\n @rootNode\r\n end", "def init_simple_tree\n @root_org = Org.create(name: 'root')\n @lv1_child_org = Org.create(name: 'lv1')\n @lv1_child_org2 = Org.create(name: 'lv1-2')\n @lv2_child_org = Org.create(name: 'lv2')\n @lv2_child_org2 = Org.create(name: 'lv2-2')\n @lv2_child_org3 = Org.create(name: 'lv2-3')\n @lv2_child_org4 = Org.create(name: 'lv2-4')\n @lv3_child_org = Org.create(name: 'lv3')\n @lv3_child_org2 = Org.create(name: 'lv3-2')\n @lv4_child_org = Org.create(name: 'lv4')\n @lv4_child_org2 = Org.create(name: 'lv4-2')\n @lv5_child_org = Org.create(name: 'lv5')\n @lv5_child_org2 = Org.create(name: 'lv5-2')\n\n current_time = Time.now\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @root_org.id,\n distance: 0,\n start_time: 10.minutes.ago(current_time),\n end_time: 1000.years.from_now,\n scope_name: 'default'\n )\n\n # 10 minutes ago\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org.id,\n distance: 1,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org.id,\n distance: 2,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv1_child_org.id,\n distance: 1,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n # now\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv2_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv2_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org3.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org2.id,\n child_id: @lv2_child_org3.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org4.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org2.id,\n child_id: @lv2_child_org4.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv3_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv3_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv3_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv4_child_org.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv5_child_org.id,\n distance: 5,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv4_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv3_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv3_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv3_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv4_child_org2.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv4_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv4_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org2.id,\n child_id: @lv4_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv5_child_org2.id,\n distance: 5,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv5_child_org2.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv4_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\nend", "def recurse_nodes(parent_names, source_tmp_geo_area)\n if parent_names.count > 1\n parents = parent_names.dup # Tricky! \n name = parents.shift\n puts \"building internal node: #{name} : #{parents} \"\n add_item(\n name: name,\n parent_names: parents,\n source_table: source_tmp_geo_area.source_table,\n source_table_gid: source_tmp_geo_area.source_table_gid,\n is_internal_node: true\n )\n recurse_nodes(parents, source_tmp_geo_area)\n end\n end", "def build_tree(array)\n\t\t@root = Node.new(array.shift)\n\t\tarray.each { |value| add_node(value, @root)}\n\tend", "def node_tree\n @node_tree ||= Node.all({:fields => \"title, permalink, parent_id, _id, path, _type\", :published_at => { :$lte => Time.zone.now }, :published_to => { :$gte => Time.zone.now }, :order => 'parent_id ASC, position ASC'}).group_by{|n| n.parent_id.to_s }\n end", "def visit_nodes(nodes, my_left, parent, depth, tree, url, restricted)\n nodes.each do |item|\n my_right = my_left + 1\n my_restricted = item['restricted'] || restricted\n urls = process_url(url, item)\n\n if item['children']\n my_right, tree = visit_nodes(item['children'], my_left + 1, item['id'], depth + 1, tree, urls[:children_path], my_restricted)\n end\n\n tree[item['id']] = TreeNode.new(my_left, my_right, parent, depth, urls[:my_urlname], my_restricted)\n my_left = my_right + 1\n end\n\n [my_left, tree]\n end", "def build_tree(data)\n @root = Node.new(data[0])\n data.shift\n data.each { |value| @root.insert(value) }\n end", "def build_tree\n t = RDTree.new\n t.add_node(0, DummyRoot)\n root = root_node_of\n t.add_edge(0, root.attributes[\"ID\"])\n do_build_tree(root, 1, t) \n t\n end", "def create_tree(items, rootpage)\n _, tree = visit_nodes(items, rootpage.lft + 1, rootpage.id, rootpage.depth + 1, {}, \"\", rootpage.restricted)\n tree\n end", "def node_tree(nodes, &block)\n \n nodes = nodes.dup\n printed_nodes = []\n \n result = \"<ul>\"\n \n # top level nodes first, then others\n for node in nodes\n next if node.instance_of?(Center) || node.instance_of?(Team)\n next unless node.parent == nil\n printed_nodes << node\n result += \"<li>\"\n\n if block_given?\n result += yield node\n else\n result += node.title\n end\n\n children = node.children.dup\n children.delete_if { |r| not nodes.include?(r) }\n if not children.empty?\n result += node_tree_help(children, nodes, printed_nodes, &block)\n end\n \n result += \"</li>\"\n end\n \n # TODO: Add depth counting here to get a minimum of trees\n for node in nodes\n next if printed_nodes.include? node\n printed_nodes << node\n \n result += \"<li>\"\n\n if block_given?\n result += yield node\n else\n result += node.title\n end\n\n children = node.children #.dup\n children.delete_if { |r| not nodes.include?(r) }\n\n if not children.empty?\n result += node_tree_help(children, nodes, printed_nodes, &block)\n end\n \n result += \"</li>\"\n end\n\n result += '</ul>'\n\n return result\n end", "def build_tree(arr)\n #take array, turn into bt with node objs\n return nil if arr.empty?\n\n mid = (arr.size - 1)/2\n current_node = Node.new(arr[mid])\n\n current_node.left = build_tree(arr[0...mid])\n current_node.right = build_tree(arr[(mid+1)..-1])\n \n current_node\n end", "def build_tree(array)\n\t\t@root = Node.new(array[0])\n\t\ttemp_root = @root\n\n\t\tarray[1..-1].each do |node_value|\n\t\t\tinsert_node(node_value, temp_root)\n\t\tend\n\tend", "def parse_text(text)\n\t\tNode.destroy_all(work_id: self.id)\n\t\tLink.destroy_all(work_id: self.id)\n\t\tLinkCollection.destroy_all(work_id: self.id)\n\n\t\tstack = Array.new\n\t\tnew_ordering= []\n\t\tlink_colls_queue = []\n\t\ttext.each_line do |line|\n\t\t\t#parser rules: any amount of whitespace followed immediately by < means new node. Otherwise, new note.\n\t\t\t#<TYPE.CATEGORY>TITLE\n\t\t\t#if the occurence of <*> is before the first occurence of \" then it's a new\n\t\t\t#@angleBracketLocation = line.index(/[ ,\\t]*<.*>/)\n\t\t\n\t\t\tfirst_char = get_text_from_regexp(line, /[ ,\\t]*(.)/)\n\t\t\n\t\t\t#if a new node should be made\n\t\t\tif first_char == '.'\n\t\t\t\tnew_node = Node.new\n\t\t\t\tbuild_node(new_node, line)\n\t\t\t\tnew_node.save\n\n\t\t\t\t#get the parent.\n\t\t\t\tdepth = new_node.depth\n\n\t\t\t\tnewNodeDepth = NodeDepth.new(new_node.id, depth)\n\t\t\t\t\n\t\t\t\tif depth == 0 #if it's a base element\n\t\t\t\t\tstack.push(newNodeDepth)\n\t\t\t\telse\n\t\t\t\t\tcurrNodeDepth = stack.pop\n\t\t\t\t\twhile depth <= currNodeDepth.depth do #while you're less deep, therefore it aint yo momma \n\t\t\t\t\t\tcurrNodeDepth = stack.pop\n\t\t\t\t\tend #at this point, @currNodeDepth is the nearest element that's not as deep as the new one, it's parent\n\t\t\t\t\tparentNode = Node.find(currNodeDepth.node_idnum)\n\t\t\t\t\tif parentNode.id == new_node.id #if it didn't find any parent\n\t\t\t\t\t\tparent_id = nil\n\t\t\t\t\telse\n\t\t\t\t\t\tparent_id = parentNode.id\n\t\t\t\t\tend\n\n\t\t\t\t\t#creates the link, and the sets the parent and child relation\n\t\t\t\t\trelation = Link.new(child_id: new_node.id, parent_id: parent_id, work_id: self.id)\n\t\t\t\t\trelation.save\n\t\t\t\t\tnew_node.parent_relationships << relation\n\t\t\t\t\tparentNode.child_relationships << relation\n\n\t\t\t\t\tstack.push(currNodeDepth)#push the parent back in, in case it has siblings\n\t\t\t\t\tstack.push(newNodeDepth)#push self in, in case it has children\n\n\t\t\t\t\t#@new_node.parent_relationships.build(child_id: @new_node.id, parent_id:@parentNode.id)\n\t\t\t\t\t#@new_node.parents << @parentNode\n\t\t\t\t\t#@parent_node.child=\n\t\t\t\t\t#make this nodes id into the parents child.\n\t\t\t\t\t#make the child's parent the parentNode's id.\n\t\t\t\tend\n\t\t\t\tnew_node.save\n\t\t\t\tnew_ordering.push(ObjectPlace.new(\"Node\", new_node.id))\n\n\t\t\t#if it's a note\n\t\t\telsif first_char == '-'\n\t\t\t\tnew_note = Note.new()\n\t\t\t\tbuild_note(new_note, line)\n\n\t\t\t\t#this is a bug. it just gets attached to the previous node without regard for depth\n\t\t\t\t#binding.pry\n\t\t\t\tif (new_note.depth != 0 && !stack.empty?) #if it could have a parent and there are possibilities\n\n\t\t\t\t\tcurrNodeDepth = stack.pop\n\t\t\t\t\twhile new_note.depth <= currNodeDepth.depth do #while you're less deep, therefore it aint yo momma \n\t\t\t\t\t\tcurrNodeDepth = stack.pop\n\t\t\t\t\tend #at this point, @currNodeDepth is the nearest element that's not as deep as the new one, it's parent\n\t\t\t\t\tparentNode = Node.find(currNodeDepth.node_idnum)\n\t\t\t\t\tstack.push(currNodeDepth)\n\t\t\t\t\n\t\t\t\t\tnew_note.node_id = parentNode.id\n\t\t\t\t\t#parentNode.add_note_to_combined(new_note)\n\t\t\t\tend\n\t\t\t\tnew_note.save\n\t\t\t\tnew_ordering.push(ObjectPlace.new(\"Note\", new_note.id))\t\t\t\t\n\t\t\t#for special chars\n\t\t\telsif first_char == ':'\n\n\t\t\t\t#ordering.insert(line_number, ObjectPlace.new(\"LinkCollection\", nil))\n\t\t\t\t#set_order(ordering)\n\t\t\t\t#parent_node = find_element_parent(link_coll_depth, line_number, ordering)\n\n\t\t\t\twhitespace = get_text_from_regexp(text, /(.*):/)\n\t\t\t\tlink_coll_depth = (whitespace.length)/3 #+2?\n\t\t\t\tparentNode = nil\n\t\t\t\tif (link_coll_depth != 0 && !stack.empty?) #if it could have a parent and there are possibilities\n\n\t\t\t\t\tcurrNodeDepth = stack.pop\n\t\t\t\t\twhile link_coll_depth <= currNodeDepth.depth do #while you're less deep, therefore it aint yo momma \n\t\t\t\t\t\tcurrNodeDepth = stack.pop\n\t\t\t\t\tend #at this point, @currNodeDepth is the nearest element that's not as deep as the new one, it's parent\n\t\t\t\t\tparentNode = Node.find(currNodeDepth.node_idnum)\n\t\t\t\t\tstack.push(currNodeDepth)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tlink_coll = self.link_collections.build\n\t\t\t\tbuild_link_collection(link_coll, line, parentNode)\t\n\t\t\t\tlink_colls_queue.append({link_coll: link_coll, text: get_text_from_regexp(line, /:(.*)/)})\n\t\t\t\t#binding.pry\n\t\t\t\tnew_ordering.push(ObjectPlace.new(\"LinkCollection\", link_coll.id))\n\t\t\telse\n\t\t\t\tplace_holder = work.place_holders.create(text:line_content)\n\t\t\t\tnew_ordering.push(ObjectPlace.new(\"PlaceHolder\", place_holder.id))\n\t\t\tend\n\t\tend\n\n\t\tset_order(new_ordering)\n\t\t#at the end, build those links (appending the newly made nodes if needed.) This way, all nodes are mode before it thinks\n\t\t#it needs to be doing this shit\n\t\tlink_colls_queue.each do |link_coll_pair|\n\t\t\t#build its child links\n\t\t\tlink_coll_pair[:link_coll].set_links(link_coll_pair[:text])\n\t\tend\n\n\t\t#should fix this so I can get rid of populate_ordering, only works here because things are produced in order, can do it as I go\n\t\t#o = populate_ordering\n\tend", "def nodes\n NODE_LIST_REGEX.match(@text).to_s.scan(NODE_REGEX).map do |match|\n Node.new(match[1], match[2], match[3].to_i)\n end\n end", "def new_tree(group, options = {}, &block)\n options[:root_ol] = true if options[:root_ol].nil?\n options[:vehicles] = true if options[:vehicles].nil?\n options[:users] = false if options[:users].nil?\n options[:close_level] ||= 99\n options[:stop_level] ||= 99\n \n html = [[]]\n if options[:root_ol]\n pending = [:ol, :li, group, :nli, :nol]\n level = -1\n else\n pending = [:li, group, :nli]\n level = 0\n end\n \n while node = pending.shift\n case node\n when :ol\n html << []\n level += 1\n when :li\n html << []\n when :nli\n content = content_tag(:li, html.pop.join)\n html.last << content\n when :nol\n content = content_tag(:ol, html.pop.join)\n html.last << content\n level -= 1\n else\n html.last << capture(node, level, &block)\n end\n \n if !node.is_a?(Symbol) && !(node.is_a?(Device) || node.is_a?(User))\n if options[:vehicles]\n children = [:ol, (node.children + node.devices).map {|c| [:li, c, :nli]}, :nol]\n elsif options[:users]\n children = [:ol, (node.children + node.users).map {|c| [:li, c, :nli]}, :nol]\n else\n children = [:ol, node.children.map {|c| [:li, c, :nli]}, :nol]\n end\n \n pending.unshift *(children.flatten)\n end\n end\n \n concat(html.to_s)\n end", "def parse_doc(doc)\n doc.xpath('//div[@class = \"z-list\"]').each do |node|\n\n story_content = Hash.new\n\n # get an array of the all the links\n links = Array.new\n node.xpath('./a').each do |link_node|\n links.push(link_node)\n end\n # the first link is the title\n story_content[\"title\"] = links[0].content\n\n # get story id\n url_split = links[0]['href'].split('/')\n story_content['ff_id'] = url_split[url_split.length-3]\n\n # the last link is reviews link or the author link\n last_link = links[links.length-1]\n # remove the link if its a review link\n if ((last_link.content <=> \"reviews\") == 0)\n # remove it and do it again\n links.pop()\n last_link = links[links.length-1]\n end\n\n # Set the author\n author_name = last_link.content\n author_url_split = last_link['href'].split('/')\n author_ff_id = author_url_split[author_url_split.length-2]\n story_content['author'] = generate_author(author_name, author_ff_id)\n\n # get the gray section (details)\n gray = \"\"\n node.xpath('./div//div').each do |div_node|\n gray=div_node.content\n # remove the node for the summary later\n div_node.remove\n end\n\n details = gray.split(\" - \")\n\n tags = Hash.new\n # split each of those by :\n count = 1\n story_content['reviews'] = '0'\n details.each do |detail|\n detail_split = detail.split(\":\")\n # If there is nothing in the second one that it isn't a set\n if(detail_split[1] != nil)\n story_content[detail_split[0].downcase] = detail_split[1].strip\n else# we need to do something differnt\n # complete status\n if ((detail_split[0] <=> \"Complete\") == 0)\n story_content['complete'] = true\n # language\n elsif count == 2\n story_content['language'] = detail_split[0]\n # Theme\n elsif count == 3\n story_content['theme'] = detail_split[0].split(\"/\")\n end\n\n # Main Characters\n if (count == details.length)\n if (details[details.length-1] <=> \"Complete\") != 0\n # story isn't complete characters are the last one (or published)\n detail_split = detail.split(\":\")\n if !detail_split[1] # Not published there are no characters\n story_content['characters'] = detail_split[0].split(\" & \")\n end\n else\n # story is complete characters are the second to last one\n detail_split = details[details.length-2].split(\":\")\n if !detail_split[1] # Not published there are no characters\n story_content['characters'] = details[details.length-2].split(\" & \")\n end\n end\n end\n\n # defaulting to false if complete isn't set\n if story_content['complete'] != true\n story_content['complete'] = false\n end\n end\n count+=1\n end\n\n # get the summary\n node.xpath('./div').each do |summary_node|\n story_content['summary'] = summary_node.content\n end\n\n generate_story(story_content)\nend\n\n\n\n#\n# Stores a datastructure with the list of the current ships\n#\ndef update_ships\n # A data structure to store the ships in\n\n ships = [\n [\"Brittana\", [\"Brittany P.\", \"Santana L.\"]],\n [\"Faberry\", [\"Quinn F.\", \"Rachel B.\"]],\n [\"Flanamotta\", [\"Rory F.\", \"Sugar\"]],\n [\"Sory\", [\"Rory F.\", \"Sam E.\"]],\n [\"Seblaine\", [\"Sebastian S.\", \"Blaine A.\"]],\n [\"Santofsky\", [\"D. Karofsky\", \"Santana L.\"]],\n [\"Bartie\", [\"Brittany P.\", \"Artie A.\"]],\n [\"Tike\", [\"Mike C.\", \"Tina C.\"]],\n [\"Pezberry\", [\"Santana L.\", \"Rachel B.\"]],\n [\"Pizes\", [\"Lauren Z.\", \"Puck\"]],\n [\"St. Berry\", [\"Jesse sJ.\", \"Rachel B.\"]],\n [\"Kill\", [\"Kurt H.\", \"Will S.\"]],\n [\"Puckurt\", [\"Kurt H.\", \"Puck\"]],\n [\"Artina\", [\"Tina C.\", \"Artie A.\"]],\n [\"Partie\", [\"Puck\", \"Artie A.\"]],\n [\"Blainofskyve\", [\"Blaine A.\", \"D. Karofsky\"]],\n [\"Klaine\", [\"Kurt H.\", \"Blaine A.\"]],\n [\"Hummelberry\", [\"Kurt H.\", \"Rachel B.\"]],\n [\"Furt\", [\"Kurt H.\", \"Finn H.\"]],\n [\"Pinn\", [\"Puck\", \"Finn H.\"]],\n [\"Samcedes\", [\"Sam E.\", \"Mercedes J.\"]],\n [\"Artcedes\", [\"Artie A.\", \"Mercedes J.\"]],\n [\"Finchel\", [\"Finn H.\", \"Rachel B.\"]],\n [\"Puckleberry\", [\"Puck\", \"Rachel B.\"]],\n [\"Wemma\", [\"Will S.\", \"Emma P.\"]]\n ]\n\n ships.each do |ship_data|\n ship = Ship.find_by_name(ship_data[0])\n\n # Make sure the ship doesn't already exist\n if !ship\n\n # create a new ship\n ship = Ship.new()\n ship.name = ship_data[0]\n ship.save\n\n # For each character in the ship\n ship_characters = ship_data[1]\n generate_log(\"Generating New Ship: #{ship_data[0]} between #{ship_data[1]}\")\n ship_characters.each do |ship_character|\n character = generate_character(ship_character)\n # Save the relationship\n relationship = Relationship.new()\n relationship.ship = ship\n relationship.character = character\n relationship.save\n\n end\n else\n ship.update_attributes(:name => ship_data[0])\n ship.save\n generate_log(\"Updating: #{ship_data[0]} between #{ship_data[1]}\")\n\n\n end\n end\nend\n\n\nend", "def build_tree(arr)\n #arr.shuffle!\n arr.each do |x|\n if @root == nil\n @root = Node.new(x)\n else\n current_node = @root\n until current_node == nil\n if x < current_node.value\n parent = current_node\n direction = \"left\"\n current_node = current_node.left_child\n elsif x > current_node.value\n parent = current_node\n direction = \"right\"\n current_node = current_node.right_child\n end\n end\n if direction == \"left\"\n parent.left_child = Node.new(x)\n elsif direction == \"right\"\n parent.right_child = Node.new(x)\n end\n end\n end\n end", "def build_node(node, text)\n\t\t#node.type = :BasicNode\n\n\t\twhitespace = text.partition(\".\").first\n\t\tpure_text = text.partition(\".\").last\n\t\tnode.depth = (whitespace.length)/3 #+2?\n\n\t\t#get the category string, use it to pull a category id\n\t\tif pure_text.include?(\",\") #split by the comma if there is one\n\t\t\tcategory_name = pure_text.partition(\",\").first\n\t\t\ttitle = pure_text.partition(\",\").last\n\t\telse #default to no category\n\t\t#\tcategory_name = pure_text.partition(\" \").first\n\t\t\ttitle = pure_text\n\t\t\tcategory_name = \"\"\n\t\tend\n\n\t\t#need to make these only the categories that belong to the user\n\t\tcategory = self.categories.find_by name: category_name.downcase\n\t\tif category == nil\n\t\t\tcategory = self.categories.create(name: category_name.downcase)\n\t\tend\n\t\tnode.category = category\n\t\ttitle = title.strip\t\n\t\t\n\t\tnode.title = title\n\t\tnode.work_id = self.id\n\t\treturn node\n\tend", "def gen_tree\n new_tree = {}\n node_list = {}\n @json_tree.each do |k, v|\n if v['child_of'].nil?\n # top\n new_tree[k] = v\n node_list[k] = new_tree[k]\n else\n parent = v['child_of']\n if v['condition'] == 'and'\n node_list[parent]['and'] ||= {}\n node_list[parent]['and'][k] = v\n node_list[k] = node_list[parent]['and'][k]\n elsif v['condition'] == 'or'\n node_list[parent]['or'] ||= {}\n node_list[parent]['or'][k] = v\n node_list[k] = node_list[parent]['or'][k]\n else\n # TODO: sink?\n node_list[parent]['or'] ||= {}\n node_list[parent]['or'][k] = v\n node_list[k] = node_list[parent]['or'][k]\n end\n end\n end\n\n @json_tree_type = 'tree'\n @json_tree = new_tree\n end", "def transform(tree); end", "def build_tree(data_array)\n root = nil\n \n data_array.each do |elem|\n cur_node = root\n \n node = Node.new(elem)\n\tnode.children = Array.new(2, nil)\n\t\n\twhile !cur_node.nil?\n\t if elem < cur_node.value\n\t if cur_node.children[0].nil?\n\t\t node.parent = cur_node\n\t\t cur_node.children[0] = node\n\t\t cur_node = node\n\t\tend\n\t\tcur_node = cur_node.children[0]\n\t else\n\t if cur_node.children[1].nil?\n\t\t node.parent = cur_node\n\t\t cur_node.children[1] = node\n\t\t cur_node = node\n\t\tend\n\t\tcur_node = cur_node.children[1]\n\t end\n\tend\n\t\n\troot ||= node\n\t \n end\n \n root\nend", "def parse(tokenizer)\n @doc = REXML::Document.new\n @pos = @doc\n while node=tokenizer.next\n append(node)\n end\n end", "def navtree_build(ret, item, el, el_type = \"\")\n module_name = item[:classnames][2] ? item[:classnames][2] : item[:classnames][1];\n page_name = item[:crumb]\n\n if !ret[module_name]\n ret[module_name] = {:id => module_name, :children => Hash.new}\n #if item[:deprecated] ret[module_name][:deprecated] = true\n end\n\n if !ret[module_name][:children][page_name]\n ret[module_name][:children][page_name] = {\n :id => page_name,\n :path => item.identifier,\n :children => Hash.new\n }\n #if item[:deprecated] ret[module_name][:deprecated] = true\n end\n\n el_name = el.respond_to?(:name) ? el.name : el\n ret[module_name][:children][page_name][:children][el_name] = {\n :signature => el.respond_to?(:sass_signature) ? el.sass_signature(:none) : el,\n :el_type => el_type\n }\n\n ret\nend", "def add_nodes_r(nodes)\n cnode = self\n nodes.each do |n|\n n = Node.new(n) if n.instance_of?(String)\n x = cnode.find_child_to_update(n) \n if x then\n x.name = n.name\n x.value = n.value\n cnode = x \n else\n cnode << n\n cnode = n\n end\n end\n cnode\n end", "def tree attributes: false\n self.document.__tree attributes: attributes\n end", "def build\n reset\n visit(root, @root)\n end", "def build_hierarchy\n root = LetterNode.new(nil)\n\n # TODO: Limit word table to 50,000 highest ranking words\n\n words.each do |word|\n wl = root\n word.spelling.each_char do |letter|\n wl = wl.add(letter, word.count)\n end\n wl.word!(word.count)\n end\n\n root\n end", "def create_tree(node, elem, level, parent)\n node.level = level\n elemtype = check_type(elem[1])\n case elemtype\n when \"array\"\n node.kind = \"array\"\n node.arrsize = elem[1][\".array_size\"].to_i\n if elem[1].has_key?(\".subtype\") && elem[1][\".subtype\"].has_key?(\".members\")\n elem[1][\".subtype\"][\".members\"].each do |m|\n x = Tree.new(m[0], item_type(elem[1]), node)\n node.create_child(x)\n create_tree(x, m, level+1, node)\n end\n if elem[1][\".subtype\"].has_key?(\".type_or_id_name\")\n elem[1][\".subtype\"][\".type_or_id_name\"] =~ /\\((.+)\\): (\\w+)/\n node.s_u_name = $2.clone\n else\n node.s_u_name = \"__ANON__\"\n end\n node.basetype = node.data = elem[1][\".subtype\"][\".type\"].clone\n else\n subkind = check_type(elem[1][\".subtype\"])\n case subkind\n when \"enum\"\n node.basetype = \"enum\"\n node.data = {\".type\" => elem[1][\".subtype\"][\".type\"]}\n node.data[\".type_or_id_name\"] = elem[1][\".subtype\"][\".type_or_id_name\"]\n arr = []\n elem[1][\".subtype\"][\".values\"].each { |k,v| arr << [k,v] }\n node.data[\".values\"] = arr.clone\n node.data[\".values\"].sort! { |a,b| a[1] <=> b[1] }\n when \"numeric_ose\", \"boolean\"\n elem[1][\".subtype\"][\".type_or_id_name\"] =~ /\\((.+)\\): (\\w+)/\n node.basetype = $2.clone\n when \"native\", \"numeric_other\"\n node.basetype = \"OTHER\"\n node.data = {\".type\" => elem[1][\".subtype\"][\".type\"]}\n if elem[1][\".subtype\"].has_key?(\".signed\")\n node.data[\".signed\"] = elem[1][\".subtype\"][\".signed\"] \n end\n if elem[1][\".subtype\"].has_key?(\".type_or_id_name\")\n node.data[\".type_or_id_name\"] = elem[1][\".subtype\"][\".type_or_id_name\"]\n end\n end\n node.leaf = true\n end\n when \"struct\", \"union\"\n node.kind = elemtype\n if is_anon?(elem[1])\n node.s_u_name = \"__ANON__\"\n else\n node.s_u_name = item_name(elem[1])\n end\n elem[1][\".members\"].each do |m|\n x = Tree.new(m[0], item_type(elem[1]), node)\n node.create_child(x)\n create_tree(x, m, level+1, node)\n end\n when \"enum\"\n node.kind = \"enum\"\n node.basetype = \"enum\"\n node.s_u_name = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n arr = []\n elem[1][\".values\"].each { |k,v| arr << [k,v] }\n node.data = arr.clone\n node.data.sort! { |a,b| a[1] <=> b[1] }\n when \"numeric_ose\"\n node.kind = \"numeric\"\n node.basetype = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n when \"boolean\"\n node.kind = \"boolean\"\n node.basetype = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n when \"native\", \"numeric_other\"\n node.kind = \"numeric\"\n node.basetype = \"OTHER\"\n node.data = {'.type' => elem[1][\".type\"]}\n node.data[\".signed\"] = elem[1][\".signed\"] if elem[1].has_key?(\".signed\")\n if elem[1].has_key?(\".type_or_id_name\")\n node.data[\".type_or_id_name\"] = elem[1][\".type_or_id_name\"]\n end\n node.parent = parent\n node.leaf = true\n else\n raise \"Node #{node.name} contains erroneous data\" \n end\n end", "def build_tree(tree_size, input)\n nodes = Array.new(tree_size) { Node.new(nil, nil, nil) }\n\n tree_size.times do |i|\n line = input.next\n val, left, right = line.chomp.split.map(&:to_i)\n nodes[i].val = val\n nodes[i].left = nodes[left] unless left == -1\n nodes[i].right = nodes[right] unless right == -1\n end\n \n nodes.first\nend", "def tokens_to_tree\n\n tag_stack = [ ] # stack for element tags\n children_stack = [ ] # stack for lists of children\n children = [ ] # current list of children\n err_count = 0\n\n # Note: the text token pattern test assumes that all text tokens\n # are non-empty. This should be true, because REX doesn't create\n # empty tokens.\n\n @tokens.each_index do |i|\n token = @tokens[i]\n line_num = @line_num[i]\n tok_err = \"Error near line #{line_num}, token #{i+1} (#{token})\"\n case token\n when /\\A[^<]/ # text\n children << text_node(token)\n when /\\A<!--/ # comment\n children << comment_node(token)\n when /\\A<\\?/ # processing instruction\n children << pi_node(token)\n when /\\A<!DOCTYPE/ # DOCTYPE\n children << doctype_node(token)\n when /\\A<!\\[/ # CDATA\n children << cdata_node(token)\n when /\\A<\\// # element close tag\n if tag_stack.empty?\n warn \"#{tok_err}: Close tag w/o preceding open tag; malformed document?\\n\"\n err_count += 1\n next\n end\n if children_stack.empty?\n warn \"#{tok_err}: Empty children stack; malformed document?\\n\"\n err_count += 1\n next\n end\n tag = tag_stack.pop\n open_tag_name = extract_tag_name(tag)\n close_tag_name = extract_tag_name(token)\n if open_tag_name != close_tag_name\n warn \"#{tok_err}: Tag mismatch; malformed document?\\n\"\n warn \" open tag: #{tag}\\n\"\n warn \" close tag: #{token}\\n\"\n print_tag_stack(\"enclosing tags\", tag_stack)\n err_count += 1\n next\n end\n elt = element_node(tag, token, children)\n children = children_stack.pop\n children << elt\n else # element open tag\n # If we reach here, we're seeing the open tag for an element:\n # - If the tag is also the close tag (e.g., <abc/>), close the\n # element immediately, giving it an empty child list.\n # - Otherwise, push tag and child list on stacks, begin new child\n # list for element body.\n case token\n when /\\/>\\Z/ # tag is of form <abc/>\n children << element_node(token, \"\", [ ])\n else # tag is of form <abc>\n tag_stack << token\n children_stack << children\n children = [ ]\n end\n end\n end\n\n # At this point, the stacks should be empty if the document is\n # well-formed.\n\n if !tag_stack.empty?\n warn \"Error at EOF: Unclosed tags; malformed document?\\n\"\n print_tag_stack(\"unclosed tags\", tag_stack)\n err_count += 1\n end\n if !children_stack.empty?\n warn \"Error at EOF: Unprocessed child elements; malformed document?\\n\"\n# TODO: print out info about them\n err_count += 1\n end\n\n @tree = children\n return err_count\n end", "def generate_toc_tree(toc, type, attr); end", "def build_tree(model)\n # inflate the node id to test id wrap around edge cases\n ENV[\"NODES\"].to_i.times { model.create!.destroy } if ENV[\"NODES\"]\n\n n1 = model.create!\n n2 = model.create!(:parent => n1)\n n3 = model.create!(:parent => n2)\n n4 = model.create!(:parent => n2)\n n5 = model.create!(:parent => n1)\n n6 = model.create!(:parent => n5)\n\n puts \"create: #{n1.id}..#{n6.id}\" if ENV[\"NODES\"]\n [n1, n2, n3, n4, n5, n6]\n end", "def nodes_to_s(p_nodes, p_nodes_text=\"\")\n nodes_text = p_nodes_text\n p_nodes.each do |node|\n #set optional node attributes\n color = node[\"color\"] == nil ? \"\" : \"COLOR=\\\"#{node[\"color\"]}\\\" \"\n nodes_text << \"<node #{color}CREATED=\\\"#{node[\"created\"]}\\\" ID=\\\"#{node[\"type\"]}_#{node[\"id\"]}\\\" MODIFIED=\\\"#{node[\"modified\"]}\\\" TEXT=\\\"#{node[\"text\"]}\\\">\\n\"\n # add icons and fonts to nodes\n case node[\"type\"]\n when \"feature\"\n nodes_text << \"<font BOLD=\\\"true\\\" NAME=\\\"SansSerif\\\" SIZE=\\\"12\\\"/>\"\n when \"subdir\"\n nodes_text << \"<icon BUILTIN=\\\"folder\\\"/>\\n\"\n when \"scenario_outline\"\n nodes_text << \"<icon BUILTIN=\\\"list\\\"/>\\n\"\n when \"tag\"\n nodes_text << \"<icon BUILTIN=\\\"attach\\\"/>\\n\"\n end\n # call function recursively for sublevel nodes\n if not node[\"nodes\"].empty?\n nodes_to_s(node[\"nodes\"], nodes_text)\n end\n nodes_text << \"</node>\\n\"\n end\n return nodes_text\n end", "def build_tree(unit, node, level = 0)\r\n return nil if level > @max_depth\r\n \t\r\n unit.next_move(node.current_case).each do |next_case|\r\n next if next_case[0] < 0 || next_case[0] > 7 ||\r\n next_case[1] < 0 || next_case[1] > 7 \r\n \r\n next_node = Node.new(next_case, node)\r\n node.children << next_node\r\n\r\n build_tree(unit, next_node, level + 1)\r\n end \r\n end", "def concat(nodes); end", "def render(node = nil)\n elt = node | tree\n puts \"\\nNodes: #{elt.body.count}\"\n puts \"\\nAttributes:\"\n elt.attrs.each{ |k, v| puts(\"#{k}: #{v}\") }\n children = elt.body.select{ |i| i.is_a?(Node) }\n puts \"\\nChildren: #{children.each{ |c| render(c) }}\"\n\n\n end", "def create_tree(father,tree)\n tree.each do |name|\n n = Meta::create_class(father, name[0], name[1])\n create_tree(n, name[2])\n end\nend", "def to_node\n Nokogiri::XML::Builder.new do |xml|\n build xml\n end.doc.root\n end", "def parse_tree\n File.open(html_file, 'r') do |file|\n current = nil\n file.each_line do |line|\n line.scan(%r{(<(.*?>.*?)<(\\/.*?)>|<(.*?)>(.*))}).each do |tag|\n if !tag[3].nil? && tag[3].start_with?('/') # ending tag\n current = current.parent\n else\n node = Node.new(tag)\n if @root.nil?\n @root = node\n else\n node.parent = current\n current.childs << node\n end\n @tags << node.tag\n current = node\n current = current.parent if !tag[2].nil? && tag[2].start_with?('/')\n end\n end\n end\n end\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 build_graph(dir, graph, parent)\n return if /test|doc$/ =~ dir\n subnodes = Dir[\"#{dir}/*\"].collect do |f|\n is_dir = File.directory?(f)\n vertex = graph.add_vertex(is_dir ? DirVertex : FileVertex, {:file => f})\n build_graph(f, graph, vertex) if is_dir\n vertex\n end\n graph.connect(parent, subnodes)\nend", "def build_server_tree(tree, options= {})\n result = ''\n tree = Array.wrap tree\n opts = {\n # node and base node params\n :id => :id, # node id field\n :title => :title, # name of title fileld\n :node => nil, # node\n\n # base options\n :type => :tree, # tree type\n :root => false, # is it root node?\n :level => 0, # recursion level\n :namespace => [], # :admin\n\n # BOOST! hash\n :boost => {}\n }.merge!(options)\n\n # Basic vars\n root = opts[:root]\n node = opts[:node]\n\n # namespace prepare [Rails require]\n opts[:namespace] = Array.wrap opts[:namespace]\n\n # Module with **Render** class\n opts[:render_module] = TREE_RENDERERS[opts[:type]] unless opts[:render_module]\n\n # Define tree class\n opts[:klass] = define_class_of_elements_of(tree) unless opts[:klass]\n\n # BOOST PATCH (BUILD ONCE)\n # solution of main perfomance problem\n # magick index-hash, which made me happy!\n\n # Performance comparison\n # Boost OFF: 8000 nodes, 3 levels => (Views: 176281.9ms | ActiveRecord: 189.8ms)\n # Boost ON: 8000 nodes, 3 levels => (Views: 8987.8ms | ActiveRecord: 141.6ms)\n\n if opts[:boost].empty?\n tree.each do |item|\n num = item.parent_id || -1\n opts[:boost][num.to_s] = [] unless opts[:boost][num.to_s]\n opts[:boost][num.to_s].push item\n end\n end\n\n unless node\n # RENDER ROOTS\n roots = opts[:boost]['-1']\n\n # Boost OFF\n # roots = tree.select{ |node| node.parent_id.blank? }\n\n # define roots, if it's need\n if roots.nil? && !tree.empty?\n # Looks like the new algo really does what we need (28 sept. 2016)\n # Thanks to: https://github.com/patrick-nits\n #\n ids = tree.map(&:id)\n opt_ids = opts[:boost].keys.map(&:to_i)\n candidate_ids = (ids + opt_ids).uniq - (ids & opt_ids) # xor\n roots = candidate_ids.map {|c| opts[:boost][c.to_s]}.compact.flatten\n end\n\n # children rendering\n if roots\n roots.each do |root|\n _opts = opts.merge({ :node => root, :root => true, :level => opts[:level].next, :boost => opts[:boost] })\n result << build_server_tree(tree, _opts)\n end\n end\n else\n # RENDER NODE'S CHILDREN\n children_res = ''\n children = opts[:boost][node.id.to_s]\n\n # Boost OFF\n # children = tree.select{ |_node| _node.parent_id == node.id }\n\n opts.merge!({ :has_children => children.blank? })\n\n unless children.nil?\n children.each do |elem|\n _opts = opts.merge({ :node => elem, :root => false, :level => opts[:level].next, :boost => opts[:boost] })\n children_res << build_server_tree(tree, _opts)\n end\n end\n\n result << build_tree_html(self, opts[:render_module], opts.merge({ :root => root, :node => node, :children => children_res }))\n end\n\n raw result\n end", "def set_links(text)\n \tchunks = text.split(\",\")\n new_nodes = []\n\n \tchunks.each do |chunk|\n #perhaps have this find all of them\n \t\tchild_node = Node.find_by(title: chunk.strip, work_id:self.work)\n\n if child_node == nil #if the child doesn't exist, create it at the very end\n place = self.work.get_ordering.length\n self.work.add_new_element([place], [\".,\"+chunk])\n child_node = self.work.get_element_in_ordering(place, self.work.get_ordering)\n new_nodes << child_node\n end\n \n link = self.links.build\n #if it has a parent, give the link that parent. otherwise, set it to nil\n if self.node != nil\n link.parent_id = self.node.id\n else\n link.parent_id = nil\n end\n link.work = self.work\n link.child = child_node\n \tlink.save\n\t end\n\n return new_nodes\n end", "def reset\r\n super\r\n @rootNode = @currentNode = Document.new\r\n end", "def index\n @nodes = Node.find(:all,:order => :lft)\n \n @node_list = []\n 0.upto(@nodes.size-1) do |i|\n node = @nodes[i]\n links = []\n if i > 0\n \tprev_node = @nodes[i-1]\n \tif prev_node.level == node.level\n links << {:link_type=> :arrow_right, :to => 'child_of', :dest_id => prev_node}\n \tend\n \tif prev_node.level < node.level\n links << {:link_type=> :arrow_left, :to => 'right_of', :dest_id => prev_node}\n \tend\n links << {:link_type=> :arrow_up, :to => 'left_of', :dest_id => prev_node}\n end\n if i < @nodes.size-1\n (i+1).upto(@nodes.size-1) do |n|\n if @nodes[n].level <= node.level\n links << {:link_type=> :arrow_down, :to => 'right_of', :dest_id => @nodes[n]}\n break\n end\n end\n end\n @node_list << [node,links]\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end", "def expand_current(nodes, klass)\n nodes.each {|node| node.old_parent = node.parent }\n list = klass.new(nodes)\n list.parent = self\n @nodes[@pos] = list\n end", "def create_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.resource(\"xmlns\" => \"http://datacite.org/schema/kernel-2.2\", \"xmlns:xsi\" =>\"http://www.w3.org/2001/XMLSchema-instance\", \"xsi:schemaLocation\" => \"http://datacite.org/schema/kernel-2.2 http://schema.datacite.org/meta/kernel-2.2/metadata.xsd\") {\n xml.identifier(:identifierType => \"DOI\"){ xml.text doi.sub(\"doi:\", \"\") }\n xml.creators{\n xml.creator{\n xml.creatorName creator\n xml.nameIdentifier(:nameIdentifierScheme => \"ISNI\") { xml.text name_id }\n }\n }\n xml.titles{\n xml.title title\n xml.title(:titleType => \"Subtitle\") { xml.text subtitle}\n }\n xml.publisher publisher\n xml.publicationYear publicationyear\n xml.subjects{\n xml.subject subject\n }\n xml.contributors{\n xml.contributor(:contributorType => \"DataManager\"){\n xml.contributorName contributor\n }\n }\n xml.dates{\n xml.date(:dateType => \"Valid\"){ xml.text created_date }\n xml.date(:dateType => \"Accepted\"){ xml.text accepted_date }\n }\n xml.language lang\n xml.resourceType(:resourceTypeGeneral => \"Image\"){ xml.text resource_type }\n xml.sizes{\n xml.size data_size\n }\n xml.formats{\n xml.format format\n }\n xml.version version\n xml.rights rights\n xml.descriptions{\n xml.description(:descriptionType => \"Other\") { xml.text description }\n }\n }\n end\n end", "def new\n puts \"xxxxxxx NodesC a:new xxxxxxx\"\n # @node = Node.new # orig \n \n @node = Node.new\n #@node.build ==> this does not work as there is m\n #@node.node_attrbs.build\n #byebug\n end", "def nested_array_to_html(nodes)\n classes = \"depth-#{ nodes.first[:depth] }\"\n classes += \" folder-tree\" if nodes.first[:depth].zero?\n\n html = \"<ul class=\\\"#{ classes }\\\">\"\n nodes.each do |node|\n html += \"<li>\"\n\n if node[:children]\n html += '<i class=\"icon-folder-close\"></i>'\n else\n html += '<i class=\"icon-file-alt\"></i>'\n end\n\n html += \"<span class=\\\"name\\\">#{ node[:name].strip }</span>\"\n unless (node[:children].nil? || node[:children].empty?)\n html += nested_array_to_html(node[:children]) \n end\n html += '</li>'\n end\n\n html += '</ul>'\n\n html\n end", "def nodesCreate\n nodes=Array.new\n @parser.getAllNodes.each do |node|\n nodes.push(Node.new(@parser.getNodeName(node), @parser.getOS(node)))\n nodes.last.interfaces=interfacesCreate(node)\n nodes.last.toInstall=listToInstall(node)\n end\n return nodes\n end", "def initialize\n @nodes = []\n end", "def get_xml_doc()\n doc = REXML::Document.new \"<top description='My Description' name='My Data Set'></top>\"\n root_node = @all_depths[0].first[1]\n doc.elements[\"top\"].add_element root_node.xml\n\n # see method below\n xml_recurse_helper(root_node)\n\n return doc\n end", "def initialize\n @nodes = []\n end", "def build_document_component(node)\n DocumentComponent.new(\n node.name.downcase,\n build_document_components_array(node.children),\n attrs_of(node)\n )\n end", "def build_document_hash\n # Generate the base version keys for the doc_hash by gobbing all files and folders in the base directory. This means that any folder in the base directory will be treated as a version when being migrated. **You must have at least one version folder**.\n Dir.glob(\"*.*.*\").each {|version| GuidesGenerator::Parser::doc_hash[version] = {};}\n\n # With the version added to the base level of the `doc_hash` now we recursively generate the document structure for each version.\n GuidesGenerator::Parser::doc_hash.each {|version, hash| add_files_and_sections(version, hash);} \n end", "def add_child(node_or_tags); end", "def add_child(node_or_tags); end", "def children=(node_or_tags); end", "def children=(node_or_tags); 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 process_nodes(html_nodes, properties)\n html_nodes.flat_map do |node|\n # get tags from config\n parent_tag = fetch_tag(node.parent.name) if node.parent.name\n tag = fetch_tag(node.name)\n\n # remove all text nodes if the tag doesn't accept them\n node.search('./text()').remove if drop_text?(tag)\n\n # check node hierarchy\n validate_structure(parent_tag, tag)\n\n # merge properties\n local_props = merge_node_properties(node, tag, properties)\n if tag.ast_class\n tag.ast_class.new(@env, node, local_props)\n else\n process_nodes(node.children, local_props)\n end\n end\n end" ]
[ "0.6759299", "0.61817175", "0.6109053", "0.6109053", "0.6109053", "0.6047327", "0.5995407", "0.59610176", "0.58842117", "0.58841145", "0.5881897", "0.5864456", "0.5863683", "0.5860872", "0.58446574", "0.58124137", "0.57991546", "0.57841784", "0.5776693", "0.5776693", "0.5755873", "0.5722662", "0.5717472", "0.57130915", "0.5684259", "0.56715876", "0.5653325", "0.564757", "0.564681", "0.5642941", "0.5642941", "0.56417286", "0.5632956", "0.5624616", "0.5624086", "0.5624086", "0.560434", "0.55992556", "0.55983186", "0.55874956", "0.55825645", "0.55716366", "0.5564906", "0.5557849", "0.5548138", "0.5542239", "0.55368423", "0.5528223", "0.552513", "0.55135435", "0.5512213", "0.54951614", "0.5472367", "0.5466875", "0.54658777", "0.54568636", "0.5437361", "0.54348254", "0.54316235", "0.5429388", "0.5420682", "0.54023457", "0.5400541", "0.5399897", "0.5396899", "0.53948134", "0.539294", "0.53924143", "0.53887975", "0.5375046", "0.53681636", "0.5364668", "0.53582686", "0.53490293", "0.5337384", "0.5331005", "0.53124475", "0.5299742", "0.52983624", "0.52903914", "0.529037", "0.5288918", "0.52887267", "0.5287322", "0.527687", "0.5270137", "0.5266416", "0.52654237", "0.52610654", "0.525985", "0.5258618", "0.5255501", "0.52553594", "0.5247616", "0.5245961", "0.5245961", "0.5236587", "0.5236587", "0.52349246", "0.52339524" ]
0.72364736
0
< gives access to all columns of Business define the attribute accessor method
def eventable_attr_accessor(*attribute_array) attribute_array.each do |att| define_method(att) do event.send(att) end define_method("#{att}=") do |val| event.send("#{att}=",val) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_columns\n @attr_columns\n end", "def attribute_values\n # call Array#map on SQLObject::columns, call send on the instance to \n # get the value\n self.class.columns.map { |attribute| self.send(attribute) }\n end", "def define_accessors\n columns.each do |column|\n underscored_column_name = column.name.underscore\n unless respond_to?(underscored_column_name)\n self.class.send :define_method, underscored_column_name do\n @attributes[column.name.underscore]\n end\n end\n end\n end", "def attribute_values\n self.class.columns.map { |col| self.send(col) }\n end", "def attribute_values\n self.class.columns.map { |attr| self.send(attr) }\n end", "def attribute_values \n columns = self.class.columns\n columns.map { |col| self.send(col) } #=> ex. [:id, :name, :owner_id]\n end", "def get_attributes(column, column_type, klass, options); end", "def arel_attribute(column_name, table = arel_table)\n super\n end", "def attribute_values\n self.class.columns.map { |column| send(column) }\n end", "def method_missing(method_name, *args, &block)\n return super unless define_attribute_methods\n self.send(method_name, *args, &block)\n end", "def define_read_method(symbol, attr_name, column)\n\n cast_code = column.type_cast_code('v') if column\n access_code = cast_code ? \"(v=@attributes['#{attr_name}']) && #{cast_code}\" : \"@attributes['#{attr_name}']\"\n\n unless attr_name.to_s == self.primary_key.to_s\n access_code = access_code.insert(0, \"missing_attribute('#{attr_name}', caller) unless @attributes.has_key?('#{attr_name}'); \")\n end\n\n # This is the Hobo hook - add a type wrapper around the field\n # value if we have a special type defined\n if can_wrap_with_hobo_type?(symbol)\n access_code = \"val = begin; #{access_code}; end; wrapper_type = self.class.attr_type(:#{attr_name}); \" +\n \"if HoboFields.can_wrap?(wrapper_type, val); wrapper_type.new(val); else; val; end\"\n end\n\n if cache_attribute?(attr_name)\n access_code = \"@attributes_cache['#{attr_name}'] ||= begin; #{access_code}; end;\"\n end\n\n generated_attribute_methods.module_eval(\"def #{symbol}; #{access_code}; end\", __FILE__, __LINE__)\n end", "def [](column)\n @attributes[column]\n end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def get_attribute(name); end", "def get_attribute(name); end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def define_accessor\n klass.class_eval <<-ACCESSOR\n def #{@relation}\n #self.dataset.left_outer_join(#{@relation}, :id => :#{klass.primary_key_string}).limit(1)\n puts #{relation_class}\n end\n \n def #{@relation}=(value)\n end\n ACCESSOR\n end", "def table_attributes\n attributes\n end", "def method_missing(name, *args, &block)\n fn = name.to_s\n fnne = fn.gsub('=','')\n if (!self.attributes.keys.include?(fnne)) && self.connection.columns(self.class.table_name).map{|c| c.name}.include?(fnne)\n # for next time\n self.class.reset_column_information\n\n # for this time\n if self.new_record?\n self.attributes[fnne] = nil\n else\n self.attributes[fnne] = self.connection.select_all(\"select #{fnne} from #{self.class.table_name} where id = #{self.id}\")[0][fnne] rescue nil\n end\n\n return self.attributes[fnne]\n else\n super\n end\n end", "def columns; self.class.columns; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attribute(name); end", "def def_column_accessor(*columns)\n clear_setter_methods_cache\n columns, bad_columns = columns.partition{|x| /\\A[A-Za-z_][A-Za-z0-9_]*\\z/.match(x.to_s)}\n bad_columns.each{|x| def_bad_column_accessor(x)}\n im = instance_methods\n columns.each do |column|\n meth = \"#{column}=\"\n overridable_methods_module.module_eval(\"def #{column}; self[:#{column}] end\", __FILE__, __LINE__) unless im.include?(column)\n overridable_methods_module.module_eval(\"def #{meth}(v); self[:#{column}] = v end\", __FILE__, __LINE__) unless im.include?(meth)\n end\n end", "def column_for(method) #:nodoc:\n @object.column_for_attribute(method) if @object.respond_to?(:column_for_attribute)\n end", "def column_for(method) #:nodoc:\n @object.column_for_attribute(method) if @object.respond_to?(:column_for_attribute)\n end", "def def_column_accessor(*columns)\n clear_setter_methods_cache\n columns, bad_columns = columns.partition{|x| /\\A[A-Za-z_][A-Za-z0-9_]*\\z/.match(x.to_s)}\n bad_columns.each{|x| def_bad_column_accessor(x)}\n im = instance_methods.map(&:to_s)\n columns.each do |column|\n meth = \"#{column}=\"\n overridable_methods_module.module_eval(\"def #{column}; self[:#{column}] end\", __FILE__, __LINE__) unless im.include?(column.to_s)\n overridable_methods_module.module_eval(\"def #{meth}(v); self[:#{column}] = v end\", __FILE__, __LINE__) unless im.include?(meth)\n end\n end", "def attributes\n end", "def define_read_method(symbol, attr_name, column)\n cast_code = column.type_cast_code('v') if column\n access_code = cast_code ? \"(v=@attributes['#{attr_name}']) && #{cast_code}\" : \"@attributes['#{attr_name}']\"\n\n unless attr_name.to_s == self.class.primary_key.to_s\n access_code = access_code.insert(0, \"raise NoMethodError, 'missing attribute: #{attr_name}', caller unless @attributes.has_key?('#{attr_name}'); \")\n self.class.read_methods << attr_name\n end\n\n evaluate_read_method attr_name, \"def #{symbol}; #{access_code}; end\"\n end", "def column_for_attribute(name)\n name = name.to_sym\n return self.faux_columns[name] if self.faux_columns.has_key?(name)\n super\n end", "def read_attribute(attr_name)\n return unless attr_name\n\n attr_name = attr_name.to_s\n methods = self.class.generated_external_attribute_methods\n\n if methods.method_defined?(attr_name)\n if @attributes.has_key?(attr_name) || attr_name == 'id'\n methods.send(attr_name, @attributes[attr_name], @attributes, @attributes_cache, attr_name)\n end\n elsif !self.class.attribute_methods_generated?\n # If we haven't generated the caster methods yet, do that and\n # then try again\n self.class.define_attribute_methods\n read_attribute(attr_name)\n else\n # If we get here, the attribute has no associated DB column, so\n # just return it verbatim.\n @attributes[attr_name]\n end\n end", "def attributes\n [type, column_options]\n end", "def column_attrs\n attrs = {}\n\n attrs[\"Last Name\"] = :last_name\n attrs[\"First Name\"] = :first_name\n attrs[\"Email\"] = :email\n attrs[\"Institution\"] = \"try(:professional_org_lookup, 'institution')\"\n attrs[\"College\"] = \"try(:professional_org_lookup, 'college')\"\n attrs[\"Department\"] = \"try(:professional_org_lookup, 'department')\"\n attrs[\"Account Created Date\"] = \"self.created_at.try(:strftime, \\\"%D\\\")\"\n attrs[\"ID\"] = :id\n attrs[\"LDAP_UID\"] = :ldap_uid\n attrs[\"Approved/Activated?\"] = \"self.approved? ? \\\"Y\\\" : \\\"N\\\"\"\n attrs[\"Overlord?\"] = \"self.catalog_overlord? ? \\\"Y\\\" : \\\"N\\\"\"\n\n attrs\n end", "def accessor_for(attribute)\n attribute = attribute.to_sym\n\n if table.has_key?(attribute)\n attribute\n\n elsif pair = pair_for(attribute)\n pair.first\n\n else\n send_to_translation(:accessor_for, attribute)\n end\n end", "def user_column\n end", "def create_smart_attribute_methods\n denormalized_attribute_names.each do |denormalized_attribute_name|\n base_method_name = denormalized_attribute_base_name(denormalized_attribute_name)\n define_method(base_method_name) do\n if may_use_denormalized_value?(denormalized_attribute_name)\n self.send(denormalized_attribute_name)\n else\n self.send(self.class.denormalized_compute_method_name(denormalized_attribute_name))\n end\n end\n end\n end", "def define_accessors attribute_name\n define_getter attribute_name\n define_setter attribute_name\n\n self.attribute_names ||= []\n attribute_names << attribute_name.to_s\n attribute_names.uniq!\n end", "def define_attribute_method(column_name, &block)\n return if method_defined? column_name\n\n define_method(:\"#{column_name}=\") do |value|\n instance_variable_set(:\"@#{column_name}\", value)\n end\n\n define_method(:\"#{column_name}\") do\n instance_variable_get(:\"@#{column_name}\")\n end\n end", "def collection\n col_attrs = super\n col_attrs.merge(id: col_attrs[:identifier].first).merge(open_access)\n end", "def columns\n @columns\n end", "def is_attribute?; end", "def [](name)\n key = name.to_s\n if attributes.key?(key)\n attributes[key]\n elsif index = underscored_column_names.index(key)\n attributes[@columns[index].name]\n end\n end", "def real_column; end", "def attr_name\n \"#{self.proxy.column_family_name}:#{key}\"\n end", "def create_attribute_methods_on(model)\n #model.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1\n model.class_eval %(\n def self.values_for_#{attribute}\n self.bitmask_definitions[:#{attribute}].values\n end\n\n def self.values_with_bitmask_for_#{attribute}\n ret = []\n self.bitmask_definitions[:#{attribute}].values.each_with_index{|v,k| ret.push [v,k]}\n ret\n end\n )\n end", "def method_missing(method, *args, &block)\n attributes.public_send(method, *args, &block)\n end", "def api_attributes\n record.class.column_names.map(&:to_sym)\n end", "def attributes\n query[ model_name ]\n end", "def [](attr_name)\n if attr_name.class == Fixnum\n rows[attr_name]\n else\n read_attribute(attr_name) { |n| missing_attribute(n, caller) }\n end\n end", "def readable_columns\n readable_attributes.keys\n end", "def my_attribute\n @my_attribute\n end", "def read_attribute\n record.public_send(attribute)\n end", "def html_data_attributes\n data_attributes = record.class.columns.select do |column|\n column.type.in?(%i[integer boolean datetime float uuid interval]) && !column.array?\n end.map(&:name).map(&:to_sym)\n\n api_attributes & data_attributes\n end", "def attributes_from_column_definition\n # If there are dynamo fields put them in the list.\n unless self.class.dynamo_fields.empty?\n attributes = self.class.dynamo_fields.inject({}) do |attributes, column|\n attributes[column.to_s] = nil\n attributes\n end\n end\n # Add any dynamo attributes to 'normal' attributes\n self.class.columns.inject(attributes || {}) do |attributes, column|\n attributes[column.name] = column.default unless column.name == self.class.primary_key\n attributes\n end\n end", "def attributes\n end", "def attr; end", "def fe_for(column_name)\n col = @model.column_for_attribute(column_name)\n fe(col.type, col.name)\n end", "def define_attribute_methods\n return if attribute_methods_generated?\n @attributes.each_pair do |k,v|\n self.class.module_eval %Q?\n def #{k}\n read_attribute :#{k}\n end\n def #{k}=(value)\n write_attribute :#{k},value\n end\n ?\n end\n self.class.attribute_methods_generated = true\n end", "def attribute_names\n raise NotImplementedError\n end", "def [](name)\n name = name.to_sym\n super(name)\n rescue MissingAttributeError\n raise unless self.class.attribute_names.include?(name)\n end", "def def_bad_column_accessor(column)\n overridable_methods_module.module_eval do\n define_method(column){self[column]}\n define_method(\"#{column}=\"){|v| self[column] = v}\n end\n end", "def def_bad_column_accessor(column)\n overridable_methods_module.module_eval do\n define_method(column){self[column]}\n define_method(\"#{column}=\"){|v| self[column] = v}\n end\n end", "def arel_attribute\n target && target.arel_table[column, arel_table]\n end", "def column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def [](attr_name)\n attr_s = attr_name.to_s\n if interesting_for_scrooge?( attr_s )\n augment_callsite!( attr_s )\n fetch_remaining\n @scrooge_columns << attr_s\n end\n super\n end", "def method_missing(method, *args, &block)\n unless self.class.attribute_methods_generated?\n self.class.define_attribute_methods\n\n if respond_to_without_attributes?(method)\n send(method, *args, &block)\n else\n super\n end\n else\n super\n end\n end", "def method_missing(method, *args, &block)\n unless self.class.attribute_methods_generated?\n self.class.define_attribute_methods\n\n if respond_to_without_attributes?(method)\n send(method, *args, &block)\n else\n super\n end\n else\n super\n end\n end", "def column_for_attribute(name)\n self.class.columns_hash[name.to_s]\n end", "def call\n ['first_name', 'last_name', 'email'].map do |column|\n ActiveDynamic::AttributeDefinition.new(column, datatype: ActiveDynamic::DataType::String)\n end\n end", "def [](attr_name)\n if self.attribute_names.include?(attr_name)\n read_attribute(attr_name)\n else\n get_custom_attribute(attr_name)\n end\n end", "def generate_strategy_accessors\n\n attributes = []\n columns.keys.each do |column_name|\n attributes << column_name\n\n self.send(:define_attribute_methods, column_name)\n self.send(:define_method, column_name) { @strategy_hash[column_name] }\n self.send(:define_method, \"#{column_name}=\") do |value|\n send(\"#{column_name}_will_change!\") unless value == instance_variable_get(\"@_#{column_name}\")\n @strategy_hash[column_name] = value\n end\n end\n\n self.send(:define_method, :attributes) do\n Hash[attributes.map { |name, _| [name, send(name)] }]\n end\n end", "def column_for_attribute(name)\n if self.class._has_virtual_column?(name)\n return VirtualColumnWrapper.new(singleton_class._virtual_column(name))\n else\n super\n end\n end", "def getX\n\t\t\[email protected](@columnName)\n\t\tend", "def method_missing(method_name, *args, &block)\n attributes.send(method_name.to_s, *args, &block)\n end" ]
[ "0.73409235", "0.7117606", "0.7098941", "0.6887798", "0.68810153", "0.68259585", "0.6808558", "0.6766901", "0.6765925", "0.6759795", "0.6680784", "0.667382", "0.662865", "0.662865", "0.662865", "0.662865", "0.662865", "0.662865", "0.662865", "0.6557244", "0.6557244", "0.6549137", "0.6549137", "0.6549137", "0.6549137", "0.6549137", "0.6549137", "0.6549137", "0.6523102", "0.6522974", "0.6519205", "0.65041983", "0.6500929", "0.6500929", "0.6500929", "0.6500929", "0.6500929", "0.6500929", "0.6500929", "0.6500929", "0.6500929", "0.6500929", "0.6500929", "0.6466102", "0.64285606", "0.64232117", "0.64232117", "0.64117646", "0.64109886", "0.6409809", "0.6402725", "0.6398029", "0.6326012", "0.6316475", "0.62914675", "0.6244438", "0.62371147", "0.6235515", "0.62325233", "0.62322444", "0.6225112", "0.62244135", "0.6215877", "0.6214631", "0.6213856", "0.6213593", "0.6212226", "0.62118536", "0.62101734", "0.620283", "0.618846", "0.6177047", "0.61765456", "0.6176199", "0.6175171", "0.61651826", "0.61563283", "0.6152154", "0.615034", "0.61285144", "0.61220086", "0.61197984", "0.61197984", "0.61128557", "0.61065453", "0.61065453", "0.61065453", "0.61065453", "0.61065453", "0.61065453", "0.61065453", "0.6105634", "0.6103391", "0.6103391", "0.6097872", "0.609675", "0.60885864", "0.6085756", "0.6084235", "0.6069535", "0.6068062" ]
0.0
-1
when create new dose we put in parameters (description, ingredient_id and ingredient) no cocktail_id as that's coming from the backend and user doesn't provide input
def dose_params params.require(:dose).permit(:description, :ingredient_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dose_params\n params.require(:dose).permit(:description, :ingredient_id, :cocktail_id)\n end", "def dose_params\n params.require(:dose).permit(:description, :cocktail_id, :ingredient_id)\n end", "def cocktail_params\n # params.require(:cocktail).permit(:name)\n params.require(:cocktail).permit(:name, doses_attributes: [:id, :description, :ingredient_id, :_destroy])\n end", "def dose_params\n params.require(:dose).permit(:description, :ingredient_id)\n end", "def create\n @dose = Dose.new(dose_params)\n # params[:cocktail_id] = params[:dose][:cocktail_id]\n # puts params\n unless params[:cocktail_id]\n params[:cocktail_id] = params[:dose][:cocktail_id]\n end\n\n # we need `cocktail_id` to associate dose with corresponding cocktail\n @cocktail = Cocktail.find(params[:cocktail_id])\n\n @dose.cocktail = @cocktail\n\n if @dose.save\n redirect_to cocktail_path(@cocktail)\n else\n render :new\n end\n end", "def dose_params\n params.require(:dose).permit(:description, :amount, :ingredient_id)\n end", "def create\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal ? @meal.recipes.create(params[:recipe]) : Recipe.new(params[:recipe])\n\n #@recipe.ingredients = params[:ingredients].map {|i| \n #Ingredient.new(:item => Food.find(i.delete(:item_id)), :quantity => i[:quantity]) unless i[:item_id].blank? \n #}.compact if params[:ingredients]\n\n @recipe.tags = params[:tags].split(/,/).map { |t|\n Tag.find_or_create_by_name(t.strip.downcase)\n }.compact if params[:tags]\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe}\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cocktail = Cocktail.find(params[:cocktail_id])\n @dose = Dose.new(dose_params)\n @dose.cocktail = @cocktail\n if @dose.save\n redirect_to cocktail_path(@cocktail), notice: 'New dose was created'\n else\n render :new\n end\n end", "def cocktail_params\n params.require(:cocktail).permit(:name, :ingredients, :doses)\n end", "def create\n begin\n ActiveRecord::Base.transaction do\n @recipe = Recipe.find_or_create_by!(trusted_params)\n @ingredient = Ingredient.find_or_create_by!(ingredient: params[:recipe][:ingredient])\n\n new_ingredient_recipe = IngredientRecipe.new(\n ingredient_id: @ingredient.id,\n recipe_id: @recipe.id,\n )\n new_ingredient_recipe.save!\n \n redirect_to @recipe, notice: \"Recipe was successfully created.\"\n end\n rescue\n render :new, status: :unprocessable_entity\n end\n end", "def create\n @dis_ingredient = DisIngredient.new(dis_ingredient_params)\n\n respond_to do |format|\n if @dis_ingredient.save\n format.html { redirect_to @dis_ingredient, notice: 'Dis ingredient was successfully created.' }\n format.json { render :show, status: :created, location: @dis_ingredient }\n else\n format.html { render :new }\n format.json { render json: @dis_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_ingredient(recipe_id, ingredients)\n\t\t\t\tdestroy_ingredients = RecipeIngredient.where(recipe_id: recipe_id)\n\t\t\t\tif !destroy_ingredients.blank? \n\t\t\t\t\tdestroy_ingredients.delete_all \n\t\t\t\tend\n\t\t\t\tingredients.each do |recipe_ingredient|\n\t\t\t\t\tingredient = RecipeIngredient.new\n\t\t\t\t\tingredient.recipe_id = recipe_id\n\t\t\t\t\tingredient.ingredient = recipe_ingredient\n\t\t\t\t\tingredient.save!\n\t\t\t\tend\n\t\t\tend", "def create\n @recipe = Recipe.new(recipe_params)\n # if params[:add_ingredient]\n # @recipe.ingredients.build\n # end\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @beverage = Beverage.new(params[:beverage])\n params[:ingredient].each{|ingr|\n @beverage.ingredients << Ingredient.find_by_name(ingr)\n } unless params[:ingredient].blank?\n\n\n respond_to do |format|\n if @beverage.save\n format.html { redirect_to @beverage, notice: 'Beverage was successfully created.' }\n format.json { render json: @beverage, status: :created, location: @beverage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @beverage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recipe_ingredient = Recipe_ingredient.new(params[:recipe_ingredient])\n\n respond_to do |format|\n if @recipe_ingredient.save\n format.html { redirect_to @recipe_ingredient, notice: 'Recipe_ingredient was successfully created.' }\n format.json { render json: @recipe_ingredient, status: :created, location: @recipe_ingredient }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n if params[\"donor\"]\n @recipe = Recipe.find(params[\"donor\"]).clone_with_ingredients(params[\"recipe\"])\n @recipe.user = current_user\n\n else\n @recipe = Recipe.new(params[\"recipe\"])\n end\n\n @recipe.user = current_user\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ingredient = Ingredient.new(ingredient_params)\n\n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to edit_receipe_url(@receipe), notice: 'Ingredient was successfully created.' }\n format.json { render :show, status: :created, location: @ingredient }\n else\n format.html { render :new }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = current_user\n if params[:id]\n @recipe = Recipe.new(name: params[:name],\n description: params[:description],\n ingredients: params[:indredients],\n instructions: params[:instructions],\n servings: params[:servings],\n original_id: params[:id])\n else\n @recipe = Recipe.new(recipe_params)\n end\n user.recipes << @recipe\n if user.save\n render json: @recipe, status: :created\n else\n render json: {message: \"something went wrong\"}\n end\n end", "def create\n @recipe = Recipe.new(recipe_params)\n params[:recipe][:ingredients].each do |ingredient_id|\n next if ingredient_id.to_i == 0\n ingredient = Ingredient.find(ingredient_id.to_i)\n @recipe.ingredients << ingredient\n end\n params[:recipe][:gadgets].each do |gadget_id|\n next if gadget_id.to_i == 0\n gadget = Gadget.find(gadget_id.to_i)\n @recipe.gadgets << gadget\n end\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recipe }\n else\n format.html { render action: 'new' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recipe_ingredient = RecipeIngredient.new(recipe_ingredient_params)\n\n respond_to do |format|\n if @recipe_ingredient.save\n format.html { redirect_to @recipe_ingredient, notice: 'Recipe ingredient was successfully created.' }\n format.json { render :show, status: :created, location: @recipe_ingredient }\n else\n format.html { render :new }\n format.json { render json: @recipe_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ingredient = Ingredient.new(ingredient_params)\n @ingredient.recipe = Recipe.find(ingredient_params[:recipe])\n @ingredient.recipe.ingredients << @ingredient\n save_relations\n \n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to @ingredient.recipe, notice: 'Ingredient was successfully added.' }\n format.json { render :show, status: :created, location: @ingredient }\n else\n format.html { render :new }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recipe_ingredient = RecipeIngredient.new(params[:recipe_ingredient])\n\n respond_to do |format|\n if @recipe_ingredient.save\n format.html { redirect_to @recipe_ingredient, notice: 'Recipe ingredient was successfully created.' }\n format.json { render json: @recipe_ingredient, status: :created, location: @recipe_ingredient }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post_ingredient = @post.post_ingredients.build(post_ingredient_params)\n\n respond_to do |format|\n if @post_ingredient.save\n format.html { redirect_to post_post_ingredients_path(@post), notice: \"Post ingredient was successfully created.\" }\n format.json { render :show, status: :created, location: @post_ingredient }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ingredient_recipe = IngredientRecipe.new(ingredient_recipe_params)\n\n respond_to do |format|\n if @ingredient_recipe.save\n format.html { redirect_to @ingredient_recipe, notice: 'Ingredient recipe was successfully created.' }\n format.json { render :show, status: :created, location: @ingredient_recipe }\n else\n format.html { render :new }\n format.json { render json: @ingredient_recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ingredient = Ingredient.new(ingredient_params)\n\n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to recipes_path, notice: 'Ingredient was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @bruschettum = Bruschettum.new(params[:bruschettum])\n params[:ingredient].each{|ingr|\n @bruschettum.ingredients << Ingredient.find_by_name(ingr)\n }\n\n\n respond_to do |format|\n if @bruschettum.save\n format.html { redirect_to @bruschettum, notice: 'Bruschetta è stata creata con successo.' }\n format.json { render json: @bruschettum, status: :created, location: @bruschettum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bruschettum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ingredient = Ingredient.new(params[:ingredient])\n @ingredient.ingredient_category = @ingredient_category\n\n respond_to do |format|\n if @ingredient.save\n flash[:notice] = l(:flash_notice_ingredient_created)\n format.html { redirect_to [ @ingredient_category, Ingredient.new ] }\n format.xml { render :xml => @ingredient, :status => :created, :location => @ingredient }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ingredient.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @recipe = Recipe.new(recipe_params)\n if params['ingredients']\n params['ingredients'].each do |ingredient_name|\n @recipe.ingredients << Ingredient.find_by(name: ingredient_name)\n end\n end\n\n @recipe.save \n redirect_to recipes_path\n end", "def create\n @recipeingredient = Recipeingredient.new(recipeingredient_params)\n\n respond_to do |format|\n if @recipeingredient.save\n format.html { redirect_to @recipeingredient, notice: 'Recipeingredient was successfully created.' }\n format.json { render :show, status: :created, location: @recipeingredient }\n else\n format.html { render :new }\n format.json { render json: @recipeingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if recipe_ingredient_params[:ingredients_list]\n fill_form_from_ingredients_list\n elsif recipe_params[:url] && !ingredient_params[:product_name]\n fill_form_from_url\n else\n @recipe = Recipe.new(recipe_params)\n @recipe.country_consumption = Country.find_or_create(recipe_name_params[:country_consumption_name])\n @recipe.user = current_user\n \n if ingredient_params[:product_name]\n ingredients = ingredient_params.values.transpose.map { |s| Hash[ingredient_params.keys.zip(s)] }\n ingredients.each do |ingredient|\n weight, item_name = Ingredient.parse(ingredient[\"item_name\"])\n if ingredient[\"product_name\"].length > 0 and not ingredient[\"product_name\"] == \"None\"\n @ingredient = Ingredient.new({:weight => ingredient[\"weight\"]})\n @ingredient.description = ingredient[\"item_name\"]\n @ingredient.product = Product.find_or_create(ingredient[\"product_name\"])\n @ingredient.country_origin = Country.find_or_create(ingredient[\"country_origin_name\"])\n @recipe.ingredients << @ingredient\n \n @product_alias = ProductAlias.find_or_create(item_name)\n @product_alias.country = @recipe.country_consumption\n @product_alias.product = @ingredient.product\n if not @product_alias.save\n render :html => \"Could not save product alias\"\n return\n end\n elsif item_name.length > 0\n @product_alias = ProductAlias.find_or_create(item_name)\n @product_alias.country = @recipe.country_consumption\n @product_alias.product = Product.find_by(name: \"None\")\n if not @product_alias.save\n render :html => \"Could not save product alias\"\n return\n end\n end\n end\n end\n \n save\n end\n end", "def create\n @ingredient = Ingredient.new(params[:ingredient])\n @food = Food.find_by_name(params[:food][:name])\n @ingredient.food_id = @food.id if @food\n respond_to do |format|\n if @recipe.ingredients << @ingredient\n flash[:notice] = 'Ingredient was successfully added.'\n format.html { redirect_to recipe_url(@recipe) }\n format.js\n format.xml { head :created, :location => ingredient_url(@ingredient) }\n else\n format.html { render :action => \"new\" }\n format.js\n format.xml { render :xml => @ingredient.errors.to_xml }\n end\n end\n end", "def create\n @cooking_ingredient ||= CookingIngredient.new(params[:cooking_ingredient])\n\n respond_to do |format|\n if @cooking_ingredient.save\n format.html {\n if @cooking_recipe\n redirect_to(edit_cooking_recipe_path(@cooking_recipe), :notice => 'CookingIngredient was successfully updated.')\n else\n redirect_to(@cooking_ingredient, :notice => 'CookingIngredient was successfully updated.')\n end\n }\n format.xml { render :xml => @cooking_ingredient, :status => :created, :location => @cooking_ingredient }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cooking_ingredient.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ingredient = Ingredient.new(ingredient_params)\n\n\n if @ingredient.save\n flash[:success] = \"Ajout de l'ingredient réussi...\"\n redirect_to ingredient_path @ingredient\n else\n flash[:success] = \"Ajout de l'ingredient réussi...\"\n render :new \n end\n\n end", "def create\n ingredient = Ingredient.find_or_initialize_by(title: barbecue_ingredient_params[:ingredient][:title])\n barbecue = Barbecue.find params[:barbecue_id]\n @barbecue_ingredient = BarbecueIngredient.new(barbecue: barbecue, ingredient: ingredient, quantity: barbecue_ingredient_params[:quantity])\n\n respond_to do |format|\n if @barbecue_ingredient.save\n format.html { redirect_to @barbecue_ingredient, notice: 'Added #{@barbecue_ingredient.quantity} #{@barbecue_ingredient.ingredient.title} '}\n format.json { render :show, status: :created, location: @barbecue_ingredient }\n format.js\n else\n format.html { render :new }\n format.json { render json: @barbecue_ingredient.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n recipe_id = ingredient_params[:recipe_id]\n authorize Recipe.find(recipe_id), :update?\n parent_id = params[:parent_id]\n piece_type = params[:ingredient][:piece_type]\n piece_id = case piece_type\n when 'Loadout'\n loadout_kind = params[:ingredient][:loadout_kind]\n params[:ingredient][loadout_kind.downcase + '_id']\n when 'Character'\n params[:ingredient][:character_id]\n when 'Respawn'\n params[:ingredient][:respawn_id]\n end\n ingredient = Ingredient.create(recipe_id: recipe_id,\n piece_id: piece_id,\n piece_type: piece_type,\n parent_id: parent_id)\n redirect_back fallback_location: root_path\n end", "def create\n @ingredient = Ingredient.new(params[:ingredient])\n\n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to @ingredient, notice: 'Ingredient was successfully created.' }\n format.json { render json: @ingredient, status: :created, location: @ingredient }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def ingredient_params\n params.require(:ingredient).permit(:item_id, :qty, :recipe_id).merge({recipe_id: @recipe.id})\n end", "def ingredient_params\n params.require(:ingredient).permit(:name, :amount, :recipe_id)\n end", "def create\n @ingredient = @bar.ingredients.new(ingredient_params)\n\n respond_to do |format|\n if @ingredient.save\n format.html { render :show, notice: 'Ingredient was successfully created.' }\n format.json { render :show, status: :created, location: @ingredient }\n else\n format.html { render :new }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def ingredient_recipe_params\n params.require(:ingredient_recipe).permit(:ingredient_id, :recipe_id)\n end", "def create\n @recipe = Recipe.new(recipe_params)\n\n \n end", "def recipe_params\n params.require(:recipe).permit(:name,:description, ingredient_ids: [])\n end", "def create\n #Rails 4 forces us to use STRONG PARAMETERS to white list which submitted parameters should be accepted for security reasons. We'll do it by creating a private method down. \n @recipe = Recipe.new(recipe_params)\n #We need to insert CHEF ID as we did not define in RECIPE_PARAMS method and it is required inside white list. \n @recipe.chef = current_user\n if @recipe.save\n #To show a flash message\n flash[:success] = \"Your recipe was created successfully!\"\n redirect_to recipes_path\n else\n #If it fails, we want it to render the form again\n render :new\n end\n \n end", "def create\n @diet_ingredient_type = DietIngredientType.new(diet_ingredient_type_params)\n\n respond_to do |format|\n if @diet_ingredient_type.save\n format.html { redirect_to @diet_ingredient_type, notice: 'Diet ingredient type was successfully created.' }\n format.json { render :show, status: :created, location: @diet_ingredient_type }\n else\n format.html { render :new }\n format.json { render json: @diet_ingredient_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def recipe_params\n params.require(:recipe).permit(:user_id, :title, :image_url, :description, :cuisine_id, :category_id, :cook_time, :serving_num, :instruction, :ingredients_attributes => [:id, :recipe_id, :quantity, :unit, :item_id, :_destroy, :item_attributes => [:name]])\n end", "def create\n @recipe = Recipe.new(params[:recipe])\n #@recipe.ingrediences = Ingredience.find(@params[:ingredience_ids]) if @params[:ingredience_ids]\n respond_to do |format|\n if @recipe.save\n flash[:notice] = 'Recipe was successfully created.'\n format.html { redirect_to(@recipe) }\n format.xml { render :xml => @recipe, :status => :created, :location => @recipe }\n else\n format.html { render :action => \"new\" }\n @ingrediences = Ingredience.find(:all, :order => 'title')\n @categories = Category.find(:all, :conditions => [\"food = ?\", true])\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\t\t\trecipe = Recipe.new(recipe_params)\n\t\t\t\tingredients = params[:ingredients]\n\t\t\t\ttags = params[:tags]\n\t\t\t\t\n\t\t\t\tif recipe.save\n\t\t\t\t\tif !ingredients.blank?\n\t\t\t\t\t\tredirect_to api_v1_recipe_ingredients_url(recipe_id: recipe.id, ingredients: ingredients, tags: tags)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\trender json: {status: 'ERROR', message: 'Recipe not saved', data: recipe.errors}, status: :unprocessable_entity\n\t\t\t\tend\n\t\t\tend", "def recipe_params\n params.require(:recipe).permit(:ingredient_id,:title, :description, :ingredients, :directions, :preptime, :cooktime, :servings, :cuisine_id, :cookcategory_id, :user_id, :picture, ingredient_recipes_attributes: [:id,:amount, :measurement_unit])\n end", "def create\n recipeIngredient = rRcipeIngredient.create(recipeIngredient_params)\n render json: recipeIngredient\n end", "def create\n @recipe = Recipe.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n count = 1\n complete_directions = \"\"\n params[\"directions\"].each do |direction|\n complete_directions += direction + \"\\n\"\n count += 1\n end\n @recipe.directions = complete_directions\n params[\"ingredients\"].each_with_index do |ingredient, index|\n found = false\n Ingredient.all.each do |db_ingredient|\n if db_ingredient.name == ingredient\n @ingredient = db_ingredient\n Recipeingredient.create({:ingredient_id => @ingredient.id, :recipe_id => @recipe.id, :amount => params[\"amounts\"][index]})\n found = true\n end\n end\n if found == false\n @ingredient = Ingredient.create({:name => ingredient})\n Recipeingredient.create({:ingredient_id => @ingredient.id, :recipe_id => @recipe.id, :amount => params[\"amounts\"][index]})\n end\n end\n Userrecipe.create({:contribution_id => @recipe.id, :user_id => current_user.id})\n if params[\"tags\"] != nil\n params[\"tags\"].each do |tag|\n @tag = Tag.find_by_name(tag)\n Recipetag.create({:recipe_id => @recipe.id,:tag_id => @tag.id})\n end\n end\n @recipe.serves = params[\"serves\"]\n @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_recipe(db,name,description,length,difficulty)\n # your code here\nend", "def create\n unless logged_in?\n render :file => 'public/401', :status => :unauthorized, :layout => false and return\n end\n\n @ingredient = Ingredient.new(ingredient_params)\n\n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to Item.find(@recipe.item_id), notice: 'Ingredient was successfully added to the recipe.' }\n format.json { render :show, status: :created, location: @ingredient }\n else\n flash.now[:error] = 'Unable to save ingredient'\n format.html { redirect_to new_recipe_ingredient_path }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def ingredient_sauce_params\n params.require(:ingredient_sauce).permit(:necessary, :sauce_id, :ingredient_id, :notes)\n end", "def barbecue_ingredient_params\n params.require(:barbecue_ingredient)\n .permit(\n :quantity,\n :barbecue_id,\n ingredient:\n [\n :id,\n :title\n ]\n )\n end", "def ingredient_params\n params.require(:ingredient).permit(:name, :description, :tags)\n end", "def recipe_params\n params.require(:recipe).permit(:name, :user_id, :vegetarian, :soy, :gluten, :dairy, :vegan, :ingredients=>{}, :gadgets=>{})\n end", "def recipe_params\n params.require(:recipe).permit(:name, :serves, :cooking_time, :difficulty, :ingredients, :procedure, :food_preference_id, :food_type_id, :cuisine_id, :photo)\n end", "def create\n @ingredient = Ingredient.new(ing_params)\n @obj = @ingredient\n if(@ingredient.save)\n flash.alert = \"Ingredient Added\"\n redirect_to new_ingredient_path\n else\n flash.now.alert = \"Form Error\"\n render 'shared/form'\n end\n end", "def create\n\n @ingredient = Ingredient.find_by_name(params[\"ingredient\"][\"name\"]) || Ingredient.new(params[\"ingredient\"])\n respond_to do |format|\n if @ingredient.save and Amount.create(params[\"amount\"].merge(:ingredient_id => @ingredient.id, :recipe_id => @recipe.id))\n flash[:notice] = 'Ingredient was successfully created.'\n format.html {render :partial => 'list_ingredients', :object => @ingredient}\n format.xml { render :xml => @ingredient, :status => :created, :location => @ingredient }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ingredient.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ingredient = Ingredient.find(params[:id])\n \n @supplier.ingredients << @ingredient\n redirect_to supplier_path(@supplier)\n end", "def create\n \n @intervention = Intervention.new\n \n \n \n author = current_user.id\n customer_id = params['customer_id']\n building_id = params['building_id']\n battery_id = params['battery_id']\n column_id = params['column_id']\n elevator_id = params['elevator_id']\n employee_id = params['Employee_name']\n description = params['Message']\n \n @intervention = Intervention.new\n \n @intervention.author = current_user.id\n @intervention.customer_id = customer_id\n @intervention.building_id = building_id\n @intervention.battery_id = battery_id\n @intervention.column_id = column_id\n @intervention.elevator_id = elevator_id\n @intervention.employee_id = employee_id\n @intervention.report = description\n @intervention.save!\n \n @intervention.intervention\n redirect_to quote_confirm_path\n \n\n end", "def create\n\n @recipe = current_user.recipes.new(params[:recipe])\n @user = current_user\n @dish = Dish.find(@recipe.dish_id)\n @winner = Recipe.where(\"dish_id = ? AND king = ?\", @recipe.dish_id, true).first\n\n respond_to do |format|\n if @recipe.save\n RecipeMailer.create_recipe(@user, @recipe, @winner, @dish).deliver\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diet_dish = DietDish.new(diet_dish_params)\n\n respond_to do |format|\n if @diet_dish.save\n format.html { redirect_to @diet_dish, notice: 'Diet dish was successfully created.' }\n format.json { render action: 'show', status: :created, location: @diet_dish }\n else\n format.html { render action: 'new' }\n format.json { render json: @diet_dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def ingredient_params\n params\n .require(:ingredient)\n .permit(:quantity, :product_id)\n .merge({receipe_id: @receipe.id})\n end", "def ingredient_params\n params.require(:ingredient).permit(:name, :category_id, :unit_item, :shrinkage, baseproducts_attributes:[:_destroy, :id, :ingredient_id, :purchase_date, :unit_weight, :total_weight, :unit_count, :total_price, :unit_price, :price_per, :ingredient_id, :vendor_id])\n end", "def create\n @expense = Expense.new(params[:expense])\n if params[:expense][:item_id].present?\n @expense.categorie_id = Item.find(params[:expense][:item_id]).categorie_id\n end\n @expense.dossier_id = params[:dossier]\n \n if params[:activite_id].present?\n @expense.activite_id = params[:activite_id]\n end\n \n @expense.save\n respond_to do |format|\n format.json { render :json => { :success => true, :message => \"Created Expense #{@expense.id}\", :data => @expense.attributes.merge(:total_ht => @expense.total, :total_ttc => @expense.total_ttc, :activite_name => @expense.activite.try(:description))}}\n end\n \n end", "def create_drug_context\n @motrin = FactoryGirl.create(:drug, name: \"Motrin\", active: true, otc: true, description: \"Helps alleviate fever and menstrual cramps\")\n @ibuprofen = FactoryGirl.create(:drug, name: \"Ibuprofen\", active: true, otc: true, description: \"Used for headaches\")\n @advil = FactoryGirl.create(:drug, name: \"Advil\", active: true, otc: true)\n @antihistamine = FactoryGirl.create(:drug, name: \"Antihistamine\", active: false, otc: false, description: \"Used for allergies and sinuses\")\n end", "def create\n name = @view.ask_user_for_info(\"name\")\n description = @view.ask_user_for_info(\"description\")\n prep_time = @view.ask_user_for_attribute(\"prep_time\")\n difficulty = @view.ask_user_for_attribute(\"difficulty\")\n recipe = Recipe.new(name: name, description: description, prep_time: prep_time, difficulty: difficulty)\n @cookbook.add_recipe(recipe)\n end", "def add_ingredients\n rid = params['id']\n name = params['name']\n quant = params['quantity']\n meas = params['measurement']\n\n ingredients = {\n 'name' => name,\n 'quantity' => quant,\n 'measurement' => meas,\n }\n\n if Aws.save_ingredient_to_db(rid, ingredients)\n msg = {:notice => \"Ingredient created!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while creating ingredient!\"}\n render :json => msg\n end\n end", "def recipe_params\n params.require(:recipe).permit(:name, :summary, :description, :picture, style_ids: [], ingredient_ids: [])\n end", "def create\n @recipe = Recipe.find(params[:recipe_id])\n @food = Food.find(params[:food_id])\n @compound = Compound.new\n @compound.food = @food\n @compound.recipe_id = params[:recipe_id]\n @compound.grams = 100\n\n respond_to do |format|\n if @compound.save\n format.html { redirect_to subcategory_foods_path(@food.subcategory),\n notice: 'Compuesto añadido a la receta actual. acceda al menú para finalizar la creación de la receta.' }\n format.json { render :show, status: :created, location: @compound }\n else\n format.html { render :new }\n format.json { render json: @compound.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ingredient = Ingredient.new(params[:ingredient])\n\n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to(@ingredient, :notice => 'Ingredient was successfully created.') }\n format.xml { render :xml => @ingredient, :status => :created, :location => @ingredient }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ingredient.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @diet = Diet.new(diet_params)\n\n respond_to do |format|\n if @diet.save\n format.html { redirect_to @diet, notice: 'Diet was successfully created.' }\n format.json { render :show, status: :created, location: @diet }\n else\n format.html { render :new }\n format.json { render json: @diet.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_ingredient_to_recipe quantity, measure, food_item_name, recipe \n food_item = FoodItem.new(:name => food_item_name, :price => nil)\n ingredient = Ingredient.new(:food_item => food_item, :quantity => quantity, :measure => measure, :recipe_id => recipe.id)\n recipe.ingredients << ingredient\n end", "def create\n @food_recipe = FoodRecipe.new(params[:food_recipe])\n\n respond_to do |format|\n if @food_recipe.save\n format.html { redirect_to @food_recipe, notice: 'Food recipe was successfully created.' }\n format.json { render json: @food_recipe, status: :created, location: @food_recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @food_recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \t#logger.debug(\"\\n\\n\\n\\n#{dish_params.inspect}\\n\\n\\n\\n\\n\")\n \n \t#restaurant_name = dish_params.delete(\"restaurant_name\")\n \t\n \t#logger.debug(\"\\n\\n\\n\\n#{dish_params.delete(\"restaurant_name\")}\\n\\n\\n\\n\\n\")\n \n @dish = Dish.new()\n @dish.name = dish_params[:name]\n @dish.image_code = dish_params[:image_code]\n @dish.price = dish_params[:price]\n \n @dish.restaurant_id = @dish.populate_restaurant(dish_params[:restaurant_name])\n\n respond_to do |format|\n if @dish.save\n #format.html { redirect_to @dish, notice: 'Dish was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @dish }\n format.json { render :json => { \"success\" => true, \"dish\" => @dish.as_json(only: [:id]) }, status: :created }\n format.html { render :json => { \"success\" => true, \"dish\" => @dish.as_json(only: [:id]) }, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def createRecipeFromAPI(randRecipe)\n # make a recipe obj to create for our DB\n recipe = Recipe.create(title: randRecipe[\"title\"], cookbook: Cookbook.all.sample, instructions: randRecipe[\"instructions\"])\n photo = Photo.create(recipe: recipe, img_url: randRecipe[\"image\"], description: \"test photo\")\n ingredients = randRecipe[\"extendedIngredients\"].map do |ing| \n ingredient = Ingredient.find_or_create_by(name: ing[\"name\"].titlecase)\n ri = RecipeIngredient.create(recipe: recipe, ingredient: ingredient, quantity: \"#{ing[\"amount\"]} #{ing[\"unit\"]}\")\n end\nend", "def ingredient_params\n params.require(:ingredient).permit(:name, :recipe_ids => [])\n end", "def ingredient_params\n params.require(:ingredient).permit(:weight, :recipe, :description)\n end", "def addIngredient(params)\n parent_item = self.item\n ingredient_item = Item.find(params[:ingredient][:item_id])\n create_params = {\n base_item_id: params[:ingredient][:item_id],\n quantity: params[:ingredient][:quantity],\n basis_of_cost: parent_item.price_basis.to_i,\n formula_id: self.id,\n ndc_number: ingredient_item.ndc_number,\n base_cost: Ingredient.getPrice(\n {basis: parent_item.price_basis.to_i,\n quantity: params[:ingredient][:quantity],\n item_id: params[:ingredient][:item_id]\n })\n }\n Ingredient.create(create_params)\n set_unit_cost\n end", "def create\n\n @recipe = Recipe.new(recipe_params)\n @recipe.user = current_user\n\n \n\n respond_to do |format|\n if @recipe.save\n recipe_ingredient_group = @recipe.recipe_ingredient_groups.new\n recipe_ingredient_group.name = \"Main ingredients\"\n recipe_ingredient_group.save\n format.html { redirect_to @recipe, notice: \"Recipe was successfully created.\" }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @descuento_adicional = DescuentoAdicional.new(descuento_adicional_params)\n\n respond_to do |format|\n if @descuento_adicional.save\n format.html { redirect_to @descuento_adicional, notice: 'Descuento adicional was successfully created.' }\n format.json { render :show, status: :created, location: @descuento_adicional }\n else\n format.html { render :new }\n format.json { render json: @descuento_adicional.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recipes_food = RecipesFood.new(recipes_food_params)\n\n respond_to do |format|\n if @recipes_food.save\n format.html { redirect_to @recipes_food, notice: 'Recipes food was successfully created.' }\n format.json { render :show, status: :created, location: @recipes_food }\n else\n format.html { render :new }\n format.json { render json: @recipes_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def params_ingredient\n params.permit(:drink_id, :ratio, :volume_alcohol)\n end", "def create\n ingredient = Ingredient.create(ingredient_params)\n render json: ingredient\n end", "def create\n @client = Client.find_by email: current_user.email\n\n price_quote = PriceQuote.create(description: params[:description], photographer_id: params[:photographer_id], client_id: @client.id, status: :aberto)\n if price_quote\n flash[:notice] = 'Orçamento enviado'\n redirect_to :back\n end\n end", "def create\n @dosing = Dosing.new(dosing_params)\n @dosing.user_id = current_user.id\n\n respond_to do |format|\n if @dosing.save\n new_quantity = Stock.where(:user_id => current_user.id, :drug_id => @dosing.drug_id).order(\"updated_at DESC\").first.quantity_available - 1\n @stock = Stock.new(user_id: current_user.id, quantity_available: new_quantity, drug_id: @dosing.drug_id)\n @stock.save\n \n format.html { redirect_to @dosing, notice: 'Dosing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dosing }\n else\n format.html { render action: 'new' }\n format.json { render json: @dosing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recipe = Recipe.new(params[:recipe])\n @errors = process_ingredient_inputs(params, @recipe)\n @errors = [\"You must include at least one ingredient in your recipe\"] if @recipe.recipe_ingredients.empty?\n if(! @errors.empty?) then\n\t\t# reshow\n\t\[email protected]{ |msg| @recipe.errors[:base] << msg } \n\t\trespond_to do |format|\n\t\t\tformat.html { render :action => \"new\" }\n\t\tend\n\t\treturn\n\tend\n\[email protected]_by_id = @current_user.id\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to(@recipe, :notice => 'Recipe was successfully created.') }\n format.xml { render :xml => @recipe, :status => :created, :location => @recipe }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @fooddrink = Fooddrink.new(fooddrink_params)\n @fooddrink.user_id = current_user.id\n\n respond_to do |format|\n if @fooddrink.save\n format.html { redirect_to @fooddrink, notice: 'Food/Drink was successfully created.' }\n format.json { render :show, status: :created, location: @fooddrink }\n else\n format.html { render :new }\n format.json { render json: @fooddrink.errors, status: :unprocessable_entity }\n end\n end\n end", "def food_catering_params\n params.require(:food_catering).permit(:price, :additional, :food_id)\n end", "def recipe_params\n params.require(:recipe).permit(:title, :description, :image, tag_ids:[], ingredients_attributes:[:id, :name, :amount, :_destroy], directions_attributes:[:id, :step, :_destroy])\n end", "def cleanse_params\n params.require(:cleanse).permit(:name, :short_description, :long_description, :price, :ingredients, :photo)\n end", "def recipe_params\n params.require(:recipe).permit(:title,\n :description,\n :notes,\n :acknowledgements,\n :preparation_time,\n :featured_image,\n :user_id,\n :jewel_id,\n :color_scheme_id,\n :cuisine_ids => [],\n :meal_type_ids => [],\n :diet_ids => [],\n :season_ids => [],\n :occasion_ids => [],\n :pairing_ids => [],\n :box_ids => [],\n steps_attributes: [:id, :_destroy, :position, :description],\n ingredients_attributes: [:id, :_destroy, :position, :title, :amount],)\n end", "def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end", "def diet_dish_params\n params.require(:diet_dish).permit(:dish_id, :diet_id)\n end", "def create\n @recipe = current_user.recipes.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n if params[:lista].present?\n params[:lista].each do |(c,ingrediente)|\n Ingredient.create(name: ingrediente, recipe_id:@recipe.id) if ingrediente != \"\"\n end\n end\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n format.js {flash.now[:notice] = 'La receta se ha creado de forma exitosa.'} #ajax\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n format.js {flash.now[:alert] = 'Error al crear la receta.'} #ajax\n end\n end\n end", "def recipeIngredient_params\n params.require(:recipeIngredient).permit(:recipe_id, :ingredient_id, :amount_of_ingredient)\n end", "def create\n @expense = Expense.new(expense_params)\n\n respond_to do |format|\n if @expense.save\n if !params[:expense_category].blank?\n category = ExpenseCategory.find_by name: params[:expense_category]\n if !category.nil?\n @expense.update(expense_category: category)\n if params[:expense_category] == \"Diesel\"\n company = DieselCompany.find(params[:diesel_company])\n DieselExpense.create! expense: @expense, diesel_company: company, litres: @expense.quantity\n end\n end\n # cash = Cash.today.first\n # cash.update(amount_out: (cash.amount_out + @expense.amount), balance: (cash.balance - @expense.amount))\n end\n format.html { redirect_to expenses_path, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def receipe_params\n params.require(:receipe).permit(:name, :description,ingredients_attributes:[:name,:_destroy])\n end" ]
[ "0.7574941", "0.73232037", "0.7245146", "0.7237917", "0.7225594", "0.697426", "0.68656313", "0.6838586", "0.6781766", "0.6727858", "0.6709891", "0.670512", "0.6620719", "0.6545459", "0.65405416", "0.65087956", "0.6503689", "0.64813715", "0.64708596", "0.64682966", "0.64666355", "0.644182", "0.64293236", "0.6425948", "0.6416999", "0.64016956", "0.6401029", "0.6385912", "0.63802814", "0.63767034", "0.63714427", "0.63671577", "0.63637614", "0.6353026", "0.6344564", "0.6312522", "0.63057095", "0.6305648", "0.6298607", "0.6292453", "0.6286442", "0.6282364", "0.6281999", "0.6277607", "0.62745476", "0.6225851", "0.6183184", "0.61581194", "0.6153923", "0.61531335", "0.6151003", "0.6141019", "0.61382663", "0.6137984", "0.613772", "0.61215854", "0.6120203", "0.61184543", "0.6115537", "0.61120975", "0.61109954", "0.6090735", "0.6086988", "0.6080666", "0.6073856", "0.60700727", "0.60614973", "0.60594034", "0.6058727", "0.605852", "0.6053749", "0.6052679", "0.6050658", "0.6049669", "0.60489213", "0.60469764", "0.6045407", "0.60416603", "0.6039738", "0.60255164", "0.60179716", "0.60135406", "0.60114735", "0.60107154", "0.6006766", "0.6006637", "0.5982307", "0.5980989", "0.5975865", "0.5970258", "0.59679204", "0.59643716", "0.5959781", "0.5958624", "0.5952891", "0.59511894", "0.5948374", "0.59473777", "0.59465104" ]
0.72071385
6
PUT /containers/1 PUT /containers/1.json
def update @container = Container.find(params[:id]) respond_to do |format| if @container.update_attributes(params[:container]) format.html { redirect_to @container, notice: 'Container was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @container.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @container.update(container_params)\n format.html { redirect_to @container, notice: 'Container was successfully updated.' }\n format.json { render :show, status: :ok, location: @container }\n else\n format.html { render :edit }\n format.json { render json: @container.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @container = Container.get!(params[:id])\n\n respond_to do |format|\n if @container.update(params[:container])\n flash[:notice] = 'Container was successfully updated.'\n format.html { redirect_to(edit_container_url(@container.id)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @container.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @containers = args[:containers] if args.key?(:containers)\n end", "def create\n response = post_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers.json\"), params[:container].to_json, (sesh :current_token))\n json_respond response.body \n\n end", "def update\n @updated_container = params([:container])\n @container = DeployedContainer.find(params[:container][:id])\n\n nova_ip = nil\n quantum_ip = nil\n if request.headers[\"X-Auth-Token\"] != \"\"\n token = request.headers[\"X-Auth-Token\"]\n begin\n services = Donabe::KEYSTONE.get_endpoints(token)\n services[\"endpoints\"].each do |endpoint|\n if endpoint[\"name\"] == \"nova\"\n nova_ip = endpoint[\"internalURL\"]\n elsif endpoint[\"name\"] == \"quantum\"\n quantum_ip = endpoint[\"internalURL\"]\n end\n end\n rescue\n token = Storage.find(cookies[:current_token]).data\n nova_ip = Storage.find(cookies[:nova_ip]).data\n quantum_ip = Storage.find(cookies[:quantum_ip]).data\n end\n end\n\n novaIP = URI.parse(nova_ip)\n nova = Ropenstack::Nova.new(novaIP, token)\n\n quantumIP = URI.parse(quantum_ip)\n quantum = Ropenstack::Quantum.new(quantumIP, token)\n\n # Make a note of how many networks this container already has\n networks_count = @container.deployed_networks.count\n # Define an array to keep track of how many existing networks have been sent back\n existing_networks = Array.new()\n @updated_container[\"deployed_networks\"].each do |network|\n if network[\"deployStatus\"] == false\n # This is a new network. Create it and store its data\n\n else\n # This is an existing network\n existing_networks << network[\"temp_id\"]\n end\n end\n \n if existing_networks.count < networks_count\n # Some existing networks were not sent back. Delete these networks\n end \n\n # Make a note of how many VMs this container already has\n vms_count = @container.deployed_vms.count\n # Define an array to keep track of how many existing VMs have been sent back\n existing_vms = Array.new()\n @updated_container[\"deployed_vms\"].each do |vm|\n if vm[\"deployStatus\"] == false\n # This is a new VM. Create it and store its data\n v = @container.deployed_vms.build()\n ports = Array.new()\n port_list = Array.new()\n vm[\"deployed_connected_networks\"].each do |network|\n port = quantum.create_port(network[\"openstack_id\"],'',\"compute:nova\")\n ports << port[\"port\"][\"id\"]\n data = {'uuid'=>network[\"openstack_id\"]}\n port_list << data\n connected_network = v.deployed_connected_networks.build()\n connected_network.openstack_id = network[\"openstack_id\"]\n connected_network.save \n end\n else\n # This is an existing VM\n existing_vms << vm[\"temp_id\"]\n end\n end\n \n if existing_vms.count < vms_count\n # Some existing vms were not sent back. Delete these vms\n end \n \n # Make a note of how many routers this container already has\n routers_count = @container.deployed_routers.count\n # Define an array to keep track of how many existing routers have been sent back\n existing_routers = Array.new()\n @updated_container[\"deployed_routers\"].each do |router|\n if router[\"deployStatus\"] == false\n # This is a new router. Create it and store its data\n else\n # This is an existing router\n existing_routers << router[\"temp_id\"] \n end\n end\n\n if existing_routers.count < routers_count\n # Some existing routers were not sent back. Delete these routers\n end \n\n @updated_container[\"deployed_conatiners\"].each do |container|\n # Do some magic. Possibly recursive magic.\n end\n\n end", "def update!(**args)\n @container_type = args[:container_type] if args.key?(:container_type)\n @id = args[:id] if args.key?(:id)\n end", "def update\n @container = Container.find(params[:id])\n\n respond_to do |format|\n if @container.update_attributes(params[:container])\n flash[:notice] = 'Container was successfully updated.'\n format.html { redirect_to(@container) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @container.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n response = post_request(URI.parse(\"http://\"+Storage.find(cookies[:donabe_ip]).data+\"/\"+Storage.find(cookies[:current_tenant]).data+\"/containers.json\"), params[:container].to_json, Storage.find(cookies[:current_token]).data)\n json_respond response.body \n\n end", "def set_container\n @container = Container.find(params[:id])\n end", "def set_container\n @container = Container.find(params[:id])\n end", "def create params = {}, body = {}\n @connection.request(method: :post, path: build_path(\"/containers/create\", params), headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def container_params\n params.require(:container).permit(:name, :container_name, :image)\n end", "def container_params\n params.require(:container).permit(:name, :image, :command, :exposed_port, :host_port, :server_id)\n end", "def update!(**args)\n @container = args[:container] if args.key?(:container)\n @container_type = args[:container_type] if args.key?(:container_type)\n @deleted = args[:deleted] if args.key?(:deleted)\n @id = args[:id] if args.key?(:id)\n @last_updated = args[:last_updated] if args.key?(:last_updated)\n @last_updated_micros = args[:last_updated_micros] if args.key?(:last_updated_micros)\n @source_etag = args[:source_etag] if args.key?(:source_etag)\n end", "def update\n respond_to do |format|\n if @serverhascontainer.update(serverhascontainer_params)\n format.html { redirect_to @serverhascontainer, notice: 'Serverhascontainer was successfully updated.' }\n format.json { render :show, status: :ok, location: @serverhascontainer }\n else\n format.html { render :edit }\n format.json { render json: @serverhascontainer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_container_with_http_info(container_id, container_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContainersApi.update_container ...'\n end\n # verify the required parameter 'container_id' is set\n if @api_client.config.client_side_validation && container_id.nil?\n fail ArgumentError, \"Missing the required parameter 'container_id' when calling ContainersApi.update_container\"\n end\n # verify the required parameter 'container_body' is set\n if @api_client.config.client_side_validation && container_body.nil?\n fail ArgumentError, \"Missing the required parameter 'container_body' when calling ContainersApi.update_container\"\n end\n # resource path\n local_var_path = '/containers/{container_id}'.sub('{' + 'container_id' + '}', CGI.escape(container_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(container_body) \n\n # return_type\n return_type = opts[:return_type] || 'Container' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContainersApi#update_container\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @container_id = args[:container_id] if args.key?(:container_id)\n @container_type = args[:container_type] if args.key?(:container_type)\n @extended_data = args[:extended_data] if args.key?(:extended_data)\n @materialized = args[:materialized] if args.key?(:materialized)\n end", "def update\n @container_stack = ContainerStack.find(params[:id])\n\n respond_to do |format|\n if @container_stack.update_attributes(params[:container_stack])\n format.html { redirect_to @container_stack, notice: 'Container stack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @container_stack.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers/\"+params[:containerID].to_s+\"/deploy.json\"), (sesh :current_token))\n json_respond response.body\n end", "def update!(**args)\n @container_id = args[:container_id] if args.key?(:container_id)\n @permission = args[:permission] if args.key?(:permission)\n end", "def destroy\n @container = Container.find(params[:id])\n @container.destroy\n\n respond_to do |format|\n format.html { redirect_to containers_url, notice: 'Container was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def create(container_name, file_name, body = nil, args = {})\n validate_path_elements(container_name, file_name)\n\n client.request(\n method: :put,\n path: \"#{container_name}/#{file_name}\",\n expected: 201,\n params: {:body => body},\n headers: create_headers_from(args)\n )\n end", "def update!(**args)\n @container_port = args[:container_port] if args.key?(:container_port)\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n if @container_item.update(container_item_params)\n format.html {redirect_back(fallback_location: (request.referer || root_path), notice: 'Container item was successfully created.')}\n format.json { render json: @container_item, status: :ok, location: @container_item }\n else\n format.html {redirect_back(fallback_location: (request.referer || root_path), notice: 'Container item was NOT successfully updated.')}\n format.json { render json: @container_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @container = current_user.containers.build(params[:container])\n \n respond_to do |format|\n if @container.save\n flash[:notice] = 'Container was successfully created.'\n format.html { redirect_to(@container) }\n format.xml { render :xml => @container, :status => :created, :location => @container }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @container.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_chef_object(container_name, requestor, object_json)\n post(api_url(\"/#{container_name}\"), requestor, :payload => object_json)\n end", "def destroy\n @container = Container.find(params[:id])\n @container.destroy\n\n respond_to do |format|\n format.html { redirect_to(containers_url) }\n format.xml { head :ok }\n end\n end", "def create # rubocop:disable Metrics/AbcSize\n attrcheck = { 'container name' => @options[:container] }\n @validate.attrvalidate(@options, attrcheck)\n newcontainer = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n newcontainer = newcontainer.create(@options[:container])\n if newcontainer.code == '201'\n puts \"Container #{@options[:container]} created\"\n else\n @util.response_handler(newcontainer)\n end \n end", "def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def assign_containers_to_pods!(pods, containers)\n pods.each do |pod|\n pod['containers'] = containers.select do |container|\n container.key?('pod') && container['pod'] == pod['name']\n end\n end\nend", "def create\n begin\n #get the server chosen container_params[:server_id]\n @currentServer = Server.where(id: container_params[:server_id])\n Docker.url = 'tcp://' + @currentServer[0].ip + \":\" + @currentServer[0].port\n\n #create the container in docker\n if container_params[:exposed_port].blank?\n @con = Docker::Container.create(\n 'name' => container_params[:name],\n 'Image' => container_params[:image]\n ) \n else \n @con = Docker::Container.create(\n 'name' => container_params[:name],\n 'Image' => container_params[:image],\n 'ExposedPorts' => { container_params[:exposed_port]+'/tcp' => {} },\n 'HostConfig' => {\n 'PortBindings' => {\n container_params[:exposed_port]+'/tcp' => [{ 'HostPort' => container_params[:host_port] }]\n }\n }\n )\n end\n\n #adds the container into the database\n @container = Container.new(:name => container_params[:name], :image => container_params[:image], :command => container_params[:command], :exposed_port => container_params[:exposed_port], \n :host_port => container_params[:host_port], :dockercontainer_id => @con.id, :status => 'Created')\n\n Docker.url = ''\n\n respond_to do |format|\n if @container.save\n Serverhascontainer.new(:server_id => @currentServer[0].id, :container_id => @container.id).save\n format.html { redirect_to root_path, notice: 'Container was successfully created.' }\n format.json { render :show, status: :created, location: @container }\n else\n format.html { render :new }\n format.json { render json: @container.errors, status: :unprocessable_entity }\n end\n end\n\n rescue Docker::Error::ClientError => e\n respond_to do |format| \n format.html { redirect_to root_path, notice: \"Oops: #{e.message}\" }\n end\n\n rescue Docker::Error::NotFoundError => e\n respond_to do |format| \n format.html { redirect_to root_path, notice: \"Oops: #{e.message}\" }\n end\n\n rescue Docker::Error::ConflictError => e\n respond_to do |format| \n format.html { redirect_to root_path, notice: \"Oops: #{e.message}\" }\n end\n\n end\n end", "def set_container_item\n @container_item = ContainerItem.find(params[:id])\n end", "def update!(**args)\n @container_version = args[:container_version] if args.key?(:container_version)\n @container_version_header = args[:container_version_header] if args.key?(:container_version_header)\n end", "def commit(options = {})\n options.merge!('container' => self.id[0..7])\n hash = JSON.parse(connection.request(:post, '/commit', options))\n Docker::Image.send(:new, :id => hash['Id'], :connection => self.connection)\n end", "def handle_create(event)\n @bus.request 'containers', 'created', event: event.json, container: container_info(event.id)\n end", "def commit(options = {})\n options.merge!(container: self.id[0..7])\n hash = Docker::Util.parse_json(connection.post('/commit', options))\n Docker::Image.send(:new, id: hash[:id], connection: self.connection)\n end", "def update\n upload_slides(params)\n build_kiosks(params)\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @collection }\n else\n format.html { render :edit }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def put(*args)\n request :put, *args\n end", "def update\n @container_content = ContainerContent.find(params[:id])\n\n respond_to do |format|\n if @container_content.update_attributes(params[:container_content])\n format.html { redirect_to(@container_content.container, :notice => 'Container content was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @container_content.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_container(params = {})\n now = Time.now.strftime(\"%Y-%m-%dT%H:%M:%S\")\n now = now.gsub(':', '--')\n\n @slug = params.fetch(:slug, now)\n \n containers = self.get_containers\n containers.each do |c|\n return c if c.uri.to_s.match(/\\/#{@slug}\\/?$/) # check if it already exists\n end\n \n # headers = {accept: 'text/turtle', content_type: 'text/turtle', \"Slug\" => @slug, \"Link\" => '<http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"'}\n \n payload = \"\"\"@prefix ldp: <http://www.w3.org/ns/ldp#> . \n <> a ldp:Container, ldp:BasicContainer .\"\"\"\n etag = Digest::SHA2.hexdigest payload \n headers = {ETag: \"#{etag}\", accept: 'text/turtle', content_type: 'text/turtle', \"Slug\" => @slug, \"Link\" => '<http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"'}\n \n \n response = LDP::HTTPUtils::post(self.uri, headers, payload, self.client.username, self.client.password)\n if response\n newuri = response.headers[:location] \n newcont = self._add_container({:uri => newuri,\n :client => self.client,\n :parent => self,\n :top => self.toplevel_container,\n :init => true})\n unless newcont\n abort \"PROBLEM - cannot add new container with id #{newuri}. BAILING just to be safe\"\n end\n return newcont\n else\n abort \"PROBLEM - cannot create container into #{self.uri}. BAILING just to be safe\"\n end\n \n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def destroy\n @docker_instance.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def put_collection_key(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}\"\n\tputs do_the_put_call( url: api_url, user: @user, json: args[:json] )\nend", "def set_container_metadata(name, metadata, options={})\n query = { 'comp' => 'metadata'}\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n headers = service_properties_headers\n add_metadata_to_headers(metadata, headers) if metadata\n\n call(:put, container_uri(name, query), nil, headers)\n nil\n end", "def update\n @template_container = TemplateContainer.find(params[:id])\n\n respond_to do |format|\n if @template_container.update_attributes(params[:template_container])\n flash[:notice] = 'TemplateContainer was successfully updated.'\n format.html { redirect_to(@template_container) }\n format.xml { head :ok }\n format.js { render :layout => false }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @template_container.errors, :status => :unprocessable_entity }\n end\n end\n end", "def delete # rubocop:disable Metrics/AbcSize\n attrcheck = { 'container name' => @options[:container] }\n @validate.attrvalidate(@options, attrcheck)\n containerview = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n if @options[:recurse]\n contents = containerview.contents(@options[:container])\n container_contents = contents.body.split(/\\n/)\n container_contents.each do |content|\n containerview.delete_content(@options[:container], content)\n puts 'deleted ' + content\n end\n end\n containerview = containerview.delete(@options[:container])\n if containerview.code == '204'\n puts \"Container #{@options[:container]} deleted\"\n else\n @util.response_handler(containerview)\n end\n end", "def update\n respond_to do |format|\n if @docker_instance.update(docker_instance_params)\n format.html { redirect_to @docker_instance, notice: 'Docker instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @docker_instance }\n else\n format.html { render :edit }\n format.json { render json: @docker_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request(:put, *args)\n end", "def set_container_metadata(name, metadata, options={})\n # Query\n query = { 'comp' => 'metadata' }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n # Headers\n headers = StorageService.common_headers\n StorageService.add_metadata_to_headers(metadata, headers) if metadata\n\n # Call\n call(:put, container_uri(name, query), nil, headers, options)\n \n # Result\n nil\n end", "def index_containers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContainersApi.index_containers ...'\n end\n # resource path\n local_var_path = '/containers'\n\n # query parameters\n query_params = opts[: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[:'sort_by'] = @api_client.build_collection_param(opts[:'sort_by'], :pipe) if !opts[:'sort_by'].nil?\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n query_params[:'quota_total_size'] = opts[:'quota_total_size'] if !opts[:'quota_total_size'].nil?\n query_params[:'quota_on_cache'] = opts[:'quota_on_cache'] if !opts[:'quota_on_cache'].nil?\n query_params[:'stat_total_files'] = opts[:'stat_total_files'] if !opts[:'stat_total_files'].nil?\n query_params[:'stat_total_size'] = opts[:'stat_total_size'] if !opts[:'stat_total_size'].nil?\n query_params[:'stat_size_on_cache'] = opts[:'stat_size_on_cache'] if !opts[:'stat_size_on_cache'].nil?\n query_params[:'guest_right'] = opts[:'guest_right'] if !opts[:'guest_right'].nil?\n query_params[:'last_update'] = opts[:'last_update'] if !opts[:'last_update'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ContainerCollection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContainersApi#index_containers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def id\n container.id\n end", "def modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n body[\"tag\"]\n end", "def update\n @level_container = LevelContainer.find(params[:id])\n\n respond_to do |format|\n if @level_container.update_attributes(params[:level_container])\n format.html { redirect_to @level_container, notice: 'Level container was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @level_container.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def index\n @containers = Container.all\n end", "def patch_containers(containers)\n (containers || Array.new).each do |container|\n if container[\"image\"] =~ /.*velum.*/\n container[\"image\"] = \"sles12/velum:development\"\n container[\"volumeMounts\"] ||= Array.new\n container[\"volumeMounts\"] << {\n \"mountPath\" => \"/srv/velum\",\n \"name\" => \"velum-devel\"\n }\n container[\"env\"] ||= Array.new\n container[\"env\"].each do |env|\n env[\"value\"] = \"development\" if env[\"name\"] == \"RAILS_ENV\"\n end\n\n # Ensure the velum_production db is used, this is what the\n # salt mysql returner is configured to use\n container[\"env\"] << {\n \"name\" => \"VELUM_DB_NAME\",\n \"value\" => \"velum_production\"\n }\n end\n end\nend", "def update!(**args)\n @acl_choices = args[:acl_choices] if args.key?(:acl_choices)\n @additional_container_info = args[:additional_container_info] if args.key?(:additional_container_info)\n @affinity = args[:affinity] if args.key?(:affinity)\n @contact_visibility = args[:contact_visibility] if args.key?(:contact_visibility)\n @container = args[:container] if args.key?(:container)\n @container_id = args[:container_id] if args.key?(:container_id)\n @container_primary = args[:container_primary] if args.key?(:container_primary)\n @container_type = args[:container_type] if args.key?(:container_type)\n @cross_device_allowed = args[:cross_device_allowed] if args.key?(:cross_device_allowed)\n @default_acl_choice = args[:default_acl_choice] if args.key?(:default_acl_choice)\n @deprecated_contact_container_id = args[:deprecated_contact_container_id] if args.key?(:deprecated_contact_container_id)\n @edge_key = args[:edge_key] if args.key?(:edge_key)\n @edge_key_info = args[:edge_key_info] if args.key?(:edge_key_info)\n @encoded_container_id = args[:encoded_container_id] if args.key?(:encoded_container_id)\n @field_acl = args[:field_acl] if args.key?(:field_acl)\n @last_update_time = args[:last_update_time] if args.key?(:last_update_time)\n @matching_info = args[:matching_info] if args.key?(:matching_info)\n @other_deduped_containers = args[:other_deduped_containers] if args.key?(:other_deduped_containers)\n @primary = args[:primary] if args.key?(:primary)\n @product_metadata = args[:product_metadata] if args.key?(:product_metadata)\n @verified = args[:verified] if args.key?(:verified)\n @visibility = args[:visibility] if args.key?(:visibility)\n @writeable = args[:writeable] if args.key?(:writeable)\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 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 payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "def update\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+params[:name]+'\",\n \"description\" : \"'+params[:description]+'\"\n }}'\n response = RestClient::Request.new({\n method: :put,\n url: ENV['API_URL'] + '/widgets/' + params[:id],\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }\n format.json { render :show, status: :ok, location: @widget }\n else\n format.html { render :edit }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/deployed_containers/\"+params[:id].to_s+\"/destroy_deployed.json\"), (sesh :current_token))\n json_respond response.body\n\n end", "def update!(**args)\n @container_runtime = args[:container_runtime] if args.key?(:container_runtime)\n @max_pods_per_node = args[:max_pods_per_node] if args.key?(:max_pods_per_node)\n end", "def create_container_with_http_info(container_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContainersApi.create_container ...'\n end\n # verify the required parameter 'container_body' is set\n if @api_client.config.client_side_validation && container_body.nil?\n fail ArgumentError, \"Missing the required parameter 'container_body' when calling ContainersApi.create_container\"\n end\n # resource path\n local_var_path = '/containers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(container_body) \n\n # return_type\n return_type = opts[:return_type] || 'Container' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContainersApi#create_container\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_container(name, options={})\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n uri = container_uri(name, query)\n\n headers = service_properties_headers\n\n add_metadata_to_headers(options[:metadata], headers) if options[:metadata]\n\n headers['x-ms-blob-public-access'] = options[:public_access_level].to_s if options[:public_access_level]\n\n response = call(:put, uri, nil, headers)\n\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container.metadata = options[:metadata]\n container\n end", "def create_container(name, options={})\n # Query\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n # Scheme + path\n uri = container_uri(name, query)\n\n # Headers\n headers = StorageService.common_headers\n StorageService.add_metadata_to_headers(options[:metadata], headers) if options[:metadata]\n headers['x-ms-blob-public-access'] = options[:public_access_level].to_s if options[:public_access_level]\n\n # Call\n response = call(:put, uri, nil, headers, options)\n\n # result\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container.metadata = options[:metadata]\n container\n end", "def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def create\n @serverhascontainer = Serverhascontainer.new(serverhascontainer_params)\n\n respond_to do |format|\n if @serverhascontainer.save\n format.html { redirect_to @serverhascontainer, notice: 'Serverhascontainer was successfully created.' }\n format.json { render :show, status: :created, location: @serverhascontainer }\n else\n format.html { render :new }\n format.json { render json: @serverhascontainer.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(*args, &block)\n self.client.put *args\n end", "def update!(**args)\n @account_id = args[:account_id] if args.key?(:account_id)\n @container = args[:container] if args.key?(:container)\n @container_id = args[:container_id] if args.key?(:container_id)\n @container_version_id = args[:container_version_id] if args.key?(:container_version_id)\n @deleted = args[:deleted] if args.key?(:deleted)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n @folder = args[:folder] if args.key?(:folder)\n @macro = args[:macro] if args.key?(:macro)\n @name = args[:name] if args.key?(:name)\n @notes = args[:notes] if args.key?(:notes)\n @rule = args[:rule] if args.key?(:rule)\n @tag = args[:tag] if args.key?(:tag)\n @trigger = args[:trigger] if args.key?(:trigger)\n @variable = args[:variable] if args.key?(:variable)\n end", "def update\n @receipt_container = ReceiptContainer.find(params[:id])\n\n respond_to do |format|\n if @receipt_container.update_attributes(params[:receipt_container])\n format.html { redirect_to @receipt_container, notice: 'Receipt container was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @receipt_container.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_storage(request, params)\n xmldoc = XMLElement.build_xml(request.body, 'STORAGE')\n image_info = XMLElement.new(xmldoc) if xmldoc != nil\n\n image = ImageOCCI.new(\n Image.build_xml(params[:id]),\n @client)\n\n rc = nil\n if image_info['PERSISTENT'] && image_info['PUBLIC']\n error_msg = \"It is not allowed more than one change per request\"\n return OpenNebula::Error.new(error_msg), 400\n elsif image_info['PERSISTENT'] == 'YES'\n rc = image.persistent\n elsif image_info['PERSISTENT'] == 'NO'\n rc = image.nonpersistent\n elsif image_info['PUBLIC'] == 'YES'\n rc = image.publish\n elsif image_info['PUBLIC'] == 'NO'\n rc = image.unpublish\n end\n\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n # --- Prepare XML Response ---\n image.info\n return to_occi_xml(image, :code=>202)\n end", "def update\n render_json :status => :forbidden and return unless @collection.write?(@user, @client)\n if !params[:collection]\n render_json :status => :bad_request, :messages => \"Tried to update collection with no data.\" and return\n end\n @collection.update_attributes(params[:collection].slice(:metadata, :read_only, :title, :tags, :priv))\n render_json :entry => @collection.to_hash(@user, @client) and return\n end", "def destroy\n @serverhascontainer.destroy\n respond_to do |format|\n format.html { redirect_to serverhascontainers_url, notice: 'Serverhascontainer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def put\n if(resource.collection?)\n Forbidden\n elsif(!resource.parent_exists? || !resource.parent_collection?)\n Conflict\n else\n resource.lock_check if resource.supports_locking?\n status = resource.put(request, response)\n response['Location'] = \"#{scheme}://#{host}:#{port}#{url_format(resource)}\" if status == Created\n response.body = response['Location']\n status\n end\n end", "def put(*args)\n execute(:put, *args)\n end", "def update!(**args)\n @batch = args[:batch] if args.key?(:batch)\n @container_image = args[:container_image] if args.key?(:container_image)\n @vpc_network = args[:vpc_network] if args.key?(:vpc_network)\n end", "def create_container(collection, container = nil)\n active_container = container\n if active_container.nil?\n active_container = {\n \"metadata\": [\n {\n \"key\": \"dc.title\",\n \"language\": \"en_US\",\n \"value\": \"Empty Container Document\"\n },\n {\n \"key\": \"dc.contributor.author\",\n \"language\": \"en_US\",\n \"value\": \"Data Services, Bobst Library\"\n }\n ]\n }\n end\n cmd = `curl -X POST -H \"Content-Type: application/json\" -H \"Accept: application/json\" -H \"rest-dspace-token: #{@token}\" -d '#{JSON.generate(active_container)}' #{ENV[\"FDA_REST_ENDPOINT\"]}/collections/#{collection}/items --insecure -s`\n return JSON.parse(cmd)\n end", "def update_metadata(params)\n @client.put(metadata_path, nil, params, \"Content-Type\" => \"application/json\")\n end", "def update!(**args)\n @container_name = args[:container_name] if args.key?(:container_name)\n @content_language = args[:content_language] if args.key?(:content_language)\n @create_time = args[:create_time] if args.key?(:create_time)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @interactions = args[:interactions] if args.key?(:interactions)\n @keywords = args[:keywords] if args.key?(:keywords)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n @object_type = args[:object_type] if args.key?(:object_type)\n @search_quality_metadata = args[:search_quality_metadata] if args.key?(:search_quality_metadata)\n @source_repository_url = args[:source_repository_url] if args.key?(:source_repository_url)\n @title = args[:title] if args.key?(:title)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def set_new\n @container = Container.find(params[:container_id])\n @container_row = ContainerRow.new\n end", "def save_container(name, expire, **data)\n data.each do |k, v|\n @client.hset(name, k, v)\n @client.expire(name, expire)\n @logger.debug(\"Saving container: #{name} with fields #{data.keys} and expire set to #{expire}\")\n end\n @logger.debug('Container data has been saved to database')\n rescue StandardError => e\n @logger.error(\" Unable to save the to database: #{e} \")\n end", "def destroy\n @container_stack = ContainerStack.find(params[:id])\n @container_stack.destroy\n\n respond_to do |format|\n format.html { redirect_to container_stacks_url }\n format.json { head :no_content }\n end\n end", "def container_id=(value)\n @container_id = value\n end", "def create_method\n :put_json\n end", "def put endpoint, data\n do_request :put, endpoint, data\n end", "def put(request)\n error = validate(request)\n return error if error\n\n code =\n if data_store.exists?(request.rest_path)\n set_data(request, request.rest_path, request.body, :data_store_exceptions)\n 200\n else\n name = request.rest_path[4]\n data_store.create(request.rest_path[0..3], name, request.body, :create_dir)\n 201\n end\n already_json_response(code, request.body)\n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n respond_to do |format|\n name = Server.find(params[:id]).name\n n = Neography::Node.find('servers', 'name', name)\n n.name = server_params[:name]\n n.add_to_index('servers', 'name', server_params[:name]) #TODO: is this necessary?\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_object(opts)\n ctn = opts[:container_name]\n obn = opts[:object_name]\n if opts[:content].is_a?(String)\n body = StringIO.new(opts[:content])\n else\n body = opts[:content]\n end\n\n headers = opts[:headers] || {}\n if opts[:content_type].nil?\n headers['X-Detect-Content-Type'] = 'true'\n else\n headers['Content-Type'] = opts[:content_type]\n end\n if !opts[:metadata].nil?\n opts[:metadata].each do |k,v|\n headers[\"X-Object-Meta-#{k}\"] = v\n end\n end\n resp = self.execute_request(\n path: \"/#{ctn}/#{obn}\",\n method: \"PUT\",\n headers: headers,\n data: body\n )\n parse_object(resp, {'name' => obn, 'container_name' => ctn})\n resp[:object].reload if resp[:object]\n return resp\n end", "def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def set_serverhascontainer\n @serverhascontainer = Serverhascontainer.find(params[:id])\n end", "def update!(**args)\n @all_namespaces = args[:all_namespaces] if args.key?(:all_namespaces)\n @cluster_metadata = args[:cluster_metadata] if args.key?(:cluster_metadata)\n @complete_time = args[:complete_time] if args.key?(:complete_time)\n @config_backup_size_bytes = args[:config_backup_size_bytes] if args.key?(:config_backup_size_bytes)\n @contains_secrets = args[:contains_secrets] if args.key?(:contains_secrets)\n @contains_volume_data = args[:contains_volume_data] if args.key?(:contains_volume_data)\n @create_time = args[:create_time] if args.key?(:create_time)\n @delete_lock_days = args[:delete_lock_days] if args.key?(:delete_lock_days)\n @delete_lock_expire_time = args[:delete_lock_expire_time] if args.key?(:delete_lock_expire_time)\n @description = args[:description] if args.key?(:description)\n @encryption_key = args[:encryption_key] if args.key?(:encryption_key)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @manual = args[:manual] if args.key?(:manual)\n @name = args[:name] if args.key?(:name)\n @pod_count = args[:pod_count] if args.key?(:pod_count)\n @resource_count = args[:resource_count] if args.key?(:resource_count)\n @retain_days = args[:retain_days] if args.key?(:retain_days)\n @retain_expire_time = args[:retain_expire_time] if args.key?(:retain_expire_time)\n @selected_applications = args[:selected_applications] if args.key?(:selected_applications)\n @selected_namespaces = args[:selected_namespaces] if args.key?(:selected_namespaces)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n @state = args[:state] if args.key?(:state)\n @state_reason = args[:state_reason] if args.key?(:state_reason)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @volume_count = args[:volume_count] if args.key?(:volume_count)\n end", "def update!(**args)\n @container_type = args[:container_type] if args.key?(:container_type)\n @intersect_type = args[:intersect_type] if args.key?(:intersect_type)\n @remodelings = args[:remodelings] if args.key?(:remodelings)\n @same_type = args[:same_type] if args.key?(:same_type)\n @union_type = args[:union_type] if args.key?(:union_type)\n end", "def containers=(value)\n @containers = value\n end", "def assign_tenant_circles_to_an_aos_version_box(args = {}) \n body_put(\"/aosversions.json/aosversionbox/circles/#{args[:aosVersionBoxId]}\", args[:array_of_ids])\nend", "def put(path, collection)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = @media_type\n\n response = case @media_type\n when 'application/occi+json'\n self.class.post(@endpoint + path,\n :body => collection.to_json,\n :headers => headers)\n when 'text/occi'\n self.class.post(@endpoint + path,\n :headers => collection.to_header.merge(headers))\n else\n self.class.post(@endpoint + path,\n :body => collection.to_text,\n :headers => headers)\n end\n\n response_msg = response_message response\n\n case response.code\n when 200, 201\n Occi::Parser.parse(response.header[\"content-type\"].split(\";\").first, response)\n else\n raise \"HTTP POST failed! #{response_msg}\"\n end\n end" ]
[ "0.66836345", "0.65470034", "0.64823234", "0.6460558", "0.6404556", "0.6371154", "0.63334733", "0.61593586", "0.59945625", "0.59945625", "0.5972793", "0.5943352", "0.59177345", "0.5867174", "0.58667505", "0.5823491", "0.58164847", "0.5776682", "0.5775518", "0.5684361", "0.56818277", "0.5670482", "0.5639135", "0.56387705", "0.56119776", "0.55788773", "0.5556246", "0.5523758", "0.5504969", "0.5476262", "0.54561675", "0.5452639", "0.54426", "0.54387945", "0.54375523", "0.54352194", "0.53696334", "0.5361186", "0.5354021", "0.5351335", "0.53145576", "0.52969474", "0.52847016", "0.5276409", "0.52763623", "0.52589995", "0.52570593", "0.5252745", "0.52484727", "0.5240013", "0.5225026", "0.520382", "0.51859254", "0.5181679", "0.5180588", "0.5169425", "0.5167313", "0.5163536", "0.51608783", "0.5150449", "0.51344776", "0.51314956", "0.5128191", "0.51241535", "0.51135516", "0.5111298", "0.51082015", "0.50790644", "0.5076976", "0.5073113", "0.5066775", "0.5059547", "0.50593615", "0.5055703", "0.5042179", "0.5041452", "0.5040242", "0.5034194", "0.5021517", "0.5019472", "0.5018569", "0.50163144", "0.50143576", "0.50108993", "0.50092167", "0.5002759", "0.5001296", "0.49918714", "0.49905425", "0.49903998", "0.49872324", "0.49792093", "0.49790156", "0.49658775", "0.49590385", "0.4957313", "0.4955728", "0.49516228", "0.49511018", "0.4945734" ]
0.68049645
0
DELETE /containers/1 DELETE /containers/1.json
def destroy @container = Container.find(params[:id]) @container.destroy respond_to do |format| format.html { redirect_to containers_url, notice: 'Container was successfully deleted.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete # rubocop:disable Metrics/AbcSize\n attrcheck = { 'container name' => @options[:container] }\n @validate.attrvalidate(@options, attrcheck)\n containerview = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n if @options[:recurse]\n contents = containerview.contents(@options[:container])\n container_contents = contents.body.split(/\\n/)\n container_contents.each do |content|\n containerview.delete_content(@options[:container], content)\n puts 'deleted ' + content\n end\n end\n containerview = containerview.delete(@options[:container])\n if containerview.code == '204'\n puts \"Container #{@options[:container]} deleted\"\n else\n @util.response_handler(containerview)\n end\n end", "def destroy\n @container = Container.find(params[:id])\n @container.destroy\n\n respond_to do |format|\n format.html { redirect_to(containers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @docker_instance.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete(container_name, file_name)\n validate_path_elements(container_name, file_name)\n\n client.request(\n method: :delete,\n path: \"#{container_name}/#{file_name}\",\n expected: 204\n )\n end", "def destroy\n response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/deployed_containers/\"+params[:id].to_s+\"/destroy_deployed.json\"), (sesh :current_token))\n json_respond response.body\n\n end", "def destroy\n @serverhascontainer.destroy\n respond_to do |format|\n format.html { redirect_to serverhascontainers_url, notice: 'Serverhascontainer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n begin\n #finds the current server that the container is on and sets it as Docker.ulr\n #@serverid = Serverhascontainer.where(container_id: @container.id)[0].server_id;\n #@currentServer = Server.where(id: @serverid)\n #Docker.url = 'tcp://' + @currentServer[0][\"ip\"] + \":\" + @currentServer[0][\"port\"]\n Docker.url = findServer()\n\n #removes the container from docker\n Docker::Container.get(Container.find(params[:id]).dockercontainer_id).remove;\n\n #removes the Server-container relation from the database\n @d = Serverhascontainer.where(container_id: @container.id) \n Serverhascontainer.destroy(@d[0].id);\n\n #removes the container from the database\n @container.destroy\n Docker.url = ''\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'deleted.' }\n format.json { head :no_content }\n end\n\n rescue Docker::Error::ConflictError => e\n respond_to do |format| \n format.html { redirect_to root_path, notice: \"Oops: You cannot remove a running container. Stop the container before attempting removal\" }\n end\n end\n end", "def destroy\n @level_container = LevelContainer.find(params[:id])\n @level_container.destroy\n\n respond_to do |format|\n format.html { redirect_to level_containers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @container = Container.get(params[:id])\n @container.destroy if(@container && [email protected]?)\n\n respond_to do |format|\n format.html { redirect_to(container_url(@container.parent.id)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @container_item.destroy\n respond_to do |format|\n format.html { destroy_redirect @container_item, notice: 'Container item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @container_stack = ContainerStack.find(params[:id])\n @container_stack.destroy\n\n respond_to do |format|\n format.html { redirect_to container_stacks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n log_debug \"[ #{@node}/#{@environment} ] - Destroy Podman Container #{@container} ...\"\n @cmd_runner.run_cmd \"#{podman_cmd} container rm #{@container}\"\n end", "def destroy\n @container_content = ContainerContent.find(params[:id])\n container = @container_content.container\n @container_content.destroy\n\n respond_to do |format|\n format.html { redirect_to(container) }\n format.xml { head :ok }\n end\n end", "def delete_container(name, options={})\n # Query\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n # Call\n call(:delete, container_uri(name, query), nil, {}, options)\n \n # result\n nil\n end", "def destroy\n @receipt_container = ReceiptContainer.find(params[:id])\n @receipt_container.destroy\n\n respond_to do |format|\n format.html { redirect_to receipt_containers_url }\n format.json { head :no_content }\n end\n end", "def delete(key)\n log \"deleting #{key} from #{container_path}\"\n object_path = File.join(container_path, Raca::Util.url_encode(key))\n response = storage_client.delete(object_path)\n (200..299).cover?(response.code.to_i)\n end", "def destroy\n @template_container = TemplateContainer.find(params[:id])\n @template_container.destroy\n respond_to do |format|\n format.html { redirect_to(template_containers_url) }\n format.xml { head :ok }\n format.js { render :layout => false }\n end\n end", "def destroy\n @container = @container_row.container\n @container_row.destroy\n respond_to do |format|\n flash[:success] = 'Row was successfully deleted.' \n format.html { redirect_to admin_container_url(@container) }\n format.json { head :no_content }\n end\n end", "def delete_container(name, options={})\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n call(:delete, container_uri(name, query))\n nil\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end", "def destroy\n @docker_cfg.destroy\n respond_to do |format|\n format.html { redirect_to docker_cfgs_url, notice: 'Docker cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def handle_destroy(event)\n @bus.request 'containers', 'destroyed', event: event.json, container: container_info(event.id)\n end", "def destroy\n @container_navigation = ContainerNavigation.find(params[:id])\n @container_navigation.destroy\n\n respond_to do |format|\n format.html { redirect_to container_navigations_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n # The correct implementation, with garbage collection:\n # if params.has_key?(:container_id)\n # container = ActiveFedora::Base.load_instance(params[:container_id]) \n # container.file_objects_remove(params[:id])\n # FileAsset.garbage_collect(params[:id])\n # else\n \n # The dirty implementation (leaves relationship in container object, deletes regardless of whether the file object has other containers)\n ActiveFedora::Base.load_instance(params[:id]).delete \n flash[:notice] = \"Deleted #{params[:id]} from #{params[:container_id]}.\"\n \n if !params[:container_id].nil?\n redirect_params = {:controller => \"catalog\", :action => \"edit\", :id => params[:container_id], :anchor => \"file_assets\"}\n end\n redirect_params ||= {:action => 'index', :q => nil , :f => nil}\n \n redirect_to redirect_params\n \n end", "def destroy\n id = params[:id]\n @datacenter = Datacenter.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @datacenter.destroy\n\n respond_to do |format|\n format.html { redirect_to datacenters_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 delete(labels = [])\n call_container_method(:delete, labels)\n end", "def destroy\n @declaration_container.destroy\n\n respond_to do |format|\n format.html { redirect_to declaration_containers_url(:declaration_id => @declaration_container.declaration_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def prune params = {}\n @connection.post(build_path(\"/containers/prune\", params))\n end", "def destroy\n @api_post.destroy\n\n head :no_content\n end", "def delete\n svc = Service.find_by_label(params[:label])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n\n svc.destroy\n\n render :json => {}\n end", "def destroy\n @konfig = Konfig.find(params[:id])\n @konfig.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_konfigs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n response = connection.delete(\"/collections/#{id}\")\n (200..299).include?(response.status)\n end", "def clean\n # TODO: help?\n # TODO: check for unknown args\n\n # Can give the following\n # Error response from daemon: conflict: unable to delete cfc459985b4b (cannot be forced)\n # image is being used by running container a7108a524a4d\n command = \"docker images -q -f='dangling=true' | xargs docker rmi --force\"\n run command\nend", "def destroy\n dns_entry_response = RestClient.delete('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n @dns_entry.destroy\n respond_to do |format|\n format.html { redirect_to dns_entries_url, notice: \"Dns entry was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete\n if params[:id]\n result = backend_instance.compute_delete(params[:id])\n else\n result = backend_instance.compute_delete_all\n end\n\n if result\n respond_with(Occi::Collection.new)\n else\n respond_with(Occi::Collection.new, status: 304)\n end\n end", "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @shipping_container = ShippingContainer.find(params[:id])\n @shipping_container.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_shipping_containers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @page = @containers_page.page\n @containers_page.destroy\n @containers_pages = @page.containers_pages\n respond_to do |format|\n format.js\n format.html do \n flash[:success] = 'Container was successfully removed from page.' \n redirect_to containers_pages_url \n end\n format.json { head :no_content }\n end\n end", "def remove_container(name)\n render :update do |page|\n page.remove name\n end\n end", "def destroy\n @logstash = Logstash.find(params[:id])\n @logstash.destroy\n\n respond_to do |format|\n format.html { redirect_to logstashes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lifecycle = Lifecycle.find(params[:id])\n @lifecycle.destroy\n\n respond_to do |format|\n format.html { redirect_to lifecycles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chronicle.destroy\n respond_to do |format|\n format.html { redirect_to chronicles_url }\n format.json { head :no_content }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couche was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n id = @api_v1_canvas.id\n @api_v1_canvas.destroy\n respond_to do |format|\n format.html do\n redirect_to api_v1_canvases_url, notice: 'Canvas was successfully destroyed.'\n end\n\n format.json do\n msg = { id: id }\n broadcast(\"deleted\", msg)\n head :no_content\n end\n end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @database.destroy\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end", "def delete_blob(container, blob, key = nil, options = {})\n key ||= properties.key1\n\n url = File.join(properties.primary_endpoints.blob, container, blob)\n url += \"?snapshot=\" + options[:date] if options[:date]\n\n headers = build_headers(url, key, :blob, :verb => 'DELETE')\n\n response = ArmrestService.send(\n :rest_delete,\n :url => url,\n :headers => headers,\n :proxy => proxy,\n :ssl_version => ssl_version,\n :ssl_verify => ssl_verify\n )\n\n headers = Azure::Armrest::ResponseHeaders.new(response.headers)\n headers.response_code = response.code\n\n headers\n end", "def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @jumbotron.destroy\n respond_to do |format|\n format.html { redirect_to jumbotrons_url, notice: 'Jumbotron was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove\n @container.stop\n @container.delete\n end", "def destroy\n @kv.destroy\n respond_to do |format|\n format.html { redirect_to kvs_url, notice: 'Kv was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @node = Node.find_key(params[:id] || params[:name])\n @node.destroy\n respond_to do |format|\n format.html { redirect_to deployment_path(@node.deployment_id) }\n format.json { render api_delete @node }\n end\n end", "def destroy\n @client.delete( name )\n end", "def destroy\n streak, success = jsonapi_destroy.to_a\n\n if success\n render json: { meta: {} }\n else\n render_errors_for(streak)\n end\n end", "def destroy\n @admin.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end", "def destroy\n chef_rest_v1.delete(\"clients/#{@name}\")\n end", "def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @collection.destroy\n\n render json: @collection, status: :ok#, location: @collection\n end", "def cleanup\n docker.stop_container\n docker.delete_container\n end", "def destroy\n @database = Database.find(params[:id])\n if @database.started\n @database_client = RdsServer.find(@database.name)\n @database_client.destroy\n end\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :ok }\n end\n end", "def destroy\n @cloud.delete\n respond_to do |format|\n format.html { redirect_to clouds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_collection.destroy\n respond_to do |format|\n format.html { redirect_to image_collections_url, notice: 'Image collection was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cage.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @azul.destroy\n respond_to do |format|\n format.html { redirect_to azuls_url, notice: 'Azul was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @database = Database.find(params[:id])\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json {render :head => :no_content }\n end\n end", "def destroy\n @cont = Cont.find(params[:id])\n @cont.destroy\n\n respond_to do |format|\n format.html { redirect_to conts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @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 @datasource.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @cloud = Cloud.find(params[:id])\n @cloud.destroy\n\n respond_to do |format|\n format.html { redirect_to clouds_url }\n format.json { head :no_content }\n end\n end", "def delete_ingress(namespace, ingress_name)\n if namespace_exists?(namespace) && object_exists?(namespace, \"ingress\", ingress_name)\n execute(\"kubectl delete ingress #{ingress_name} -n #{namespace}\")\n end\nend", "def destroy\n @command.destroy\n respond_to do |format|\n msg = { :status => 'ok', message: 'Deleted Successfully'}\n format.json { render json: msg }\n end\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def delete(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 @data_collection = DataCollection.find(params[:id])\n @data_collection.destroy\n\n respond_to do |format|\n format.html { redirect_to data_collections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.delete(@name)\n end", "def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end", "def destroy\n @collab = Collab.find(params[:id])\n @collab.destroy\n\n respond_to do |format|\n format.html { redirect_to collabs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n\n json_response(@post)\n end", "def destroy\n @health.destroy\n respond_to do |format|\n format.html { redirect_to \"/dashboard\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @control_loop.destroy\n respond_to do |format|\n format.html { redirect_to control_loops_url, notice: 'Control loop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fabrica.destroy\n respond_to do |format|\n format.html { redirect_to fabricas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @data_center = DataCenter.find(params[:id])\n @data_center.destroy\n\n respond_to do |format|\n format.html { redirect_to data_centers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @databox.destroy\n render json: { post: @databox }\n# respond_to do |format|\n# format.html { redirect_to databoxes_url }\n# format.json { head :no_content }\n# end\n end", "def destroy\n return if @name.nil?\n delete_rest \"vservers/#{@name}\"\n end" ]
[ "0.77225286", "0.7483382", "0.733286", "0.72302747", "0.71350247", "0.7011121", "0.6998195", "0.68595165", "0.68256927", "0.68032837", "0.67667943", "0.6749357", "0.66991055", "0.6698833", "0.6677833", "0.6663417", "0.66421056", "0.66407144", "0.65907025", "0.6587319", "0.65378803", "0.64676213", "0.6463947", "0.64609975", "0.6397508", "0.6340059", "0.62859446", "0.62787765", "0.6245424", "0.6242797", "0.62417644", "0.62314713", "0.6217786", "0.6199377", "0.618587", "0.61783785", "0.617779", "0.6172896", "0.6156228", "0.6155503", "0.61441326", "0.6139558", "0.6137328", "0.6127516", "0.6126939", "0.61255056", "0.6118818", "0.6109809", "0.61097217", "0.6104722", "0.61018074", "0.6094484", "0.60854065", "0.6070131", "0.6067691", "0.6061884", "0.60585994", "0.60564065", "0.6055839", "0.604943", "0.6049026", "0.6046257", "0.6041805", "0.6036793", "0.6036109", "0.6028592", "0.60277045", "0.60135585", "0.6012471", "0.600846", "0.600846", "0.6006375", "0.59971356", "0.5996127", "0.5990309", "0.5988655", "0.59863406", "0.59829056", "0.5981976", "0.5980749", "0.598071", "0.5980595", "0.59803677", "0.59792787", "0.59778243", "0.597519", "0.5973704", "0.5967078", "0.59633183", "0.59619963", "0.5959979", "0.595396", "0.5953917", "0.59534824", "0.5952836", "0.59524745", "0.5951712", "0.59502226", "0.5950154", "0.5948221" ]
0.7655
1
checks players decks to determine type of round being played if any deck is < 3, game is killed and that player loses.
def type if (@player1.deck.cards.count < 3 || @player2.deck.cards.count < 3) if @player1.deck.cards.count < 3 @player1.has_lost?(true) else @player2.has_lost?(true) end else if @player1.deck.cards[0].rank != @player2.deck.cards[0].rank :basic elsif (@player1.deck.cards[0].rank == @player2.deck.cards[0].rank) && (@player1.deck.cards[2].rank == @player2.deck.cards[2].rank) :mutually_assured_destruction else :war end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def final_round()\n d = value(@dealer)\n puts \"--- Check Round --- \"\n puts \"Dealers' cards are #{@dealer.join(',')} for a value #{d}\"\n\n # Iterate over all players who are still in the game,\n # as in they haven't lost in the initial round doing 'hits'\n #\n # Precondition: forall p in players where p.cur_playing == false, value(p.cards) <= 21\n @players.find_all{|p| p.cur_playing}.each do |p|\n if value(p.cards) < d && d <= 21 # Dealer Wins\n puts \"Player #{p.index} has deck worth #{value p.cards}, and loses to the dealer...\"\n debit_player(p)\n elsif (value(p.cards) > d && d <= 21) || d > 21 # Player Wins\n puts \"Player #{p.index} has deck worth #{value p.cards}, and wins with the dealer...\"\n credit_player(p)\n elsif value(p.cards) == d\n puts \"Player #{p.index} has deck worth #{value p.cards}, and draws with the dealer...\"\n end\n end\n end", "def game_ended?\n @player.reveal? || @player.cards.size == 3 || @dealer.cards.size == 3\n end", "def play_game \n #initialize variables used for game\n player_name = get_name \n deck = init_deck\n player_total = 0\n dealer_total = 0\n # deal the initial cards\n player_cards = deal_cards(2, deck)\n dealer_cards = deal_cards(2, deck)\n #player plays round\n player_total = player_round(player_cards, dealer_cards, player_total, player_name, deck)\n puts \"Player round finished, player total is #{player_total}.\"\n # dealer plays round, but only if player didn't hit blackjack or go bust\n if (blackjack(player_total) != true) && (bust(player_total) != true)\n dealer_total = dealer_round(dealer_cards, dealer_total, deck)\n puts \"Dealer round finished, dealer total is #{dealer_total} and player total is #{player_total}.\"\n end\n # evaluate to see who won \n playing = evaluate(player_total, dealer_total, playing)\n if playing == \"yes\"\n play_game\n else \n puts \"Bye! Thanks for visiting the casino!\"\n exit\n end\nend", "def six_cards?(player_check)\n if (player_check.hand.length == 6) && (player_check.hand_total < 21)\n return true\n else\n return false\n end\n end", "def kick_player([email protected])\n @turn_timer = nil\n announce \"#{Bold}#{player.user}#{Bold}: You have been \" +\n \"dropped from #{DOS} ...#{REMARK.sample}\"\n if @players.length >= 3\n next_turn if player == @players.first\n debug @stock.length\n while player.cards.length > 0\n @stock.insert(rand(@stock.length), player.cards.shift)\n end\n debug @stock.length\n @dropouts << @players.delete_one(player)\n else\n # Don't dump the kicked player's cards. We\n # need those to count the winner's earnings.\n debug @stock.length\n while @players.last.cards.length > 0\n @stock.insert(rand(@stock.length), @players.last.cards.shift)\n end\n debug @stock.length\n next_turn\n end_game\n end\n end", "def pile_cards\n players = [@player1, @player2]\n if type == :basic\n players.each do |player|\n @spoils_of_war << player.deck.cards[0]\n player.deck.remove_card\n end\n elsif type == :war\n players.each do |player|\n @spoils_of_war << player.deck.cards[0..2]\n 3.times do\n player.deck.remove_card\n end\n @spoils_of_war = @spoils_of_war.flatten\n end\n elsif type == :mutually_assured_destruction\n players.each do |player|\n 3.times do\n player.deck.remove_card\n end\n end\n # replace 'No Winner' with nil so it can be tested in award_spoils\n @turn_winner = nil\n end\n end", "def playable\r\n\t\[email protected] do |x| #go through player hand\r\n\t\t\tif @attack[-1].suit == @trump.suit && x.suit == @trump.suit && x.value > @attack[-1].value\r\n\t\t\t\tx.canplay = true\r\n\t\t\telsif x.suit == @trump.suit && @attack[-1].suit != @trump.suit #player can always trump any non trump\r\n\t\t\t\tx.canplay = true\r\n\t\t\telsif x.suit == @attack[-1].suit && x.value > @attack[-1].value #player can play a higher card of the same suit\r\n\t\t\t\tx.canplay = true\r\n\t\t\telsif x.value == @attack[-1].value && @defend.count == 0\r\n\t\t\t\tx.canplay = true\r\n\t\t\telse\r\n\t\t\t\tx.canplay = false\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def getRoundResult(winning_suit, suit1, number1, suit2, number2)\n # Write your code here\n return 'Player 1 wins' if suit1 == winning_suit && suit2 != winning_suit\n return 'Player 2 wins' if suit2 == winning_suit && suit1 != winning_suit\n if (suit1 == winning_suit && suit2 == winning_suit) || (suit1 != winning_suit && suit2 != winning_suit)\n if number1 > number2\n return 'Player 1 wins'\n elsif number2 > number1\n return 'Player 2 wins'\n else\n return 'Draw'\n end\n end\nend", "def runner2\n game_on = true\n welcome\n card_total = 0\n dealer_total = 0\n dealer_total = initial_round_dealer\n card_total = initial_round\n while game_on do\n if card_total == 21 && dealer_total != 21\n end_game4(dealer_total, card_total)\n game_on = false\n elsif card_total != 21 && dealer_total == 21\n end_game2(dealer_total, card_total)\n game_on = false\n elsif card_total > 21 && dealer_total <= 21\n end_game1(dealer_total, card_total)\n game_on = false\n elsif card_total <= 21 && dealer_total > 21\n end_game3(dealer_total, card_total)\n game_on = false\n elsif card_total == 21 && dealer_total == 21\n end_game5(dealer_total, card_total)\n game_on = false\n else\n dealer_total = dealer_hits?(dealer_total)\n card_total = hit?(card_total)\n display_dealer_total(dealer_total)\n display_card_total(card_total)\n end\n end\nend", "def is_game_over?\n players.count < 2 ||\n @state == 'stop' ||\n @cards_on_table.count >= Deck.num_cards ||\n (players.map{|p| p.num_cards_remaining == Deck.num_cards}.include? true)\n end", "def deal(round)\n round_int = round.to_i\n case round_int\n when 0\n self.players.each do |player|\n move_card(get_random_card, player.location) # moves cards to users\n move_card(get_random_card, player.location)\n # player.in_hand = true\n player.save\n end\n addBlinds()\n when 1\n self.current_player = get_next_player(self.dealer)\n move_card(get_random_card, 0) #moves cards to table\n move_card(get_random_card, 0)\n move_card(get_random_card, 0)\n when 2\n self.current_player = get_next_player(self.dealer)\n move_card(get_random_card, 0)\n when 3\n self.current_player = get_next_player(self.dealer)\n move_card(get_random_card, 0)\n when 4\n get_winners()\n else\n p 'deal case > 4 or < 0, error'\n end\n\n self.players.each do |player|\n player.in_pot_current = 0\n player.save\n end\n if round_int > 0 && round_int < 4\n self.high_bet = 0\n self.high_better = self.current_player\n end\n self.save\n end", "def isOver?\n @deck.cardsRemaining < MIN_CARDS\n end", "def three_of_a_kind?\n cards_by_rank.values.first.count >= 3\n end", "def deck_options(deck_option)\n case deck_option\n when 1 \n result = []\n counter = 0\n answer1 = Question.find(1).answers[0]\n answer2 = Question.find(1).answers[1]\n answer3 = Question.find(1).answers[2]\n puts Deck.find(1).questions[0].question\n puts \"a) #{answer1.name}\"\n puts \"b) #{answer2.name}\"\n puts \"c) #{answer3.name}\"\n answer1_user = gets.chomp\n if answer1_user == \"a\"\n answer1_user = answer1\n elsif answer1_user == \"b\"\n answer1_user = answer2\n elsif answer1_user == \"c\"\n answer1_user = answer3\n end\n a = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[0].id, answer_id: answer1_user.id, correct: answer1_user.correct)\n result << a.correct\n #\n #\n answer4 = Question.find(2).answers[0]\n answer5 = Question.find(2).answers[1]\n answer6 = Question.find(2).answers[2]\n puts Deck.find(1).questions[1].question\n puts \"a) #{answer4.name}\"\n puts \"b) #{answer5.name}\"\n puts \"c) #{answer6.name}\"\n answer2_user = gets.chomp\n if answer2_user == \"a\"\n answer2_user = answer4\n elsif answer2_user == \"b\"\n answer2_user = answer5\n elsif answer2_user == \"c\"\n answer2_user = answer6\n end\n b = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[1].id, answer_id: answer2_user.id, correct: answer2_user.correct)\n result << b.correct\n #\n #\n answer7 = Question.find(3).answers[0]\n answer8 = Question.find(3).answers[1]\n answer9 = Question.find(3).answers[2]\n\n puts Deck.find(1).questions[2].question\n puts \"a) #{answer7.name}\"\n puts \"b) #{answer8.name}\"\n puts \"c) #{answer9.name}\"\n answer3_user = gets.chomp \n if answer3_user == \"a\"\n answer3_user = answer7\n elsif answer3_user == \"b\"\n answer3_user = answer8\n elsif answer3_user == \"c\"\n answer3_user = answer9\n end\n c = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[2].id, answer_id: answer3_user.id, correct: answer3_user.correct)\n result << c.correct\n #\n #\n answer10 = Question.find(4).answers[0]\n answer11 = Question.find(4).answers[1]\n answer12 = Question.find(4).answers[2]\n puts Deck.find(1).questions[3].question\n puts \"a) #{answer10.name}\"\n puts \"b) #{answer11.name}\"\n puts \"c) #{answer12.name}\"\n answer4_user = gets.chomp\n if answer4_user == \"a\"\n answer4_user = answer10\n elsif answer4_user == \"b\"\n answer4_user = answer11\n elsif answer4_user == \"c\"\n answer4_user = answer12\n end\n d = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[3].id, answer_id: answer4_user.id, correct: answer4_user.correct)\n result << d.correct\n #\n #\n answer13 = Question.find(5).answers[0]\n answer14 = Question.find(5).answers[1]\n answer15 = Question.find(5).answers[2]\n puts Deck.find(1).questions[4].question\n puts \"a) #{answer13.name}\"\n puts \"b) #{answer14.name}\"\n puts \"c) #{answer15.name}\"\n answer5_user = gets.chomp\n if answer5_user == \"a\"\n answer5_user = answer13\n elsif answer5_user == \"b\"\n answer5_user = answer14\n elsif answer5_user == \"c\"\n answer5_user = answer15\n end\n e = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[4].id, answer_id: answer5_user.id, correct: answer5_user.correct)\n result << e.correct\n #\n #\n answer16 = Question.find(6).answers[0]\n answer17 = Question.find(6).answers[1]\n answer18 = Question.find(6).answers[2]\n puts Deck.find(1).questions[5].question\n puts \"a) #{answer16.name}\"\n puts \"b) #{answer17.name}\"\n puts \"c) #{answer18.name}\"\n answer6_user = gets.chomp\n if answer6_user == \"a\"\n answer6_user = answer16\n elsif answer6_user == \"b\"\n answer6_user = answer17\n elsif answer6_user == \"c\"\n answer6_user = answer18\n end\n f = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[5].id, answer_id: answer6_user.id, correct: answer6_user.correct)\n result << f.correct\n #\n #\n answer19 = Question.find(7).answers[0]\n answer20 = Question.find(7).answers[1]\n answer21 = Question.find(7).answers[2]\n puts Deck.find(1).questions[6].question\n puts \"a) #{answer19.name}\"\n puts \"b) #{answer20.name}\"\n puts \"c) #{answer21.name}\"\n answer7_user = gets.chomp\n if answer7_user == \"a\"\n answer7_user = answer19\n elsif answer7_user == \"b\"\n answer7_user = answer20\n elsif answer7_user == \"c\"\n answer7_user = answer21\n end\n g = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[6].id, answer_id: answer7_user.id, correct: answer7_user.correct)\n result << g.correct\n #\n #\n answer22 = Question.find(8).answers[0]\n answer23 = Question.find(8).answers[1]\n answer24 = Question.find(8).answers[2]\n puts Deck.find(1).questions[7].question\n puts \"a) #{answer22.name}\"\n puts \"b) #{answer23.name}\"\n puts \"c) #{answer24.name}\"\n answer8_user = gets.chomp\n if answer8_user == \"a\"\n answer8_user = answer22\n elsif answer8_user == \"b\"\n answer8_user = answer23\n elsif answer8_user == \"c\"\n answer8_user = answer24\n end\n h = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[7].id, answer_id: answer8_user.id, correct: answer8_user.correct)\n result << h.correct\n #\n #\n answer25 = Question.find(9).answers[0]\n answer26 = Question.find(9).answers[1]\n answer27 = Question.find(9).answers[2]\n puts Deck.find(1).questions[8].question\n puts \"a) #{answer25.name}\"\n puts \"b) #{answer26.name}\"\n puts \"c) #{answer27.name}\"\n answer9_user = gets.chomp\n if answer9_user == \"a\"\n answer9_user = answer25\n elsif answer9_user == \"b\"\n answer9_user = answer26\n elsif answer9_user == \"c\"\n answer9_user = answer27\n end\n i = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[8].id, answer_id: answer9_user.id, correct: answer9_user.correct)\n result << i.correct\n #\n #\n answer28 = Question.find(10).answers[0]\n answer29 = Question.find(10).answers[1]\n answer30 = Question.find(10).answers[2]\n puts Deck.find(1).questions[9].question\n puts \"a) #{answer28.name}\"\n puts \"b) #{answer29.name}\"\n puts \"c) #{answer30.name}\"\n answer10_user = gets.chomp\n if answer10_user == \"a\"\n answer10_user = answer28\n elsif answer10_user == \"b\"\n answer10_user = answer29\n elsif answer10_user == \"c\"\n answer10_user = answer30\n end\n j = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[9].id, answer_id: answer10_user.id, correct: answer10_user.correct)\n result << j.correct\n pp Stat.where(game_id: @new_game.id)\n result.each do |answers_do|\n if answers_do == 1\n counter += 1\n end\n end\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n puts \"Yor result was: #{counter} correct answers and #{10-counter} incorrect answers\"\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n options(@view.menu)\n when 2 \n result_2 = []\n counter_2 = 0\n answer1_1 = Question.find(11).answers[0]\n answer2_1 = Question.find(11).answers[1]\n answer3_1 = Question.find(11).answers[2]\n puts Deck.find(2).questions[0].question\n puts \"a) #{answer1_1.name}\"\n puts \"b) #{answer2_1.name}\"\n puts \"c) #{answer3_1.name}\"\n answer1_1user = gets.chomp\n if answer1_1user == \"a\"\n answer1_1user = answer1_1\n elsif answer1_1user == \"b\"\n answer1_1user = answer2_1\n elsif answer1_1user == \"c\"\n answer1_1user = answer3_1\n end\n k = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[0].id, answer_id: answer1_1user.id, correct: answer1_1user.correct)\n result_2 << k.correct\n #\n #\n answer4_1 = Question.find(12).answers[0]\n answer5_1 = Question.find(12).answers[1]\n answer6_1 = Question.find(12).answers[2]\n puts Deck.find(2).questions[1].question\n puts \"a) #{answer4_1.name}\"\n puts \"b) #{answer5_1.name}\"\n puts \"c) #{answer6_1.name}\"\n answer2_1user = gets.chomp\n if answer2_1user == \"a\"\n answer2_1user = answer4_1\n elsif answer2_1user == \"b\"\n answer2_1user = answer5_1\n elsif answer2_1user == \"c\"\n answer2_1user = answer6_1\n end\n m = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[1].id, answer_id: answer2_1user.id, correct: answer2_1user.correct)\n result_2 << m.correct\n #\n #\n answer7_1 = Question.find(13).answers[0]\n answer8_1 = Question.find(13).answers[1]\n answer9_1 = Question.find(13).answers[2]\n\n puts Deck.find(2).questions[2].question\n puts \"a) #{answer7_1.name}\"\n puts \"b) #{answer8_1.name}\"\n puts \"c) #{answer9_1.name}\"\n answer3_1user = gets.chomp \n if answer3_1user == \"a\"\n answer3_1user = answer7_1\n elsif answer3_1user == \"b\"\n answer3_1user = answer8_1\n elsif answer3_1user == \"c\"\n answer3_1user = answer9_1\n end\n n = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[2].id, answer_id: answer3_1user.id, correct: answer3_1user.correct)\n result_2 << n.correct\n #\n #\n answer10_1 = Question.find(14).answers[0]\n answer11_1 = Question.find(14).answers[1]\n answer12_1 = Question.find(14).answers[2]\n puts Deck.find(2).questions[3].question\n puts \"a) #{answer10_1.name}\"\n puts \"b) #{answer11_1.name}\"\n puts \"c) #{answer12_1.name}\"\n answer4_1user = gets.chomp\n if answer4_1user == \"a\"\n answer4_1user = answer10_1\n elsif answer4_1user == \"b\"\n answer4_1user = answer11_1\n elsif answer4_1user == \"c\"\n answer4_1user = answer12_1\n end\n l = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[3].id, answer_id: answer4_1user.id, correct: answer4_1user.correct)\n result_2 << l.correct\n #\n #\n answer13_1 = Question.find(15).answers[0]\n answer14_1 = Question.find(15).answers[1]\n answer15_1 = Question.find(15).answers[2]\n puts Deck.find(2).questions[4].question\n puts \"a) #{answer13_1.name}\"\n puts \"b) #{answer14_1.name}\"\n puts \"c) #{answer15_1.name}\"\n answer5_1user = gets.chomp\n if answer5_1user == \"a\"\n answer5_1user = answer13_1\n elsif answer5_1user == \"b\"\n answer5_1user = answer14_1\n elsif answer5_1user == \"c\"\n answer5_1user = answer15_1\n end\n o = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[4].id, answer_id: answer5_1user.id, correct: answer5_1user.correct)\n result_2 << o.correct\n #\n #\n answer16_1 = Question.find(16).answers[0]\n answer17_1 = Question.find(16).answers[1]\n answer18_1 = Question.find(16).answers[2]\n puts Deck.find(2).questions[5].question\n puts \"a) #{answer16_1.name}\"\n puts \"b) #{answer17_1.name}\"\n puts \"c) #{answer18_1.name}\"\n answer6_1user = gets.chomp\n if answer6_1user == \"a\"\n answer6_1user = answer16_1\n elsif answer6_1user == \"b\"\n answer6_1user = answer17_1\n elsif answer6_1user == \"c\"\n answer6_1user = answer18_1\n end\n p = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[5].id, answer_id: answer6_1user.id, correct: answer6_1user.correct)\n result_2 << p.correct\n #\n #\n answer19_1 = Question.find(17).answers[0]\n answer20_1 = Question.find(17).answers[1]\n answer21_1 = Question.find(17).answers[2]\n puts Deck.find(2).questions[6].question\n puts \"a) #{answer19_1.name}\"\n puts \"b) #{answer20_1.name}\"\n puts \"c) #{answer21_1.name}\"\n answer7_1user = gets.chomp\n if answer7_1user == \"a\"\n answer7_1user = answer19_1\n elsif answer7_1user == \"b\"\n answer7_1user = answer20_1\n elsif answer7_1user == \"c\"\n answer7_1user = answer21_1\n end\n q = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[6].id, answer_id: answer7_1user.id, correct: answer7_1user.correct)\n result_2 << q.correct\n #\n #\n answer22_1 = Question.find(18).answers[0]\n answer23_1 = Question.find(18).answers[1]\n answer24_1 = Question.find(18).answers[2]\n puts Deck.find(2).questions[7].question\n puts \"a) #{answer22_1.name}\"\n puts \"b) #{answer23_1.name}\"\n puts \"c) #{answer24_1.name}\"\n answer8_1user = gets.chomp\n if answer8_1user == \"a\"\n answer8_1user = answer22_1\n elsif answer8_1user == \"b\"\n answer8_1user = answer23_1\n elsif answer8_1user == \"c\"\n answer8_1user = answer24_1\n end\n r = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[7].id, answer_id: answer8_1user.id, correct: answer8_1user.correct)\n result_2 << r.correct\n #\n #\n answer25_1 = Question.find(19).answers[0]\n answer26_1 = Question.find(19).answers[1]\n answer27_1 = Question.find(19).answers[2]\n puts Deck.find(2).questions[8].question\n puts \"a) #{answer25_1.name}\"\n puts \"b) #{answer26_1.name}\"\n puts \"c) #{answer27_1.name}\"\n answer9_1user = gets.chomp\n if answer9_1user == \"a\"\n answer9_1user = answer25_1\n elsif answer9_1user == \"b\"\n answer9_1user = answer26_1\n elsif answer9_1user == \"c\"\n answer9_1user = answer27_1\n end\n s = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[8].id, answer_id: answer9_1user.id, correct: answer9_1user.correct)\n result_2 << s.correct\n #\n #\n answer28_1 = Question.find(20).answers[0]\n answer29_1 = Question.find(20).answers[1]\n answer30_1 = Question.find(20).answers[2]\n puts Deck.find(2).questions[9].question\n puts \"a) #{answer28_1.name}\"\n puts \"b) #{answer29_1.name}\"\n puts \"c) #{answer30_1.name}\"\n answer10_1user = gets.chomp\n if answer10_1user == \"a\"\n answer10_1user = answer28_1\n elsif answer10_1user == \"b\"\n answer10_1user = answer29_1\n elsif answer10_1user == \"c\"\n answer10_1user = answer30_1\n end\n y = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[9].id, answer_id: answer10_1user.id, correct: answer10_1user.correct)\n result_2 << y.correct\n result_2\n result_2.each do |answers_do|\n if answers_do == 1\n counter_2 += 1\n end\n end\n pp Stat.where(game_id: @new_game.id)\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n puts \"Yor result was: #{counter_2} correct answers and #{10-counter_2} incorrect answers\"\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n options(@view.menu)\n when 3 \n counter_3 = 0\n result_3 = []\n answer1_2 = Question.find(21).answers[0]\n answer2_2 = Question.find(21).answers[1]\n answer3_2 = Question.find(21).answers[2]\n puts Deck.find(3).questions[0].question\n puts \"a) #{answer1_2.name}\"\n puts \"b) #{answer2_2.name}\"\n puts \"c) #{answer3_2.name}\"\n answer1_2user = gets.chomp\n if answer1_2user == \"a\"\n answer1_2user = answer1_2\n elsif answer1_2user == \"b\"\n answer1_2user = answer2_2\n elsif answer1_2user == \"c\"\n answer1_2user = answer3_2\n end\n a_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[0].id, answer_id: answer1_2user.id, correct: answer1_2user.correct)\n result_3 << a_1.correct\n #\n #\n answer4_2 = Question.find(22).answers[0]\n answer5_2 = Question.find(22).answers[1]\n answer6_2 = Question.find(22).answers[2]\n puts Deck.find(3).questions[1].question\n puts \"a) #{answer4_2.name}\"\n puts \"b) #{answer5_2.name}\"\n puts \"c) #{answer6_2.name}\"\n answer2_2user = gets.chomp\n if answer2_2user == \"a\"\n answer2_2user = answer4_2\n elsif answer2_2user == \"b\"\n answer2_2user = answer5_2\n elsif answer2_2user == \"c\"\n answer2_2user = answer6_2\n end\n b_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[1].id, answer_id: answer2_2user.id, correct: answer2_2user.correct)\n result_3 << b_1.correct\n #\n #\n answer7_2 = Question.find(23).answers[0]\n answer8_2 = Question.find(23).answers[1]\n answer9_2 = Question.find(23).answers[2]\n\n puts Deck.find(3).questions[2].question\n puts \"a) #{answer7_2.name}\"\n puts \"b) #{answer8_2.name}\"\n puts \"c) #{answer9_2.name}\"\n answer3_2user = gets.chomp \n if answer3_2user == \"a\"\n answer3_2user = answer7_2\n elsif answer3_2user == \"b\"\n answer3_2user = answer8_2\n elsif answer3_2user == \"c\"\n answer3_2user = answer9_2\n end\n c_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[2].id, answer_id: answer3_2user.id, correct: answer3_2user.correct)\n result_3 << c_1.correct\n #\n #\n answer10_2 = Question.find(24).answers[0]\n answer11_2 = Question.find(24).answers[1]\n answer12_2 = Question.find(24).answers[2]\n puts Deck.find(3).questions[3].question\n puts \"a) #{answer10_2.name}\"\n puts \"b) #{answer11_2.name}\"\n puts \"c) #{answer12_2.name}\"\n answer4_2user = gets.chomp\n if answer4_2user == \"a\"\n answer4_2user = answer10_2\n elsif answer4_2user == \"b\"\n answer4_2user = answer11_2\n elsif answer4_2user == \"c\"\n answer4_2user = answer12_2\n end\n d_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[3].id, answer_id: answer4_2user.id, correct: answer4_2user.correct)\n result_3 << d_1.correct\n #\n #\n answer13_2 = Question.find(25).answers[0]\n answer14_2 = Question.find(25).answers[1]\n answer15_2 = Question.find(25).answers[2]\n puts Deck.find(3).questions[4].question\n puts \"a) #{answer13_2.name}\"\n puts \"b) #{answer14_2.name}\"\n puts \"c) #{answer15_2.name}\"\n answer5_2user = gets.chomp\n if answer5_2user == \"a\"\n answer5_2user = answer13_2\n elsif answer5_2user == \"b\"\n answer5_2user = answer14_2\n elsif answer5_2user == \"c\"\n answer5_2user = answer15_2\n end\n f_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[4].id, answer_id: answer5_2user.id, correct: answer5_2user.correct)\n result_3 << f_1.correct\n #\n #\n answer16_2 = Question.find(26).answers[0]\n answer17_2 = Question.find(26).answers[1]\n answer18_2 = Question.find(26).answers[2]\n puts Deck.find(3).questions[5].question\n puts \"a) #{answer16_2.name}\"\n puts \"b) #{answer17_2.name}\"\n puts \"c) #{answer18_2.name}\"\n answer6_2user = gets.chomp\n if answer6_2user == \"a\"\n answer6_2user = answer16_2\n elsif answer6_2user == \"b\"\n answer6_2user = answer17_2\n elsif answer6_2user == \"c\"\n answer6_2user = answer18_2\n end\n g_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[5].id, answer_id: answer6_2user.id, correct: answer6_2user.correct)\n result_3 << g_1.correct\n #\n #\n answer19_2 = Question.find(27).answers[0]\n answer20_2 = Question.find(27).answers[1]\n answer21_2 = Question.find(27).answers[2]\n puts Deck.find(3).questions[6].question\n puts \"a) #{answer19_2.name}\"\n puts \"b) #{answer20_2.name}\"\n puts \"c) #{answer21_2.name}\"\n answer7_2user = gets.chomp\n if answer7_2user == \"a\"\n answer7_2user = answer19_2\n elsif answer7_2user == \"b\"\n answer7_2user = answer20_2\n elsif answer7_2user == \"c\"\n answer7_2user = answer21_2\n end\n h_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[6].id, answer_id: answer7_2user.id, correct: answer7_2user.correct)\n result_3 << h_1.correct\n #\n #\n answer22_2 = Question.find(28).answers[0]\n answer23_2 = Question.find(28).answers[1]\n answer24_2 = Question.find(28).answers[2]\n puts Deck.find(3).questions[7].question\n puts \"a) #{answer22_2.name}\"\n puts \"b) #{answer23_2.name}\"\n puts \"c) #{answer24_2.name}\"\n answer8_2user = gets.chomp\n if answer8_2user == \"a\"\n answer8_2user = answer22_2\n elsif answer8_2user == \"b\"\n answer8_2user = answer23_2\n elsif answer8_2user == \"c\"\n answer8_2user = answer24_2\n end\n i_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[7].id, answer_id: answer8_2user.id, correct: answer8_2user.correct)\n result_3 << i_1.correct\n #\n #\n answer25_2 = Question.find(29).answers[0]\n answer26_2 = Question.find(29).answers[1]\n answer27_2 = Question.find(29).answers[2]\n puts Deck.find(3).questions[8].question\n puts \"a) #{answer25_2.name}\"\n puts \"b) #{answer26_2.name}\"\n puts \"c) #{answer27_2.name}\"\n answer9_2user = gets.chomp\n if answer9_2user == \"a\"\n answer9_2user = answer25_2\n elsif answer9_2user == \"b\"\n answer9_2user = answer26_2\n elsif answer9_2user == \"c\"\n answer9_2user = answer27_2\n end\n j_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[8].id, answer_id: answer9_2user.id, correct: answer9_2user.correct)\n result_3 << j_1.correct\n #\n #\n answer28_2 = Question.find(30).answers[0]\n answer29_2 = Question.find(30).answers[1]\n answer30_2 = Question.find(30).answers[2]\n puts Deck.find(3).questions[9].question\n puts \"a) #{answer28_2.name}\"\n puts \"b) #{answer29_2.name}\"\n puts \"c) #{answer30_2.name}\"\n answer10_2user = gets.chomp\n if answer10_2user == \"a\"\n answer10_2user = answer28_2\n elsif answer10_2user == \"b\"\n answer10_2user = answer29_2\n elsif answer10_2user == \"c\"\n answer10_2user = answer30_2\n end\n k_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[9].id, answer_id: answer10_2user.id, correct: answer10_2user.correct)\n result_3 << k_1.correct\n pp Stat.where(game_id: @new_game.id)\n result_3\n result_3.each do |answers_do|\n if answers_do == 1\n counter_3 += 1\n end\n end\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n puts \"Yor result was: #{counter_3} correct answers and #{10-counter_3} incorrect answers\"\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n options(@view.menu)\n end\nend", "def round(num_player)\n puts \"values\"+num_player.to_s\n cont = 1\n while cont <= @players.length\n num_player = 0 if num_player == @players.length\n throw_card_player(@players[num_player])\n if @cards_thrown.length.zero?\n else\n puts '--------Cartas en la mesa-------'\n @cards_thrown.each do |card|\n puts \"Carta: Numero: #{card.number} Tipo: #{card.type} \"\n end\n end\n cont += 1\n num_player += 1\n end\n end", "def play_as_dealer(deck)\r\n if value < 17\r\n hit!(deck)\r\n play_as_dealer(deck)\r\n else\r\n puts \"Dealer Total is #{value}\"\r\n end\r\n end", "def hand_check(player_check)\n if player_check.hand_total > 21\n player_check.bust = true\n puts \"#{player_check.name} busted with #{player_check.hand_total}\"\n winner\n elsif player_check.hand_total == 21\n winner\n elsif six_cards?(player_check) == true\n puts \"~~~Six cards! #{player_check.name} wins!~~~\" ; player_check.score += 1\n show_hands_final\n again?\n end\n end", "def four_of_a_kind?\r\n players_cards.each do |card_obj|\r\n return card_obj.value if players_cards.count {|card| card.value == card_obj.value} == 4\r\n end\r\n false \r\n end", "def play_game\n num_turns = 0\n # @deck = Deck.new\n @deck.create_shuffled_deck\n deal_cards\n\n until (@player1.hand.deck.front == nil && @player1.hand.deck.back == nil) || (@player2.hand.deck.front == nil && @player2.hand.deck.back == nil)\n num_turns += 1\n\n p1_card = @player1.hand.deal_card\n p2_card = @player2.hand.deal_card\n cards = WarAPI.play_turn(@player1, p1_card, @player2, p2_card)\n add_player_card(cards)\n end\n\n if @player1.hand.deck.front == nil\n puts \"#{@player2.name}\"\n return num_turns\n else\n puts \"#{@player1.name}\"\n return num_turns\n end\n end", "def error_check\n if @number_of_players.to_i * @number_of_cards.to_i > Deck::CARD_COUNT\n error_message\n input_players\n else\n get_player_names\n end\nend", "def game_over?\n return true if @game_over\n !find_set && @deck.count < 1\n end", "def valid_rounds?(rounds)\n rounds % 2 == 1\n end", "def game_closable?\n @ranking = @game.statuses.where(status: [1, 2]).includes(:player).sort_by(&:created_at).reverse\n if @ranking.first.status != 1 || @ranking.select{ |r| r.status == 1 }.size > 1\n false\n else\n true\n end\n end", "def bust_or_win?\n if player.total == BLACKJACK\n puts \"#{player.name} hit backjack!! #{player.name} lost, dealer lost.\"\n play_again?\n elsif player.total > BLACKJACK\n puts \"#{player.name} busted! #{player.name} lost, dealer won.\"\n play_again?\n elsif dealer.total == BLACKJACK\n puts \"Dealer hit blackjack!! #{player.name} lost.\" \n play_again?\n elsif dealer.total > BLACKJACK\n puts \"Dealer busted! #{player.name} won.\"\n play_again?\n else\n \"continue\"\n end\n end", "def round\n puts \"The dealer is showing the #{dealer.first.face} of #{dealer.first.suit}.\"\n puts \"You have the #{player.first.face} of #{player.first.suit} and the #{player.last.face} of #{player.last.suit}, worth\"\n check_player_hand\n if player_hand_value == 21\n puts \"You're at 21-- YOU WIN!\"\n new_game?\n end\n\n end", "def play_game (dealer, player, deck)\n # initial deal\n 2.times do\n player.hand << deck.cards.pop\n dealer.hand << deck.cards.pop\n end\n # player round\n p_value = player.p_round(dealer, player, deck)\n d_value = 0\n # evaluate player for blackjack/bust before dealer plays round\n if (player.blackjack?(p_value) != true) && (player.bust?(p_value) != true)\n # dealer round\n d_value = dealer.d_round(dealer, player, deck)\n end\n evaluate(dealer, player, d_value, p_value)\n end", "def round_result\n interface.show_cards_evident(player.cards, croupier.cards)\n interface.current_points(player.amt_points, croupier.amt_points)\n\n return interface.draw if player.amt_points == croupier.amt_points\n return interface.draw if player.excess? && croupier.excess?\n return win_round if croupier.excess?\n return lose_round if player.excess?\n return win_round if player.amt_points > croupier.amt_points\n lose_round\n end", "def game_over?\n remaining_players == 1\n end", "def has_lost?\n @deck.cards == []\n end", "def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > GAME_LIMIT\n :player_busted\n elsif dealer_total > GAME_LIMIT\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def runner\n players_hand = 0\n welcome \n players_hand = initial_round\n until players_hand > 21 do\n players_hand = hit?(players_hand)\n display_card_total(players_hand)\n end\n return end_game(players_hand)\nend", "def determine_playable_cards\n playable_cards = []\n hand.each do |card_in_hand|\n if card_in_hand[\"cost\"] <= @mana_available\n playable_cards.push(card_in_hand)\n end \n end\n if mana_available >= 2\n playable_cards.push(\"hero ablity\")\n end\n playable_cards\n end", "def hand_of_poker\n players_in_hand = @players.dup\n @players.each {|player| deal(player, 5)}\n remaining_players = betting_round(players_in_hand)\n unless remaining_players.count == 1\n exchange_cards\n remaining_players = betting_round(remaining_players)\n unless remaining_players.count == 1\n remaining_players = compare_hands(remaining_players)\n end\n end\n winner = remaining_players.first\n puts \"#{winner.name} wins!\"\n print \"\\n\\n\\n\"\n pay_out(winner)\n reset_deck\n end", "def rule_3 *cards\n if cards.all?(&:face?)\n puts \"Upping the anti! #{cards.map(&:face?)}\"\n cards.raw_integer_value + 50\n end\n end", "def round(player)\n # if black jack from first 2 cards\n if player.score == 21\n case_black_jack(player)\n unless play_again\n return\n end\n end\n\n while true\n print_scores(player)\n if player.score == 21\n dealer_game(player)\n unless play_again\n break\n end\n end\n print_options_choosing(player)\n option = gets.chomp\n if option.match('1|Hit')\n player.open_new_card\n # if player got > 21 - game is over\n if player.score > WINNER_SCORE\n if player.has_ace and player.ace_score <= WINNER_SCORE\n player.score, player.ace_score = player.ace_score, player.score\n next\n end\n puts \"Your score is: #{player.score}\"\n puts 'YOU LOSE! DEALER WIN'\n player.update_money(false, false)\n else\n next\n end\n elsif option.match('2|Stand')\n dealer_game(player)\n elsif option.match('3|Double_down')\n option_double_down(player)\n elsif option.match('4|Surrender')\n puts \"House returned #{player.bet}$ to you!\"\n player.update_money(false, true)\n elsif option.match('5|Split')\n option_split(player)\n else\n puts 'You entered wrong option! Try again!'\n next\n end\n unless play_again\n break\n end\n end\n end", "def deal_and_check\n get_bet\n deal_hands\n blackjack_winner\n check_winner_else_do(\"player_loop\")\n end", "def round()\n\t\t#array of used cards\n\t\t@used = []\n\t\t#loop through players array\n\t\tfor i in 0...@num_players\n\t\t\t#reset player variables\n\t\t\t@players[i].reset()\t\n\t\t\t#populate hand\n\t\t\t@players[i].populate(@used,52,5)\n\t\t\t#get hand rank\n\t\t\t@players[i].get_rank()\n\t\t\t#add hand to array of used cards\n\t\t\t@used += @players[i].hand\n\t\tend\n\t\t#increment round number\n\t\t@roundnum += 1 \n\tend", "def draw\n player = @round_player_order[0]\n raise 'draw called when deck empty' if @deck.empty?\n player.add_to_hand(@deck.shift)\n\n player.protected = false\n\n # Player died due to having 7\n if @minister_death && player.ministered?\n bad_hand = player.hand.map(&:to_s).join(' and ')\n\n kill_player(player)\n\n if @game_winner\n # This led to a game winner. Do nothing else.\n elsif @round_winners.size >= @round\n # We found a round winner by sole survivor.\n elsif @deck.empty?\n # Deck is empty. Time to compare cards.\n compare_cards\n else\n # Move on to the next player's turn\n draw\n end\n return [player.name, bad_hand]\n end\n\n [nil, nil]\n end", "def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > GAME_MAX_TOTAL\n :player_busted\n elsif dealer_total > GAME_MAX_TOTAL\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def lost?\n @deck.cards.length == 0\n end", "def valid_numbers(num_cards, num_players)\n if (num_cards * num_players > 52 || num_cards < 1 || num_players < 2)\n\t\treturn false\n\telse\n\t\treturn true\n\tend\nend", "def check_who_wins(hand_total_dealer, hand_total_player)\n hand_to_use_dealer = 0\n hand_to_use_player = 0\n\n if hand_total_dealer[1] <= 21\n hand_to_use_dealer = hand_total_dealer[1]\n else\n hand_to_use_dealer = hand_total_dealer[0]\n end\n\n if hand_total_player[1] <= 21\n hand_to_use_player = hand_total_player[1]\n else\n hand_to_use_player = hand_total_player[0]\n end\n\n if hand_to_use_player < hand_to_use_dealer\n return \"dealer\"\n elsif hand_to_use_dealer < hand_to_use_player\n return \"player\"\n elsif hand_to_use_player = hand_to_use_dealer\n return \"draw\"\n end\n\nend", "def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > WINNING_TOTAL\n :player_busted\n elsif dealer_total > WINNING_TOTAL\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def runner\n welcome\n hand = hit?(initial_round)\n until hand > 21\n display_card_total(hand)\n hand += hit?(deal_card)\n end\n display_card_total(hand)\n end_game(hand)\nend", "def dealer_turns\n while (dealer.hand_total < 16)\n self.hit(dealer)\n hand_check(dealer)\n end\n winner\n end", "def play_game\n @events.handle(:game) do\n until @players.empty?\n play_round\n\n # Remove the players that have no cash left.\n @players.reject! {|p| p.cash <= 0 }\n end\n end\n end", "def play\n self.check \n while (\"unfinished\" == @hands_status[@cur])\n choice = 0\n \n if 2 == @hands[@cur].length # handle a hand first time\n if (num_to_value(@hands[@cur][0]) == num_to_value(@hands[@cur][1])) && (@balance >= @bets[@cur])\n # can split and double\n puts \"please input INTEGER for your choice:\\n1--hit; 2--stand; 3--double; 4--split\"\n get_input = gets.chomp\n while (!is_int? get_input) || ((is_int? get_input) && !((1..4)===Integer(get_input)))\n puts \"invalid input, please re-input:\\n1--hit; 2--stand; 3--double; 4--split\"\n get_input = gets.chomp\n end\n choice = Integer(get_input)\n elsif (@balance >= @bets[@cur])\n # can double\n puts \"please input INTEGER for your choice:\\n1--hit; 2--stand; 3--double\"\n get_input = gets.chomp\n while (!is_int? get_input) || ((is_int? get_input) && !((1..3)===Integer(get_input)))\n puts \"invalid input, please re-input:\\n1--hit; 2--stand; 3--double\"\n get_input = gets.chomp\n end\n choice = Integer(get_input)\n else\n puts \"please input INTEGER for your choice:\\n1--hit; 2--stand\"\n get_input = gets.chomp\n while (!is_int? get_input) || ((is_int? get_input) && !((1..2)===Integer(get_input)))\n puts \"invalid input, please re-input:\\n1--hit; 2--stand\"\n get_input = gets.chomp\n end\n choice = Integer(get_input)\n end\n else\n # can only hit or stand\n puts \"please input INTEGER for your choice:\\n1--hit; 2--stand\"\n get_input = gets.chomp\n while (!is_int? get_input) || ((is_int? get_input) && !((1..2)===Integer(get_input)))\n puts \"invalid input, please re-input:\\n1--hit; 2--stand\"\n get_input = gets.chomp\n end \n choice = Integer(get_input)\n end\n\n case choice\n when 1\n self.hit\n when 2\n self.stand\n when 3\n self.double\n when 4\n self.split\n end\n\n self.check\n \n end\n end", "def end_game?\n @game = Game.find(game_id)\n count = game.player_ids.count > 3 ? 3 : 1\n @game.winners && @game.winners.count == count ? true : false\n end", "def uses_deck?\n uses_deck\n end", "def detect_result(dealer_cards, player_cards)\r\n player_total = total(player_cards)\r\n dealer_total = total(dealer_cards)\r\n\r\n if player_total > HAND_LIMIT\r\n :player_busted\r\n elsif dealer_total > HAND_LIMIT\r\n :dealer_busted\r\n elsif dealer_total < player_total\r\n :player\r\n elsif dealer_total > player_total\r\n :dealer\r\n else\r\n :tie\r\n end\r\nend", "def play_game\n while @player_array.select{ |player| player.bankroll > 0 }.length > 0\n play_round\n Print.round_over\n gets\n end\n Print.game_over\n end", "def decide(dealer)\n @dealer_card = dealer.visible_card[:value]\n @card_total = hands.last.total\n if values.include?(Ace)\n if (values.include?(2) || values.include?(3)) && [5,6].include?(@dealer_card)\n :doubledown #hit\n elsif values.include?(2) || values.include?(3)\n :hit\n elsif (values.include?(4) || values.include?(5)) && [4,5,6].include?(@dealer_card)\n :doubledown #hit\n elsif values.include?(4) || values.include?(5)\n :hit\n elsif values.include?(6) && [3,4,5,6].include?(@dealer_card)\n :doubledown #hit\n elsif values.include?(6)\n :hit\n elsif values.include?(7) && [2,7,8].include?(@dealer_card)\n elsif values.include?(7) && [3,4,5,6].include?(@dealer_card)\n :doubledown #stand\n elsif values.include?(7)\n :hit\n elsif values.include?(8) || values.include?(9)\n :stand\n elsif values.first == values.last\n :split\n end\n elsif values.first == values.last\n if [2,3,7].include?(values.first) && @dealer_card <= 7\n :split\n elsif [2,3,7].include?(values.first)\n :hit\n elsif values.first == 4 && [5,6].include?(@dealer_card)\n :split\n elsif values.first == 4\n :hit\n elsif values.first == 5 && #dealer_card <= 9\n :doubledown #hit\n elsif values.first == 5 \n :hit\n elsif values.first == 6 && @dealer_card <= 6\n :split\n elsif values.first == 6\n :hit\n elsif values.first == 8\n :split\n elsif values.first == 9 && [2,3,4,5,6,8,9].include?(@dealer_card)\n :split\n elsif values.first == 9\n :stand\n elsif values.first.to_i == 10\n :split\n end\n else\n if (5...8).include?(@card_total)\n :hit\n elsif @card_total == 9 && (3...6).include?(@dealer_card)\n :doubledown #hit\n elsif @card_total == 9\n :hit\n elsif @card_total == 10 && (2...9).include?(@dealer_card)\n :doubledown #hit\n elsif @card_total == 10\n :hit\n elsif @card_total == 11 && ((2...10)+[Jack, Queen, King]).include?(@dealer_card)\n :doubledown #hit\n elsif @card_total == 11\n :hit\n elsif @card_total == 12 && [4,5,6].include?(@dealer_card)\n :stand\n elsif @card_total == 12\n :hit\n elsif (13...16).include?(@card_total) && @dealear_card <= 6\n :stand\n elsif (13...16).include?(@card_total) && (@dealer_card >= 7 || @dealer_card.is_a?(Ace))\n :hit\n elsif @card_total == 17\n :stand\n end\n end\n end", "def whoWinRound(num_player_start)\n cont = 0\n card_win = @players[num_player_start].card_thrown\n while cont <= (@players.length - 1)\n card = @players[cont].card_thrown\n if card_win != card\n if card.type.to_s == @trump_card.type.to_s || card_win.type.to_s == @trump_card.type.to_s\n aux_card = validate_card_with_trump(card, card_win)\n else\n aux_card = validate_card_without_trump(card, card_win)\n end\n if save_card_win(aux_card).nil?\n else\n card_win = save_card_win(aux_card)\n end\n end\n cont += 1\n end\n cont_player = 0\n while cont_player <= (@players.length - 1)\n return cont_player if @players[cont_player].card_thrown == card_win\n cont_player += 1\n end\n end", "def runner\n welcome\n sum = initial_round\n until sum > 21\n current_hand = hit?(sum)\n sum = current_hand if current_hand.is_a?(Integer)\n display_card_total(sum)\n end\n end_game(sum)\nend", "def game_over?\n @players.all? {|p| p.last_turn == \"skipped turn\"} || (@letter_bank.empty? && current_player.rack_empty?)\n end", "def determine_players_best_total(current_player)\n # @player1_hand = ['ace of spades', '5 of spades', '4 of spades', 'ace of diamonds']\n # @player1_hand = ['3 of spades', 'ace of hearts', '4 of spades', 'ace of clubs']\n # @player1_hand = ['ace of clubs', '2 of clubs', 'ace of hearts', '4 of hearts']\n sum_of_players_hand = 0\n number_of_aces_in_hand = 0\n if current_player == 1 then\n @player1_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n\n sum_of_players_hand = sum_of_players_hand - 10\n\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 1\n\n if current_player == 2 then\n @player2_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n sum_of_players_hand = sum_of_players_hand - 10\n $stdout.write(\"sum of players hand #{sum_of_players_hand} :\")\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 2\n\n if current_player == 3 then\n @player3_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n sum_of_players_hand = sum_of_players_hand - 10\n# $stdout.write(\"sum of players hand #{sum_of_players_hand} :\")\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 3\n\n if current_player == 4 then\n @player4_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n sum_of_players_hand = sum_of_players_hand - 10\n# $stdout.write(\"sum of players hand #{sum_of_players_hand} :\")\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 4\n # ### This method returns sum of player's best hand\n return sum_of_players_hand\n end", "def runner\n welcome\n total_of_cards = initial_round\n until total_of_cards > 21\n total_of_cards = hit?(total_of_cards)\n display_card_total(total_of_cards)\n end\n end_game(total_of_cards)\nend", "def deuce?\n @points >= 3 && @points == @opponent.points\n end", "def deuce?\n @points >= 3 && @points == @opponent.points\n end", "def runner\n welcome\n cards_counter = initial_round\n\n until cards_counter > 21\n compare = hit?(cards_counter)\n compare == cards_counter ? display_card_total(cards_counter):display_card_total(compare)\n cards_counter = compare\n end\nend_game(cards_counter)\nend", "def runner\n welcome\n userHand = initial_round\n until userHand > 21\n userHand = hit?(userHand)\n display_card_total(userHand)\n end\n end_game(userHand)\nend", "def play_cards\n selection = get_card_numbers\n selection_cards = selection.map {|i| @game.field[i] }\n if (selection_cards.compact.length != 3)\n flash[:error] = 'You did not select three cards.'\n return false\n end\n @found_set = @game.make_set_selection( @player, *selection_cards )\n unless @found_set\n flash[:notice] = 'The three cards you selected are not a set.'\n return false\n end\n flash[:notice] = nil\n flash[:error] = nil\n true\n end", "def runner\n welcome #introduces the game\n \n card_total = initial_round #est. current total + lets user know what number they have at the moment\n until card_total > 21 #continue game until user loses\n card_total = hit?(card_total)\n display_card_total(card_total)\n end\n end_game(card_total) #prints out when user has lost\nend", "def blackjack_rules\n if get_hand_value(@player_hand) > 21\n puts \"Sorry Sir, Your BUST! THE HOUSE WINS\".colorize(:red)\n elsif get_hand_value(@dealer_hand) > 21\n puts \"CONGRATULATIONS HOUSE BUSTED YOU WIN\".colorize(:yellow)\n elsif get_hand_value(@player_hand) == 21\n puts \"BLACKJACK BABY\".colorize(:light_blue)\n elsif get_hand_value(@dealer_hand) == 21\n puts \"BLACKJACK FOR THE HOUSE\".colorize(:red)\n return\n end\n\n if get_hand_value(@player_hand) == get_hand_value(@dealer_hand)\n puts \"THATS A REDRAW, HERE IS YOUR MONEY BACK\".colorize.(:red)\n elsif get_hand_value(@player_hand) > get_hand_value(@dealer_hand)\n puts \"YOU WON HOUSE LOSES, SECURITY THIS GUY IS COUNTING CARDS\".colorize(:magenta)\n elsif get_hand_value(@player_hand) < get_hand_value(@dealer_hand) \n puts \"YOU HAVE LOST AGAIN! GIVE ME THAT MULLAY PLUS A TIP PLEASE\".colorize(:red)\n else\n puts \"Sorry im not sure what happened\".colorize(:red)\n return\n end \nend", "def deal\n end_round()\n shuffle()\n rounds_dealt = 0\n while rounds_dealt < @hand_size\n @players.each do | player |\n if card = @deck.draw()\n player.hand << card\n else\n return\n end\n end\n rounds_dealt += 1\n end\n end", "def runner\nwelcome\ncard_total = initial_round\nuntil card_total > 21\ncard_total = hit?(card_total)\ndisplay_card_total(card_total)\nend_game(card_total)\nend\nend", "def check_discards_in_hand?(player, turn, done)\n expected_hand = expected_hand(player, turn)\n\n discard_list = done.discards.map{|squad|\n squad.list_of_cards\n }.flatten\n \n if !discard_list.all?{|card| expected_hand.include?(card)}\n raise Cheating, \"Player is discarding cards not in his/her hand!\"\n else\n true\n end\n end", "def runner\n welcome\n card_total=initial_round\n begin\n deal_card\n card_total=hit?(card_total)\n display_card_total(card_total)\nend until card_total>21 \nend_game(card_total)\nend", "def foundation_conditions?(card)\n @card_to_drop.rank.higher_by_one_than?(card.rank) &&\n card.suit == @card_to_drop.suit\n end", "def start_game\n @deck_current = @deck_default\n @hand_dealer = []\n @hand_player = []\n get_card_and_put_in_hand(\"dealer\")\n get_card_and_put_in_hand(\"dealer\")\n get_card_and_put_in_hand(\"player\")\n get_card_and_put_in_hand(\"player\")\n\n display_board_screen(true)\n\n result_player = turn_player\n\n if result_player === \"over\"\n puts \"player is over 21, press enter to continue\"\n gets\n bet_attribution(\"lose\")\n display_betting_screen(false)\n elsif result_player === \"stay\"\n result_dealer = turn_dealer\n end\n \n if result_dealer === \"over21\"\n puts \"Dealer over 21, press enter to continue\"\n gets\n bet_attribution(\"win\")\n display_betting_screen(false)\n elsif result_dealer === \"over17\"\n final_result = check_who_wins(calculate_hand_total_value(@hand_dealer), calculate_hand_total_value(@hand_player))\n if final_result === \"draw\"\n puts \"It's a draw, press enter to continue\"\n bet_attribution(\"push\")\n elsif final_result === \"player\"\n puts \"Player wins, press enter to continue\"\n bet_attribution(\"win\")\n elsif final_result === \"dealer\"\n puts \"Dealer wins, press enter to continue\"\n bet_attribution(\"lose\")\n end\n \n gets\n display_betting_screen(false)\n end\n\nend", "def type\n\n if @player_1.deck.cards[0].rank != @player_2.deck.cards[0].rank\n return :basic\n elsif @player_1.deck.cards[2].rank == @player_2.deck.cards[2].rank\n return :mutually_assured_destruction\n else\n return :war\n end\n end", "def runner\n welcome\n users_hand = initial_round\n card_total = users_hand\n \n until card_total >= 21\n card_total = hit?(card_total)\n display_card_total(card_total)\nend \nend_game(card_total)\nend", "def runner\nwelcome\ncard_total = initial_round\nuntil card_total > 21\ncard_total = hit?(card_total)\ndisplay_card_total(card_total)\nend \nend_game(card_total)\nend", "def one_round\n player1_weapon = get_player_one_weapon\n player2_weapon = get_player_two_weapon\n return winner?(player1_weapon,player2_weapon)\nend", "def tableau_conditions?(card)\n card.rank.higher_by_one_than?(@card_to_drop.rank) &&\n card.suit.different_color?(@card_to_drop.suit)\n end", "def runner\n welcome\n total_cards = initial_round\n until total_cards > 21 do\n total_cards = hit?(total_cards)\n display_card_total(total_cards)\n end\n end_game(total_cards)\nend", "def runner\n welcome\n hand=initial_round\n until hand>21 do\n hand=hit?(hand)\n display_card_total(hand)\n end\n end_game(hand)\nend", "def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > WINNING_VALUE\n :player_busted\n elsif dealer_total > WINNING_VALUE\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def runner\n welcome\n cards_total = initial_round\n until cards_total > 21\n cards_total = hit?(cards_total)\n display_card_total(cards_total)\n end\n end_game(cards_total)\nend", "def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > BREAK_POINT\n :player_busted\n elsif dealer_total > BREAK_POINT\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > BREAK_POINT\n :player_busted\n elsif dealer_total > BREAK_POINT\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def runner\n welcome\n card_total = initial_round # first round delt cards\n\n until card_total > 21\n card_total = hit?(card_total)\n display_card_total(card_total)\n end\n\n end_game(card_total)\nend", "def four_of_a_kind?\n high_single_card = -1\n four_card = -1\n (12).downto(0) do |i|\n if @ranks[i] > 0 && @ranks[i] != 4 && high_single_card == -1\n high_single_card = i\n end\n if @ranks[i] == 4\n four_card = i\n end\n end\n if four_card != -1\n return [8, four_card, high_single_card, -1, -1, -1]\n end\n return false\n end", "def runner\n welcome\n card_total = initial_round\n card_total = hit?(card_total)\n display_card_total(card_total)\n until card_total > 21\n end \n end_game(card_total)\nend", "def valid_play?(card)\n card.suit == current_suit ||\n card.value == current_value ||\n card.value == :eight\n end", "def runner\nwelcome\ncards=initial_round\ncards=hit?(cards)\ndisplay_card_total(cards)\nwhile cards<21\n cards=hit?(cards)\nend\nend_game(cards)\nend", "def four_of_a_kind?\n cards_by_rank.values.first.count == 4\n end", "def pl_high?\n session[:player].hand_total > session[:dealer].hand_total\n end", "def runner\n welcome\n sum_cards=initial_round\n until sum_cards >21 do \n sum_cards = hit?(sum_cards)\n end\n end_game(sum_cards)\nend", "def runner\n welcome\n hand = initial_round\n until hand > 21 do \n hand = hit?(hand)\n display_card_total(hand)\n end\n end_game(hand)\nend", "def play\n # round_started used to determine if we need to settle bets\n # if the user quits mid-game.\n @round_started = nil\n catch :quit do\n init_game\n\n want_to_play = 1\n while want_to_play\n\n # Create and shuffle Shoe\n @shoe = Shoe.new(@num_decks)\n @shoe.shuffle\n\n # Player can cut the shoe, pick a random one (excluding dealer)\n @io.show_shoe(@shoe) if @debug\n cut_at = @io.cut_shoe(@shoe, @players[ rand(@players.length - 1) ])\n @shoe.cut(cut_at)\n while @shoe.can_play(@players.length)\n @io.start_round(@players, @num_shoes + 1, @num_rounds + 1)\n @io.show_shoe(@shoe) if @debug\n place_your_bets\n @round_started = 1 # Round is considered started after bets are in\n deal_round\n @io.show_hands(@players) if @debug\n handle_insurance if @dealer.hand.up_card.is_ace\n play_round unless @dealer.hand.is_bj\n settle_round\n @num_rounds += 1\n @round_started = nil\n end\n\n @num_shoes += 1\n want_to_play = @io.want_to_play(@num_shoes)\n end\n end\n if @shoe\n settle_round if @round_started\n @io.show_game_results(@broke_players + @players, @num_rounds, @num_shoes)\n end\n @io.quit\n end", "def request_play(trick)\n choices = sort_by_rank(valid_cards(trick))\n \n return choices.first if choices.count == 1 # No choice\n return choices.first if trick.number == 0 # Play largest in first round\n return choices.last if trick.empty? # Always play smallest if starting\n \n if choices.first.suit != trick.suit\n # We're free to play anything, get rid of the most unwanted card\n return choices.first\n else\n # We are following a suit...\n \n if trick.high_card && choices.last > trick.high_card\n # We are forced to take the trick, play most unwanted card\n return choices.first\n else\n # We are following a suit...\n \n if trick.count == 3\n # We are the last to play\n if trick.points?\n return play_safe(trick,choices)\n else\n return choices.first\n end\n end\n \n # Check if the remaining players are all out of the suit\n all_out = true\n \n # We are either 2nd or 3rd to play\n all_out = all_out && neighbour(:left).out_of?(trick.suit)\n all_out = all_out && neighbour(:left).neighbour(:left).out_of?(trick.suit) if trick.count == 1\n \n return play_safe(trick,choices) if all_out\n \n # TODO...\n \n if trick.count == 1\n if trick.number < 4\n if trick.suit == HEARTS\n return risk_it(trick,choices,4)\n elsif trick.suit == SPADES\n if trick.points?\n return risk_it(trick,choices,6)\n else\n return risk_it(trick,choices,JACK)\n end\n else\n return risk_it(trick,choices)\n end\n else\n return play_safe(trick,choices)\n end\n else\n if trick.number < 6\n if trick.suit == HEARTS\n return risk_it(trick,choices,5)\n elsif trick.suit == SPADES\n if trick.points?\n return risk_it(trick,choices,6)\n else\n return risk_it(trick,choices,JACK)\n end\n else\n if trick.points?\n return risk_it(trick,choices,7)\n else\n return risk_it(trick,choices,JACK)\n end\n end\n else\n return play_safe(trick,choices)\n end\n end\n end\n end\n end", "def turn_end?\n players.all?(&:cant_take_cards?) || players.any?(&:wants_open_cards?)\n end", "def can_play(player_cnt)\n if @cards.length >= player_cnt * AVERAGE_HAND_SIZE\n return 1\n end\n return nil\n end", "def valid_for_double_down\n if @hand_cards.size == 2\n return true\n else\n return false\n end\n end", "def runner\nwelcome\ncard_total = initial_round\nuntil card_total >21\n card_total = hit?(card_total)\n display_card_total(card_total)\nend\n end_game(card_total)\nend", "def more_decks deck\n if deck.length == 0\n\n create_deck deck\n shuffle deck\n\n else \n deal_cards deck\n end\n # p deck.length\nend", "def three_of_a_kind(hand)\n\t\thand_num = check_num(hand)\n\t\ti = 0\n\t\twhile i < hand_num.size\n\t\t\tif hand_num.count(hand_num[i]) == 3\n\t\t\t\treturn 3\n\t\t\tend\n\t\t\ti += 1\n\t\tend\n\t\treturn 0\n\tend", "def full_house?\n return unless size >= 5\n\n the_cards = cards_by_rank.values\n the_cards[0].count >= 3 && the_cards[1].count >= 2\n end", "def opponent_exhausted_winnings_and_base_cards?\n @opponent.no_base_cards_remaining?\n end" ]
[ "0.6359215", "0.62601", "0.6201466", "0.61949444", "0.61614084", "0.61271816", "0.61099106", "0.6093914", "0.6077148", "0.60691386", "0.6024081", "0.601893", "0.59970665", "0.59806776", "0.59377235", "0.5935702", "0.59234667", "0.5918509", "0.59153736", "0.59054524", "0.59051955", "0.5895474", "0.586643", "0.58636606", "0.5858365", "0.5854528", "0.5853615", "0.5852138", "0.5841703", "0.58347404", "0.5824644", "0.5821835", "0.5807424", "0.5801569", "0.5790294", "0.5788416", "0.5773078", "0.5770507", "0.5770097", "0.57640517", "0.5744961", "0.5744431", "0.574236", "0.5736901", "0.57362306", "0.5735779", "0.5727508", "0.57237136", "0.5723528", "0.5723166", "0.57175684", "0.57079023", "0.5707", "0.56951666", "0.56942403", "0.5686013", "0.5684747", "0.5684445", "0.5684445", "0.56815034", "0.56766707", "0.56730884", "0.5668629", "0.5666304", "0.5663323", "0.56612664", "0.5660802", "0.56562394", "0.5652471", "0.56487554", "0.5645795", "0.563328", "0.5627052", "0.5625526", "0.5623567", "0.56229234", "0.56226", "0.5621835", "0.56217444", "0.5620929", "0.5620929", "0.5620871", "0.5612534", "0.56101274", "0.56081265", "0.5600666", "0.56000745", "0.55968463", "0.5596042", "0.5594802", "0.55831677", "0.5577617", "0.5575938", "0.5575918", "0.55737317", "0.5572265", "0.55722415", "0.55710804", "0.5570878", "0.5569941" ]
0.6743641
0
identifies winner based on type of round
def winner(returned_type) if returned_type == :basic if @player1.deck.cards[0].rank > @player2.deck.cards[0].rank @player1 else @player2 end elsif returned_type == :war if @player1.deck.cards[2].rank > @player2.deck.cards[2].rank @player1 else @player2 end else "No Winner" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winner\n win_hash = { basic: basic_winner,\n war: war_winner,\n mutually_assured_destruction: \"No Winner\"\n }\n win_hash[type]\n end", "def winner\n if type == :basic\n basic_winner\n elsif type == :war\n war_winner\n elsif type == :mutally_assured_destruction\n \"No Winner\"\n end\n end", "def choose_winner; end", "def win_round\n interface.win_round\n player.win_round\n croupier.lost_round\n overall_result\n end", "def winner\n if type == :basic\n if get_rank(@player1, 0) > get_rank(@player2, 0)\n @player1\n else\n @player2\n end\n elsif type == :war\n if get_rank(@player1, 2) > get_rank(@player2, 2)\n @player1\n else\n @player2\n end\n elsif type == :mutually_assured_destruction\n 'No Winner'\n end\n end", "def nextRound\n retval = false\n if @game_parameters[ @GAME_STATE ] == @STATE_GOING\n if @game_parameters[ @GAME_CURRENT_ROUND ] < @game_parameters[ @GAME_NUM_ROUNDS ]\n @game_parameters[ @GAME_CURRENT_ROUND ] += 1\n oneRound( nil, nil, nil, @channel, nil )\n retval = true\n else\n # No more rounds in the game. GAME OVER.\n\n put \"Game over.\"\n\n @game_parameters[ @GAME_STATE ] = @STATE_NONE\n\n # Reward game winner.\n\n high_score = 0\n high_wins = 0\n @players.each_value do |data|\n if data[ @PLAYER_WINS ] > high_wins\n high_wins = data[ @PLAYER_WINS ]\n end\n if data[ @PLAYER_SCORE ] > high_score\n high_score = data[ @PLAYER_SCORE ]\n end\n end\n\n $reby.log \"highs: #{high_wins} #{high_score}\"\n\n winners = Array.new\n @players.each do |nick, data|\n if @game_parameters[ @GAME_WIN_CRITERION ] == @WINBY_WINS\n if data[ @PLAYER_WINS ] == high_wins\n winners.push nick\n $reby.log \"Adding winner: #{nick}\"\n end\n elsif @game_parameters[ @GAME_WIN_CRITERION ] == @WINBY_POINTS\n if data[ @PLAYER_SCORE ] == high_score\n winners.push nick\n $reby.log \"Adding winner: #{nick}\"\n end\n end\n if @score[ nick ] == nil\n # New player\n addScoreRecord( nick )\n end\n @score[ nick ][ @SCORE_GAMES_PLAYED ] += 1\n end\n\n win_reason = \"nothing\"\n if @game_parameters[ @GAME_WIN_CRITERION ] == @WINBY_WINS\n win_reason = \"#{high_wins} wins\"\n elsif @game_parameters[ @GAME_WIN_CRITERION ] == @WINBY_POINTS\n win_reason = \"#{high_score} points\"\n end\n if winners.length > 1\n put \"A #{winners.length}-way tie for the win!\"\n put \"#{winners.join( ', ' )} each had #{win_reason}.\"\n else\n put \"#{winners[ 0 ]} is the game winner with #{win_reason}.\"\n end\n\n other_scores = \"Other scores: \"\n @players.each do |nick, data|\n next if winners.include?( nick )\n case @game_parameters[ @GAME_WIN_CRITERION ]\n when @WINBY_WINS\n score_str = data[ @PLAYER_WINS ]\n when @WINBY_POINTS\n score_str = data[ @PLAYER_SCORE ]\n end\n other_scores += \"#{nick}: #{score_str} \"\n end\n put other_scores\n\n if winners.length == 1\n @score[ winners[ 0 ] ][ @SCORE_GAMES_WON ] += 1\n else\n winners.each do |winner|\n @score[ winner ][ @SCORE_GAMES_TIED ] += 1\n end\n end\n\n saveScores\n\n end\n end\n return retval\n end", "def declare_round_winner(game_val,player1,player2)\n if game_val == 1\n puts \"#{player1.name} wins!\"\n player1.won_round\n elsif game_val == -1\n puts \"#{player2.name} wins!\"\n player2.won_round\n else\n puts \"It's a tie!\"\n end\n end", "def decide_winner\n winner.is_a?(Array) ? draw(winner) : win(winner)\n end", "def determine_winner\n result = @data[\"game_tags\"][\"Result\"]\n whites_result = result.split(\"-\")\n if whites_result == \"1\"\n \"White Wins!\"\n elsif whites_result == \"1/2\"\n \"It's a draw!\"\n else\n \"Black Wins!\"\n end\n end", "def determineWinner\n if @botChoice == @playerChoice\n puts \"It's a tie! Redo round:\"\n elsif (@playerChoice == \"paper\" and @botChoice == \"rock\") or \\\n (@playerChoice == \"scissors\" and @botChoice == \"paper\") or \\\n (@playerChoice == \"rock\" and @botChoice == \"scissors\")\n @roundsWon += 1\n @roundsLeft -= 1\n puts \"You won this round! Rounds Won: #{@roundsWon}. Rounds Lost: #{@roundsLost}\"\n else\n @roundsLost += 1\n @roundsLeft -= 1\n puts \"You lost this round... Rounds Won: #{@roundsWon}. Rounds Lost: #{@roundsLost}\"\n end\n end", "def winner\n\t\tbest_for_1 = best_hand(@hand1)\n\t\tbest_for_2 = best_hand(@hand2)\n\t\tcase best_for_1[:rank] <=> best_for_2[:rank]\n\t\t\twhen -1 then 2\n\t\t\twhen 1 then 1\n\t\t\twhen 0 then check_kicker(best_for_1, best_for_2)\n\t\tend\n\tend", "def scoreboard(round_winner)\n if round_winner != 0\n round_winner == 1 ? round_winner = @player1 : round_winner = @player2 \n puts \"#{round_winner.name} won the round.\"\n round_winner.win\n else puts \"tie\"\n end\n puts \"#{player1.name}: #{player1.score}\", \"#{player2.name}: #{player2.score}\"\n end", "def calculate_winner\n self.winner = case human.move <=> computer.move\n when 1\n human\n when -1\n computer\n when 0\n 'tie'\n end\n end", "def getRoundResult(winning_suit, suit1, number1, suit2, number2)\n # Write your code here\n return 'Player 1 wins' if suit1 == winning_suit && suit2 != winning_suit\n return 'Player 2 wins' if suit2 == winning_suit && suit1 != winning_suit\n if (suit1 == winning_suit && suit2 == winning_suit) || (suit1 != winning_suit && suit2 != winning_suit)\n if number1 > number2\n return 'Player 1 wins'\n elsif number2 > number1\n return 'Player 2 wins'\n else\n return 'Draw'\n end\n end\nend", "def winner\n\n if type == :basic\n if @player_1.deck.cards[0].rank > @player_2.deck.cards[0].rank\n return @player_1\n else\n return @player_2\n end\n elsif type == :mutually_assured_destruction\n return \"No winner.\"\n elsif type == :war\n if @player_1.deck.cards[2].rank > @player_2.deck.cards[2].rank\n return @player_1\n else\n return @player_2\n end\n end\n end", "def winner\n big_p = 1\n \n marks = self.unrolled\n @@All_Runs.each do |run|\n #p = product of all the slots\n p = run.map {|i| marks[i]}.inject(:*)\n return :x if p == 8\n return :o if p == 1\n big_p *= p\n end\n \n return (big_p == 0) ? nil : :cat\n end", "def winner\n count1, count2 = @cups[6].count, @cups[13].count\n if count1 > count2\n @name1\n elsif count2 > count1\n @name2\n else\n :draw\n end\n end", "def winner\n case\n when in_checkmate?(1)\n 2\n when in_checkmate?(2)\n 1\n else\n nil\n end\n end", "def next_round\n unless current_round == num_rounds\n update_attributes(current_round: current_round + 1)\n round.start_response_timer\n else\n max_points = game_players_by_points.first.points\n if max_points == 0\n game_players.each{|game_player| game_player.set_lose}\n else\n has_winner = game_players.select{|game_player| game_player.points == max_points}.count == 1\n if has_winner\n game_players_by_points.first.set_win\n else\n game_players.select{|game_player| game_player.points == max_points}.each{|game_player| game_player.set_tie}\n end\n game_players.reject{|game_player| game_player.points == max_points}.each{|game_player| game_player.set_lose}\n end\n update_attributes(current_state: 3)\n end\n end", "def round_win(p1_answer, p2_answer)\n\tif p1_answer == p2_answer\n\t\treturn 0\n\telsif p1_answer == \"rock\" and p2_answer == \"paper\"\n\t\treturn 2\n\telsif p1_answer == \"scissors\" and p2_answer == \"rock\"\n\t\treturn 2\n\telsif p1_answer == \"paper\" and p2_answer == \"scissors\"\n\t \treturn 2\n\telse\n\t\treturn 1\n\tend\nend", "def determineWinner() \n\n end", "def winner\n return @winner\n end", "def whoWinRound(num_player_start)\n cont = 0\n card_win = @players[num_player_start].card_thrown\n while cont <= (@players.length - 1)\n card = @players[cont].card_thrown\n if card_win != card\n if card.type.to_s == @trump_card.type.to_s || card_win.type.to_s == @trump_card.type.to_s\n aux_card = validate_card_with_trump(card, card_win)\n else\n aux_card = validate_card_without_trump(card, card_win)\n end\n if save_card_win(aux_card).nil?\n else\n card_win = save_card_win(aux_card)\n end\n end\n cont += 1\n end\n cont_player = 0\n while cont_player <= (@players.length - 1)\n return cont_player if @players[cont_player].card_thrown == card_win\n cont_player += 1\n end\n end", "def run_a_round\n # Sets player one's choice\n player_one_selection = select_player_choice(@player_one)\n # Sets player two's choice\n player_two_selection = select_player_choice(@player_two)\n # Determines winner with correct output string\n puts determine_winner(player_one_selection, player_two_selection)\n end", "def one_round\n player1_weapon = get_player_one_weapon\n player2_weapon = get_player_two_weapon\n return winner?(player1_weapon,player2_weapon)\nend", "def winner\n return nil if player_one_move == player_two_move\n winning_combinations = { 'rock' => 'scissors', 'scissors' => 'paper', 'paper' => 'rock' }\n {\n true => player_one,\n false => player_two,\n }[winning_combinations[player_one_move] == player_two_move]\n end", "def determine_winner\n if @current_moves[0] == @current_moves[1]\n \t\tputs \"We have a tie!\"\n \telsif ((@current_moves[0] == \"Rock\") && (@current_moves[1] == \"Scissors\")) \n \t\tputs \"#{player_1.name} wins - #{@current_moves[0]} crushes #{@current_moves[1]}\"\n @winner = @player_1\n player_1.games_won\n \telsif ((@current_moves[0] == \"Scissors\") && (@current_moves[1] == \"Paper\")) \n \t\tputs \"#{player_1.name} wins - #{@current_moves[0]} cuts #{@current_moves[1]}\"\n @winner = @player_1\n player_1.games_won\n \telsif ((@current_moves[0] == \"Paper\") && (@current_moves[1] == \"Rock\"))\n \t\tputs \"#{player_1.name} wins - #{@current_moves[0]} covers #{@current_moves[1]}\"\n @winner = @player_1\n player_1.games_won\n \telse\n \t\tputs \"#{player_2.name} wins - #{@current_moves[1]} beats #{@current_moves[0]}\"\n @winner = @player_2\n player_2.games_won\n \tend\n end", "def update_round(type,dealer,winner,loser,hand)\n # Verify inputs\n if (dealer == nil)\n puts \"Error: Missing dealer's name\"\n return false\n end\n if (hand.empty? || hand.first.empty?) && (type==T_TSUMO || type==T_RON)\n puts \"Error: Missing hand value\"\n return false\n end\n\n dealer_flag = winner.include?(dealer)\n\n # Handle each round type\n case type\n\n when T_TSUMO\n # Tsumo type: loser = everyone else\n losers = @scores.keys\n losers -= winner\n return false if not self.award_bonus(winner.first,losers,dealer_flag)\n if dealer_flag then @bonus += 1 else self.next_round end\n score_h = Scoring.get_tsumo(dealer_flag, hand.first)\n winner.each do |w|\n @scores[w] += if dealer_flag then score_h[\"nondealer\"]*(@mode-1)\n else (score_h[\"dealer\"]+score_h[\"nondealer\"]*(@mode-2)) end\n end\n losers.each do |l|\n @scores[l] -= score_h[l==dealer ? \"dealer\" : \"nondealer\"]\n end\n\n when T_RON\n # Ron type - can have multiple winners off of same loser\n return false if not self.award_bonus(winner.first,loser,dealer_flag)\n if dealer_flag then @bonus += 1 else self.next_round end\n winner.zip(hand).each do |w,h|\n paym = Scoring.get_ron((w==dealer),h)\n @scores[w] += paym\n @scores[loser.first] -= paym\n end\n\n when T_TENPAI\n # Tenpai type: losers = all - winners\n losers = @scores.keys\n losers -= winner\n if dealer_flag then @bonus += 1 else self.next_round end\n if winner.length < @mode\n total = @mode==4 ? Scoring::P_TENPAI_4 : Scoring::P_TENPAI_3\n paym = total / losers.length\n recv = total / winner.length\n winner.each do |w|\n @scores[w] += recv\n end\n losers.each do |l|\n @scores[l] -= paym\n end\n end\n\n when T_NOTEN\n # Noten type: ignore all other params\n self.next_round\n\n when T_CHOMBO\n # Chombo type: loser = chombo player, winner = everyone else\n winners = @scores.keys\n winners -= loser\n dealer_flag = loser.include?(dealer)\n score_h = Scoring.get_chombo(dealer_flag)\n @scores[loser.first] -= if dealer_flag then score_h[\"nondealer\"]*(@mode-1)\n else (score_h[\"dealer\"] + score_h[\"nondealer\"]*(@mode-2)) end\n winners.each do |w|\n @scores[w] += score_h[w==dealer ? \"dealer\" : \"nondealer\"]\n end\n\n when T_RESET\n # Round reset: add bonus stick\n @bonus += 1\n\n else\n printf \"Invalid round result type\\n\", type\n puts nil\n return false\n end\n\n return true\n end", "def winner\n horizontal_winner || vertical_winner || diagonal_winner\n end", "def determine_winner(player_one_selection, player_two_selection)\n if player_one_selection == player_two_selection\n outcome = \"\\nThis round was a tie. You both chose '#{player_one.move}'\"\n elsif player_one_selection == \"rock\" && player_two_selection == \"scissors\" ||\n player_one_selection == \"paper\" && player_two_selection == \"rock\" ||\n player_one_selection == \"scissors\" && player_two_selection == \"paper\"\n outcome = \"\\n#{player_one.name} won this round!\"\n @player_one.wins_round\n elsif player_two_selection == \"rock\" && player_one_selection == \"scissors\" ||\n player_two_selection == \"paper\" && player_one_selection == \"rock\" ||\n player_two_selection == \"scissors\" && player_one_selection == \"paper\"\n outcome = \"\\n#{player_two.name} won this round!\"\n @player_two.wins_round\n else\n puts \"\\nSomething strange happened here\"\n end\n outcome\n end", "def winner \n if won? \n turn_count.even? ? \"O\" : \"X\"\n end \n end", "def next_round!\n @round =\n case @round\n when Round::Stock\n @operating_rounds = @phase.operating_rounds\n reorder_players\n new_operating_round\n when Round::Operating\n if @round.round_num < @operating_rounds\n or_round_finished\n new_operating_round(@round.round_num + 1)\n else\n @turn += 1\n or_round_finished\n or_set_finished\n if @minor_exchange == :triggered\n new_minor_exchange_round\n else\n new_stock_round\n end\n end\n when init_round.class\n init_round_finished\n reorder_players\n new_operating_round(@round.round_num)\n end\n end", "def someone_won_round?\r\n !!winner\r\n end", "def winner\n row_winners = rows.select{|r| identical_symbols(r)}.map{|r| r[0]}\n column_winners = columns.select{|c| identical_symbols(c)}.map{|c| c[0]}\n diagonal_winners = diagonals.select{|d| identical_symbols(d)}.map{|d| d[0]}\n winners = (row_winners + column_winners + diagonal_winners).uniq - %w(_)\n players = winners.map{|w| to_player_number(w)}\n players[0] # this would default to nil if players is empty\n end", "def rps_tournament_winner(tournament)\n\n\t#base case, if it's a string then there are only 2 players\n\tif tournament[0][0].is_a?(String)\n\t\treturn rps_game_winner(tournament)\n\telse\t\n\t\t#calls rps_tournament_winner and breaks into rounds\n\t\treturn rps_tournament_winner([rps_tournament_winner(tournament[0]), rps_tournament_winner(tournament[1])])\n\tend\n\t\t\n \t\nend", "def winner\n triplet = won?\n if !!triplet\n return @board[triplet[0]]\n end\n return nil\n end", "def winner\r\n self.results_hash[:winner]\r\n end", "def winner\n (rows + cols + diagonals).each do |triple|\n return :x if triple == [:x, :x, :x]\n return :o if triple == [:o, :o, :o]\n end\n \n nil\n end", "def winner\n winner=winner_row()\n if winner\n return winner\n end\n\n winner=winner_col()\n if winner\n return winner\n end\n \n winner=winner_daigonal()\n if winner \n return winner\n end\n\n # if no winner \n return \n end", "def determine_winner\n \tif self.won?(@player_symbol) then\n \t\t@over = true\n \treturn \"Player\" \n \tend\n \tif self.won?(@computer_symbol) then\n \t\t@over = true\n \t return \"Computer\" \n \tend\n \tif self.open_spots.count == 0 then\n \t\t@over = true\n \t\treturn \"Draw\"\n \tend\n return \"\" \n end", "def determine_match_winner\n @games_to_win = ((total_number_of_games / 2.0).floor) + 1\n if player1.score == games_to_win\n return player1\n elsif player2.score == games_to_win\n return player2\n else\n return nil\n end\n end", "def round_result\n interface.show_cards_evident(player.cards, croupier.cards)\n interface.current_points(player.amt_points, croupier.amt_points)\n\n return interface.draw if player.amt_points == croupier.amt_points\n return interface.draw if player.excess? && croupier.excess?\n return win_round if croupier.excess?\n return lose_round if player.excess?\n return win_round if player.amt_points > croupier.amt_points\n lose_round\n end", "def winner\n if winning_array = won?\n @board[winning_array[0]]\n end\n end", "def breaker_rounds(who)\n while @round < 11\n @board.update_total_matches\n return win_screen if win? # check for if the breaker got everything right\n\n round_result\n @board.breaker.create_number if who == 'player'\n @board.breaker.random_number if who == 'computer'\n end\n @board.update_total_matches\n return win_screen if win? # check for if the breaker got everything right\n\n announce_code\n end", "def winner\n @winner\n end", "def determine_game_winner(p1, p2)\n winning_choices = {spock: [\"scissors\", \"rock\"], paper: [\"rock\", \"spock\"], scissors: [\"paper\", \"lizard\"], rock: [\"scissors\", \"lizard\"], lizard: [\"spock\", \"paper\"]}\n \n if p1.move == p2.move\n winner = Player.new(\"Neither\")\n elsif\n winning_choices[p1.move.to_sym].include?(p2.move.to_s)\n winner = p1\n else\n winner = p2\n end\n winner.score += 1\n return winner\n end", "def winner\n (score1 > score2 ? 1 : 2) if won?\n end", "def winner\n store_person = winner_function\n store_combo = won?\n if store_combo == false\n return nil\n elsif store_person == \"X\"\n return \"X\"\n elsif store_person == \"O\"\n return \"O\"\n else\n return false\n end\n end", "def winner_of_game(p1, p2)\n if @rules[p1.move] == p2.move\n @winner = p1.name\n p1.score += 1\n elsif @rules[p2.move] == p1.move\n @winner = p2.name\n p2.score += 1\n else\n @winner = \"Tie\"\n end\n @winner\n end", "def winner\n if winning_combo = won?\n @board[winning_combo.first]\n end\n end", "def winner\n if won?\n @board[won?[0]]\n end\n end", "def winner\n if winning_combo = won?\n @winner = @board.cells[winning_combo.first]\n end\n end", "def winner\n self.won?? self.board.cells[self.won?[0]] : nil\n end", "def winner_of_game(p1, p2)\n if @rules[p1.move].include?(p2.move) == true\n @winner = p1.name\n p1.score += 1\n elsif @rules[p2.move].include?(p1.move) == true\n @winner = p2.name\n p2.score += 1\n else\n @winner = \"Tie\"\n end\n @winner\n end", "def winner\n\n # Check every row\n winner = winner_rows()\n\n # Winner?\n if winner\n\n # Yes, the game is over\n return winner\n\n end\n\n # No row winner, so check every column\n winner = winner_columns()\n\n # Winner?\n if winner\n\n # Yes, the game is over\n return winner\n\n end\n\n # No row or column winner, so check every diagonal\n winner = winner_diagonals()\n\n # Winner?\n if winner\n\n # Yes, the game is over\n return winner\n\n end\n\n # Otherwise, no winner\n return\n\n end", "def winner\n match = horizontal_match || vertical_match || diagonal_match\n match ? @last_drop[:piece] : nil\n end", "def winner\r\n win_combination = won?\r\n if win_combination\r\n win_index = win_combination[0]\r\n @board[win_index]\r\n end\r\n end", "def winner(game)\n result = nil\n if game.team1_goals.present? && game.team2_goals.present?\n result = TEAM1_WIN if game.team1_goals > game.team2_goals\n result = TEAM2_WIN if game.team1_goals < game.team2_goals\n result = DRAW if game.team1_goals == game.team2_goals\n end\n\n result\n end", "def win\n # horizontal win\n winner = horizontal_win?\n if winner\n victory(winner)\n return winner\n end\n\n # Vertical win (way harder to test for)\n winner = vertical_win?\n if winner\n victory(winner)\n return winner\n end\n\n # Diagonal win\n winner = diagonal_win?\n if winner\n victory(winner)\n return winner\n end\n\n # If the board is full and there are no declared winners\n\n if full?\n victory(\"Nobody\")\n return \"tie\"\n end\n return false\n end", "def determine_winner game\n winner = game.max_by {|team| team[:score]}\n team_standings = get_team_by_name(winner)\n team_standings[:winnings] += 3\nend", "def determine_winner(move1, move2)\n who_wins = 0\n if @rules[0].include?(\"#{move1} #{move2}\")\n who_wins += 1\n elsif @rules[1].include?(\"#{move1} #{move2}\")\n who_wins += 3\n else @rules[2].include?(\"#{move1} #{move2}\")\n who_wins += 2\n end\n end", "def winner\n if object.team_winner.nil?\n nil\n else\n if object.match.doubles\n object.team_winner.id\n else\n object.team_winner.first_player.id\n end\n end\n end", "def find_winner\n if @player_1.life == 0\n return 2\n end\n return 1\n end", "def find_winner(move)\n condition1 = (move / 3).ceil * 3\n condition2 = (move - 1) % 3\n line = players[turn % 2].symbol + players[turn % 2].symbol + players[turn % 2].symbol\n winner_conditions(condition1, condition2, line)\n end", "def next_round\n offer_tip\n guess = @players[APlayer::CODE_BREAKER].get_guess\n @logic.analyze_guess(guess)\n @guess_results.push({:guess => guess, :whites => @logic.whites, :blacks => @logic.blacks, :guesses => guess_no})\n @players[APlayer::CODE_BREAKER].increase_won_times if @logic.guess_correct?\n @players[APlayer::CODE_BREAKER].analyse_last_guess(guess, @logic.whites, @logic.blacks)\n nil\n end", "def winner\n if won?\n @board[won?[0]]\n end\n end", "def winner \n @board[won?[0]] if won?\n end", "def winner?\n\t\t@winner\n\tend", "def calculate_winner(a, b)\n if a == b\n puts \"A tie!\"\n return [0,0]\n elsif a == ROCK && b == SCISSORS ||\n a == SCISSORS && b == PAPER ||\n a == PAPER && b == ROCK\n puts \"You win that round! (#{RPS::CHOICES[a]} beats #{RPS::CHOICES[b]})\"\n return [1,0]\n elsif b == ROCK && a == SCISSORS ||\n b == SCISSORS && a == PAPER ||\n b == PAPER && a == ROCK\n puts \"You lose that round :( (#{RPS::CHOICES[a]} loses to #{RPS::CHOICES[b]})\"\n return [0,1]\n end\n puts \"what: #{a} #{b}\"\n end", "def winner\n if (self.homeScore > self.awayScore)\n return self.home_team\n elsif (self.awayScore > self.homeScore)\n return self.away_team\n else\n return nil\n end\n end", "def p_winner(tictactoe)\n return \"Player 1\" if tictactoe.winner?(p1_moves(tictactoe))\n return \"Player 2\" if tictactoe.winner?(p2_moves(tictactoe))\n return \"Draw\" if tictactoe.draw?(p1_moves(tictactoe),p2_moves(tictactoe))\n end", "def winner\n index = won?\n if index && @board.cells[index[0]] == \"X\"\n return \"X\"\n elsif index && @board.cells[index[0]] == \"O\"\n return \"O\"\n else\n return nil\n end\n end", "def winner\n if self.won?\n self.board.cells[self.won?[0]]\n elsif self.draw?\n nil\n end\n end", "def winner\n won? ? board.cells[won?[0]] : nil\n end", "def determine_winner(p1, p2)\n p1.acquire_move(@rules)\n p2.acquire_move(@rules)\n @rules.winner_of_game(p1, p2)\n end", "def winner\n player_alive?(Player1) ? Player1 : Player2\n end", "def detect_winner # iterate through winning lines, and see if square in each 3 elements\n # in this line array matches the human marker or computer marker, if so return that marker\n # if no match return nil\n WINNNING_LINES.each do |line| # line is 3 element arr representing winning line\n if count_human_marker(@squares.values_at(*line)) == 3\n return TTTGame::HUMAN_MARKER # vid 8 refactor\n elsif count_computer_marker(@squares.values_at(*line)) == 3\n return TTTGame::COMPUTER_MARKER\n end\n end\n nil # if we dno't put this, then .each will return array\n end", "def overall_winner?(p1_wins,p2_wins)\n if p1_wins > p2_wins\n return 1\n elsif p2_wins > p1_wins\n return 2\n else\n return nil\n end\nend", "def main_game\n p1_wins = 0\n p2_wins = 0\n puts \"Let's play Rock-Paper-Scissors!\"\n games = how_many_games\n best_of(games)\n\n until p1_wins == games || p2_wins == games\n winner = one_round\n display_winner(winner)\n p1_wins += track_p1_wins(winner)\n p2_wins += track_p2_wins(winner)\n end\n\n overall_winner = overall_winner?(p1_wins, p2_wins)\n display_overall_winner(overall_winner)\nend", "def track_p1_wins(winner)\n if winner == 1\n return 1\n else\n return 0\n end\nend", "def winner()\n if won?()\n win = won?()\n if @board[win[0]] == \"X\"\n return \"X\"\n elsif @board[win[0]] == \"O\"\n return \"O\"\n else @board[win[0]] != \"X\" && @board[win[0]] != \"O\" #srsly..this is like ducttape over a huge hole\n return nil\n end\n end\nend", "def find_winner\n\t\t@counter = 0\n\t\[email protected] do |player|\n\t\t\tif player.points > @winning\n\t\t\t\t@winner = @counter + 1\n\t\t\tend\n\t\t\t@counter += 1\n\t\tend\n\t\treturn @winner\n\tend", "def get_winner_against(move)\n\t\tif move == :r\n\t\t\t:p\n\t\telsif move == :p\n\t\t\t:s\n\t\telse\n\t\t\t:r\n\t\tend\n\tend", "def winner\n winning_conditions_met? == \"x\" ? \"#{@player_one} won!\" : \"#{@player_two} won!\"\n end", "def winner\n scoreboard.first\n end", "def tie_winner \n\t\t# Store the winner information if there is a tie for player 1 and 2 \n\t\t@tie_1 = Array.new\n\t\t@tie_2 = Array.new\n\n\t\tfor i in 0..@best_hand_value_1.length-1 do \n\n\t\t\tif @best_hand_value_1[i] == @best_hand_value_2[i]\n\n\t\t\t\t# This cannot happen but included to be complete \n\t\t\t\tif @combo_name_1[i][0] == \"A Royal Flush\"\n\t\t\t\t\t@tie_1[i] = 0 \n\t\t\t\t\t@tie_2[i] = 0 \n\t\t\t\tend \n\t\t\t\t# find winner with two straight flushes\n\t\t\t\t# larger straight flush will be the largest value in the values array\n\t\t\t\tif @combo_name_1[i][0] == \"A Straight Flush\"\n\t\t\t\t\tif @hand_information_player_1[i]['vals'].sort[-1] > @hand_information_player_2[i]['vals'].sort[-1]\n\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['vals'].sort[-1]\n\t\t\t\t\t\t@tie_2[i] = 0 \n\t\t\t\t\telsif @hand_information_player_1[i]['vals'].sort[-1] < @hand_information_player_2[i]['vals'].sort[-1]\n\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['vals'].sort[-1]\n\t\t\t\t\tend \n\t\t\t\tend\n\t\t\t\t# find winner with 2 four of a kinds\n\t\t\t\t# larger 4 of a kind will be the mode of the value array\n\t\t\t\tif @combo_name_1[i][0] == \"Four of a Kind\"\n\t\t\t\t\tif @hand_information_player_1[i]['vals'].mode > @hand_information_player_2[i]['vals'].mode\n\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['vals'].mode\n\t\t\t\t\t\t@tie_2[i] = 0 \n\t\t\t\t\telsif @hand_information_player_1[i]['vals'].mode < @hand_information_player_2[i]['vals'].mode\n\t\t\t\t \t\t@tie_1[i] = 0\n\t\t\t\t \t\t@tie_2[i] = @hand_information_player_2[i]['vals'].mode\n\t\t\t\t \tend \n\t\t\t\tend \n\t\t\t\t# find winner with two three of a kinds\n\t\t\t\t# larger 3 of a kind will be the mode of the values array \n\t\t\t\tif @combo_name_1[i][0] == \"Three of a Kind\"\n\t\t\t\t\tif @hand_information_player_1[i]['vals'].mode > @hand_information_player_2[i]['vals'].mode\n\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['vals'].mode\n\t\t\t\t\t\t@tie_2[i] = 0 \n\t\t\t\t\telsif @hand_information_player_1[i]['vals'].mode < @hand_information_player_2[i]['vals'].mode\n\t\t\t\t \t\t@tie_1[i] = 0\n\t\t\t\t \t\t@tie_2[i] = @hand_information_player_2[i]['vals'].mode\n\t\t\t\t \tend \n\t\t\t\tend \n\t\t\t\t# find winner with two full houses. Larger full house will be larger 3 of a kind, \n\t\t\t\t# which can be found as the mode of the values array \n\t\t\t\tif @combo_name_1[i][0] == \"A Full House\"\n\t\t\t\t\tif @hand_information_player_1[i]['vals'].mode > @hand_information_player_2[i]['vals'].mode\n\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['vals'].mode\n\t\t\t\t\t\t@tie_2[i] = 0 \n\t\t\t\t\telsif @hand_information_player_1[i]['vals'].mode < @hand_information_player_2[i]['vals'].mode\n\t\t\t\t \t\t@tie_1[i] = 0\n\t\t\t\t \t\t@tie_2[i] = @hand_information_player_2[i]['vals'].mode\n\t\t\t\t \tend \n\t\t\t\tend \n\t\t\t\t# find winner with two flushes. Since a flush is 5 cards, max will store largest. \n\t\t\t\tif @combo_name_1[i][0] == \"A Flush\"\n\t\t\t\t\tif @hand_information_player_1[i]['max'] > @hand_information_player_2[i]['max'] \n\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['max']\n\t\t\t\t\t\t@tie_2[i] = 0\n\t\t\t\t\telsif @hand_information_player_1[i]['max'] < @hand_information_player_2[i]['max'] \n\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['max']\n\t\t\t\t\tend \n\t\t\t\tend \n\t\t\t\t# find winner with two straights. Since a straight is 5 cards, the max will have \n\t\t\t\t# the larger of the two saved \n\t\t\t\tif @combo_name_1[i][0] == \"A Straight\"\n\t\t\t\t\tif @hand_information_player_1[i]['max'] > @hand_information_player_2[i]['max'] \n\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['max']\n\t\t\t\t\t\t@tie_2[i] = 0\n\t\t\t\t\telsif @hand_information_player_1[i]['max'] < @hand_information_player_2[i]['max'] \n\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['max']\n\t\t\t\t\tend \n\t\t\t\tend \n\t\t\t\t# find winner with same high card. Itterate through all 5 cards until one is bigger (in order from highest)\n\t\t\t\tif @combo_name_1[i][0] == \"High Card\"\n\t\t\t\t\tfor k in 1..5 do\n\t\t\t\t\t\tif @hand_information_player_1[i]['vals'].sort[-k] > @hand_information_player_2[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t@tie_2[i] = 0\n\t\t\t\t\t\t\tbreak \n\t\t\t\t\t\telsif @hand_information_player_1[i]['vals'].sort[-k] < @hand_information_player_2[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['vals'].sort[-k]\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend \n\t\t\t\t\tend \n\t\t\t\tend\n\t\t\t\t# find winner with same two pairs. First check each of the pair values (high to low) then check\n\t\t\t\t# the remaining cards high to low \n\t\t\t\tif @combo_name_1[i][0] == \"Two Pair\" \n\t\t\t\t\tif @hand_information_player_1[i]['pairvals'].sort[-1] > @hand_information_player_2[i]['pairvals'].sort[-1]\n\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['pairvals'].sort[-1]\n\t\t\t\t\t\t@tie_2[i] = 0\n\t\t\t\t\telsif @hand_information_player_1[i]['pairvals'].sort[-1] < @hand_information_player_2[i]['pairvals'].sort[-1]\n\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['pairvals'].sort[-1]\n\t\t\t\t\telsif @hand_information_player_1[i]['pairvals'].sort[-1] == @hand_information_player_2[i]['pairvals'].sort[-1]\n\t\t\t\t\t\tif @hand_information_player_1[i]['pairvals'].sort[-2] > @hand_information_player_2[i]['pairvals'].sort[-2]\n\t\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['pairvals'].sort[-2]\n\t\t\t\t\t\t\t@tie_2[i] = 0\n\t\t\t\t\t\telsif @hand_information_player_1[i]['pairvals'].sort[-2] < @hand_information_player_2[i]['pairvals'].sort[-2]\n\t\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['pairvals'].sort[-2]\n\t\t\t\t\t\telsif @hand_information_player_1[i]['pairvals'].sort[-2] == @hand_information_player_2[i]['pairvals'].sort[-2]\n\t\t\t\t\t\t\tfor k in 1..3 do\n\t\t\t\t\t\t\t\tif @hand_information_player_1[i]['vals'].sort[-k] > @hand_information_player_2[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t\t\t@tie_2[i] = 0\n\t\t\t\t\t\t\t\t\tbreak \n\t\t\t\t\t\t\t\telsif @hand_information_player_1[i]['vals'].sort[-k] < @hand_information_player_2[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tend \n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend \n\t\t\t\t# find winner with same pairs, first check pair value (high to low), then itterate through all remaining cards\n\t\t\t\t# high to low \n\t\t\t\tif @combo_name_1[i][0] == \"A Pair\"\n\t\t\t\t\tif @hand_information_player_1[i]['pairvals'][0] > @hand_information_player_2[i]['pairvals'][0]\n\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['pairvals'][0]\n\t\t\t\t\t\t@tie_2[i] = 0\n\t\t\t\t\telsif @hand_information_player_1[i]['pairvals'][0] < @hand_information_player_2[i]['pairvals'][0]\n\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['pairvals'][0]\n\t\t\t\t\telsif @hand_information_player_1[i]['pairvals'][0] == @hand_information_player_2[i]['pairvals'][0]\n\t\t\t\t\t\tfor k in 1..4 do\n\t\t\t\t\t\t\tif @hand_information_player_1[i]['vals'].sort[-k] > @hand_information_player_2[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t\t@tie_2[i] = 0\n\t\t\t\t\t\t\t\tbreak \n\t\t\t\t\t\t\telsif @hand_information_player_1[i]['vals'].sort[-k] < @hand_information_player_2[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\tend \n\t\t\t\t\t\tend \n\t\t\t\t\tend\n\t\t\t\tend \n\t\t\telse \n\t\t\t\t# if no tie, tie should be zero\n\t\t\t\t@tie_1[i] = 0\n\t\t\t\t@tie_2[i] = 0\n\t\t\tend\n\n\t\tend # Ends the loop for the different types of tied hands \n\n\tend", "def winner_count\n end", "def determine_winner_one_game\n if @weapon_p1 == \"r\" && @weapon_p2 == \"s\"\n return 1 \n elsif @weapon_p1 == \"s\" && @weapon_p2 == \"p\"\n return 1 \n elsif @weapon_p1 == \"p\" && @weapon_p2 == \"r\" \n return 1 \n \n elsif @weapon_p1 == \"p\" && @weapon_p2 == \"s\"\n return 2\n elsif @weapon_p1 == \"r\" && @weapon_p2 == \"p\"\n return 2\n elsif @weapon_p1 == \"s\" && @weapon_p2 == \"r\"\n return 2 \n\n else\n return nil\n end \n end", "def winner\n won = won?()\n if won != false\n if @board[won[0]] == \"X\"\n return \"X\"\n elsif @board[won[0]] == \"O\"\n return \"O\"\n end\n else\n return nil\n end\n end", "def track_p2_wins(winner)\n if winner == 2\n return 1\n else\n return 0\n end\nend", "def winner\n if !won?\n nil\n else winner = @board[won?[0]]\n\n end\n\n end", "def play_round\r\n reset_board\r\n\r\n loop do\r\n display_board\r\n current_player_moves\r\n break if someone_won_round? || board_full?\r\n rotate_players!\r\n end\r\n\r\n the_winner = winner\r\n display_board\r\n display_round_result(the_winner)\r\n update_scores!(the_winner)\r\n end", "def winner\n win_combination = won?\n if win_combination == false\n nil\n elsif @board.cells[win_combination[0]] == \"X\"\n return \"X\"\n elsif @board.cells[win_combination[0]] == \"O\"\n return \"O\"\n end\n end", "def winner\n if won? == nil\n return nil\n else\n winning_position = won?\n winning_index = winning_position[0]\n @board[winning_index]\n end\n end", "def winner(board)\n # Return the square entry from the winning configuration\n won?(board) ? board[won?(board)[0]] : nil\nend", "def winner\n return @board[won?[0]] if won?\n end", "def winner(board)\n # returns X when X won, O when O won and nill when there is no winner\n if (draw?(board) || !full?(board)) && !won?(board)\n return nil\n elsif (board[won?(board)[0]] == \"X\")\n return \"X\"\n elsif (board[won?(board)[0]] == \"O\")\n return \"O\"\n end\nend", "def play_rounds(player1,player2,rules)\n rnd = 0\n \n until rnd > @rounds-1 do\n \n play1 = player1.get_move\n play2 = player2.get_move\n \n game_val = rules.determine_round_winner(play1, play2)\n \n declare_round_winner(game_val,player1,player2)\n \n rnd += 1\n end\n end", "def winner?\n return @winner if @winner\n\n b = to_i\n @winner = @@WINNER_STATES.any? { |a| a & b == a }\n end", "def winner?\n not @winners[@pick].nil?\n end" ]
[ "0.7793069", "0.77480507", "0.7488251", "0.744985", "0.7447646", "0.7440452", "0.7262125", "0.72125286", "0.718163", "0.7165421", "0.7119723", "0.7117874", "0.71061313", "0.7105146", "0.709743", "0.70863456", "0.7062522", "0.7038047", "0.7022531", "0.702059", "0.7018634", "0.70126873", "0.69913596", "0.6963144", "0.69630927", "0.694699", "0.69461673", "0.6937633", "0.6930212", "0.6907971", "0.6891362", "0.6882747", "0.68704116", "0.6855412", "0.6843161", "0.6814394", "0.6807213", "0.6790728", "0.6776764", "0.6772454", "0.67634284", "0.6759832", "0.67578334", "0.6742291", "0.6739949", "0.67354757", "0.6725781", "0.67154056", "0.6712813", "0.6687021", "0.66822356", "0.6676072", "0.6669189", "0.66656977", "0.6663911", "0.66624355", "0.6652144", "0.6651727", "0.6644989", "0.6639355", "0.6633971", "0.66336507", "0.6630831", "0.6629508", "0.66283995", "0.6625002", "0.6622035", "0.65848106", "0.65772504", "0.6575601", "0.65658706", "0.6562873", "0.6562819", "0.656201", "0.6560072", "0.6554345", "0.65524465", "0.6550137", "0.6548901", "0.6546889", "0.654561", "0.6544748", "0.65433085", "0.65419304", "0.6538782", "0.6536133", "0.6535043", "0.65292114", "0.652639", "0.65239936", "0.6515379", "0.65124565", "0.6504762", "0.64986104", "0.64986056", "0.6494117", "0.6489937", "0.64858556", "0.64856374", "0.64783686" ]
0.7344108
6
removes staked cards from player deck sends staked cards to spoils_of_war
def pile_cards if type == :basic @spoils_of_war << @player1.deck.cards[0] @spoils_of_war << @player2.deck.cards[0] @player1.deck.cards.shift @player2.deck.cards.shift elsif type == :war @spoils_of_war << @player1.deck.cards[0] @spoils_of_war << @player1.deck.cards[1] @spoils_of_war << @player1.deck.cards[2] @spoils_of_war << @player2.deck.cards[0] @spoils_of_war << @player2.deck.cards[1] @spoils_of_war << @player2.deck.cards[2] @player1.deck.cards.shift(3) @player2.deck.cards.shift(3) else @player1.deck.cards.shift(3) @player2.deck.cards.shift(3) p "MUTALLY ASSURED DESTRUCTION" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deal_cards\n MAX_CARDS.times do |d|\n @player_manager.players.each do |player| \n player.rack.add_card(@decks_manager.draw_pile.draw_card)\n end\n end\n\n # prep the discard pile with one card from the top of the draw pile\n @decks_manager.discard_top_card\n end", "def reset_discard_pile(deck)\n @cards = []\n @cards << deck.take_card\n while @cards[0].color == 'Wild' || @cards[0].number.is_a?(String)\n deck.cards.unshift(@cards.pop)\n @cards << deck.take_card\n end\n @cards\n end", "def discard(card)\n discard_pile << card\n end", "def deal_card\n @deck.remove(:front)\n end", "def discard_card(player)\n if player.player_hand.size == 0\n nil\n else\n rand_index = rand(5)\n rand_index += 1\n Keepem.new(Image.new(\"keepem.gif\"), rand_index)\n end\n end", "def remove_card_from_deck (card)\n\t\t@deck -= [card]\n\tend", "def remove_cards\n\t\[email protected]!(0,2)\n\tend", "def hit(deck)\n rand_card = deck.sample # pulls a random card from the playing deck.\n deck.delete(rand_card)\nend", "def remove_card\n cards.shift\n return cards\n end", "def remove_card\n @cards.delete_at(0)\n end", "def deal_card\r\n random = rand(@playable_cards.size)\r\n @playable_cards.delete_at(random)\r\n end", "def remove_card\n self.cards.delete_at(0)\n end", "def remove_set_from_hand(card)\n\t\[email protected](card)\n\tend", "def test_reshuffle_discard_into_draw\n # drain the draw pile into the discard pile\n while [email protected]_pile.is_empty?\n @manager.discard_top_card\n end\n assert_equal([], @manager.draw_pile.cards)\n assert_not_equal([], @manager.discard_pile.cards)\n\n @manager.reshuffle_discard_into_draw\n\n # draw pile should have cards and discard pile should be empty again\n assert_equal([], @manager.discard_pile.cards)\n assert_not_equal([], @manager.draw_pile.cards)\n end", "def remove_card\n @cards.shift\n end", "def remove remove_card\r\n @card_list.remove remove_card\r\n end", "def deal_card\n random = rand(@playable_cards.size)\n @playable_cards.delete_at(random)\n end", "def remove_card\n @cards.shift\n\n end", "def remove remove_card\n @card_list.remove remove_card\n end", "def pop_cards(num_pops)\r\n #p @deck_todisp.size\r\n num_pops.times{|ix| @deck_todisp.pop}\r\n if @briscola and @card_briscola_todisp and @deck_todisp.size == 0\r\n #if @card_briscola_todisp and @realgame_num_cards == 0\r\n # no more cards on deck, pick the briscola\r\n @card_briscola_todisp.visible = false\r\n end\r\n #p @deck_todisp.size\r\n end", "def discard_card(player)\n if player.player_hand.size == 0\n return nil\n elsif player.player_hand.size == 1\n return player.player_hand.hand_to_list.first\n else\n rand_index = rand(player.player_hand.size)\n return player.player_hand.hand_to_list.fetch(rand_index)\n end\n end", "def deal_card\n @deck.pop\n end", "def reset!\n @hands.each(&:discard!)\n @cards += @used\n @used = []\n end", "def make_discards(player, list_of_allies, list_of_axis)\n complete_squads = player.player_hand.completes\n\n # We need to make sure that we don't make attacks with squadrons that have already been used\n complete_squads = player.remove_used_squads(complete_squads, list_of_allies, list_of_axis)\n end", "def hand_over_player \r\n puts \"Player getting 1 random card...\"\r\n @random_card = @game_deck.random_card # def random card\r\n random_card_val = @game_deck.deck[@random_card]\r\n @player_deck[@random_card] = random_card_val # to player\r\n @game_deck.deck.delete(@random_card) \r\n puts \"@player_deck = #{@player_deck}\"\r\n\r\n end", "def discard(card)\n hand.transfer!(card: card, to: discard_pile)\n end", "def discard\n\n # organize hand into sorted array of cards\n #### METHOD\n\n puts \"here is your hand #{hand}\"\n\n puts 'what cards? you can only discard 3.'\n\n #the player returns [2,3]\n ##### METHOD\n\n # find hand[2], hand[3] and remove from hand\n ##### METHOD\n\n # hand currently has 3 cards\n\n # hand << deck.deal(2)\n\n #RETURNS new hand\n\n\n #....player1.hand = the new hand\n end", "def remove_card_row_cards\n card_row.each do |gc|\n gc.discard! if gc && gc.position < self.card_row_discard_size\n end\n end", "def remove_cards(to_remove)\n to_remove.each { |num| @cards.delete_at(num - 1) }\n end", "def discard_effect\n @game.discard_pile_cards << \"lock_down\"\n end", "def pile_cards\n players = [@player1, @player2]\n if type == :basic\n players.each do |player|\n @spoils_of_war << player.deck.cards[0]\n player.deck.remove_card\n end\n elsif type == :war\n players.each do |player|\n @spoils_of_war << player.deck.cards[0..2]\n 3.times do\n player.deck.remove_card\n end\n @spoils_of_war = @spoils_of_war.flatten\n end\n elsif type == :mutually_assured_destruction\n players.each do |player|\n 3.times do\n player.deck.remove_card\n end\n end\n # replace 'No Winner' with nil so it can be tested in award_spoils\n @turn_winner = nil\n end\n end", "def award_spoils(winner)\n while !@spoils_of_war.empty?\n card = @spoils_of_war.pop\n winner.deck.add_card(card)\n end\n end", "def remove_card(card)\n @all_cards.delete(card)\n end", "def discard_card(player)\n if player.player_hand.size == 0\n return nil\n elsif player.player_hand.size == 1\n return player.player_hand.hand_to_list.first\n elsif player.player_hand.wildcards.size > 0\n wildcards = player.player_hand.wildcards\n rand_index = rand(wildcards.size)\n return wildcards.fetch(rand_index)\n else\n rand_index = rand(player.player_hand.size)\n return player.player_hand.hand_to_list.fetch(rand_index)\n end\n end", "def reshuffle\n discard.each do |modifier|\n deck.push modifier\n end\n @discard = []\n shuffle\n end", "def deal_player_card(current_player)\n\n card = @deck.delete_at(0)\n if current_player == 1 then\n @player1_hand << card\n end\n if current_player == 2 then\n @player2_hand << card\n end\n if current_player == 3 then\n @player3_hand << card\n end\n if current_player == 4 then\n @player4_hand << card\n end\n\n end", "def deal_cards(cards)\n @players.each do |player|\n player.hand += @deck.cards.pop(cards)\n end\n end", "def award_spoils\n if @turn_winner\n @turn_winner.deck.cards << @spoils_of_war.shuffle \n @turn_winner.deck.cards = @turn_winner.deck.cards.flatten\n end\n end", "def kick_player([email protected])\n @turn_timer = nil\n announce \"#{Bold}#{player.user}#{Bold}: You have been \" +\n \"dropped from #{DOS} ...#{REMARK.sample}\"\n if @players.length >= 3\n next_turn if player == @players.first\n debug @stock.length\n while player.cards.length > 0\n @stock.insert(rand(@stock.length), player.cards.shift)\n end\n debug @stock.length\n @dropouts << @players.delete_one(player)\n else\n # Don't dump the kicked player's cards. We\n # need those to count the winner's earnings.\n debug @stock.length\n while @players.last.cards.length > 0\n @stock.insert(rand(@stock.length), @players.last.cards.shift)\n end\n debug @stock.length\n next_turn\n end_game\n end\n end", "def deal_card\r\n\t\tcards.pop\r\n\tend", "def deal_dealer_card\n\n card = @deck.delete_at(0)\n @dealer_hand << card\n\n end", "def hand_over_dealer\r\n puts \"Dealer getting 1 random card...\"\r\n @random_card = @game_deck.random_card # def random card\r\n random_card_val = @game_deck.deck[@random_card]\r\n @dealer_deck[@random_card] = random_card_val # to dealer\r\n @game_deck.deck.delete(@random_card) \r\n puts \"@dealer_deck = #{@dealer_deck}\"\r\n end", "def redeal\n # take all current cards in play and add to deck\n @deck.concat(@cards_in_play)\n @cards_in_play = Array.new\n\n #shuffle cards \n @deck.shuffle!\n\n #deal 12 more new cards\n @cards_in_play.concat(@deck.pop(12))\nend", "def discard\n player.hand.first\n end", "def removeCard(card)\n @cards.delete(card)\n end", "def deal_hand(players)\n players.each do |player|\n player.clear_hand\n end\n\n 2.times do \n players.each do |player|\n deal_card(player)\n end\n end\n end", "def reset_unused!\n @cards += @used\n @used = []\n end", "def deal\n @players.each{ |p| @shoe.trash(p.discard_hands) }\n @shoe.trash(@dealer.discard_hands)\n @shoe.reshuffle! if @shoe.cards_left < (@players.length+1) * 5\n first = true\n 2.times{\n @players.each{ |p| p.take(@shoe.hit) }\n if first\n @dealer.take(@shoe.silent_hit)\n else\n @dealer.take(@shoe.hit)\n end\n first = false\n }\n\n # In Counting Mode, it'd be nice to see everyone's hand so you can practice\n # doing the count yourself. In other modes, it just clutters things though.\n all_player_status if $Counting_Mode\n end", "def deal\r\n @deck_of_cards.shift\r\n end", "def deal_card(hand)\n\t# pick a random card and add to the hand\n\tindex = rand($card_deck.length)\n\thand << $card_deck[index]\n\n\t# remove the card from the deck\n\t$card_deck.delete_at(index)\nend", "def deal_turn\n @pokerdeck.pop\n turn = @pokerdeck.pop\n @communal_cards << turn\n return turn\n end", "def deal_hole_cards\n # Initiates a loop, iterating over each player within the active players array.\n @active_players.map do |player|\n # Removes any persistent cards from the player's hands.\n player.hole_cards.clear\n end\n # Initiates a loop that will repeat twice.\n 2.times do\n # Initiates a loop, iterating over each player with the active players array.\n @active_players.map do |player|\n # Moves a card from the top of the deckto the current player's hand.\n player.hole_cards.push(@deck.cards.shift)\n end\n end\nend", "def dealSelf(deck)\n \t@hands[0].addCard(deck.removeCard)\n end", "def deleteCard(pos)\n @cardsShown.delete_at(pos)\n end", "def clear_hands\n @player_hand = []\n @dealer_hand = []\n end", "def deal\n end_round()\n shuffle()\n rounds_dealt = 0\n while rounds_dealt < @hand_size\n @players.each do | player |\n if card = @deck.draw()\n player.hand << card\n else\n return\n end\n end\n rounds_dealt += 1\n end\n end", "def deal()\n loop_size = Constant::CARD_COUNT / 6\n loop_size.times do\n @players.each do |player|\n break if @deck.cards.empty?\n player.hand += @deck.cards.pop(2)\n end\n end\n end", "def deal_card\n @eg_users.each do |user|\n user << @pokerdeck.pop\n end\n @eg_users\n end", "def remove_cards_forAI(cardToRemove1, cardToRemove2, cardToRemove3)\n\t\[email protected](cardToRemove1)\n\t\[email protected](cardToRemove2)\n\t\[email protected](cardToRemove3)\n\tend", "def destroy_deck\n [@heart, @club, @spade, @diamond].each do |suit|\n (2..10).each do |number|\n File.delete(Dir.pwd + \"/#{number}_#{suit}.txt\")\n end\n [\"J\", \"Q\", \"K\", \"A\"].each do |face|\n File.delete(Dir.pwd + \"/#{face}_#{suit}.txt\")\n end\n end\n [\"R\", \"B\"].each do |color|\n File.delete(Dir.pwd + \"/#{@joker}_#{color}.txt\")\n end\n end", "def deal_hand\n\t\thand = Array.new\n\t\t@num_cards.times do\n\t\t\tcard = get_card(get_random_number)\n\t\t\thand << card\n\t\t\tremove_card_from_deck(card)\n\t\tend\n\t\thand\n\tend", "def deal_cards\n if @deck.length != 0\n puts \"Dealt 3 more cards\"\n for i in 0...3\n r = rand([email protected])\n @cards_in_play.append(@deck[r])\n @deck.delete_at(r)\n end\n else\n puts \"There are no more cards in the deck!\"\n end\nend", "def clear_hand\n @hand_cards.clear\n @points = 0\n end", "def deal_cards\n player.add_card(deck.deal_one)\n dealer.add_card(deck.deal_one)\n player.add_card(deck.deal_one)\n dealer.add_card(deck.deal_one)\n end", "def random_card\n result = @deck.sample(1)\n @deck.delete result\n result.first\n end", "def discard_characters_for(player)\n player.characters.each do |c|\n self.discard_pile << c\n end\n end", "def deal_cards\n Print.heading('Dealing initial cards')\n deal_card_to_players\n dealer_card_to_dealer(false) #false to hide first dealer card\n deal_card_to_players\n dealer_card_to_dealer(true)\n end", "def deal_flop\n @pokerdeck.pop\n flop = @pokerdeck.pop(3)\n @communal_cards = flop\n return flop\n end", "def flush_deck (n = 1)\n deck = []\n n.times { deck.concat(generate_deck) }\n\n # swap two random cards (4 * deck.length) times\n (4 * deck.length).times do\n \n i, j = rand(deck.length), rand(deck.length)\n deck[i], deck[j] = deck[j], deck[i]\n end\n deck\nend", "def the_draw_card(deck_value, deck_card_name, cards, cards_value, random)\n cards = cards[random]\n deck_card_name.delete_at(random.to_i)\n return cards\n end", "def drawcard\n @deck.pop\n end", "def setup_game()\n @players.each { |p| p.reset() } # Reset the player\n @cards = Array.new # Reset cards \n @dealer = Array.new # Reset dealer cards\n (@num_decks*4).times { @cards += CARDS }\n puts \"Shuffling cards....\"\n @cards = @cards.sort_by { rand } # Hack to shuffle. Ruby 1.9 has shuffling built-in!\n\n @players.find_all { |p| p.money <= 0}.each do |p|\n puts \"Player #{p.index} is out of money, removing from game...\"\n end\n @players.reject! { |p| p.money <= 0}\n if @players.length == 0\n puts \"Everybody is out of money, quitting game...\"\n exit()\n end\n\n\n @players.each do |p|\n p.cards = [@cards.pop, @cards.pop]\n end\n\n puts \"Dealer taking cards....\"\n 2.times { @dealer.push @cards.pop }\n\n get_player_bets()\n end", "def get_card_and_put_in_hand(which_hand)\n the_card = @deck_current.delete_at(rand(@deck_current.length))\n\n if which_hand === \"dealer\"\n @hand_dealer.push(the_card)\n\n elsif which_hand === \"player\"\n @hand_player.push(the_card)\n\n end\n \nend", "def make_discards(player, list_of_allies, list_of_axis)\n complete_squads = player.player_hand.completes\n complement_squads = player.player_hand.complementable\n wildcards = player.player_hand.wildcards\n\n # We need to make sure that we don't make attacks with squadrons that have already been used\n complete_squads = player.remove_used_squads(complete_squads, list_of_allies, list_of_axis)\n complement_squads = player.remove_used_squads(complement_squads, list_of_allies, list_of_axis)\n\n # Look through complement squadrons and go ahead and add\n # WildCards to them. If we don't have enough WildCards, well then\n # just make some up.\n complement_squads.each{|squadron|\n if wildcards.size > 0\n if wildcards.size >= 2 && squadron.list_of_cards.size == 1\n squadron.push!(wildcards.shift)\n squadron.push!(wildcards.shift)\n elsif wildcards.size > 1 && squadron.list_of_cards.size == 2\n squadron.push!(wildcards.shift)\n else\n squadron.push!(Keepem.new(Image.new(\"keepem.gif\"), rand(5)+1))\n end\n end\n }\n \n # Combine the two lists of Squadrons\n all_squads = complete_squads.dup.concat(complement_squads)\n\n # Now we go through and make sure all the Squadrons\n # are complete.\n all_squads.find_all {|squadron| squadron.squadron_complete? }\n end", "def return\n @cards += @discard\n @discard.clear\n @cards.shuffle\n end", "def subtractSet(chosenCards)\n @cardsOnTable.each { |c|\n if c = chosenCards[0]\n @cardsOnTable.delete_at(0)\n elsif c = chosencards[1]\n @cardsOnTable.delete_at(1)\n elsif c = chosenCards[2]\n @cardsOnTable.delete_at(2)\n end\n }\n end", "def deal(player)\n cards = []\n 26.times do \n cards << self.deck.shift\n end\n\n player.receive_cards(cards)\n end", "def deal_card\n if @unshuffled_deck[-1] == nil\n @unshuffled_deck = @addhand\n @addhand = @emptyarray\n @x = 0\n end\n card = @unshuffled_deck[@x]\n @unshuffled_deck[@x] = nil\n @x+=1\n return card\n end", "def flush_cards(cards)\n\t\thsh = {}\n\t\tcards.each {|c| hsh[c.suit] ||= []; hsh[c.suit] << c}\n\t\tret = []\n\t\thsh.each {|suit, suit_cards| ret = suit_cards if suit_cards.size > ret.size}\n\t\tret.sort_by {|x| x.sort_value}\n\tend", "def draw_card(cards)\n card = cards.to_a.sample(1).flatten\n cards.delete(card[0])\n card\nend", "def test_discard_top_card\n top_card = @manager.draw_pile.cards[0]\n assert_not_equal(top_card, @manager.discard_pile.cards[0])\n @manager.discard_top_card\n assert_equal(top_card, @manager.discard_pile.cards[0])\n end", "def deal_card\n @cards.pop\n end", "def check_discards_removed_from_hand?(player, turn, done)\n played_cards = all_discards(done)\n\n player_hand = player.player_hand.hand_to_list\n\n played_cards.each{|card|\n if player_hand.include?(card)\n raise Cheating, \"Player is not discarding the cards he/she is playing!\"\n end\n }\n true\n end", "def remove remove_card\n @cards.each_with_index do |card, i|\n if card.to_string == remove_card.to_string\n @cards.delete_at(i)\n return true\n end\n end\n false\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 deal_cards(old_deck, num_cards)\n hand = old_deck.sample(num_cards)\n new_deck = old_deck - hand\n return [hand, new_deck]\nend", "def deal_card(hand)\n #hand is a string whose valid values are 'player_cards' and 'dealer_cards' \n\n if !['player_cards','dealer_cards'].include?(hand)\n raise \"Unknown hand #{hand}\"\n end \n\n #Check for an empty deck and reshuffle if necessary\n if (session['game_cards'].length == 0) \n\n session['game_cards'] = session['discard']\n session['game_cards'].shuffle!\n session['discard'] = []\n append_message(\"Dealer shuffled the cards.\") \n\n end \n\n #Move the card\n session[hand] << session['game_cards'].pop \n\n end", "def flip_deck\n if @deck.empty?\n if @recycle_count < @recycle_limit\n @deck = @discard.reverse.collect {|c| c.flip}\n @discard = CardArray.new\n @recycle_count += 1\n else\n nil\n end\n else\n @discard.push @deck.pop\n end\n @discard.first.flip\n end", "def reset_self\r\n @hole_cards = []\r\n @folded = false\r\n @bet = 0\r\n end", "def remove_sticker(card_id, sticker_id)\n delete_card_resource card_id, \"stickers\", resource_id(sticker_id)\n end", "def dealCards\n @players.times do |p|\n c=p + 1\n tmp = []\n puts \"#{$dm} Dealing #{c} of #{cardsDealt} Cards for player #{c} of #{players}\" if $debug\n while c <= cardsNeeded do\n puts \"#{$dm} INSIDE While #{c} up to #{cardsNeeded}\" if $debug\n #d=c-1 # This is ugly... :( Needed to start at array 0 beginning\n tmp.push(@deckOfCards[@deckA[c-1]])\n c += @players\n end\n @playersCards[(p+1)] = tmp\n end\n end", "def deal\n # pack cards past the default 12 into the begining\n if @cards.length > 12\n # cards still in play past the standard 12 positions\n extra = @cards.last(@cards.length - 12).compact\n # move what can be moved into the standard 12 positions\n @cards = @cards.take(12).map! { |c| c || extra.pop }\n # hopefully extra is empty now, but maybe not\n @cards += extra\n end\n\n # sets is still valid as we haven't modified the combinaion of cards in play\n # do we need to expand the cards in play?\n if(@sets && @sets.none?)\n @cards += Array.new(3)\n end\n \n ## fill any gaps from the deck\n @cards.map! { |x| x || @deck.pop }\n\n # recompute sets\n #@sets = []\n @sets = IsASet.sets @cards.compact\n end", "def zero_chips\n @player_positions.each do |player|\n @player_positions.delete(player) if player.chip_stack.zero?\n end\nend", "def deal_cards(deck, playing_cards)\n return if deck.length == 0\n\n #initializing deck.\n if playing_cards.length == 0\n for count in 0...12\n card = deck.delete_at(rand(deck.length))\n card.set_id($card_count)\n $card_count += 1\n playing_cards.push(card)\n end\n return\n end\n\n if (valid_table(playing_cards)).length == 0\n #continually adds cards until there is a set or there are no more cards.\n while ((valid_table(playing_cards)).length == 0) && deck.length > 0\n #print(\"\\n Empty: #{(valid_table(playingCards)).length == 0} \\n\")\n for count in 0...3\n card = deck.delete_at(rand(deck.length))\n card.set_id($card_count)\n $card_count += 1\n playing_cards.push(card)\n end\n end\n elsif playing_cards.length < 12\n # Adds cards if there is a set but less than 12 playing cards.\n for count in 0...3\n card = deck.delete_at(rand(deck.length))\n card.set_id($card_count)\n $card_count += 1\n playing_cards.push(card)\n end\n\n end\n\nend", "def deal\r\n @cards.shift\r\n end", "def remove_all_but_top_cards\n piles.map { |pile| pile.slice!(0, pile.size - 1) }\n end", "def flush\n my_hand.group_by(&:suit).select { |_, hand_of_suit| hand_of_suit.count == 5 }.values.flatten\n end", "def deal\n @deckOfCards.shift\n end", "def draw # draw one card at random\n build_deck if cards.empty?\n ndx = (0...cards.size).to_a.sample\n cards.delete_at(ndx)\n end", "def convert_deck(arr_of_cards)\n arr_of_cards.each do |card|\n # Remove the \"Your Cards:\" from the first element\n if arr_of_cards.index(card) == 0\n card.slice!(0, 12)\n end\n end\n end" ]
[ "0.74004495", "0.73050904", "0.7286182", "0.7221042", "0.7168238", "0.707717", "0.7063359", "0.70390224", "0.6973399", "0.69510406", "0.6898719", "0.68520296", "0.6847112", "0.6835678", "0.68330723", "0.68236184", "0.6817077", "0.68075806", "0.6785336", "0.6770736", "0.67625177", "0.67503613", "0.67502016", "0.6724534", "0.67087424", "0.6703453", "0.67027426", "0.66717553", "0.6663564", "0.66610223", "0.6654829", "0.6653397", "0.6627418", "0.66258353", "0.662128", "0.66202515", "0.6608521", "0.6581999", "0.6563682", "0.65516096", "0.6541553", "0.6539718", "0.6538305", "0.6523345", "0.65117556", "0.65060866", "0.6487325", "0.6478891", "0.64615816", "0.64607245", "0.6450061", "0.64346176", "0.64293134", "0.6428355", "0.6416669", "0.6415412", "0.63874745", "0.63852227", "0.63846016", "0.63499177", "0.63497514", "0.6347296", "0.6335402", "0.6334815", "0.631228", "0.6296066", "0.6291692", "0.62900734", "0.62879455", "0.62765616", "0.62692624", "0.626645", "0.62651074", "0.6258079", "0.6254498", "0.62518543", "0.6248324", "0.62411326", "0.62213206", "0.6218398", "0.62115055", "0.6211464", "0.62091625", "0.6207329", "0.6199331", "0.61932534", "0.6185251", "0.61848116", "0.617797", "0.61582226", "0.6133749", "0.6122759", "0.6117009", "0.61124057", "0.61041474", "0.61007184", "0.6097164", "0.6096583", "0.60943544", "0.6091476" ]
0.6223062
78
sends spoils_of_war to winners deck clears spoils_of_war for next turn
def award_spoils(winner) if winner == @player1 @spoils_of_war.each do |card| @player1.deck.add_card(card) end elsif winner == @player2 @spoils_of_war.each do |card| @player2.deck.add_card(card) end else p "NO WINNER. ALL SPOILS." end @spoils_of_war = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def award_spoils(winner)\n while !@spoils_of_war.empty?\n card = @spoils_of_war.pop\n winner.deck.add_card(card)\n end\n end", "def award_spoils\n if @turn_winner\n @turn_winner.deck.cards << @spoils_of_war.shuffle \n @turn_winner.deck.cards = @turn_winner.deck.cards.flatten\n end\n end", "def award_spoils(winner_of_turn)\n return if winner_of_turn == \"No Winner\"\n @spoils_of_war.each do |card|\n winner_of_turn.deck.cards << card\n end\n end", "def go_to_war\n # for use in battle/war results\n set_game_state 'war'\n # clear previous hand..\n reset_hand\n @num_cards_per_war.times do |w|\n all_play_a_card\n end\n # clear previous hand also, as it's the face-down card or cards\n reset_hand\n\n # populate hand_played array again\n all_play_a_card\n # score it...\n score_battle @hand_played\n\n # after scoring, update war metadata for players \n @winning_player.won_war\n players.each{|x| x.in_war }\n nil\n end", "def winner_take_hand\n from_war = @state == 'war'\n\n #save this for use in the stats display later\n @hand_played.freeze \n\n @winning_player = get_player_by_name @hand_played.try(:first).try(:owner)\n # @hand_played.each{|x| cards_played.push(x)}\n\n unless @winning_player.blank? \n # first calculate the loser's lost cards and metadata\n @cards_on_table.each do |c|\n get_player_by_name( c.try(:owner) ).in_battle\n get_player_by_name( c.try(:owner) ).lose_cards [c]\n end\n\n # winner puts all cards on table at the end of their deck, change ownership\n @winning_player.gain_cards(@cards_on_table)\n @winning_player.won_battle\n\n # reset var to empty array\n @cards_on_table = []\n end\n\n # check if all players can continue\n players.each do |p|\n player_leaves_game(p) if p.try(:cards).try(:count) < 1\n end\n\n display_battle_results\n set_game_state 'play'\n end", "def reset_game()\n # If money in pot, distribute\n while (self.pot > 0)\n winners = []\n # In case where everyone has folded, set the winner to whoever is left\n if self.players.where(:in_hand => true).length <= 1\n winners = self.players.where(:in_hand => true)\n else\n #gets people with highest score\n winners = get_winners()\n end\n winners.each do |winner|\n #TO IMPLEMENT: more advanced side pots\n winner.money += self.pot / winners.length()\n winner.save\n end\n self.pot = 0\n end\n # reset deck of cards\n self.cards.where.not(:location => -1).each do |card|\n card.location = -1\n card.save\n end\n # reset amount each player has in the pot to 0\n self.players.each do |player|\n player.in_hand = true\n player.in_pot_hand = 0\n player.in_pot_current = 0\n player.hand = ''\n player.save\n end\n # reset pot to empty, increment dealer if not first hand\n if self.round != -1\n self.dealer = (self.dealer + 1)%10 + 10\n end\n # makes sure a player exists where the dealer is set\n while self.players.where(:location => self.dealer).length == 0\n self.dealer = (self.dealer + 1)%10 + 10\n end\n self.round = 0\n self.high_bet = 0\n self.high_better = get_next_player(self.dealer)\n self.save\n deal(self.round)\n end", "def deal\n @players.each{ |p| @shoe.trash(p.discard_hands) }\n @shoe.trash(@dealer.discard_hands)\n @shoe.reshuffle! if @shoe.cards_left < (@players.length+1) * 5\n first = true\n 2.times{\n @players.each{ |p| p.take(@shoe.hit) }\n if first\n @dealer.take(@shoe.silent_hit)\n else\n @dealer.take(@shoe.hit)\n end\n first = false\n }\n\n # In Counting Mode, it'd be nice to see everyone's hand so you can practice\n # doing the count yourself. In other modes, it just clutters things though.\n all_player_status if $Counting_Mode\n end", "def pile_cards\n if type == :basic\n @spoils_of_war << @player1.deck.cards[0]\n @spoils_of_war << @player2.deck.cards[0]\n @player1.deck.cards.shift\n @player2.deck.cards.shift\n elsif type == :war\n @spoils_of_war << @player1.deck.cards[0]\n @spoils_of_war << @player1.deck.cards[1]\n @spoils_of_war << @player1.deck.cards[2]\n @spoils_of_war << @player2.deck.cards[0]\n @spoils_of_war << @player2.deck.cards[1]\n @spoils_of_war << @player2.deck.cards[2]\n @player1.deck.cards.shift(3)\n @player2.deck.cards.shift(3)\n else\n @player1.deck.cards.shift(3)\n @player2.deck.cards.shift(3)\n p \"MUTALLY ASSURED DESTRUCTION\"\n end\n end", "def take_winnings(winnings)\n\t\t@bankroll += winnings\n\t\t@net_winnings += winnings\n\tend", "def dealer_action\n # Dealer stands on soft 17's.\n while @dealer.hand.count < 17\n @dealer.take(@shoe.hit)\n end\n\n # The first card is drawn silently. This fixes the count.\n @shoe.adjust_count(@dealer.hand.cards[0])\n end", "def pile_cards\n players = [@player1, @player2]\n if type == :basic\n players.each do |player|\n @spoils_of_war << player.deck.cards[0]\n player.deck.remove_card\n end\n elsif type == :war\n players.each do |player|\n @spoils_of_war << player.deck.cards[0..2]\n 3.times do\n player.deck.remove_card\n end\n @spoils_of_war = @spoils_of_war.flatten\n end\n elsif type == :mutually_assured_destruction\n players.each do |player|\n 3.times do\n player.deck.remove_card\n end\n end\n # replace 'No Winner' with nil so it can be tested in award_spoils\n @turn_winner = nil\n end\n end", "def deal_hand\n 2.times do\n dealer << shoe.deal\n player << shoe.deal\n end\n end", "def win_insurance_bet(hand, winnings)\n @bankroll += winnings\n @@bankroll += winnings\n #hand.insurance_bet = 0\n end", "def play_game_with_current_moves\n winners = get_games_winners\n save_winners(winners) unless winners.nil?\n winners\n end", "def pass_out_characters_and_coins\n if self.players.size == 2 && @settings.include?(:twoplayer)\n side_decks = [[], []]\n # Uh this is kinda wonky.\n # Oh Well YOLT (You only live twice) in Coup.\n 5.times {\n side_decks[0] << self.draw_cards(1)[0]\n side_decks[1] << self.draw_cards(1)[0]\n self.deck.rotate!\n }\n end\n\n self.deck.shuffle!\n\n # assign loyalties\n self.players.each_with_index do |player, index|\n if self.players.size == 2\n if @settings.include?(:twoplayer)\n player.receive_characters(self.draw_cards(1))\n player.receive_side_characters(*side_decks[index].shuffle)\n else\n player.receive_characters(self.draw_cards(2))\n end\n # first player gets 1 coin and second gets 2.\n player.give_coins(index + 1)\n else\n player.receive_characters(self.draw_cards(2))\n player.give_coins(2)\n end\n end\n end", "def play_night_phase\n increment_phase\n villager_to_kill = @players.reject {|player| player.is_werewolf? }.random\n\n # healer picks someone at random, is ignorant of seer's cleared list\n if @players.any? { |player| player.is_healer? } && villager_to_kill == @players.random\n log \"NIGHT: Wolves kill nobody; the #{villager_to_kill.class} was healed\"\n else\n log \"NIGHT: Wolves kill a #{villager_to_kill.class}\"\n @players.delete villager_to_kill\n end\n end", "def end_game_scoring\n # for each founded hotel pay shareholders\n self.game_hotels.each do |hotel|\n if hotel.chain_size > 0\n find_shareholders(hotel, hotel.chain_size)\n end\n end\n\n # for each player, sell stock at current share price\n self.game_players.each do |player|\n player.stock_cards.each do |stock|\n hotel = self.game_hotels.where(name: stock.hotel).first\n player.cash = player.cash + hotel.share_price\n player.save\n end\n end\n \n # determine winner\n most_money = 0\n winner = 0\n self.game_players.each do |player|\n if player.cash > most_money\n winner = player\n most_money = player.cash\n end\n end\n\n #notify players of results\n msg2 = 'Player ' + winner.username + ' won ' + self.name \n self.game_players.each do |player|\n if player == winner\n msg1 = 'You won ' + self.name\n Notification.create(message: msg1, user_id: player.user.id)\n else\n Notification.create(message: msg2, user_id: player.user.id)\n end\n end\n\n return winner.username\n end", "def deal_round\n for player in @players\n cards = []\n if @play_god\n cards = @io.set_hand(@shoe, player)\n else\n cards = @shoe.deal_hand(@players.index(player), @players.length)\n end\n player.hands[0].deal(cards)\n end\n end", "def give_cards_to_winner(winner, loser)\n lost_cards = loser.give_hand\n winner.receive_cards(lost_cards)\n end", "def dealer_turn\r\n dealer.reveal_hand\r\n if dealer.total_for_hand < 17\r\n loop do\r\n dealer.add_to_hand(deck)\r\n break if dealer.total_for_hand > 16\r\n end\r\n puts \"#{dealer.name} has #{dealer.total_for_hand}\"\r\n end\r\n end", "def payout\n until @pot_size.zero?\n\n # If the winning player has gone all in this round, they are only paid out the maximum amount they could possibly win from the pot.\n if @active_players[0].max_winnings < @pot_size && @active_players[0].max_winnings != 0\n puts \"#{@active_players[0].player_name} won #{@active_players[0].max_winnings} with high hand: #{@active_players[0].strongest_hand}.\"\n @active_players[0].chip_stack += @active_players[0].max_winnings\n @pot_size -= @active_players[0].max_winnings\n @active_players[0].max_winnings = 0\n\n # Deletes the player who has been paid out from the array so that they do not get paid out twice.\n @active_players.shift\n\n # If the winning player didn't need to go all in, they simply win the whole pot.\n else\n if @active_players.length > 1\n puts \"#{@active_players[0].player_name} won #{@pot_size} chips with high hand: #{@active_players[0].strongest_hand}.\"\n else\n puts \"#{@active_players[0].player_name} won #{@pot_size} chips.\"\n end\n @active_players[0].chip_stack += @pot_size\n @pot_size = 0\n puts \"#{@active_players[0].player_name} now has #{@active_players[0].chip_stack} chips.\"\n end\n end\n sleep(5)\nend", "def make_discards(player, list_of_allies, list_of_axis)\n complete_squads = player.player_hand.completes\n\n # We need to make sure that we don't make attacks with squadrons that have already been used\n complete_squads = player.remove_used_squads(complete_squads, list_of_allies, list_of_axis)\n end", "def battle\n # Runden auf 0 setzen, continue auf true (Für die Schleife)\n round = 0\n continue = true\n # Bilde Arrays mit allen nötigen Werten für den Kampf\n turn_fleet = build_array(@attacker, @attacker_fleet)\n target_fleet = build_array(@defender, @defender_fleet)\n # Angreifer beginnt\n turn_user = @attacker\n target_user = @defender\n while (round < 1000 && continue ) do\n round = round + 1\n if target_user == @defender\n @fight_shield = @defender_shield\n else\n @fight_shield = @attacker_shield\n end\n # Damit alle Gruppen in einer Runde nur auf das Schild feuern können\n shield = @fight_shield\n # Für die Ausgabe der Runden-Berichte\n round_report = []\n round_report << \"Runde #{round+1}: \"\n round_report << \"#{turn_user.username} ist am Zug.\"\n if shield > 0\n round_report << \"Schild von #{target_user.username} ist aktiv.\"\n round_report << \"Schild hält noch #{shield} Schaden aus.\"\n round_report << \"Alle Truppen schießen auf den Schildt!\"\n else \n round_report << \"Schild von #{target_user.username} ist inaktiv.\"\n round_report << \"Angriffe werden nicht abgewehrt!\"\n round_report << \" \"\n end\n turn_fleet.each do |a|\n # Nur Einheiten mit Anzahl > 0 und Schaden > 0 können kämpfen\n if a[1] > 0 && a[2] > 0 \n round_report << \"Die Gruppe #{a[5]} trifft... \"\n # Bestimme Ziel anhand von id.\n # -2 ist Miss\n # -1 ist Schild\n target = hit(target_fleet, turn_user)\n if(target == -2)\n round_report << \"nicht. Der Angriff ging daneben. \"\n round_report << \" \"\n round_report << \" \"\n elsif(target==-1)\n round_report << \"das Schild. Der Schaden beträgt: \"\n mult = 1\n # Falls Ionenwaffe, wird Schaden an Schild erhöht\n if a[3] == 2\n mult = 1.5\n end\n damage = a[2] * mult\n round_report << \"#{damage} \"\n round_report << \" \"\n # Abzug des Schilds. Übernahme erst bei nächster Runde\n @fight_shield = @fight_shield - damage\n else\n mult=1\n # Falls Laserwaffe, wird Schaden an Hülle erhöht\n # TABELLE DAMAGETYPE EINFÜGEN\n if(a[3]==1)\n mult=1.5\n end \n # Bestimme welche Einheit getroffen wurde\n victim=target_fleet[target]\n # round_report << \"#{victim[5]}. Der Schaden beträgt: \"\n # Schadensberechnung\n damage=a[2]*mult\n round_report << \"#{damage} \"\n # Berechne neue HP\n hit_points=victim[-2]\n victim[-2]=hit_points-damage\n # Berechne Anzahl und Schaden neu\n update_ship_group(victim)\n round_report << \"#{victim[4]} Einheiten wurden zerstört. \"\n end\n end \n # Füge Runden-Bericht ein\n # @round_reports << round_report\n end\n # Testet, ob Spieler noch Truppen besitzt\n if (defeat(target_fleet))\n continue=false\n else\n # Falls Schild unter 0, wird er auf 0 gesetzt\n if @fight_shield < 0\n @fight_shield = 0\n end\n # Kampf-Schild für nächste Runde\n if target_user==@attacker\n @attacker_shield=@fight_shield\n else\n @defender_shield=@fight_shield\n end\n # Tausche Rolle des Angreifers aus\n tmp_fleet=turn_fleet\n tmp_user=turn_user\n turn_fleet=target_fleet\n turn_user=target_user\n target_fleet=tmp_fleet\n target_user=tmp_user\n end\n # Füge alle Runden-Berichte hinzu\n @report << @round_reports\n end\n if continue\n @report << \"Unentschieden! \"\n @report << \"Es konnte kein Sieger ermittelt werden \"\n else \n @report << \"Die Flotte von #{target_user.username} unterlag. \"\n @report << \" #{turn_user.username} war siegreich! \"\n end\n # Generiere Verlustrechnung\n if turn_user == @attacker\n lost_report(turn_fleet, @attacker) \n lost_report(target_fleet, @defender) \n else\n lost_report(target_fleet, @attacker) \n lost_report(turn_fleet, @defender) \n end\n end", "def who_wins\n\n bj = false\n bust = false\n #//Check for dealer status after the showing hands\n if @dealer.busted?\n @ui.message(\"dealer loses\")\n bust=true\n else\n if @dealer.get_value == 21 && @dealer.num_cards == 2\n bj=true\n end\n end\n\n #//Check for player status after showing hands\n\n for player in @players\n hand_index = 0\n while hand_index < player.num_hands\n if player.busted?(hand_index)\n ui.message(player.name+\"loses on hand\"+ (hand_index+1).to_s)\n else\n if player.get_value(hand_index) == 21 && player.num_cards(hand_index) == 2 && !player.split?\n if BJ == true\n @ui.message(player.name+\" and dealer has a black jack!!! its a push on hand\"+ (hand_index+1).to_s)\n @ui.message(player.name+\"gets back \"+ player.push(hand_index).to_s)\n else\n @ui.message(\" its a black jack!!!\"+player.name+\" wins on hand\"+ (hand_index+1).to_s)\n @ui.message(player.name+\"gets \"+player.win(hand_index,true).to_s)\n end\n else\n if !bust\n if player.get_value(hand_index) > @dealer.get_value\n @ui.message(player.name+\" wins on hand\"+ (hand_index+1).to_s+\"!!!\")\n @ui.message(player.name+\"gets \"+player.win(hand_index,false).to_s)\n elsif player.get_value(hand_index) == dealer.get_value\n @ui.message(\"Its a push on hand\"+ (hand_index+1).to_s+\"!!!\"+player.name+\" and dealer has same value.\")\n @ui.message(player.name+\"gets back \"+ player.push(hand_index).to_s)\n else\n @ui.message(player.name+\" loses on hand\"+ (hand_index+1).to_s)\n end\n else\n @ui.message(player.name+\" wins on hand\"+ (hand_index+1).to_s+\"!!!\")\n @ui.message(player.name+\"gets \"+player.win(hand_index,false).to_s)\n end\n end\n end\n hand_index+=1\n end\n end\n end", "def dealer_turns\n while (dealer.hand_total < 16)\n self.hit(dealer)\n hand_check(dealer)\n end\n winner\n end", "def deal_cards\n MAX_CARDS.times do |d|\n @player_manager.players.each do |player| \n player.rack.add_card(@decks_manager.draw_pile.draw_card)\n end\n end\n\n # prep the discard pile with one card from the top of the draw pile\n @decks_manager.discard_top_card\n end", "def discard_effect\n @game.discard_pile_cards << \"lock_down\"\n end", "def end_game()\n get_winners()\n end", "def gameover\n op_hand.clear\n end", "def play_game\n turns = 0\n begin\n hash = WarAPI.play_turn(@player1, @player1.hand.deal_card, @player2, @player2.hand.deal_card)\n cards = hash.flatten\n @player1.hand.add_card(cards[1])\n @player2.hand.add_card(cards[3])\n puts \"#{turns}\"\n turns += 1\n end until (@player1.hand.addhand.length == 0 && @player1.hand.unshuffled_deck[-1] == nil && cards[1].length == 0) || (@player2.hand.addhand.length == 0 && @player2.hand.unshuffled_deck[-1] == nil && cards[3].length == 0)\n puts \"#{@player1.name} wins!\" if @player1.hand.deal_card != nil\n puts \"#{@player2.name} wins!\" if @player2.hand.deal_card != nil\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 setup_game()\n @players.each { |p| p.reset() } # Reset the player\n @cards = Array.new # Reset cards \n @dealer = Array.new # Reset dealer cards\n (@num_decks*4).times { @cards += CARDS }\n puts \"Shuffling cards....\"\n @cards = @cards.sort_by { rand } # Hack to shuffle. Ruby 1.9 has shuffling built-in!\n\n @players.find_all { |p| p.money <= 0}.each do |p|\n puts \"Player #{p.index} is out of money, removing from game...\"\n end\n @players.reject! { |p| p.money <= 0}\n if @players.length == 0\n puts \"Everybody is out of money, quitting game...\"\n exit()\n end\n\n\n @players.each do |p|\n p.cards = [@cards.pop, @cards.pop]\n end\n\n puts \"Dealer taking cards....\"\n 2.times { @dealer.push @cards.pop }\n\n get_player_bets()\n end", "def Witch(action_hash = {})\n puts 'Witch called!'\n card = Card.find(played_card_id)\n if card and phase == 'Action'\n add_actions(-1)\n player = game.players.find(player_turn)\n player.add_to_played(card)\n player.draw_card(2)\n game.players.where.not(id: player_turn).each do |p|\n puts 'adding curse to discard for player_id = ' + p.id.to_s\n p.discard.cards.create!( cardmapping_id: Cardmapping.get( 'Curse' ) )\n end\n update_attributes(prompt: '<b>Played Witch!</b><br />Draw 2 cards<br />Each other player gains a curse card.<br />')\n end\n reset_action_variables\n end", "def deal_hole_cards\n # Initiates a loop, iterating over each player within the active players array.\n @active_players.map do |player|\n # Removes any persistent cards from the player's hands.\n player.hole_cards.clear\n end\n # Initiates a loop that will repeat twice.\n 2.times do\n # Initiates a loop, iterating over each player with the active players array.\n @active_players.map do |player|\n # Moves a card from the top of the deckto the current player's hand.\n player.hole_cards.push(@deck.cards.shift)\n end\n end\nend", "def dealer_win\n @dealer_win += 1\n end", "def play_game\n\t\t\n\t\t2.times do \n\t\t\t\n\t\t\tputs to_s\n\t\t\[email protected] do |player|\n\n\t\t\t\tif player.is_fold\n\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tputs player.to_s\n\t\t\t\todds = @pokeroddsproxy.get_odds(player.get_cards, get_cards, @playernumber)\n\t\t\t\t#puts player.get_cards\n\t\t\t\tif player.get_user\n\t\t\t\t\tinput = get_input\n\t\t\t\t\tamount = 0\n\t\t\t\t\tif input == 1\n\t\t\t\t\t\tamount = 100 + @bet\n\t\t\t\t\telsif input == 2\n\t\t\t\t\t\tamount = @bet\n\t\t\t\t\telse\n\t\t\t\t\t\tamount = 0\n\t\t\t\t\t\tplayer.fold\n\t\t\t\t\tend\n\t\t\t\t\tplayer.removemoney(amount)\n\t\t\t\t\t@pot = @pot + amount \n\t\t\t\telse\n\t\t\t\t\tamount = player.set_move(odds, 200, 200)\n\t\t\t\t\tplayer.removemoney(amount)\n\t\t\t\t\t@pot = @pot + amount \n\t\t\t\tend\n\t\t\t\t#puts get_cards\n\t\t\t\tputs odds\n\t\t\t\tputs\n\t\t\tend\n\t\t\t\n\t\t\tputs \"pot: #{@pot}\"\n\n\t\t\t@board << @deck.deal\n\t\tend\n\n\t\tfind_winner\n\tend", "def battle\n # Runden auf 0 setzen, continue auf true (Für die Schleife)\n round = 0\n continue = true\n victory = false\n # Bilde Arrays mit allen nötigen Werten für den Kampf\n turn_fleet = build_array(@attacker, @attacker_fleet)\n target_fleet = build_array(@defender, @defender_fleet)\n emp_phase(@attacker)\n emp_phase(@defender)\n # Angreifer beginnt\n turn_user = @attacker\n target_user = @defender\n while (round < 1000 && continue ) do\n round = round + 1\n if target_user == @defender\n @fight_shield = @defender_shield\n else\n @fight_shield = @attacker_shield\n end\n # Damit alle Gruppen in einer Runde nur auf das Schild feuern können\n shield = @fight_shield\n # Für die Ausgabe der Runden-Berichte\n turn_fleet.each do |fleet|\n # Nur Einheiten mit Anzahl > 0 und Schaden > 0 können kämpfen\n if fleet[1] > 0 && fleet[2] > 0 \n # Bestimme Ziel anhand von id.\n # -2 ist Miss\n # -1 ist Schild\n target = hit(target_fleet, turn_user)\n if(target==-1)\n mult = 1\n # Falls Ionenwaffe, wird Schaden an Schild erhöht\n if fleet[3] == 2\n mult = DamageType.find(fleet[3]).shield_mult\n end\n damage = fleet[2] * mult\n # Abzug des Schilds. Übernahme erst bei nächster Runde\n @fight_shield = @fight_shield - damage\n else\n mult = 1\n # Falls Laserwaffe, wird Schaden an Hülle erhöht\n # TABELLE DAMAGETYPE EINFÜGEN\n if (fleet[3] == 1)\n mult = DamageType.find(fleet[3]).shell_mult\n end \n if fleet[3] == 3 and !fleet[6]\n mult = DamageType.find(fleet[3]).station_mult\n end\n if fleet[3] == 4 and fleet[0] == @plattform_id\n mult = DamageType.find(fleet[3]).plattform_mult\n end \n # Bestimme welche Einheit getroffen wurde\n victim = target_fleet[target]\n # Schadensberechnung\n damage = fleet[2] * mult\n # Berechne neue HP\n hit_points = victim[-2]\n victim[-2] = hit_points-damage\n # Berechne Anzahl und Schaden neu\n update_ship_group(victim, target_user)\n end\n end \n end\n # Füge Runden-Bericht ein\n # Testet, ob Spieler noch Truppen besitzt\n if (defeat(target_fleet))\n continue = false\n if turn_user == @attacker\n victory = true \n end\n else\n # Falls Schild unter 0, wird er auf 0 gesetzt\n if @fight_shield < 0\n @fight_shield = 0\n end\n # Kampf-Schild für nächste Runde\n if target_user == @attacker\n @attacker_shield = @fight_shield\n else\n @defender_shield = @fight_shield\n end\n # Tausche Rolle des Angreifers aus\n tmp_fleet = turn_fleet\n tmp_user = turn_user\n turn_fleet = target_fleet\n turn_user = target_user\n target_fleet = tmp_fleet\n target_user = tmp_user\n end\n # Füge alle Runden-Berichte hinzu\n end\n if continue\n @report << \"Unentschieden! \"\n @report << \"Es konnte kein Sieger ermittelt werden \"\n else \n @report << \"Die Flotte von #{target_user.username} unterlag. \"\n @report << \" #{turn_user.username} war siegreich! \"\n end\n # Generiere Verlustrechnung\n attacker_fleet_ary = []\n defender_fleet_ary = []\n if turn_user == @attacker\n lost_report(turn_fleet, @attacker) \n lost_report(target_fleet, @defender) \n attacker_fleet_ary = turn_fleet\n defender_fleet_ary = target_fleet\n else\n lost_report(target_fleet, @attacker) \n lost_report(turn_fleet, @defender) \n\n attacker_fleet_ary = target_fleet\n defender_fleet_ary = turn_fleet\n end\n update_fighting_fleet(@attacker_fleet, attacker_fleet_ary)\n update_fighting_fleet(@defender_fleet, defender_fleet_ary)\n ary = [@attacker_fleet, @defender_fleet] \n return [@report, @spy_report]\n end", "def win_bet(winnings)\n @bankroll += winnings\n @@bankroll += winnings\n end", "def flush\n my_hand.group_by(&:suit).select { |_, hand_of_suit| hand_of_suit.count == 5 }.values.flatten\n end", "def sweep_stairs\n climb_stair\n pick_beeper\n climb_stair\n pick_beeper\n climb_stair\n pick_beeper\n turn_off\n end", "def turn_over\n if @turn == @black\n @turn = @white\n else\n @turn = @black\n end\n @hashes << generate_hash\n end", "def test_reshuffle_discard_into_draw\n # drain the draw pile into the discard pile\n while [email protected]_pile.is_empty?\n @manager.discard_top_card\n end\n assert_equal([], @manager.draw_pile.cards)\n assert_not_equal([], @manager.discard_pile.cards)\n\n @manager.reshuffle_discard_into_draw\n\n # draw pile should have cards and discard pile should be empty again\n assert_equal([], @manager.discard_pile.cards)\n assert_not_equal([], @manager.draw_pile.cards)\n end", "def save_card_into_player_win(player)\n cont = @cards_thrown.length - 1\n while cont >= 0\n card = @cards_thrown[cont]\n player.cards_wins.push(card)\n @cards_thrown.delete_at(cont)\n cont -= 1\n end\n end", "def make_discards(player, list_of_allies, list_of_axis)\n complete_squads = player.player_hand.completes\n complement_squads = player.player_hand.complementable\n wildcards = player.player_hand.wildcards\n\n # We need to make sure that we don't make attacks with squadrons that have already been used\n complete_squads = player.remove_used_squads(complete_squads, list_of_allies, list_of_axis)\n complement_squads = player.remove_used_squads(complement_squads, list_of_allies, list_of_axis)\n\n # Look through complement squadrons and go ahead and add\n # WildCards to them. If we don't have enough WildCards, well then\n # just make some up.\n complement_squads.each{|squadron|\n if wildcards.size > 0\n if wildcards.size >= 2 && squadron.list_of_cards.size == 1\n squadron.push!(wildcards.shift)\n squadron.push!(wildcards.shift)\n elsif wildcards.size > 1 && squadron.list_of_cards.size == 2\n squadron.push!(wildcards.shift)\n else\n squadron.push!(Keepem.new(Image.new(\"keepem.gif\"), rand(5)+1))\n end\n end\n }\n \n # Combine the two lists of Squadrons\n all_squads = complete_squads.dup.concat(complement_squads)\n\n # Now we go through and make sure all the Squadrons\n # are complete.\n all_squads.find_all {|squadron| squadron.squadron_complete? }\n end", "def deal_hand(players)\n players.each do |player|\n player.clear_hand\n end\n\n 2.times do \n players.each do |player|\n deal_card(player)\n end\n end\n end", "def deal(round)\n round_int = round.to_i\n case round_int\n when 0\n self.players.each do |player|\n move_card(get_random_card, player.location) # moves cards to users\n move_card(get_random_card, player.location)\n # player.in_hand = true\n player.save\n end\n addBlinds()\n when 1\n self.current_player = get_next_player(self.dealer)\n move_card(get_random_card, 0) #moves cards to table\n move_card(get_random_card, 0)\n move_card(get_random_card, 0)\n when 2\n self.current_player = get_next_player(self.dealer)\n move_card(get_random_card, 0)\n when 3\n self.current_player = get_next_player(self.dealer)\n move_card(get_random_card, 0)\n when 4\n get_winners()\n else\n p 'deal case > 4 or < 0, error'\n end\n\n self.players.each do |player|\n player.in_pot_current = 0\n player.save\n end\n if round_int > 0 && round_int < 4\n self.high_bet = 0\n self.high_better = self.current_player\n end\n self.save\n end", "def reset_self\r\n @hole_cards = []\r\n @folded = false\r\n @bet = 0\r\n end", "def fold_hand\n @active_players[0].folded = true\n pot_adjustment\n @active_players[0].current_bet = 0\n @active_players[0].acted = false\n system 'clear'\n puts 'You have folded your hand.'\n sleep(3)\nend", "def close_game\n total_buy_in = @game.statuses.where(status: [0, 3]).size * @game.buy_in\n rate = [0.5, 0.3, 0.2]\n @ranking[0..2].each_with_index do |r, i|\n cashier = r.player.cashier\n cashier.money += total_buy_in * rate[i]\n cashier.save!\n end\n @game.update!(game_close_params)\n end", "def displace_to_waste\n @areas[:waste].add_from(@pile, @card)\n end", "def hands\n dealer.hand = []\n player.hand = []\n end", "def sweep_stairs\n turn_off\n end", "def take_turn\n turn_over = false\n until turn_over\n last_rank = ask_for_cards_until_go_fish_and_get_last_requested_rank\n\n end\n player.lay_down_books\n end", "def set_won?\n if @games_won == 6 && @opponent.games_won < 5\n @sets_won += 1\n @games_won = 0\n @opponent.games_won = 0\n end\n if @games_won == 7 && @opponent.games_won < 7\n @sets_won += 1\n @games_won = 0\n @opponent.games_won = 0\n end\n end", "def deal\n end_round()\n shuffle()\n rounds_dealt = 0\n while rounds_dealt < @hand_size\n @players.each do | player |\n if card = @deck.draw()\n player.hand << card\n else\n return\n end\n end\n rounds_dealt += 1\n end\n end", "def deal\n hit = bjdeck.draw\n self.player_hand << hit\n hit = bjdeck.draw\n self.computer_hand << hit\n end", "def kick_player([email protected])\n @turn_timer = nil\n announce \"#{Bold}#{player.user}#{Bold}: You have been \" +\n \"dropped from #{DOS} ...#{REMARK.sample}\"\n if @players.length >= 3\n next_turn if player == @players.first\n debug @stock.length\n while player.cards.length > 0\n @stock.insert(rand(@stock.length), player.cards.shift)\n end\n debug @stock.length\n @dropouts << @players.delete_one(player)\n else\n # Don't dump the kicked player's cards. We\n # need those to count the winner's earnings.\n debug @stock.length\n while @players.last.cards.length > 0\n @stock.insert(rand(@stock.length), @players.last.cards.shift)\n end\n debug @stock.length\n next_turn\n end_game\n end\n end", "def record_won_game!\n if @game_points >= 5 && @game_points >= @opponent.game_points + 2\n\n record_won_set!\n end\n end", "def hand_of_poker\n players_in_hand = @players.dup\n @players.each {|player| deal(player, 5)}\n remaining_players = betting_round(players_in_hand)\n unless remaining_players.count == 1\n exchange_cards\n remaining_players = betting_round(remaining_players)\n unless remaining_players.count == 1\n remaining_players = compare_hands(remaining_players)\n end\n end\n winner = remaining_players.first\n puts \"#{winner.name} wins!\"\n print \"\\n\\n\\n\"\n pay_out(winner)\n reset_deck\n end", "def reset\n @shoe = Shoe.new(7)\n player.hand.clear;\n player.bust = false\n dealer.hand.clear;\n dealer.bust = false\n play\n end", "def test_award_spoils_pile_to_winner_in_basic_turn_type\n # for basic type turn\n card1 = Card.new(:heart, 'Jack', 11)\n card2 = Card.new(:heart, '10', 10)\n card3 = Card.new(:heart, '9', 9)\n card4 = Card.new(:diamond, 'Jack', 11)\n card5 = Card.new(:heart, '8', 8)\n card6 = Card.new(:diamond, 'Queen', 12)\n card7 = Card.new(:heart, '3', 3)\n card8 = Card.new(:diamond, '2', 2)\n deck1 = Deck.new([card1, card2, card5, card8])\n deck2 = Deck.new([card3, card4, card6, card7])\n player1 = Player.new(\"Megan\", deck1)\n player2 = Player.new(\"Aurora\", deck2)\n turn = Turn.new(player1, player2)\n\n turn_winner = turn.winner\n turn.pile_cards\n turn.award_spoils(turn_winner)\n # using .any will make sure that the order of cards doesn't matter, just that they are included or not\n assert_equal false, ([card2, card5, card8, card1, card3] & [turn.player1.deck.cards]).any?\n end", "def update_hands\n\t\tplayers.each do |player|\n\t\t\tnext if player.folded?\n\t\t\tdiscard_idx = player.get_discard\n\t\t\tplayer.update_hand(discard_idx, @deck)\n\t\tend\n\tend", "def play\n 2.times {deal}\n blind_score\n if player_hand.collect{|x| x.value}.inject(:+) == 21\n bjwin\n elsif computer_hand.collect{|x| x.value}.inject(:+) == 21\n bjlose\n else\n action\n end\n end", "def winner\n n = rand(@eligibles.size)\n result = @eligibles[n]\n @eligibles.delete_at(n)\n File.open(DATA_PATHS[:eligibles], \"w\") do |file|\n YAML.dump(@eligibles, file)\n end\n @winners << result\n File.open(DATA_PATHS[:winners], \"w\") do |file|\n YAML.dump(@winners, file)\n end\n result\n end", "def start\n if first_game == true\n puts \"Welcome to Blackjack!\"\n end\n self.money -= 10\n puts money\n 2.times do\n player_hand << game_deck.draw\n dealer_hand << game_deck.draw\n end\n puts \"Player hand is:\"\n puts player_hand\n puts \"Dealer hand is:\"\n puts dealer_hand\n end", "def new_game\n @shots = []\n boats = []\n\n BOAT_SIZES.each do |size|\n boats << place_boat(size, boats)\n end\n boats\n end", "def won_set(player)\n if player.games_won >= 6 and player.opponent.games_won < 5\n player.sets_won += 1\n @player1.games_won = 0\n @player2.games_won = 0\n won_match(player)\n elsif player.games_won == 7\n player.sets_won += 1\n @player1.games_won = 0\n @player2.games_won = 0\n won_match(player)\n end\n end", "def play_through_set_of_games()\n while get_played_games() < get_max_games() do\n reset_player_weapons()\n set_battle()\n puts battle_outcome()\n set_played_games()\n end\n end", "def dealer_turn\n if win_state == CHECK\n do_hit_or_stay(players[0])\n end\n end", "def record_won_set!\n reset_points\n reset_game_points \n \n @set_points +=1\n end", "def check_win\n win = true\n # For each ship check if none of the hit key values is 0(is not sunk). If false game isn't over.\n ships.each do |s|\n sink = s.position.detect { |p| p[:hit] == 0 }\n if !sink.nil?\n win = false\n break\n end\n end\n if win\n puts 'Whoop Whoop!!'\n end\n win\n\n end", "def update_game(prize)\n action = bot_action\n\n if last_turn?\n prize[:final] = true\n prize[:action] = \"OPENED\"\n prize[:stolen] = false\n @game[prize[:id]] = prize\n elsif action == \"open\"\n prize[:finished] = true\n prize[:action] = \"OPENED\"\n prize[:stolen] = false\n @game[prize[:id]] = prize\n elsif action == \"steal_bot\"\n # Grab random index from array where finished\n random = [*0..finished_count - 1]\n random = random - [winner_prize[:id]] if winner_prize[:id] < finished_count\n index = random.sample\n bot_prize = @game[index]\n #set action\n prize[:action] = \"STOLEN\"\n bot_prize[:action] = \"DECIDING...\"\n #swap prizes\n temp_prize = prize[:prize]\n prize[:prize] = bot_prize[:prize]\n bot_prize[:prize] = temp_prize\n # set status\n prize[:finished] = true\n bot_prize[:finished] = false\n prize[:stolen] = false\n bot_prize[:stolen] = true\n #set game\n @game[prize[:id]] = prize\n @game[index] = bot_prize\n\n prize = bot_prize\n else\n # Grab index of user from array\n index = @game.find_index{ |item| !item[:bot]}\n bot_prize = @game[index]\n #set action\n prize[:action] = \"STOLEN\"\n bot_prize[:action] = \"DECIDING...\"\n #swap prizes\n temp_prize = prize[:prize]\n prize[:prize] = bot_prize[:prize]\n bot_prize[:prize] = temp_prize\n # set status\n prize[:finished] = true\n bot_prize[:finished] = false\n prize[:stolen] = false\n bot_prize[:stolen] = true\n #set game\n @game[prize[:id]] = prize\n @game[index] = bot_prize\n\n prize = bot_prize\n end\n\n cache.write(@key, @game, expires_in: 24.hours)\n prize\n end", "def clear_hands\n @player_hand = []\n @dealer_hand = []\n end", "def make_discards(player, list_of_allies, list_of_axis)\n complete_squads = player.player_hand.completes\n complement_squads = player.player_hand.complementable\n wildcards = player.player_hand.wildcards\n\n # We need to make sure that we don't make attacks with squadrons that have already been used\n complete_squads = player.remove_used_squads(complete_squads, list_of_allies, list_of_axis)\n complement_squads = player.remove_used_squads(complement_squads, list_of_allies, list_of_axis)\n\n # Look through complement squadrons and go ahead and add\n # WildCards to them.\n complement_squads.each{|squadron|\n if wildcards.size > 0\n if wildcards.size >= 2 && squadron.list_of_cards.size == 1\n squadron.push!(wildcards.shift)\n squadron.push!(wildcards.shift)\n else\n squadron.push!(wildcards.shift)\n end\n end\n }\n \n # Combine the two lists of Squadrons\n all_squads = complete_squads.dup.concat(complement_squads)\n\n # Now we go through and make sure all the Squadrons\n # are complete and are bombers.\n all_squads.find_all {|squadron| squadron.squadron_complete? && squadron.squadron_bomber? }\n end", "def deal_turn\n @pokerdeck.pop\n turn = @pokerdeck.pop\n @communal_cards << turn\n return turn\n end", "def draw\n player = @round_player_order[0]\n raise 'draw called when deck empty' if @deck.empty?\n player.add_to_hand(@deck.shift)\n\n player.protected = false\n\n # Player died due to having 7\n if @minister_death && player.ministered?\n bad_hand = player.hand.map(&:to_s).join(' and ')\n\n kill_player(player)\n\n if @game_winner\n # This led to a game winner. Do nothing else.\n elsif @round_winners.size >= @round\n # We found a round winner by sole survivor.\n elsif @deck.empty?\n # Deck is empty. Time to compare cards.\n compare_cards\n else\n # Move on to the next player's turn\n draw\n end\n return [player.name, bad_hand]\n end\n\n [nil, nil]\n end", "def battle\r\n\t\tcooldown = 0\r\n\t\twhile(!@battle_end) do\r\n\t\t\tcreate_turn_update_record(@turn)\r\n\t\t\t@champ_speeds.each do |x|\r\n\t\t\t\tcreate_hp_update_record\r\n\r\n\t\t\t\t# x is @team's champions\r\n\t\t\t\tif(x < 5)\r\n\t\t\t\t\tin_front = team_dead(@team)\r\n\t\t\t\t\tnum_alive_in_front = in_front[0...x].count(false)\r\n\t\t\t\t\trange = @team[x].range\r\n\t\t\t\t\tname = @team[x].name\r\n\t\t\t\t\tRails.logger.debug \"Alive in front on team for #{name}: #{num_alive_in_front} Range: #{range}}\"\r\n\r\n\t\t\t\t\tif range <= num_alive_in_front\r\n\t\t\t\t\t\tRails.logger.debug \"Nothing in range for #{name}\"\r\n\t\t\t\t\t\tcreate_nothing_in_range_record(x,range,num_alive_in_front)\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\topp_in_front = team_dead(@opp_team)\r\n\t\t\t\t\t\trange_left = range - num_alive_in_front\r\n\t\t\t\t\t\tRails.logger.debug \"Range: #{range} Range Left: #{range_left}\"\r\n\t\t\t\t\t\tnum_opp_alive = opp_in_front.count(false)\r\n\t\t\t\t\t\tRails.logger.debug \"Number of opponents alive: #{num_opp_alive}\"\r\n\t\t\t\t\t\tif range_left <= num_opp_alive\r\n\t\t\t\t\t\t\tnum_opp_alive = range_left\r\n\t\t\t\t\t\t\tRails.logger.debug \"Targets for randomming decreased from #{num_opp_alive} to the range: #{range_left}\"\r\n\t\t\t\t\t\tend\r\n\r\n\t\t\t\t\t\trandom_target = randomized_target(num_opp_alive)\r\n\t\t\t\t\t\tRails.logger.debug \"Random Target: #{random_target}\"\r\n\r\n\t\t\t\t\t\ttarget = -1\r\n\t\t\t\t\t\ttemp = -1\r\n\t\t\t\t\t\tfor y in 0..4\r\n\t\t\t\t\t\t\tif (!opp_in_front[y])\r\n\t\t\t\t\t\t\t\ttemp += 1\r\n\t\t\t\t\t\t\t\tRails.logger.debug \"#{@opp_team[y].name} is alive in front of #{name}\"\r\n\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\t\tif(temp == random_target)\r\n\t\t\t\t\t\t\t\ttarget = y\r\n\t\t\t\t\t\t\t\tRails.logger.debug \"temp: #{temp} y: #{y} random_target: #{random_target}\"\r\n\t\t\t\t\t\t\t\tbreak\r\n\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\t\tRails.logger.debug \"Thus the target is: #{@opp_team[target].name} at position: #{target}\"\r\n\r\n\t\t\t\t\t\tcreate_champion_turn_record(x,target + 5)\r\n\t\t\t\t\t\t# Ability power attack\r\n\t\t\t\t\t\tif(cooldown == 0)\r\n\r\n\t\t\t\t\t\t\t# Handle ability attack\r\n\t\t\t\t\t\t\tchamp_ap = @team[x].ap\r\n\t\t\t\t\t\t\tcreate_ability_power_record(x,champ_ap)\r\n\r\n\t\t\t\t\t\t\tchamp_mr = @opp_team[target].mr\r\n\t\t\t\t\t\t\tcreate_mr_record(champ_mr,target + 5)\r\n\r\n\t\t\t\t\t\t\tdamage = @opp_team[target].take_magic_damage(champ_ap)\r\n\t\t\t\t\t\t\tcreate_damage_record(x,damage,target + 5)\r\n\t\t\t\t\t\t\tcreate_just_dead_record(x,target + 5) if @opp_team[target].just_died?\r\n\t\t\t\t\t\telse\r\n\r\n\t\t\t\t\t\t\t# Handle physical attack\r\n\t\t\t\t\t\t\tchamp_ad = @team[x].ad\r\n\t\t\t\t\t\t\tcreate_attack_damage_record(x,champ_ad)\r\n\r\n\t\t\t\t\t\t\tchamp_ar = @opp_team[target].armor\r\n\t\t\t\t\t\t\tcreate_armor_record(champ_ar, target + 5)\r\n\r\n\t\t\t\t\t\t\tdamage = @opp_team[target].take_physical_damage(champ_ad)\r\n\t\t\t\t\t\t\tcreate_damage_record(x,damage,target + 5)\r\n\t\t\t\t\t\t\tcreate_just_dead_record(x,target + 5) if @opp_team[target].just_died?\r\n\t\t\t\t\t\tend\t\t\t\t\r\n\t\t\t\t\tend\r\n\r\n\t\t\t\t\t\r\n\r\n\t\t\t\telse # x > 5\r\n\t\t\t\t\t# x is @opp_team's champions\r\n\t\t\t\t\t\r\n\t\t\t\t\tin_front = team_dead(@opp_team)\r\n\t\t\t\t\tnum_alive_in_front = in_front[0...(x-5)].count(false)\r\n\t\t\t\t\trange = @opp_team[x-5].range\r\n\t\t\t\t\tname = @opp_team[x-5].name\r\n\t\t\t\t\tRails.logger.debug \"Alive in front for #{name}: #{num_alive_in_front} Range: #{range}\"\r\n\r\n\t\t\t\t\tif range <= num_alive_in_front\r\n\t\t\t\t\t\tRails.logger.debug \"Nothing in range for #{name}\"\r\n\t\t\t\t\t\tcreate_nothing_in_range_record(x,range,num_alive_in_front)\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\topp_in_front = team_dead(@team)\r\n\t\t\t\t\t\trange_left = @opp_team[x-5].range - num_alive_in_front\r\n\t\t\t\t\t\tRails.logger.debug \"Range: #{range} Range Left: #{range_left}\"\r\n\t\t\t\t\t\tnum_opp_alive = opp_in_front.count(false)\r\n\t\t\t\t\t\tRails.logger.debug \"Number team alive: #{num_opp_alive}\"\r\n\t\t\t\t\t\tif range_left <= num_opp_alive\r\n\t\t\t\t\t\t\tnum_opp_alive = range_left\r\n\t\t\t\t\t\t\tRails.logger.debug \"Targets for randomming decreased from #{num_opp_alive} to #{range_left}\"\r\n\t\t\t\t\t\tend\r\n\r\n\t\t\t\t\t\trandom_target = randomized_target(num_opp_alive)\r\n\t\t\t\t\t\tRails.logger.debug \"Random Target: #{random_target}\"\r\n\r\n\t\t\t\t\t\ttarget = -1\r\n\t\t\t\t\t\ttemp = -1\r\n\t\t\t\t\t\tfor y in 0..4\r\n\t\t\t\t\t\t\tif (!opp_in_front[y])\r\n\t\t\t\t\t\t\t\ttemp += 1\r\n\t\t\t\t\t\t\t\tRails.logger.debug \"#{@team[y].name} is alive in front of #{name}\"\r\n\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\t\tif(temp == random_target)\r\n\t\t\t\t\t\t\t\ttarget = y\r\n\t\t\t\t\t\t\t\tRails.logger.debug \"temp: #{temp} y: #{y} random_target: #{random_target}\"\r\n\t\t\t\t\t\t\t\tbreak\r\n\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\t\tRails.logger.debug \"Thus the target is: #{@team[target].name} at position: #{target}\"\r\n\r\n\r\n\t\t\t\t\t\tcreate_champion_turn_record(x,target)\r\n\r\n\t\t\t\t\t\tif(cooldown == 0)\r\n\r\n\t\t\t\t\t\t\tchamp_ap = @opp_team[x-5].ap\r\n\t\t\t\t\t\t\tcreate_ability_power_record(x,champ_ap)\r\n\r\n\t\t\t\t\t\t\tchamp_mr = @team[target].mr\r\n\t\t\t\t\t\t\tcreate_mr_record(champ_mr,target)\r\n\r\n\t\t\t\t\t\t\tdamage = @team[target].take_magic_damage(champ_ap)\r\n\t\t\t\t\t\t\tcreate_damage_record(x,damage,target)\r\n\t\t\t\t\t\t\tcreate_just_dead_record(x,target) if @team[target].just_died?\r\n\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tchamp_ad = @opp_team[x-5].ad\r\n\t\t\t\t\t\t\tcreate_attack_damage_record(x,champ_ad)\r\n\r\n\t\t\t\t\t\t\tchamp_ar = @team[target].armor\r\n\t\t\t\t\t\t\tcreate_armor_record(champ_ar, target)\r\n\r\n\t\t\t\t\t\t\tdamage = @team[target].take_physical_damage(champ_ad)\r\n\t\t\t\t\t\t\tcreate_damage_record(x,damage,target)\r\n\t\t\t\t\t\t\tcreate_just_dead_record(x,target) if @team[target].just_died?\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\tend\r\n\r\n\r\n\t\t\t\tend\r\n\t\t\t\tbreak if create_battle_end_record\r\n\t\t\tend\r\n\t\t\t@turn = @turn + 1\r\n\t\t\tcooldown = cooldown + 1\r\n\t\t\tcooldown = 0 if cooldown == 3\r\n\t\t\tbreak if create_battle_end_record\r\n\t\tend\r\n\tend", "def battle(trainer_collection,enemy_collection)\n keep_fighting = true\n # Create copies of collections, as we remove elements\n trainer_collection = trainer_collection.collect{|k| k }\n enemy_collection = enemy_collection.collect{|k| k }\n \n while trainer_collection.any? && enemy_collection.any? && keep_fighting\n puts \"You have #{trainer_collection.length} kudomon ready to fight.\"\n # Select random kudomon from collections to fight each other\n trainer_kudomon = trainer_collection.sample\n enemy_kudomon = enemy_collection.sample\n # Remove losing kudomon from collection\n if kudomon_battle(trainer_kudomon,enemy_kudomon)\n enemy_collection.delete(enemy_kudomon)\n else\n trainer_collection.delete(trainer_kudomon)\n end\n \n if trainer_collection.any? && enemy_collection.any?\n puts \"Do you want to keep fighting? Y/N\"\n unless gets.chomp.capitalize == \"Y\"\n keep_fighting = false\n puts \"You run away.\"\n return RUN_AWAY\n end\n elsif trainer_collection.empty?\n puts \"You lost.\"\n return LOSS\n else\n puts \"You won! Awesome!\"\n return VICTORY\n end\n end\nend", "def turn\n #I always start a turn by show the player the latest values of all the piles by calling my showPiles function\n showPiles()\n\n #Here i set some out-of-bounds defaults so that the until statements start false, allowing the player to make their choice\n take = -1\n pile = -1\n sum = 0\n\n #at the start of the turn I check if the sum of the sticks in all the piles is 0 or less, indicating that there are no more moves to make and this player has won\n $piles.each do |i|\n sum += i.count\n end\n if sum <= 0\n puts $name.to_name + \", You win!!\"\n return #this return is to exit the turn function returning to the rest of the code which is empty, essentially stopping the game now that it has been determined to be won and over.\n end\n\n #this ensures that the pile chosen is a valid number,because until it is it wont stop asking\n until pile.between?(0,2)\n print $name.to_name + \", Choose a pile:\"\n pile = gets.chomp().to_i\n end\n\n #this ensures that the pile chosen isnt already empty by restarting the turn if the chosen piles count is 0 or less\n if $piles[pile].count <= 0\n puts \"That pile is already empty, try again\"\n turn()\n return\n end\n\n #this ensures that the pile chosen has enough sticks in it to complete the users move of taking their defined sticks.\n until take.between?(1,$piles[pile].count)\n print \"How many to remove from pile \" + pile.to_s + \":\"\n take = gets.chomp().to_i\n end\n\n #this will only be ran once everything above it has been determined the move to be a plausible move, and calls the take function for the users decided sticks from their decided pile\n $piles[pile].take(take)\n\n #this inverts the name boolean so that it will show the next players name on the next turn\n $name = !$name\n #this begins the next players turn by calling the turn function, now that this players turn is done\n turn()\nend", "def reset\n generate_secret\n @solved = false\n @out_of_turns = false\n @index = 0\n @data = []\n i = 0\n while i < @turns\n hash = {\n pegs: [nil, nil, nil, nil],\n key: nil\n }\n @data.push(hash.dup)\n i = i + 1\n end\n end", "def clean_up_battle\n for window in @windows.values\n next if window == nil #skill all already disposed items.\n window.visible = false#hide all windows\n window.active = false #disable all windows\n end\n \n for battler in tactics_all\n battler.clear_tbs_actions #clear actions\n battler.tbs_battler = false #clear in battle flag\n add_remove_invited(battler) #check and add 'invited' actors to the team\n remove_dead_actors if GTBS::Dead_Actors_Leave\n end\n end", "def win\r\n\t\tfor i in 1..@mines do\r\n\t\t\tx=@mine[i].x\r\n\t\t\ty=@mine[i].y\r\n\t\t\t\r\n\t\t\tremove_pic(@field[x][y])\r\n\t\t\tadd_pic(@field[x][y],F_flag)\r\n\t\tend\r\n\t\t\r\n\t\t@start_button.remove(@actual_face)\r\n\t\t@actual_face=@image[Win]\r\n\t\t@start_button.add(@actual_face)\r\n\t\t\r\n\t\t@game_status=FINISHED\r\n\t\t\r\n\t\[email protected]_all\n\t\tif @closed_fields==@mines and !@endless_time #won\r\n\t\t\tprozent=(@progress_bar.fraction * 100) / @time_multiplicator\r\n\t\t\t\r\n\t\t\tnew_highscore(@max_time - (@actual_time - @start_time),prozent)\r\n\t\tend\r\n\tend", "def full_battle(w1, w2)\n w1.heal\n w2.heal\n\n attacker = w1\n defender = w2\n\n puts \"#{w1.name} vs #{w2.name}\"\n\n while w1.alive? && w2.alive? #both alive FIGHT!\n damage_done = damage(attacker, defender)\n defender.take_dmg(damage_done)\n\n puts log(attacker, defender, damage_done)\n\n #swap attacker and defender\n attacker, defender = [defender, attacker]\n end\n\n if w1.alive?\n puts \"#{w1.name} Wins!\"\n w1\n else\n puts \"#{w2.name} Wins!\"\n w2\n end\n end", "def win_actions\n @i.cls\n @i.show_balance(@user)\n @i.show_cards(@open, @user, @croupier)\n @i.winner_msg(@user, @croupier, @winner) if @winner == @user || @winner == @croupier\n @i.winner_msg(@user, @croupier, @draw) if @winner == @draw\n\n # balance\n @winner.balance += @bank if @winner == @user || @winner == @croupier\n if @winner == @draw\n @user.balance += 10\n @croupier.balance += 10\n end\n # play again\n if check_end\n @i.cls\n @winner = nil\n @bank = 0\n @open = false\n @loser = nil\n # start new game\n else\n # exit from the program\n @again = false\n end\n end", "def find_shareholders(acquired_hotel, acquired_hotel_size)\n hotel_name = acquired_hotel.name\n most_shares = 0\n second_most_shares = 0\n majority_player = 'none'\n minority_player = 'none'\n tie_for_first = 'none'\n tie_for_second = 'none'\n self.game_players.each do |player|\n count = player.stock_cards.where(hotel: hotel_name).count\n if count > most_shares\n majority_player = player\n most_shares = count\n tie_for_first = 'none'\n elsif count = most_shares\n tie_for_first = player\n elsif count > second_most_shares\n minority_player = player\n second_most_shares = count\n tie_for_second = 'none'\n elsif count = second_most_shares\n tie_for_second = player\n end \n end\n\n\n if minority_player == 'none' && tie_for_first == 'none'\n minority_player = majority_player\n end\n\n\n give_bonuses(acquired_hotel, majority_player, minority_player, acquired_hotel_size, tie_for_first, tie_for_second)\n end", "def play_dealer(hand, shoe, odds, upcard_result)\n case decide(hand)\n when :stand\n upcard_result[result(hand)] += odds\n when :hit\n CARDS.each do |card|\n next unless shoe.any?(card)\n card_odds = shoe.odds_of(card)\n\n hand.push(card)\n shoe.consume(card)\n\n play_dealer(hand, shoe, odds * card_odds , upcard_result)\n\n shoe.replace(card)\n hand.pop\n end\n else\n raise \"error, illegal hand action\"\n end\nend", "def settle_round\n @io.prep_round_results\n for player in @players\n for hand in player.hands\n if player.is_dealer\n @io.show_hands(player)\n else\n # This shouldn't happen unless we quit in the middle of a hand\n # or we're playing god.\n if @dealer.hand.total < 17 and not @play_god\n @dealer.hand.play(@shoe)\n end\n \n # Use total_high in case our hand is soft\n if (hand.total_high > @dealer.hand.total and \\\n not hand.is_bust) or (@dealer.hand.is_bust and \\\n not hand.is_bust)\n if hand.is_bj and not hand.is_even_money\n player.win_bet((hand.bet * BLACKJACK_PAYS) + \\\n hand.bet)\n @dealer.pay(hand.bet * BLACKJACK_PAYS)\n else\n player.win_bet(hand.bet * 2)\n @dealer.pay(hand.bet)\n end\n @io.player_wins(player, hand)\n elsif hand.total_high == @dealer.hand.total\n if hand.is_bj and hand.is_even_money\n player.win_bet(hand.bet * 2)\n @dealer.pay(hand.bet)\n @io.player_wins(player, hand)\n else\n player.win_bet(hand.bet)\n @io.player_pushes(player, hand)\n end\n else\n @dealer.win_bet(hand.bet)\n @io.player_loses(player, hand)\n end\n end\n end\n player.finish_round\n end\n\n # Check to see if player is out of money, or doesn't have min_bet\n for player in @players\n unless player.is_dealer\n if player.bankroll == 0 or player.bankroll < @min_bet\n @io.player_out_of_money(player, @min_bet)\n @broke_players[@broke_players.length] = player\n @players.delete(player)\n throw :quit if @players.length == 1\n end\n end\n end\n end", "def call_gameover\n\t\t@is_gameover = true\n\tend", "def restock_hand!\n return if Bot::CONFIG.hand_size == unplayed_cards.count\n (Bot::CONFIG.hand_size - unplayed_cards.count).times do\n add_player_card PlayerCard.create(answer: game.available_answers.sample)\n end\n end", "def war\n \n until winner?(self.player1,self.player2)\n 4.times do \n player1.play\n player2.play\n end\n end\n\n handle_winner(self.player1,self.player2)\n\n end", "def dealer_bust\n puts \"The dealer busted. You win\"\n player_win\n end", "def win_payout(symbol)\n p = {player: (session[:bet] * 2),\n blackjack: (session[:bet] * 2.5).round,\n push: session[:bet],\n dealer: 0}[symbol]\n @printer << \"#{p} Chips for #{session[:player].gender}. #{session[:player].name}\" if p != 0\n session[:player].chips += p\n nil\n end", "def make_discards(player, list_of_allies, list_of_axis)\n complete_squads = player.player_hand.completes\n complement_squads = player.player_hand.complementable\n wildcards = player.player_hand.wildcards\n\n # We need to make sure that we don't make attacks with squadrons that have already been used\n complete_squads = player.remove_used_squads(complete_squads, list_of_allies, list_of_axis)\n complement_squads = player.remove_used_squads(complement_squads, list_of_allies, list_of_axis)\n\n # Look through complement squadrons and go ahead and add\n # WildCards to them.\n complement_squads.each{|squadron|\n if wildcards.size > 0\n if wildcards.size >= 2 && squadron.list_of_cards.size == 1\n squadron.push!(wildcards.shift)\n squadron.push!(wildcards.shift)\n else\n squadron.push!(wildcards.shift)\n end\n end\n }\n \n # Combine the two lists of Squadrons\n all_squads = complete_squads.dup.concat(complement_squads)\n\n # Now we go through and make sure all the Squadrons\n # are complete.\n all_squads.find_all {|squadron| squadron.squadron_complete? }\n end", "def change_turn\n @turn += 1\n @this_players_turn = @players.reject{|x| x == @this_players_turn}[0]\n take_turn(@this_players_turn)\n end", "def won_set\n if @opponent.games_won == 6 && @games_won == 7\n @games_won = 0\n @sets_won += 1\n elsif @games_won > 4 && @games_won > @opponent.games_won + 1\n @games_won = 0\n @sets_won += 1\n end\n\n @matches_won += 1 if won_match?\n end", "def full_battle(ship, ship2)\n while ship.hull > 0 and ship2.hull > 0 do\n if battle(ship, ship2)\n \n\n end \n return ship.hull > ship2.hull \nend\n \n\n## Game Setup\n$enemies = enemy_fleet\n$you = Ship.new(20, 5, 0.7)\n\n## Game Loop Function\ndef game_loop()\n puts(\"Welcome to Space Battle, you are on the USS Schwarzenegger and six ships have come to attack\")\n # While $enemies still exist in enemy fleet battle the next ship\n while(full_battle($you, $enemies[0]))\n ## remove defeated ship from list\n $enemies.shift\n p $you.hull \n ## If no $enemies left, you win\n if ($enemies.length <= 0)\n puts(\"you have defeated the enemy fleet!\")\n break\n end\n ## Ask user if they want escape\n puts(\"type 'escape' if you want to escape or battle next ship\") \n if(gets.chomp.to_i == \"escape\")\n puts(\"You have escaped\")\n end\n puts(\"You face the next enemy ship\")\n end\nend", "def set_other_games_won()\n @score_count.set_other_games_won()\n end", "def addBlinds()\n s_blind_loc = get_next_player(self.dealer) # location of small blind player\n b_blind_loc = get_next_player(s_blind_loc) # location of big blind player\n # get player data for small and big blind locations\n s_blind_player = get_player(s_blind_loc) # actual players to change money\n b_blind_player = get_player(b_blind_loc)\n # put money from small and big blind players into pot\n put_money(self.small_blind, s_blind_player)\n put_money(self.big_blind, b_blind_player)\n self.current_player = get_next_player(b_blind_loc)\n b_blind_player.save\n s_blind_player.save\n self.save\n end", "def deal_hand\n 3.times do \n @players.each do |player|\n player.hand.draw_card\n end\n end\n end", "def reset_player_weapons()\n set_weapon()\n set_other_weapon()\n end" ]
[ "0.7989136", "0.79856783", "0.76493084", "0.6606085", "0.6522562", "0.6490399", "0.6322059", "0.63137263", "0.629386", "0.62434965", "0.62399834", "0.6235189", "0.62285966", "0.6209173", "0.6191874", "0.6185417", "0.6176588", "0.61627334", "0.615147", "0.61152387", "0.6110302", "0.61101836", "0.60839427", "0.6068066", "0.6052445", "0.6048234", "0.6041183", "0.60382575", "0.60360044", "0.6014304", "0.5997651", "0.59919274", "0.59913754", "0.5991346", "0.59717935", "0.5960936", "0.59352946", "0.59230196", "0.59225273", "0.5921577", "0.5914854", "0.5914508", "0.5909363", "0.5908793", "0.59069157", "0.5904159", "0.59035265", "0.5899537", "0.5865605", "0.58651024", "0.58480436", "0.58462065", "0.5833313", "0.5832521", "0.58274823", "0.58129054", "0.5811093", "0.5809056", "0.5790016", "0.57857454", "0.57751656", "0.57649827", "0.57611364", "0.5755261", "0.57533115", "0.57503635", "0.5746385", "0.57368386", "0.5736581", "0.5733178", "0.5730195", "0.57215077", "0.5718836", "0.5709823", "0.57082385", "0.56994176", "0.569885", "0.56916094", "0.56890434", "0.5685558", "0.56835335", "0.5682175", "0.5681236", "0.56782013", "0.5675213", "0.5673387", "0.56625134", "0.56623036", "0.56618774", "0.5658837", "0.5657237", "0.5654285", "0.56481665", "0.5640851", "0.56393045", "0.5638842", "0.56367457", "0.5632135", "0.5630058", "0.5628327" ]
0.7811694
2
GET /foodvendors/1 GET /foodvendors/1.xml
def show @foodvendor = Foodvendor.includes(:nutritionals).find(params[:id]) respond_to do |format| format.html format.xml { render :xml => @foodvendor } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vendor }\n end\n end", "def show\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vendor }\n end\n end", "def show\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vendor }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @food }\n end\n end", "def show\n @vegetable = Vegetable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vegetable }\n end\n end", "def new\n @foodvendor = Foodvendor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @foodvendor }\n end\n end", "def show\n @service_version = ServiceVersion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service_version }\n end\n end", "def show\n @discovery = Discovery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def show\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vendor }\n end\n end", "def show\n \n @product = Product.find(params[:id])\n @vendors = @product.vendor(:all)\n #@vendors = Vendor.find(params[:id])\n #@vendors = Vendor.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def show\n\n @venue = Venue.find(params[:id])\n @concerts = Concert.where(:venue_id=>@venue.id)\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @venue }\n end\n end", "def show\n @services_charger = ServicesCharger.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @services_charger }\n end\n end", "def show\n @vehiculo = Vehiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vehiculo }\n end\n end", "def show\n @gear = Gear.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gear }\n end\n end", "def show\n @foodery = Foodery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @foodery }\n end\n end", "def show\n @filtro_vehiculo = FiltroVehiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @filtro_vehiculo }\n end\n end", "def index\n @service_versions = ServiceVersion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @service_versions }\n end\n end", "def show\n @ingredient = Ingredient.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @ingredient }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service }\n end\n end", "def show\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vehicle }\n end\n end", "def show\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vehicle }\n end\n end", "def index\n @car = Car.find(params[:car_id])\n @assets = @car.assets\n\n respond_to do |format|\n format.xml {render xml: @assets}\n format.json {render json: @assets}\n end\n end", "def index\n @vendors = Vendor.all\n end", "def index\n @vendors = Vendor.all\n end", "def index\n @vendors = Vendor.all\n end", "def show\n @voucher_offer = VoucherOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @voucher_offer }\n end\n end", "def show\n @vehicle = Vehicle.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vehicle }\n end\n end", "def show\n @vehicle_daily = VehicleDaily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vehicle_daily }\n end\n end", "def show\n @bom = Bom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bom }\n end\n end", "def show\n @gtfs_agency = GtfsAgency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gtfs_agency }\n end\n end", "def show\n @shelf = Shelf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shelf.to_xml(:include => :books) }\n end\n end", "def food_info(food_id)\n get(\"/foods/#{food_id}.json\")\n end", "def show\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end", "def show\n @saved_food = SavedFood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @saved_food }\n end\n end", "def show\n @visaapp = Visaapp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @visaapp }\n end\n end", "def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @venues }\n end\n end", "def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service }\n end\n end", "def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cliente }\n end\n end", "def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cliente }\n end\n end", "def index\n @paciente = Paciente.find(params[:paciente_id])\n @visitas = @paciente.visitas\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @visitas }\n end\n end", "def show\n @food = Food.find(params[:id]) or raise ActiveRecord::RecordNotFound\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @food.to_xml }\n end\n end", "def index\n @fridge_foods = FridgeFood.find_all_by_user_id(session[:user_id])\n\n logger.debug @fridge_food\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml # { render :xml => @fridge_foods }\n end\n end", "def show\n @client_app = ClientApp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @seed }\n end\n end", "def show\n @diet = Diet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @diet }\n end\n end", "def show\n @allergy = Allergy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @allergy }\n end\n end", "def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vehicles }\n end\n end", "def show\n @prd_etc = PrdEtc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prd_etc }\n end\n end", "def opensearch\n respond_to do |format|\n format.xml do\n render :layout => false\n end\n format.json do\n render :json => get_opensearch_response\n end\n end\n end", "def show\n @hotel = Hotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hotel }\n format.json { render :json => @hotel }\n end\n end", "def show\n if params[:servings]\n @recipe = @recipe.with_servings(params[:servings])\n end\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @recipe.to_xml }\n end\n end", "def show\n @vendor = Vendor.find(params[:id])\n @transactions = @vendor.transactions\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vendor }\n end\n end", "def show\n @app_version = @app.app_versions.find(params[:id])\n # @app_version = AppVersion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app_version }\n end\n end", "def show\n @venue_config = VenueConfig.get!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @venue_config }\n end\n end", "def show\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_vehiculo }\n end\n end", "def show\n @goods_auto_option = GoodsAutoOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @goods_auto_option }\n end\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def show\n @fleet = Fleet.find params[:fleet_id]\n @vehicle = @fleet.vehicles.find params[:vehicle_id]\n @vehicle_repair = @vehicle.vehicle_repairs.find params[:id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vehicle_repair }\n end\n end", "def getVendors\n fetch(@config[:sales_path], 'Sales.getVendors')\n end", "def show\n @vehiculoscancelacion = Vehiculoscancelacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vehiculoscancelacion }\n end\n end", "def vendors\n fetch(@config[:sales_path], 'Sales.getVendors')\n end", "def index\n @product_families = ProductFamily.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_families }\n end\n end", "def show\n @agencies = Agency.find(params[:id])\n\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n end\n end", "def show\n @lookup_pettracer = LookupPettracer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end", "def show\n @lookup_pettracer = LookupPettracer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end", "def show\n @vipconsumno = Vipconsumno.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vipconsumno }\n end\n end", "def index\n @goods_items = Goods::Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @goods_items }\n end\n end", "def show\n @caterogy = Caterogy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @caterogy }\n end\n end", "def show\n @components_front_lever = Components::FrontLever.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @components_front_lever }\n end\n end", "def show\n @goods_cost = GoodsCost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @goods_cost }\n end\n end", "def show\n @vendedor = Vendedor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vendedor }\n end\n end", "def show\n @voto = Voto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @voto }\n end\n end", "def show\n @estagio = Estagio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estagio }\n end\n end", "def show\n @vendedor = Vendedor.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vendedor }\n end\n end", "def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clientes }\n end\n end", "def show\n @goods_type = GoodsType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @goods_type }\n end\n end", "def show\n @goods_item = Goods::Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @goods_item }\n end\n end", "def show\n @conveniado = Conveniado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @conveniado }\n end\n end", "def show\n @sub_vehicle = SubVehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sub_vehicle }\n end\n end", "def show\n @composer = Composer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @composer }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.xml { render xml: @variate.to_xml }\n end\n end", "def opensearch\n respond_to do |format|\n format.xml do\n render :layout => false\n end\n format.json do\n render :json => get_opensearch_response\n end\n end\n end", "def find(vendor_id)\n @client.get(\"/#{@model}/#{vendor_id}\")\n end", "def index\n @restaurants = Restaurant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @restaurants }\n end\n end", "def show\n @gene_ontology = GeneOntology.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end", "def show\n @user_hotel = UserHotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_hotel }\n end\n end", "def index\n @vendors = Vendor.order(sort_column + \" \" + sort_direction) # tweaked\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vendors }\n end\n end", "def show\n @product_family = ProductFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_family }\n end\n end", "def show\n @cooking_ingredient = CookingIngredient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cooking_ingredient }\n end\n end", "def opensearch\n respond_to do |format|\n format.xml { render layout: false }\n format.json { render json: search_service.opensearch_response }\n end\n end", "def show\n # Check to see that a valid vendor id was sent in. If not, redirect to vendors index page\n if @vendor = Vendor.find_by(id: params[:id])\n # A valid vendor was passed via :id\n # get all reviews associated with this vendor\n @reviews = @vendor.vendor_reviews.paginate(:page => params[:page], :per_page => 5).order('created_at DESC')\n else\n flash[:warning] = \"The vendor you are looking for does not exist\"\n redirect_to vendors_path\n end\n end", "def show\n @revenu = @foyer.revenus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @revenu }\n end\n end", "def show\n @vaga = Vaga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vaga }\n end\n end", "def show\n @vigencia = Vigencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vigencia }\n end\n end", "def index\n @restaurants = Restaurant.all_by_name\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @restaurants }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @client }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => current_vurl }\n end\n end", "def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend", "def show\n @departamentos = Departamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @departamentos }\n end\n end", "def show\n @blueprint = Blueprint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @blueprint }\n end\n end", "def index\n @eversions = Eversion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @eversions }\n end\n end" ]
[ "0.65514237", "0.65514237", "0.65514237", "0.6262186", "0.6147516", "0.60391116", "0.59719956", "0.5912476", "0.5868273", "0.5859781", "0.58541846", "0.58537924", "0.58441746", "0.58174586", "0.5809936", "0.58011174", "0.5797672", "0.5784592", "0.57832646", "0.57800424", "0.57800424", "0.5779717", "0.57751703", "0.57751703", "0.57751703", "0.5774586", "0.5774141", "0.57697684", "0.57649386", "0.5762663", "0.57624125", "0.57597435", "0.57405394", "0.57378846", "0.5737812", "0.5737018", "0.57363653", "0.57328075", "0.57328075", "0.5729196", "0.5725774", "0.572574", "0.57170445", "0.5698769", "0.56987166", "0.5697185", "0.56917226", "0.56862164", "0.56859565", "0.5682722", "0.5676253", "0.5673457", "0.5660618", "0.5654954", "0.565067", "0.5643029", "0.56411594", "0.56406254", "0.56356716", "0.56352645", "0.56269455", "0.56252635", "0.56227285", "0.56227285", "0.56198967", "0.56172115", "0.5615161", "0.5612431", "0.5605134", "0.5602435", "0.5592268", "0.5588811", "0.55880255", "0.5587177", "0.5583153", "0.55785847", "0.5577295", "0.55755883", "0.5564498", "0.55632794", "0.5562839", "0.55559295", "0.5553927", "0.5547775", "0.5546206", "0.554323", "0.5542733", "0.55424345", "0.5537961", "0.5533772", "0.5532866", "0.55308485", "0.5528818", "0.5524507", "0.55171585", "0.55160195", "0.5513137", "0.5512771", "0.5512155", "0.550241" ]
0.624399
4
GET /foodvendors/new GET /foodvendors/new.xml
def new @foodvendor = Foodvendor.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @foodvendor } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @vendor = Vendor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vendor }\n end\n end", "def new\n @vendor = Vendor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vendor }\n end\n end", "def new\n @vendor = Vendor.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vendor }\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 @fridge_food = FridgeFood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fridge_food }\n end\n end", "def new\n @food = Food.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @food }\n end\n end", "def new\n @vegetable = Vegetable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vegetable }\n end\n end", "def new\n @venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @venue }\n end\n end", "def new\n @venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @venue }\n end\n end", "def new\n @venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @venue }\n end\n end", "def new\n @shelf = Shelf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shelf }\n end\n end", "def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end", "def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end", "def new\n @service = Service.new\n @vendors = Vendor.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end", "def new\n @saved_food = SavedFood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @saved_food }\n end\n end", "def new\n @service_version = ServiceVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service_version }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @brand }\n end\n end", "def new\n @novel = Novel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @novel }\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml\n end\n end", "def new\n @gig = Gig.new\n @venue = Venue.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gig }\n end\n end", "def new\n @vendor = Vendor.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vendor }\n end\n end", "def new\n @vendor = Vendor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vendor }\n end\n end", "def new\n @hotel = Hotel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hotel }\n end\n end", "def new\n @pet = Pet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pet }\n end\n end", "def create\n @foodvendor = Foodvendor.new(foodvendor_params)\n\n respond_to do |format|\n if @foodvendor.save\n flash[:notice] = 'Foodvendor was successfully created.'\n format.html { redirect_to(@foodvendor) }\n format.xml { render :xml => @foodvendor, :status => :created, :location => @foodvendor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @foodvendor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def new\n @prd_etc = PrdEtc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_etc }\n end\n end", "def new\n @vehicle = Vehicle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vehicle }\n end\n end", "def new\n @vehicle = Vehicle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vehicle }\n end\n end", "def new\n @vehicle = Vehicle.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vehicle }\n end\n end", "def new\n @venture = Venture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @venture }\n end\n end", "def new\n @gear = Gear.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gear }\n end\n end", "def new\n @foodery = Foodery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @foodery }\n end\n end", "def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end", "def new\n @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 @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service }\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service }\n end\n end", "def new\n @client_app = ClientApp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @seed }\n end\n end", "def new\n @vehiculo = Vehiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vehiculo }\n end\n end", "def new\n @blueprint = Blueprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blueprint }\n end\n end", "def new\n @hotel = Hotel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hotel }\n format.json { render :json => @hotel }\n end\n end", "def new\n @title = \"New Company\"\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @vendedor = Vendedor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vendedor }\n end\n end", "def new\n @vendedor = Vendedor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vendedor }\n end\n end", "def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cliente }\n end\n end", "def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cliente }\n end\n end", "def new\n @goods_type = GoodsType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goods_type }\n end\n end", "def new\n @promos = Promos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @promos }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @software }\n end\n end", "def new\n @produto = Produto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @produto }\n end\n end", "def new\n @produto = Produto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @produto }\n end\n end", "def new\n @family = Family.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family }\n end\n end", "def new\n @diet = Diet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @diet }\n end\n end", "def new\n @produto = ProdutoSimples.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @produto }\n end\n end", "def new\n @nossos_servico = NossosServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @vip_programmer_service }\n end\n end", "def new\n @gtfs_agency = GtfsAgency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gtfs_agency }\n end\n end", "def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def new\n @visaapp = Visaapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visaapp }\n end\n end", "def new\n @echo = Echo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @echo }\n end\n end", "def new\n @brand = Brand.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @brand }\n end\n end", "def new\n @plantilla = Plantilla.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @plantilla }\n end\n end", "def new\n @dogpark = Dogpark.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dogpark }\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 @composer = Composer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @composer }\n end\n end", "def new\n @page_id = \"services\"\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service }\n end\n end", "def new\n @volunteer = Volunteer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @volunteer }\n end\n end", "def new\n @volunteer = Volunteer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @volunteer }\n end\n end", "def new\n @shopping = Shopping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shopping }\n end\n end", "def new\n @services_charger = ServicesCharger.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @services_charger }\n end\n end", "def new\n @company = Company.new\n @regios = Regio.find(:all)\n @sectors = Sector.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @varietal = Varietal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @varietal }\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 @tipo_vehiculo = TipoVehiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_vehiculo }\n end\n end", "def new\n @vehicle_daily = VehicleDaily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vehicle_daily }\n end\n end", "def new\n @vipconsumno = Vipconsumno.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vipconsumno }\n end\n end", "def new\n @cloud = Cloud.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cloud }\n end\n end", "def new\n @village = Village.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @village }\n end\n end", "def new\n @village = Village.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @village }\n end\n end", "def new\n @village = Village.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @village }\n end\n end", "def new\n @restaurant = Restaurant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @restaurant }\n end\n end", "def new\n @restaurant = Restaurant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @restaurant }\n end\n end", "def new\n @shop = Shop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shop }\n end\n end", "def new\n respond_to do |format|\n format.html\n format.xml\n end\n end", "def new\n @product_family = ProductFamily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_family }\n end\n end", "def new\n @foyer = Foyer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @foyer }\n end\n end", "def new\n @production = Production.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @production }\n end\n end", "def new\n @goods_cost = GoodsCost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goods_cost }\n end\n end", "def new\n @vehicle_class = VehicleClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vehicle_class }\n end\n end", "def new\n @vicariato = Vicariato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vicariato }\n end\n end", "def new\n\t\tPesqSecDep()\n\t\t@cliente = Cliente.new\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml {render :xml => @cliente}\n\t\tend\n\tend", "def new\n @ponto = Ponto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end", "def new\n @good = Good.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @good }\n end\n end", "def new\n @vestimenta = Vestimenta.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vestimenta }\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 @conveniado = Conveniado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @conveniado }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product_software }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product_family_product }\n end\n end", "def new\n @docent = Docent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @docent }\n end\n end" ]
[ "0.7166079", "0.7166079", "0.71598727", "0.69522274", "0.69026744", "0.6828908", "0.6820713", "0.66991085", "0.66991085", "0.66991085", "0.66702574", "0.6605199", "0.66041684", "0.66003835", "0.6586549", "0.65826076", "0.657608", "0.6572374", "0.65672255", "0.6566757", "0.65445566", "0.6539067", "0.65367234", "0.65242666", "0.65051347", "0.6493023", "0.648191", "0.64693", "0.64693", "0.64662033", "0.6453643", "0.6451308", "0.64491373", "0.6445284", "0.64363104", "0.64363104", "0.64141476", "0.64141476", "0.6411451", "0.64022446", "0.63986605", "0.6396187", "0.6385642", "0.6383126", "0.6383126", "0.63764673", "0.63764673", "0.6375348", "0.63740796", "0.63738286", "0.6369076", "0.6369076", "0.6365475", "0.63647157", "0.63627416", "0.636071", "0.6339926", "0.6338015", "0.6335191", "0.6327316", "0.6326563", "0.6324374", "0.6315792", "0.63078624", "0.63071334", "0.6303502", "0.6303269", "0.6302343", "0.6302343", "0.62994564", "0.6299293", "0.62973547", "0.6289324", "0.6281887", "0.62782615", "0.6278015", "0.62768394", "0.6275386", "0.6274761", "0.6274761", "0.6274761", "0.62702626", "0.62702626", "0.6268227", "0.62668073", "0.62663823", "0.62643445", "0.62625784", "0.626015", "0.6259546", "0.62516785", "0.62511086", "0.62509525", "0.6248951", "0.6242158", "0.62403846", "0.6237681", "0.6233098", "0.62330276", "0.62325376" ]
0.74291027
0
POST /foodvendors POST /foodvendors.xml
def create @foodvendor = Foodvendor.new(foodvendor_params) respond_to do |format| if @foodvendor.save flash[:notice] = 'Foodvendor was successfully created.' format.html { redirect_to(@foodvendor) } format.xml { render :xml => @foodvendor, :status => :created, :location => @foodvendor } else format.html { render :action => "new" } format.xml { render :xml => @foodvendor.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @vendor = Vendor.new(params[:vendor])\n\n respond_to do |format|\n if @vendor.save\n format.html { redirect_to(@vendor, :notice => 'Vendor was successfully created.') }\n format.xml { render :xml => @vendor, :status => :created, :location => @vendor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vendor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @vendor = Vendor.new(params[:vendor])\n\n respond_to do |format|\n if @vendor.save\n format.html { redirect_to(@vendor, :notice => 'Vendor was successfully created.') }\n format.xml { render :xml => @vendor, :status => :created, :location => @vendor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vendor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @fridge_food = FridgeFood.new(params[:fridge_food])\n\n respond_to do |format|\n if @fridge_food.save\n format.html { redirect_to(@fridge_food, :notice => 'Fridge food was successfully created.') }\n format.xml { render :xml => @fridge_food, :status => :created, :location => @fridge_food }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @fridge_food.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @vendor = Vendor.new(params[:vendor])\n\n respond_to do |format|\n if @vendor.save\n format.html { redirect_to([:admin,@vendor], :notice => 'Vendor was successfully created.') }\n format.xml { render :xml => [:admin,@vendor], :status => :created, :location => @vendor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vendor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n # process the request if the proper authorization key was given\n begin\n # parse the given XML document and retrieve the underlying food model\n @food = Food.new(Food.xmlfood_to_hash(request.body))\n respond_to do |format|\n if @food.save\n format.xml { render xml: @food, status: :created, location: @food }\n else # bad request: food could not be added to the database\n # check the entry could not be saved because it is already existing\n unique_error = false\n @food.errors.each do |_, err_mess|\n if err_mess == \"has already been taken\"\n unique_error = true\n break\n end\n end\n # send a 409 Conflict error if it is the case\n if unique_error\n format.xml { head :conflict }\n # else send a 422 Unprocessable entity error\n else\n format.xml { render text: @food.errors.map { |_, e| \"#{e}\" }.join(\"\\n\")+\"\\n\",\n status: :unprocessable_entity }\n end\n end\n end\n rescue ArgumentError => e\n # bad request: improper XML food\n respond_to do |format|\n format.xml { render text: \"#{e}\\n\", status: :unprocessable_entity}\n end\n end\n end", "def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n response.body\n end", "def new\n @foodvendor = Foodvendor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @foodvendor }\n end\n end", "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end", "def create\n @vendor = Vendor.new(params[:vendor])\n\n respond_to do |format|\n if @vendor.save\n format.html { redirect_to @vendor, notice: 'Vendor was successfully created.' }\n format.json { render json: @vendor, status: :created, location: @vendor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @food = @fridge.foods.create(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end", "def create\n @vendor = Vendor.new(vendor_params)\n\n respond_to do |format|\n if @vendor.save\n format.html { redirect_to @vendor, notice: 'Vendor was successfully created.' }\n format.json { render :show, status: :created, location: @vendor }\n else\n format.html { render :new }\n format.json { render json: @vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vendor = Vendor.new(params[:vendor])\n\t\[email protected]_id = current_user.id\n respond_to do |format|\n if @vendor.save\n\t\t\t\tif params[:service]\n\t\t\t\t\tparams[:service].keys.each do |f| \n\t\t\t\t\t\[email protected](:name=>f,:is_active=>true)\n\t\t\t\t\tend\n\t\t\t\tend\n format.html { redirect_to @vendor, notice: 'Vendor was successfully created.' }\n format.json { render json: @vendor, status: :created, location: @vendor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end", "def postEntityAdvertiserUpsell( entity_id, tags, locations, extra_tags, extra_locations, is_national, language, reseller_ref, reseller_agent_id, publisher_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['tags'] = tags\n params['locations'] = locations\n params['extra_tags'] = extra_tags\n params['extra_locations'] = extra_locations\n params['is_national'] = is_national\n params['language'] = language\n params['reseller_ref'] = reseller_ref\n params['reseller_agent_id'] = reseller_agent_id\n params['publisher_id'] = publisher_id\n return doCurl(\"post\",\"/entity/advertiser/upsell\",params)\n end", "def create\n @vendor_feature = VendorFeature.new(vendor_feature_params)\n\n respond_to do |format|\n if @vendor_feature.save\n format.html { redirect_to @vendor_feature, notice: 'Vendor feature was successfully created.' }\n format.json { render :show, status: :created, location: @vendor_feature }\n else\n format.html { render :new }\n format.json { render json: @vendor_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vendor = current_user.vendors.new(vendor_params)\n\n respond_to do |format|\n if @vendor.save\n format.html { redirect_to @vendor, notice: 'Vendor was successfully created.' }\n format.json { render :show, status: :created, location: @vendor }\n else\n format.html { render :new }\n format.json { render json: @vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vendor_relationship = VendorRelationship.new(params[:vendor_relationship])\n\n respond_to do |format|\n if @vendor_relationship.save\n format.html { redirect_to @vendor_relationship, notice: 'Vendor relationship was successfully created.' }\n format.json { render json: @vendor_relationship, status: :created, location: @vendor_relationship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vendor_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vendor_cat = VendorCat.new(vendor_cat_params)\n\n respond_to do |format|\n if @vendor_cat.save\n format.html { redirect_to @vendor_cat, notice: 'Vendor cat was successfully created.' }\n format.json { render :show, status: :created, location: @vendor_cat }\n else\n format.html { render :new }\n format.json { render json: @vendor_cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle = @fleet.vehicles.create(params[:vehicle])\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to( [@vehicle.fleet, @vehicle], :notice => 'Vehicle was successfully created.') }\n format.xml { render :xml => @vehicle, :status => :created, :location => @vehicle }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @vendor = Vendor.new(params[:vendor])\n if @vendor.save\n redirect_to @vendor, notice: 'Vendor was successfully created.'\n else\n render action: \"new\"\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create\n @admin_vendor = Vendor.new(admin_vendor_params)\n\n respond_to do |format|\n if @admin_vendor.save\n format.html { redirect_to admin_vendors_url, notice: 'Vendor was successfully created.' }\n format.json { render :show, status: :created, location: @admin_vendor }\n else\n format.html { render :new }\n format.json { render json: @admin_vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @saved_food = SavedFood.new(params[:saved_food])\n\n respond_to do |format|\n if @saved_food.save\n format.html { redirect_to(@saved_food, :notice => 'Saved food was successfully created.') }\n format.xml { render :xml => @saved_food, :status => :created, :location => @saved_food }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @saved_food.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @vendor_type = VendorType.new(vendor_type_params)\n respond_to do |format|\n if @vendor_type.save\n format.html { redirect_to @vendor_type, notice: 'Vendor Type was successfully created.' }\n format.json { render :show, status: :created, location: @vendor_type }\n else\n format.html { render :new }\n format.json { render json: @vendor_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def postEntityAdvertiserCreate( entity_id, tags, locations, max_tags, max_locations, expiry_date, is_national, language, reseller_ref, reseller_agent_id, publisher_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['tags'] = tags\n params['locations'] = locations\n params['max_tags'] = max_tags\n params['max_locations'] = max_locations\n params['expiry_date'] = expiry_date\n params['is_national'] = is_national\n params['language'] = language\n params['reseller_ref'] = reseller_ref\n params['reseller_agent_id'] = reseller_agent_id\n params['publisher_id'] = publisher_id\n return doCurl(\"post\",\"/entity/advertiser/create\",params)\n end", "def create\n\t\tPesqSecDep()\n\t\t@cliente = Cliente.new(params[:cliente])\n\t\t\n\t\trespond_to do |format|\n\t\t\tif @cliente.save\n\t\t\t\tformat.html {redirect_to(@cliente, :notice => 'Registro incluído com Sucesso!')}\n\t\t\t\tformat.xml {render :xml => @cliente, :status => :created, :location => @cliente}\n\t\t\telse\n\t\t\t\tformat.html {render :action => \"new\"}\n\t\t\t\tformat.xml {render :xml => @cliente.erros, :status => :unprocessable_entity }\n\t\t\tend\t\t\n\t\tend\n\tend", "def create_service_request\n # Geocode the address\n lat, long = Geocoder.coordinates(\"#{self.restaurant_address} , Chicago, IL\") \n\n HTTParty.post('http://311api.cityofchicago.org/open311/v2/requests.json', :body => { \n :api_key => SETTINGS[\"OPEN_311_KEY\"],\n :service_code => '4fd6e4ece750840569000019',\n :attribute => {\n :PLEASESE => 'FOODPOIS',\n :WHATISTH => self.restaurant_name,\n :ONWHATDA => self.date\n },\n :address_string => self.restaurant_address,\n :description => self.description,\n :lat => lat, \n :long => long, \n :first_name => self.first_name,\n :last_name => self.last_name,\n :email => self.email,\n :phone => self.phone\n })\n end", "def create\n @venue = Venue.new(params[:venue])\n\n respond_to do |format|\n if @venue.save\n flash[:notice] = 'Venue was successfully created.'\n format.html { redirect_to(@venue) }\n format.xml { render :xml => @venue, :status => :created, :location => @venue }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @venue.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @vendedor_cliente = VendedorCliente.new(vendedor_cliente_params)\n\n respond_to do |format|\n if @vendedor_cliente.save\n format.html { redirect_to @vendedor_cliente, notice: 'Vendedor cliente was successfully created.' }\n format.json { render :show, status: :created, location: @vendedor_cliente }\n else\n format.html { render :new }\n format.json { render json: @vendedor_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @foodery = Foodery.new(params[:foodery])\n\n respond_to do |format|\n if @foodery.save\n format.html { redirect_to(@foodery, :notice => 'Foodery was successfully created.') }\n format.xml { render :xml => @foodery, :status => :created, :location => @foodery }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @foodery.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post\n response = HTTParty.post(servlet_url,\n :body => to_xml,\n :headers => { 'Content-Type' => 'application/xml' }\n ).response\n\n return Dhl::Shipment::Response.new(response.body)\n rescue Exception => e\n request_xml = if @to_xml.to_s.size>0\n @to_xml\n else\n '<not generated at time of error>'\n end\n\n response_body = if (response && response.body && response.body.to_s.size > 0)\n response.body\n else\n '<not received at time of error>'\n end\n\n log_level = if e.respond_to?(:log_level)\n e.log_level\n else\n :critical\n end\n\n log_request_and_response_xml(log_level, e, request_xml, response_body )\n raise e\n end", "def build_xml\n ns = \"http://fedex.com/ws/pickup/v17\"\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.Envelope(\"xmlns\" => \"http://fedex.com/ws/pickup/v17\") {\n xml.parent.namespace = xml.parent.add_namespace_definition(\"soapenv\", \"http://schemas.xmlsoap.org/soap/envelope/\")\n xml['soapenv'].Header {}\n xml['soapenv'].Body {\n xml.CreatePickupRequest() {\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n add_origin_detail(xml)\n add_package_details(xml)\n }\n }\n }\n end\n builder.doc.root.to_xml\n end", "def create\n @vehiculo = Vehiculo.new(params[:vehiculo])\n\n respond_to do |format|\n if @vehiculo.save\n format.html { redirect_to(@vehiculo, :notice => 'Vehiculo was successfully created.') }\n format.xml { render :xml => @vehiculo, :status => :created, :location => @vehiculo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vehiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end", "def postEntityAdvertiserTag( gen_id, entity_id, language, tags_to_add, tags_to_remove)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n params['language'] = language\n params['tags_to_add'] = tags_to_add\n params['tags_to_remove'] = tags_to_remove\n return doCurl(\"post\",\"/entity/advertiser/tag\",params)\n end", "def post_to_newgistics\n document = Spree::Newgistics::DocumentBuilder.build_product([self])\n response = Spree::Newgistics::HTTPManager.post('/post_products.aspx', document)\n\n if response.status == 200\n errors = Nokogiri::XML(response.body).css('errors').children.any?\n update_column(:posted_to_newgistics, true) unless errors\n end\n\n end", "def create\n @venue = Venue.new(venue_params)\n\n if @venue.save\n render json: @venue, status: :created, location: @venue\n else\n render json: {errors: @venue.errors}, status: :unprocessable_entity\n end\n end", "def create\n @event_vendor = EventVendor.new event_vendor_params\n render_entity @event_vendor\n end", "def create\n @vendedor = Vendedor.new(params[:vendedor])\n\n respond_to do |format|\n if @vendedor.save\n flash[:notice] = 'Vendedor was successfully created.'\n format.html { redirect_to(@vendedor) }\n format.xml { render :xml => @vendedor, :status => :created, :location => @vendedor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vendedor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @vendedor = Vendedor.new(params[:vendedor])\n respond_to do |format|\n if @vendedor.save\n flash[:notice] = 'Vendedor was successfully created.'\n format.html { redirect_to(@vendedor) }\n format.xml { render :xml => @vendedor, :status => :created, :location => @vendedor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vendedor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ventas_agrupador_cliente = Ventas::AgrupadorCliente.new(ventas_agrupador_cliente_params)\n\n respond_to do |format|\n if @ventas_agrupador_cliente.save\n format.html { redirect_to @ventas_agrupador_cliente, notice: 'Agrupador cliente was successfully created.' }\n format.json { render :show, status: :created, location: @ventas_agrupador_cliente }\n else\n format.html { render :new }\n format.json { render json: @ventas_agrupador_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ventas_agrupador_cliente = Ventas::AgrupadorCliente.new(ventas_agrupador_cliente_params)\n\n respond_to do |format|\n if @ventas_agrupador_cliente.save\n format.html { redirect_to @ventas_agrupador_cliente, notice: 'Agrupador cliente was successfully created.' }\n format.json { render :show, status: :created, location: @ventas_agrupador_cliente }\n else\n format.html { render :new }\n format.json { render json: @ventas_agrupador_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @food = Food.new(params[:food].merge(\n :source_id => current_user.id,\n :source_type => \"User\" ))\n\n respond_to do |format|\n if @food.save\n flash[:notice] = 'Food was successfully created.'\n format.html { redirect_to(food_url(@food)) }\n format.xml { render :xml => @food, :status => :created, :location => @food }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @food.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @solideo_depense = SolideoDepense.new(solideo_depense_params)\n\n respond_to do |format|\n if @solideo_depense.save\n format.html { redirect_to solideo_depenses_path, notice: 'Solideo depense was successfully created.' }\n format.json { render :show, status: :created, location: @solideo_depense }\n else\n format.html { render :new }\n format.json { render json: @solideo_depense.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(url_variables:, body:)\n ensure_service_document\n\n end", "def create\n @cake_flavor = CakeFlavor.new(cake_flavor_params)\n\n respond_to do |format|\n if @cake_flavor.save\n format.html { redirect_to @cake_flavor, notice: 'Cake flavor was successfully created.' }\n format.json { render :show, status: :created, location: @cake_flavor }\n else\n format.html { render :new }\n format.json { render json: @cake_flavor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @food = Food.new(food_params)\n respond_to do |format|\n if @food.save\n format.html { redirect_to @food, notice: 'Food was successfully created.' }\n format.json { render :show, status: :created, location: @food }\n else\n format.html { render :new }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gtfs_agency = GtfsAgency.new(params[:gtfs_agency])\n\n respond_to do |format|\n if @gtfs_agency.save\n format.html { redirect_to(@gtfs_agency, :notice => 'Gtfs agency was successfully created.') }\n format.xml { render :xml => @gtfs_agency, :status => :created, :location => @gtfs_agency }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @gtfs_agency.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @vendor_category = VendorCategory.new(vendor_category_params)\n\n respond_to do |format|\n if @vendor_category.save\n format.html { redirect_to @vendor_category, notice: 'Vendor category was successfully created.' }\n format.json { render :show, status: :created, location: @vendor_category }\n else\n format.html { render :new }\n format.json { render json: @vendor_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @food = Food.new(params[:food])\n\n respond_to do |format|\n if @food.save\n format.html { redirect_to @food, notice: \"Piatto creato correttamente.\" }\n format.json { render json: @food, status: :created, location: @food }\n else\n format.html { render action: \"new\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @food_delivery = current_merchant.food_deliveries.new(food_delivery_params)\n\n respond_to do |format|\n if @food_delivery.save\n format.html { redirect_to @food_delivery, notice: 'Food delivery was successfully created.' }\n format.json { render :show, status: :created, location: @food_delivery }\n else\n format.html { render :new }\n format.json { render json: @food_delivery.errors, status: :unprocessable_entity }\n end\n end\n @food_delivery.food_delivery_type_ids = params[:food_delivery][:food_delivery_type_ids]\n @food_delivery.food_item_ids = params[:food_delivery][:food_item_ids]\n end", "def create\n @hotel = Hotel.new(params[:hotel])\n\n respond_to do |format|\n if @hotel.save\n format.html { redirect_to(@hotel, :notice => 'Hotel was successfully created.') }\n format.xml { render :xml => @hotel, :status => :created, :location => @hotel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @hotel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @producto_vehiculo = ProductoVehiculo.new(producto_vehiculo_params)\n\n respond_to do |format|\n if @producto_vehiculo.save\n format.html { redirect_to @producto_vehiculo, notice: 'Producto vehiculo was successfully created.' }\n format.json { render :show, status: :created, location: @producto_vehiculo }\n else\n format.html { render :new }\n format.json { render json: @producto_vehiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @vendor = Vendor.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vendor }\n end\n end", "def create\n @fast_food = FastFood.new(fast_food_params)\n\n respond_to do |format|\n if @fast_food.save\n format.html { redirect_to @fast_food, notice: 'Fast food was successfully created.' }\n format.json { render :show, status: :created, location: @fast_food }\n else\n format.html { render :new }\n format.json { render json: @fast_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tags_of_novel = TagsOfNovel.new(params[:tags_of_novel])\n\n respond_to do |format|\n if @tags_of_novel.save\n format.html { redirect_to @tags_of_novel, notice: 'Tags of novel was successfully created.' }\n format.json { render json: @tags_of_novel, status: :created, location: @tags_of_novel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tags_of_novel.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @vendor = Vendor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vendor }\n end\n end", "def new\n @vendor = Vendor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vendor }\n end\n end", "def create\n @raw_food = current_merchant.raw_foods.new(raw_food_params)\n\n respond_to do |format|\n if @raw_food.save\n format.html { redirect_to @raw_food, notice: 'Raw food was successfully created.' }\n format.json { render :show, status: :created, location: @raw_food }\n else\n format.html { render :new }\n format.json { render json: @raw_food.errors, status: :unprocessable_entity }\n end\n end\n @raw_food.ordering_method_ids = params[:raw_food][:ordering_method_ids]\n @raw_food.delivery_location_ids = params[:raw_food][:delivery_location_ids]\n @raw_food.online_retail_service_type_ids = params[:raw_food][:online_retail_service_type_ids]\n @raw_food.raw_food_product_category_ids = params[:raw_food][:raw_food_product_category_ids]\n end", "def create\n @paciente = Paciente.find(params[:paciente_id])\n @visita = Visita.new(params[:visita])\n @visita.paciente = @paciente\n\n respond_to do |format|\n if @visita.save\n format.html { redirect_to(paciente_visitas_url, :notice => 'La Visita se creo exitosamente.') }\n format.xml { render :xml => @visita, :status => :created, :location => @visita }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @visita.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @servant = Servant.new(servant_params)\n\n respond_to do |format|\n if @servant.save\n format.html { redirect_to @servant, notice: 'Servant was successfully created.' }\n format.json { render :show, status: :created, location: @servant }\n else\n format.html { render :new }\n format.json { render json: @servant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle = Vehicle.new(params[:vehicle])\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to(@vehicle, :notice => 'Vehicle was successfully created.') }\n format.xml { render :xml => @vehicle, :status => :created, :location => @vehicle }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @gig = Gig.new(params[:gig])\n @venue = Venue.new(params[:venue])\n respond_to do |format|\n if @gig.save\n @gig.venue_id = @venue\n @venue.save\n format.html { redirect_to(@gig) }\n format.xml { render :xml => @gig, :status => :created, :location => @gig }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @gig.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @cliente = Cliente.new(params[:cliente])\n\n respond_to do |format|\n if @cliente.save\n flash[:notice] = 'Cliente was successfully created.'\n format.html { redirect_to(clientes_url) }\n format.xml { render :xml => @cliente, :status => :created, :location => @cliente }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cliente.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_vehiculo = TipoVehiculo.new(params[:tipo_vehiculo])\n\n respond_to do |format|\n if @tipo_vehiculo.save\n format.html { redirect_to(@tipo_vehiculo, :notice => 'TipoVehiculo was successfully created.') }\n format.xml { render :xml => @tipo_vehiculo, :status => :created, :location => @tipo_vehiculo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipo_vehiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @voucher_offer = VoucherOffer.new(params[:voucher_offer])\n\n respond_to do |format|\n if @voucher_offer.save\n format.html { redirect_to(@voucher_offer, :notice => 'Voucher offer was successfully created.') }\n format.xml { render :xml => @voucher_offer, :status => :created, :location => @voucher_offer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @voucher_offer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @kingdom = Kingdom.new(params[:kingdom])\n\n respond_to do |format|\n if @kingdom.save\n flash[:notice] = 'Kingdom was successfully created.'\n format.html { redirect_to(@kingdom) }\n format.xml { render :xml => @kingdom, :status => :created, :location => @kingdom }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @kingdom.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @food = Food.create(params[:food])\n redirect_to foods_url\n end", "def create\n @depoevento = Depoevento.new(params[:depoevento])\n\n respond_to do |format|\n if @depoevento.save\n format.html { redirect_to @depoevento, notice: 'Depoevento was successfully created.' }\n format.json { render json: @depoevento, status: :created, location: @depoevento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @depoevento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @vehicel = @user.vehicels.create(vehicel_params)\n respond_to do |format|\n if @vehicel.save\n format.html { redirect_to user_vehicels_path(@user, @vehicel) }\n format.json { render :show, status: :created, location: @vehicel }\n else\n format.html { render :new }\n format.json { render json: @vehicel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vendor_part = VendorPart.new(params[:vendor_part])\n\n respond_to do |format|\n if @vendor_part.save\n format.html { redirect_to @vendor_part, :notice => 'Vendor part was successfully created.' }\n format.json { render :json => @vendor_part, :status => :created, :location => @vendor_part }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @vendor_part.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @etd = Etd.new(params[:etd])\n\n respond_to do |format|\n if @etd.save\n flash[:notice] = 'Etd was successfully created.'\n format.html { redirect_to(@etd) }\n format.xml { render :xml => @etd, :status => :created, :location => @etd }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @etd.errors, :status => :unprocessable_entity }\n end\n end\n end", "def food_params\n params.require(:food).permit(:name, :description, :image_url, :price,\n :category_id, :restaurant_id,\n tag_ids: [])\n end", "def create\n @device = Device.new(device_params)\n\n respond_to do |format|\n if @device.save\n update_total_counter(@device.venue.id)\n format.html { redirect_to @device.venue, notice: \"Se ha creado el acceso '#{@device.name}'.\" }\n # format.html { redirect_to venue_device_path(@device.venue, @device), notice: 'device was successfully created.' }\n format.json { render :show, status: :created, location: venue_device_path(@device.venue, @device) }\n else\n format.html { render :new }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "def build_xml\n ns = \"http://fedex.com/ws/pickup/v#{service[:version]}\"\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.CreatePickupRequest(:xmlns => ns) {\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n add_origin_detail(xml)\n add_package_details(xml)\n }\n end\n builder.doc.root.to_xml\n end", "def create\n @estado_pedido = EstadoPedido.new(params[:estado_pedido])\n\n respond_to do |format|\n if @estado_pedido.save\n format.html { redirect_to(@estado_pedido, :notice => 'EstadoPedido was successfully created.') }\n format.xml { render :xml => @estado_pedido, :status => :created, :location => @estado_pedido }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estado_pedido.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @prd_etc = PrdEtc.new(params[:prd_etc])\n\n respond_to do |format|\n if @prd_etc.save\n format.html { redirect_to(@prd_etc, :notice => 'PrdEtc was successfully created.') }\n format.xml { render :xml => @prd_etc, :status => :created, :location => @prd_etc }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @prd_etc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @vendor_address = VendorAddress.new(vendor_address_params)\n @vendor_address.vendor_id = current_vendor.id\n respond_to do |format|\n if @vendor_address.save\n format.html { redirect_to @vendor_address, notice: 'Vendor address was successfully created.' }\n format.json { render :show, status: :created, location: @vendor_address }\n else\n format.html { render :new }\n format.json { render json: @vendor_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @food_product = FoodProduct.new(food_product_params)\n\n respond_to do |format|\n if @food_product.save\n format.html { redirect_to @food_product, notice: \"Food product was successfully created.\" }\n format.json { render :show, status: :created, location: @food_product }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @food_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vendor = Vendor.new(admin_vendor_params)\n if @vendor.save\n redirect_to admin_vendors_path\n else\n render 'new'\n end\n end", "def create\n @food_product = FoodProduct.new(food_product_params)\n\n respond_to do |format|\n if @food_product.save\n format.html { redirect_to @food_product, notice: 'Food product was successfully created.' }\n format.json { render :show, status: :created, location: @food_product }\n else\n format.html { render :new }\n format.json { render json: @food_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @discovery = Discovery.new(params[:discovery])\n\n respond_to do |format|\n if @discovery.save\n flash[:notice] = 'Discovery was successfully created.'\n format.html { redirect_to(@discovery) }\n format.xml { render :xml => @discovery, :status => :created, :location => @discovery }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @discovery.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @vendor_fulfillment = @order.vendor_fulfillments.new(vendor_fulfillment_params)\n @vendor_fulfillment.vendor = current_vendor\n respond_to do |format|\n if @vendor_fulfillment.save\n format.html { redirect_to vendor_order_vendor_fulfillments_path(@order), notice: 'Vendor fulfillment was successfully created.' }\n format.json { render :show, status: :created, location: @vendor_fulfillment }\n else\n format.html { render :new }\n format.json { render json: @vendor_fulfillment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @travel_vendor = TravelVendor.new(travel_vendor_params)\n\n respond_to do |format|\n if @travel_vendor.save\n UserMailer.sample_email(@travel_vendor,current_user).deliver\n format.html { redirect_to @travel_vendor, notice: 'Travel vendor was successfully created.' }\n format.json { render :show, status: :created, location: @travel_vendor }\n format.xml { render :show, status: :created, location: @travel_vendor }\n else\n format.html { render :new }\n format.json { render json: @travel_vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @brief_vendor = BriefVendor.new(params[:brief_vendor])\n\n respond_to do |format|\n if @brief_vendor.save\n format.html { redirect_to @brief_vendor, notice: 'Brief vendor was successfully created.' }\n format.json { render json: @brief_vendor, status: :created, location: @brief_vendor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @brief_vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @favourite_food = FavouriteFood.new(params[:favourite_food])\n\n respond_to do |format|\n if @favourite_food.save\n format.html { redirect_to @favourite_food, notice: 'Favourite food was successfully created.' }\n format.json { render json: @favourite_food, status: :created, location: @favourite_food }\n else\n format.html { render action: \"new\" }\n format.json { render json: @favourite_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @odsreserf = Odsreserf.new(odsreserf_params)\n\n respond_to do |format|\n if @odsreserf.save\n format.html { redirect_to @odsreserf, notice: 'Odsreserf was successfully created.' }\n format.json { render :show, status: :created, location: @odsreserf }\n else\n format.html { render :new }\n format.json { render json: @odsreserf.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @voivodship_committee = VoivodshipCommittee.new(params[:voivodship_committee])\n\n respond_to do |format|\n if @voivodship_committee.save\n format.html { redirect_to @voivodship_committee, notice: 'Voivodship committee was successfully created.' }\n format.json { render json: @voivodship_committee, status: :created, location: @voivodship_committee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @voivodship_committee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cliente = Cliente.new(params[:cliente])\n\n respond_to do |format|\n if @cliente.save\n flash[:notice] = 'Cliente was successfully created.'\n format.html { redirect_to(@cliente) }\n format.xml { render :xml => @cliente, :status => :created, :location => @cliente }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cliente.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @vegetable = Vegetable.new(params[:vegetable])\n\n respond_to do |format|\n if @vegetable.save\n format.html { redirect_to(@vegetable, :notice => 'Vegetable was successfully created.') }\n format.xml { render :xml => @vegetable, :status => :created, :location => @vegetable }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vegetable.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @type_food = TypeFood.new(type_food_params)\n\n respond_to do |format|\n if @type_food.save\n format.html { redirect_to @type_food, notice: 'Type food was successfully created.' }\n format.json { render :show, status: :created, location: @type_food }\n else\n format.html { render :new }\n format.json { render json: @type_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @food_product = FoodProduct.new(food_product_params)\n @food_product.save\n end", "def new\n @fridge_food = FridgeFood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fridge_food }\n end\n end", "def create\n @tipo_ventum = TipoVentum.new(tipo_ventum_params)\n\n respond_to do |format|\n if @tipo_ventum.save\n format.html { redirect_to @tipo_ventum, notice: 'Tipo ventum was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_ventum }\n else\n format.html { render :new }\n format.json { render json: @tipo_ventum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @conveniado = Conveniado.new(params[:conveniado])\n \n\n respond_to do |format|\n if @conveniado.save\n flash[:notice] = 'Conveniado was successfully created.'\n format.html { redirect_to(@conveniado) }\n format.xml { render :xml => @conveniado, :status => :created, :location => @conveniado }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @conveniado.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n neo = Neography::Rest.new\n city = neo.create_node(params[:city])\n redirect_to cities_path\n end", "def create\n @cliente = Cliente.new(params[:cliente])\n respond_to do |format|\n if @cliente.save\n format.html { render :json => {:success => true} }\n format.xml { render :xml => @cliente, :status => :created, :location => @cliente }\n else\n format.html { render :json => ( (@cliente.errors.full_messages.join(\".<br />\").to_s + \".\").to_json ) } unless @cliente.errors.empty?\n end\n end\n end", "def create\n @hotel = Hotel.new(params[:hotel])\n\n respond_to do |format|\n if @hotel.save\n format.html { redirect_to(@hotel, :notice => 'Hotel was successfully created.') }\n format.xml { render :xml => @hotel, :status => :created, :location => @hotel }\n format.json { render :json => @hotel, :status => :created, :location => @hotel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @hotel.errors, :status => :unprocessable_entity }\n format.json { render :json => @hotel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @vehiculoscancelacion = Vehiculoscancelacion.new(params[:vehiculoscancelacion])\n\n respond_to do |format|\n if @vehiculoscancelacion.save\n format.html { redirect_to(@vehiculoscancelacion, :notice => 'Vehiculoscancelacion was successfully created.') }\n format.xml { render :xml => @vehiculoscancelacion, :status => :created, :location => @vehiculoscancelacion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vehiculoscancelacion.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.58914214", "0.58914214", "0.57690305", "0.57387394", "0.57287925", "0.5709256", "0.56650716", "0.5649667", "0.56273067", "0.5591811", "0.5558824", "0.5555467", "0.5544654", "0.542685", "0.5385678", "0.5345973", "0.5342413", "0.5330707", "0.5323066", "0.52958447", "0.52712524", "0.5270454", "0.5254955", "0.5228904", "0.5221988", "0.5213939", "0.52082604", "0.52075595", "0.5195053", "0.51760834", "0.51407236", "0.51192915", "0.5117099", "0.51135504", "0.51114374", "0.5110442", "0.51060516", "0.50999135", "0.50936294", "0.5081121", "0.50780636", "0.50770724", "0.50770724", "0.5068389", "0.506738", "0.5065801", "0.5065216", "0.5064678", "0.5054426", "0.50540966", "0.5053417", "0.50519544", "0.5051682", "0.5042777", "0.5038785", "0.50374687", "0.5034859", "0.50345576", "0.50345576", "0.50289196", "0.50225055", "0.50224906", "0.50213754", "0.50206715", "0.5018291", "0.50169104", "0.5016434", "0.50149715", "0.5012553", "0.50115246", "0.5010986", "0.5008856", "0.5003391", "0.50010085", "0.49896064", "0.49860162", "0.4974872", "0.4969251", "0.49680942", "0.49679118", "0.49556732", "0.49549678", "0.49527657", "0.49508217", "0.49484235", "0.49427864", "0.49405134", "0.49402088", "0.49390495", "0.49355793", "0.4933386", "0.49319482", "0.49307325", "0.4930646", "0.49260798", "0.49140483", "0.4913116", "0.4909333", "0.49075848", "0.4906837" ]
0.6501686
0
PUT /foodvendors/1 PUT /foodvendors/1.xml
def update @foodvendor = Foodvendor.find(params[:id]) respond_to do |format| if @foodvendor.update(foodvendor_params) flash[:notice] = 'Foodvendor was successfully updated.' format.html { redirect_to(@foodvendor) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @foodvendor.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 update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n if @vendor.update_attributes(params[:vendor])\n format.html { redirect_to(@vendor, :notice => 'Vendor was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vendor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n if @vendor.update_attributes(params[:vendor])\n format.html { redirect_to(@vendor, :notice => 'Vendor was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vendor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n @vendor_doc = VendorDoc.find(params[:id])\n\t@vdocs_requirement = @vendor_doc.vdocs_requirement\n\n respond_to do |format|\n if @vendor_doc.update_attributes(params[:vendor_doc])\n flash[:notice] = 'VendorDoc was successfully updated.'\n format.html { redirect_to(@vendor_doc) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vendor_doc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n if @vendor.update_attributes(params[:vendor])\n format.html { redirect_to([:admin,@vendor] ,:notice => 'Vendor was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vendor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def update\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n if @vendor.update_attributes(params[:vendor])\n format.html { redirect_to @vendor, notice: 'Vendor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n if @vendor.update_attributes(params[:vendor])\n format.html { redirect_to @vendor, notice: 'Vendor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @food.update(food_params)\n respond_with @food, location: -> { kitchen_board_path }\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(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n if @vendor.update(vendor_params)\n format.html { redirect_to @vendor, notice: 'Vendor was successfully updated.' }\n format.json { render :show, status: :ok, location: @vendor }\n else\n format.html { render :edit }\n format.json { render json: @vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vendor.update(vendor_params)\n format.html { redirect_to @vendor, notice: 'Vendor was successfully updated.' }\n format.json { render :show, status: :ok, location: @vendor }\n else\n format.html { render :edit }\n format.json { render json: @vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def put(*args)\n request :put, *args\n end", "def update\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n if @venue.update_attributes(params[:venue])\n format.html { redirect_to(@venue, :notice => 'Venue was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @venue.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n if @venue.update_attributes(params[:venue])\n format.html { redirect_to(@venue, :notice => 'Venue was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @venue.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @shelf = Shelf.find(params[:id])\n\n respond_to do |format|\n if @shelf.update_attributes(params[:shelf])\n flash[:notice] = 'Shelf was successfully updated.'\n format.html { redirect_to(@shelf) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shelf.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if @food.update_attributes(params[:food])\n flash[:notice] = 'Food was successfully updated.'\n format.html { redirect_to(food_url(@food)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @food.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def create\n @foodvendor = Foodvendor.new(foodvendor_params)\n\n respond_to do |format|\n if @foodvendor.save\n flash[:notice] = 'Foodvendor was successfully created.'\n format.html { redirect_to(@foodvendor) }\n format.xml { render :xml => @foodvendor, :status => :created, :location => @foodvendor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @foodvendor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @vegetable = Vegetable.find(params[:id])\n\n respond_to do |format|\n if @vegetable.update_attributes(params[:vegetable])\n format.html { redirect_to(@vegetable, :notice => 'Vegetable was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vegetable.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end", "def edit(vendor_id, edit_vendor_params)\n @client.put(\"/#{@model}/#{vendor_id}\", edit_vendor_params)\n end", "def update\n @campus_food = CampusFood.find(params[:id])\n\t@campus_food.location = params[:tags]\n respond_to do |format|\n if @campus_food.update_attributes(params[:campus_food])\n format.html { redirect_to campus_foods_path, notice: 'Campus food was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @campus_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @travel_vendor.update(travel_vendor_params)\n format.html { redirect_to @travel_vendor, notice: 'Travel vendor was successfully updated.' }\n format.json { render :show, status: :ok, location: @travel_vendor }\n else\n format.html { render :edit }\n format.json { render json: @travel_vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @inventario = Inventario.find(params[:id])\n @foto = @inventario.foto\n \n @service = InventarioService.new(@inventario, @foto)\n respond_to do |format|\n\n if @inventario.update_attributes(params[:inventario],params[:foto_file])\n format.html { redirect_to(@inventario, :notice => 'Inventario was successfully updated.') }\n format.xml { head :ok }\n else\n\t @foto = @service.foto\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inventario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @vehicle = Vehicle.find(params[:id])\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to([@vehicle.fleet,@vehicle], :notice => 'Vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def put endpoint, data\n do_request :put, endpoint, data\n end", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "def update\n respond_to do |format|\n if @vendor_cat.update(vendor_cat_params)\n format.html { redirect_to @vendor_cat, notice: 'Vendor cat was successfully updated.' }\n format.json { render :show, status: :ok, location: @vendor_cat }\n else\n format.html { render :edit }\n format.json { render json: @vendor_cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @vendor = Vendor.find(params[:id])\n @vendor.destroy\n\n respond_to do |format|\n format.html { redirect_to(vendors_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vendor = Vendor.find(params[:id])\n @vendor.destroy\n\n respond_to do |format|\n format.html { redirect_to(vendors_url) }\n format.xml { head :ok }\n end\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(*args)\n request(:put, *args)\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 @venue = Venue.find(params[:id])\n\n respond_to do |format|\n if @venue.update_attributes(params[:venue])\n format.html { redirect_to @venue, notice: 'Venue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n if @venue.update_attributes(params[:venue])\n format.html { redirect_to @venue, notice: 'Venue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, doc = nil, options = {})\n execute('PUT', path, options, doc)\n end", "def update\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n if @venue.update_attributes(params[:venue])\n format.html { redirect_to @venue, :notice => 'Venue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @venue.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vendor_feature.update(vendor_feature_params)\n format.html { redirect_to @vendor_feature, notice: 'Vendor feature was successfully updated.' }\n format.json { render :show, status: :ok, location: @vendor_feature }\n else\n format.html { render :edit }\n format.json { render json: @vendor_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vendor_relationship = VendorRelationship.find(params[:id])\n\n respond_to do |format|\n if @vendor_relationship.update_attributes(params[:vendor_relationship])\n format.html { redirect_to @vendor_relationship, notice: 'Vendor relationship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vendor_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vechicle.update(vechicle_params)\n format.html { redirect_to @vechicle, notice: 'Vechicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vechicle }\n else\n format.html { render :edit }\n format.json { render json: @vechicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to @food, notice: \"Piatto aggiornato correttamente.\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def update\n @venue = Venue.find(params[:id])\n\t\tremove_old_attendees\n\t\tgive_mojo(@venue)\n\t\t\t\t\n respond_to do |format|\n if @venue.update_attributes(params[:venue])\n format.html { redirect_to(@venue, :notice => 'Venue was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @venue.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n json_response(@food_item.update!(food_item_params))\n end", "def update\n put :update\n end", "def update\n respond_to do |format|\n if @admin_vendor.update(admin_vendor_params)\n format.html { redirect_to admin_vendors_url, notice: 'Vendor was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_vendor }\n else\n format.html { render :edit }\n format.json { render json: @admin_vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to foods_path(), notice: 'Food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path = '/files/', params = {})\n request :put, path, params\n end", "def putEntityserve( entity_id, country, event_type, domain, path)\n params = Hash.new\n params['entity_id'] = entity_id\n params['country'] = country\n params['event_type'] = event_type\n params['domain'] = domain\n params['path'] = path\n return doCurl(\"put\",\"/entityserve\",params)\n end", "def update\n @brief_vendor = BriefVendor.find(params[:id])\n\n respond_to do |format|\n if @brief_vendor.update_attributes(params[:brief_vendor])\n format.html { redirect_to @brief_vendor, notice: 'Brief vendor was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brief_vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(id:, url_variables:, body:)\n ensure_service_document\n end", "def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end", "def prepare_pet\n # remove the pet\n SwaggerClient::PetApi.delete_pet(10002)\n # recreate the pet\n pet = SwaggerClient::Pet.new('id' => 10002, 'name' => \"RUBY UNIT TESTING\")\n SwaggerClient::PetApi.add_pet(:body => pet)\nend", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end", "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end", "def update\n @saved_food = SavedFood.find(params[:id])\n\n respond_to do |format|\n if @saved_food.update_attributes(params[:saved_food])\n format.html { redirect_to(@saved_food, :notice => 'Saved food was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @saved_food.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def consumers_virtuoso_id_put_with_http_info(virtuoso_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConsumerApi.consumers_virtuoso_id_put ...'\n end\n # verify the required parameter 'virtuoso_id' is set\n if @api_client.config.client_side_validation && virtuoso_id.nil?\n fail ArgumentError, \"Missing the required parameter 'virtuoso_id' when calling ConsumerApi.consumers_virtuoso_id_put\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling ConsumerApi.consumers_virtuoso_id_put\"\n end\n # resource path\n local_var_path = '/consumers/{virtuosoId}'.sub('{' + 'virtuosoId' + '}', virtuoso_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\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 => 'ConsumerResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConsumerApi#consumers_virtuoso_id_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end", "def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end", "def update\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n if @tags_of_novel.update_attributes(params[:tags_of_novel])\n format.html { redirect_to @tags_of_novel, notice: 'Tags of novel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tags_of_novel.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, params)\n request(:put, path, params)\n end", "def update\n if @vat.update(vat_params)\n head :no_content\n else\n render json: @vat.errors, status: :unprocessable_entity\n end\n end", "def update\n @venue = Venue.find(params[:id])\n\n # replace venue_type_ids coming from ember with VenueType.find(id)\n # so Rails handles the many to many relationship correctly\n if params[:venue][:venue_type_ids]\n @venue.venue_types = params[:venue][:venue_type_ids].map { |id| VenueType.find(id) }\n else\n @venue.venue_types = []\n end\n\n if params[:venue][:venue_service_ids]\n @venue.venue_services = params[:venue][:venue_service_ids].map { |id| VenueService.find(id) }\n else\n @venue.venue_services = []\n end\n\n # replace event_type_ids coming from ember with EventType.find(id)\n # so Rails handles the many to many relationship correctly\n if params[:venue][:event_type_ids]\n @venue.event_types = params[:venue][:event_type_ids].map { |id| EventType.find(id) }\n else\n @venue.event_types = []\n end\n\n @venue.save\n if @venue.update(venue_params)\n head :no_content\n else\n render json: @venue.errors, status: :unprocessable_entity\n end\n end", "def update\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n if @venue.update_attributes(params[:venue])\n format.html { redirect_to [:manage, @venue], :notice => 'Venue was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @venue.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @vendor = Vendor.find(params[:id])\n @vendor.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_vendors_url) }\n format.xml { head :ok }\n end\n end", "def put(path, options={})\n request :put, path, options\n end", "def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end", "def update\n @vendor_part = VendorPart.find(params[:id])\n\n respond_to do |format|\n if @vendor_part.update_attributes(params[:vendor_part])\n format.html { redirect_to @vendor_part, :notice => 'Vendor part was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @vendor_part.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, params={})\n RestClient.put request_base+path, params\n end", "def update\n @food_product.update(food_product_params)\n end", "def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n put_request\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @gtfs_agency = GtfsAgency.find(params[:id])\n\n respond_to do |format|\n if @gtfs_agency.update_attributes(params[:gtfs_agency])\n format.html { redirect_to(@gtfs_agency, :notice => 'Gtfs agency was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gtfs_agency.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @voucher_offer = VoucherOffer.find(params[:id])\n\n respond_to do |format|\n if @voucher_offer.update_attributes(params[:voucher_offer])\n format.html { redirect_to(@voucher_offer, :notice => 'Voucher offer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @voucher_offer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "def update\n @bom = Bom.find(params[:id])\n\n respond_to do |format|\n if @bom.update_attributes(params[:bom])\n format.html { redirect_to(@bom, :notice => 'Bom was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bom.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to(@vehicle, :notice => 'Vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to(@vehicle, :notice => 'Vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put_update\n response = self.class.put(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp/#{$name}\", \n headers: { \"Fastly-Key\" => $key }, \n body: $put_form_data )\n end", "def update\n @foodery = Foodery.find(params[:id])\n\n respond_to do |format|\n if @foodery.update_attributes(params[:foodery])\n format.html { redirect_to(@foodery, :notice => 'Foodery was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @foodery.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.6276035", "0.6030101", "0.5951974", "0.5951974", "0.5881572", "0.5718258", "0.5716824", "0.5696827", "0.5661306", "0.5661306", "0.56028277", "0.5549509", "0.5526597", "0.55257094", "0.5505324", "0.5505324", "0.5465129", "0.5440048", "0.5428179", "0.5428179", "0.54099256", "0.5396558", "0.5389352", "0.5376468", "0.536699", "0.5366327", "0.53274024", "0.53255445", "0.53241056", "0.5310825", "0.5294883", "0.52913797", "0.5290791", "0.5287288", "0.5270657", "0.5266245", "0.52445185", "0.5237551", "0.5237551", "0.5228049", "0.5228049", "0.5228049", "0.5225158", "0.522068", "0.521815", "0.521815", "0.5216265", "0.52150834", "0.5212158", "0.5211631", "0.52043617", "0.51982117", "0.5193802", "0.5193802", "0.5193802", "0.5193802", "0.5193802", "0.5193802", "0.5193802", "0.5193802", "0.5192212", "0.5191939", "0.518916", "0.51890296", "0.51824284", "0.51812875", "0.5180273", "0.51793504", "0.5176797", "0.5165404", "0.5162593", "0.51548594", "0.51548594", "0.5147829", "0.5145496", "0.5144992", "0.51407325", "0.5140689", "0.51347923", "0.5132382", "0.5131072", "0.5121242", "0.51195055", "0.51136243", "0.510376", "0.51035917", "0.5099978", "0.50985736", "0.50962085", "0.509188", "0.50913316", "0.5078918", "0.5076761", "0.50758356", "0.50683415", "0.5061517", "0.5056122", "0.5056122", "0.50560147", "0.50420445" ]
0.6437302
0
allow users to update their accounts without passwords
def update_without_current_password(params, *options) params.delete(:current_password) if params[:password].blank? && params[:password_confirmation].blank? params.delete(:password) params.delete(:password_confirmation) end result = update_attributes(params, *options) clean_up_passwords result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_without_password(params, *options); end", "def update_with_password(params, *options); end", "def update_resource(resource, params)\n if params[\"password\"]&.present? or params[\"email\"]&.present?\n return super\n else\n resource.update_without_password(params.except(\"current_password\"))\n end\n end", "def update_without_password(params, *options)\n result = update_attributes(params, *options)\n clean_up_passwords\n result\n end", "def update_resource(resource, params)\n # Require current password if user is trying to change password.\n return super if params[\"password\"]&.present?\n # Allows user to update registration information without password.\n resource.update_without_password(params.except(\"current_password\"))\n end", "def update_with_password(params, *options)\n if encrypted_password.blank?\n update_attributes(params, *options)\n else\n super\n end\n end", "def update_with_password(params, *options)\n if encrypted_password.blank?\n update_attributes(params, *options)\n else\n super\n end\n end", "def update_with_password(params, *options)\n if encrypted_password.blank?\n update_attributes(params, *options)\n else\n super\n end\n end", "def update_with_password(params, *options)\n if encrypted_password.blank?\n update_attributes(params, *options)\n else\n super\n end\n end", "def update_with_password(params, *options)\n if encrypted_password.blank?\n update_attributes(params, *options)\n else\n super\n end\n end", "def update_with_password(params, *options)\n if encrypted_password.blank?\n update_attributes(params, *options)\n else\n super\n end\n end", "def update_with_password(params, *options)\n if encrypted_password.blank?\n update_attributes(params, *options)\n else\n super\n end\n end", "def update_with_password(params, *options)\n if encrypted_password.blank?\n update_attributes(params, *options)\n else\n super\n end\n end", "def update_with_password(params, *options)\n if encrypted_password.blank?\n update_attributes(params, *options)\n else\n super\n end\n end", "def update_with_password(params, *options)\n if encrypted_password.blank?\n update_attributes(params, *options)\n else\n super\n end\n end", "def update_with_password(params, *options)\n\t\tif encrypted_password.blank?\n\t\t\tupdate_attributes(params, *options)\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend", "def update!(**args)\n @password = args[:password] if args.key?(:password)\n @user = args[:user] if args.key?(:user)\n end", "def edit_password; end", "def update_resource(resource, params)\n return super if params[\"password\"]&.present?\n resource.update_without_password(params.except(\"current_password\"))\n end", "def update_resource(resource, params)\n # Require current password if user is trying to change password.\n return super if params['password']&.present?\n\n # Allows user to update registration information without password.\n resource.update_without_password(params.except('current_password'))\n end", "def update_with_password(params, *options)\n if encrypted_password.blank?\n update_attributes(params.except(:current_password), *options)\n else\n update_with_password_pass(params)\n end\n end", "def update_with_password params, *options\n if encrypted_password.blank?\n update_attributes(params, *options)\n else\n super\n end\n end", "def update\n if params[:commit] == \"Update\"\n super\n elsif params[:commit] == \"Cancel my account\"\n if current_user.valid_password?(params[:user][:current_password])\n kill_user(current_user)\n destroy\n else\n # I don't know how rails is doing that nice effect, so I basically have this dirty hack here...\n clean_up_passwords current_user\n params[:commit] = \"Update\"\n update\n end\n end\n end", "def update_without_password(params, *options)\n params.delete(:current_password)\n super(params)\n end", "def update_without_password(params, *options)\n params.delete(:current_password)\n super(params)\n end", "def update_without_password(params, *options)\n params.delete(:password) if params[:password].blank?\n result = update_attributes(params, *options)\n clean_up_passwords\n result\n end", "def update\n puts 'ENTROU NO UPDATE USER'\n return vinculate_user unless params[:vincular].nil?\n\n update_password\n end", "def update? ; user.account.active? ; end", "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "def update\n # @user = User.find(params[:id])\n @user = current_user # makes our views \"cleaner\" and more consistent\n params[:user][:existing_identity_attrs] ||= {}\n unless configatron.user_can_change_login\n params[:user].delete(:login)\n @user_login_is_readonly = true\n end\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Account updated!\"\n format.html { redirect_to account_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @disabled_user_deletion = args[:disabled_user_deletion] if args.key?(:disabled_user_deletion)\n @disabled_user_signup = args[:disabled_user_signup] if args.key?(:disabled_user_signup)\n end", "def update!(**args)\n @disabled_user_deletion = args[:disabled_user_deletion] if args.key?(:disabled_user_deletion)\n @disabled_user_signup = args[:disabled_user_signup] if args.key?(:disabled_user_signup)\n end", "def change_password\r\n \r\n end", "def update_resource(resource, params)\n # if params['email'] != current_user.email || params['password'].present?\n # resource.update_with_password(params)\n # else\n resource.update_without_password(params.except('password', 'password_confirmation', 'current_password'))\n # end\n end", "def update\n if params[:adminuser][:password].blank? && params[:user][:password_confirmation].blank?\n params[:adminuser].delete('password')\n params[:adminuser].delete('password_confirmation')\n end\n super\n end", "def check_password_changed\n self.temp_password = nil if ( changed.include?('encrypted_password') && !(changed.include?('temp_password')))\n end", "def update_with_password(params = {})\n if has_facebook_profile?\n params.delete(:current_password)\n update_without_password(params)\n else\n super\n end\n end", "def update_with_password(params={}) \n if params[:password].blank? \n params.delete(:password) \n params.delete(:password_confirmation) if params[:password_confirmation].blank? \n end \n update_attributes(params) \n end", "def update_with_password(params={})\n params.delete(:current_password)\n self.update_without_password(params)\n end", "def update_with_password(params={})\n params.delete(:current_password)\n self.update_without_password(params)\n end", "def update\n if params[:user][:password].blank?\n params[:user].delete(:password)\n params[:user].delete(:password_confirmation)\n end\n end", "def update_password\n # check current password is valid\n if params[:account].present? and [email protected]_password?(params[:account][:current_password])\n redirect_to gns_core.my_account_backend_accounts_path, flash: { error: \"Current password incorrectly.\" }\n return\n end\n\n if params[:account].present?\n params[:account].delete(:password) if params[:account][:password].blank?\n params[:account].delete(:password_confirmation) if params[:account][:password].blank? and params[:account][:password_confirmation].blank?\n\n if @account.update_with_password(account_params)\n bypass_sign_in(@account)\n redirect_to gns_core.my_account_backend_accounts_path, flash: { success: \"The new password has been successfully changed.\" }\n else\n if params[:account][:password].nil? or params[:account][:password].length < 6\n redirect_to gns_core.my_account_backend_accounts_path, flash: { error: \"New password must contain at least 6 characters.\" }\n else\n redirect_to gns_core.my_account_backend_accounts_path, flash: { error: \"Repeat password does not match.\" }\n end\n end\n end\n end", "def change_temp_password\n\tend", "def update\n modified_params = user_params\n modified_params.delete(\"password\") if modified_params[\"password\"].empty?\n if @user.update(modified_params)\n @users = current_user.users\n end\n end", "def update\n if correct_password_check account_update_params[:current_password]\n \n pw_params = params[:user].permit(:current_password, :password, :password_confirmation, :first_name, :last_name)\n # Handle updating password if they added anything.\n if (current_user.valid_password?(pw_params[:password]) || current_user.valid_password?(pw_params[:password_confirmation]))\n # Passwords are the same, do nothing.\n elsif (pw_params[:password] == pw_params[:password_confirmation] && pw_params[:password].length > 6)\n # Password are different.\n current_user.password = pw_params[:password]\n current_user.password_confirmation = pw_params[:password_confirmation]\n current_user.save!\n flash.alert = \"Success: Password has been changed!\"\n end\n\n \n user_params = params[:user].except(:current_password, :password, :password_confirmation).permit(:first_name, :last_name, :email)\n unless current_user.update!( user_params )\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n\n flash.alert = \"Success: Account has been updated!\"\n redirect_to edit_user_registration_path\n end\n end", "def update\n account_update_params = devise_parameter_sanitizer.sanitize(:account_update)\n\n # This is required for the form to submit when the password is left blank.\n if account_update_params[:password].blank?\n account_update_params.delete('password')\n account_update_params.delete('password_confirmation')\n end\n\n @user = User.find(current_user.id)\n if @user.update_attributes(account_update_params)\n set_flash_message ':notice', :updated\n\n # Sign in the user and bypass validation in case the password changed.\n sign_in @user, bypass: true\n redirect_to after_update_path_for(@user)\n else\n render 'edit'\n end\n end", "def update\n if params[:user][:password].present? || params[:user][:current_password].present?\n super\n else\n @user = User.find(current_user.id)\n if @user.update_without_password(params[:user])\n redirect_to after_update_path_for(@user), :notice => I18n.t(\"devise.registrations.updated\")\n else\n render \"edit\"\n end\n end\n end", "def update\n @login = Login.find(params[:id])\n\n #Test for save successful and react\n if @login.update(login_params.to_h.deep_reject { |k, v| ['password', 'password_confirmation'].include?(k) && v.blank? })\n flash[:success] = \"Account updated\"\n redirect_to :back\n else\n flash[:alert] = \"Account NOT updated\"\n render 'edit'\n end\n end", "def update\n # User.find(current_user) vs plain current_user avoids failed name change to appear immediately in layout\n @user = User.find(current_user.id)\n \n # this needs to be passed to the object instance so that it validates the current password\n # any more elegant way to do it?\n @user.validate_current_password = true if account_section == 'password'\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Changes saved.\"\n format.html { redirect_to account_edit_url(account_section) }\n format.xml { head :ok }\n else\n format.html { render :action => :edit }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_without_password(params={})\n\n params.delete(:password)\n params.delete(:password_confirmation)\n result = update_attributes(params)\n clean_up_passwords\n result\n end", "def change_password\n #check if user is new or being updated\n if self.encrypted_password.present?\n #verifies password\n if self.password_check\n self.encrypt_password\n else\n raise \"error\"\n end\n else\n raise \"error\"\n end\n end", "def need_change_password!\n return unless password_expiration_enabled?\n\n need_change_password\n save(validate: false)\n end", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def set_password; nil; end", "def update!(**args)\n @enabled = args[:enabled] if args.key?(:enabled)\n @password_required = args[:password_required] if args.key?(:password_required)\n end", "def update_with_password(params, *options)\n if authentications.present?\n update_attributes(params, *options)\n else\n super\n end\n end", "def update_account\n\n @user = User.find(current_user.id)\n\n successfully_updated = @user.update_with_password(user_params)\n\n if successfully_updated\n set_flash_message :notice, :updated\n # Sign in the user bypassing validation in case his password changed\n bypass_sign_in @user\n redirect_to user_path(@user.username)\n else\n render \"edit_account\"\n end\n\n end", "def old_password\n nil\n end", "def update_account(options)\n password = options[:new_password]\n parameters = { :curpass => options[:current_password], :email => options[:email], :newpass => password, :verpass => password, :api_type => :json }\n\n post('api/update', parameters)\n end", "def update_with_password(params = {})\n if params[:password].blank?\n params.delete(:password)\n params.delete(:password_confirmation) if params[:password_confirmation].blank?\n end\n update(params)\n end", "def password_change_new\n\n end", "def skip_password_change_notification!; end", "def update_with_password(params={})\n if params[:password].blank?\n params.delete(:password)\n params.delete(:password_confirmation) if params[:password_confirmation].blank?\n end\n update_attributes(params)\n end", "def account_update_params\nparams.require(:user).permit(:name, :email, :password, :password_confirmation, :current_password)\nend", "def update_without_current_password(params, *options)\n params.delete(:current_password)\n \n if params[:password].blank? && params[:password_confirmation].blank?\n params.delete(:password)\n params.delete(:password_confirmation)\n end\n \n result = update_attributes(params, *options)\n clean_up_passwords\n result\n end", "def update_without_current_password(params, *options)\n params.delete(:current_password)\n \n if params[:password].blank? && params[:password_confirmation].blank?\n params.delete(:password)\n params.delete(:password_confirmation)\n end\n \n result = update_attributes(params, *options)\n clean_up_passwords\n result\n end", "def update_user\n end", "def update_with_password(params={})\n if params[:password].blank?\n params.delete(:password)\n params.delete(:password_confirmation) if\n params[:password_confirmation].blank?\n end\n update_attributes(params)\n end", "def update_with_password(params={})\n params.delete(:current_password)\n\n if params[:password].blank?\n params.delete(:password)\n params.delete(:password_confirmation) if params[:password_confirmation].blank?\n end\n update_attributes(params)\n\n end", "def update\n @search = Item.search(params[:search])\n @user = User.find(current_user.id)\n email_changed = @user.email != params[:user][:email]\n password_changed = !params[:user][:password].empty?\n\n successfully_updated = if email_changed or password_changed #\n @user.update_with_password(params[:user])\n else\n @userparams = params[:user]\n @userparams.delete(:current_password)\n @userparams.delete(:password)\n @user.update_without_password(@userparams)\n end\n\n if successfully_updated\n # Sign in the user bypassing validation in case his password changed\n sign_in @user, :bypass => true\n redirect_to root_path\n else\n render \"edit\"\n end\n end", "def update\n if params[:user][:password].blank? && params[:user][:password_confirmation].blank?\n params[:user].delete(:password)\n params[:user].delete(:password_confirmation)\n end\n super\n end", "def update\n if @user.update_without_password(update_params)\n render_update_success @user\n else\n render_failure @user\n end\n end", "def update_with_password(params={})\n if params[:password].blank?\n params.delete(:password)\n params.delete(:password_confirmation) if params[:password_confirmation].blank?\n end\n update_attributes(params)\n end", "def update_with_password(params={})\n if params[:password].blank?\n params.delete(:password)\n params.delete(:password_confirmation) if params[:password_confirmation].blank?\n end\n update_attributes(params)\n end", "def update_without_current_password(params, *options)\n params.delete(:current_password)\n\n if params[:password].blank? && params[:password_confirmation].blank?\n params.delete(:password)\n params.delete(:password_confirmation)\n end\n\n result = update_attributes(params, *options)\n clean_up_passwords\n result\n end", "def update_without_current_password(params, *options)\n params.delete(:current_password)\n\n if params[:password].blank? && params[:password_confirmation].blank?\n params.delete(:password)\n params.delete(:password_confirmation)\n end\n\n result = update_attributes(params, *options)\n clean_up_passwords\n result\n end", "def update_without_current_password(params, *options)\n params.delete(:current_password)\n\n if params[:password].blank? && params[:password_confirmation].blank?\n params.delete(:password)\n params.delete(:password_confirmation)\n end\n\n result = update_attributes(params, *options)\n clean_up_passwords\n result\n end", "def password_needed?\n resource.authentications.empty? \\\n ? resource.update_with_password(params[resource_name])\\\n : resource.update_attributes(params[resource_name])\n end", "def change_password\n @user = User.shod(params[:id])\n authorize! :update, @user\n end", "def update\n @user = User.find(current_user.id)\n # email_changed = @user.email != params[:user][:email]\n is_facebook_account = [email protected]?\n\n successfully_updated = if !is_facebook_account\n @user.update_with_password(allowed_params)\n else\n @user.update_without_password(allowed_params)\n end\n\n if successfully_updated\n # Sign in the user bypassing validation in case his password changed\n # sign_in @user, :bypass => true\n redirect_to registration_path\n else\n redirect_to registration_path \n end\n end", "def update \n @account = current_user.account\n if @account.authenticate(params[:account].delete(:current_password))\n if params[:edit] == \"email\" # special treatment for email\n @account.send_confirmation_instructions(params[:account][:email])\n flash[:notice] = I18n.t(:\"confirmations.sent\", \n :email => params[:account][:email]).html_safe\n # do not update current email unless it is not confirmed\n if @account.confirmed? \n redirect_to edit_account_path\n return\n end\n end \n if params[:edit] == \"password\"\n params[:account][:password_set_at] = Time.now\n end\n if @account.update_attributes(params[:account])\n redirect_to edit_account_path\n else\n render 'edit'\n end\n else \n @account.errors.add(:current_password, I18n.t(:'accounts.wrong_password'))\n render 'edit'\n end\n end", "def admin_pwd_update\n @user = User.find_by_id(params[:user_id])\n @user.validate_pwd = true\n if @user.update(email: params[:user][:email], password: params[:user][:password], password_confirmation: params[:user][:password_confirmation])\n # if an admin is updating her own password, we need to get around Devise's automatic sign out\n if @user.id == current_user.id\n sign_in(@user, :bypass => true)\n end\n flash.keep[:notice] = 'The password for \"' + params[:user][:email] + '\" was successfully updated.'\n redirect_to '/users'\n else\n render :admin_pwd\n end\n end", "def edit\n if !(current_user.id == @user.id || is_admin?)\n indicate_illegal_request I18n.t('users.not-your-account')\n end\n end", "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 @user.password = params[:user][:password]\n @user.password_confirmation = params[:user][:password_confirmation]\n if @user.save\n @user.attempts = 0\n @user.save\n flash[:notice] = \"Password succesefully updated\"\n redirect_to account_url\n else\n render :action =>:edit\n end\n end", "def update\n # prevent spoofs\n #TODO this is bullshit code; add filters, :before_update\n if !(request.post? || request.put?) || !user_signed_in? ||\n !(self.current_user.user_id == params[:id].to_i || self.current_user.admin_flag == 1)\n flash[:notice] = 'EPIC FAIL. You\\'re not logged in or you\\'re trying to update someone else\\'s account.'\n redirect_to(:controller => '/members', :action => 'index', :id=>params[:id])\n return\n end\n\n serviceable = MemberServiceable.new(params, session)\n @user = serviceable.update\n\n flash[:message]='Account Updated.'\n redirect_to(:controller => '/members', :action => 'profile', :id=>params[:id])\n\n end", "def update\n if user_params[:password].blank?\n user_params.delete(:password)\n user_params.delete(:password_confirmation)\n end\n\n if needs_password?(current_user, user_params)\n save = current_user.update(user_params)\n else\n save = current_user.update_without_password(user_params)\n end\n\n respond_to do |format|\n if save\n format.html { redirect_to current_user.url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @title = \"Edit basic info\"\n @user=User.find(session[:user_id])\n if param_posted?(:user)\n attribute = params[:attribute]\n case attribute\n when \"email\"\n try_to_update @user, attribute\n when \"password\"\n if @user.correct_password?(params)\n try_to_update @user, attribute\n else\n @user.password_errors(params)\n end\n when \"team_id\"\n try_to_update @user, attribute\n end\n end \n #For security purpose, never fill in password fields automatically.\n @user.clear_password!\n end", "def password_updation\n user_id = params[:user_id]\n password = params[:password]\n if password.present?\n @password = User.find(params[:user_id]).update(password: params[:password])\n render json: @password, status: :ok\n else\n render json: { error: 'password can not be nil' }, status: :unauthorized\n end \n end", "def noexist_or_update_password\n !self.respond_to?(:encrypted_password) || self.encrypted_password.nil?\n end", "def update\n @user = User.find(params[:id])\n if current_user.admin? && params[:password].present?\n @user.password = params[:password]\n end\n if @user != current_user && !current_user.admin?\n render json: ['Not authorized for that action'], status: :unauthorized\n elsif @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update_password\n @user.password = @new_e_password\n if GlobalConstant::User.auto_blocked_status == @user.status\n # if we had blocked a user for more than a threshhold failed login attemps we set status to blocked\n # now we should reset it to active\n @user.status = GlobalConstant::User.active_status\n @user.failed_login_attempt_count = 0\n end\n @user.save!\n end", "def update\n @user = User.find(current_user.id)\n\n # See https://github.com/plataformatec/devise/wiki/How-To%3A-Allow-users-to-edit-their-account-without-providing-a-password\n successfully_updated = if needs_password?(@user, params)\n @user.update_with_password(devise_parameter_sanitizer.sanitize(:account_update))\n else\n params[:user].delete(:current_password)\n \n @user.update_without_password(devise_parameter_sanitizer.sanitize(:account_update))\n end\n\n if successfully_updated\n sign_in @user, :bypass => true\n redirect_to dashboard_path, notice: 'User was successfully updated.'\n else\n render 'edit'\n end\n end", "def create_account(user)\n account = Account.to_adapter.get!(user.id)\n update_status = account.update_with_password({ \"email\" => user.email, \"name\" => user.username })\nend", "def update\n \n oldUser = User.find(current_user.id)\n @user = User.find(current_user.id)\n\n successfully_updated = if needs_password?(@user, account_update_params)\n @user.update_with_password(account_update_params)\n else\n # remove the virtual current_password attribute update_without_password\n # doesn't know how to ignore it\n params[:user].delete(:current_password)\n @user.update_without_password(account_update_params)\n end\n\n if successfully_updated\n \n ## Move the user profile photo from tmp to user directory\n if @user.profile_photo!=\"\"\n move_tmp_user_photo(@user)\n end\n \n #update latitude longitude here ...\n if @user.user_type == \"fan\" || @user.user_type == \"artist\"\n #//check if the address has been changed\n addressChanged = !((oldUser.country_id == @user.country_id) && (oldUser.state_id == @user.state_id) && (oldUser.zip [email protected]) && (oldUser.city == @user.city))\n if addressChanged\n fullAddress = \"\"\n countryName = \"\"\n stateName = \"\"\n if @user.country_id.to_i > 0\n countryRow = Country.where(\"id = ? \",@user.country_id.to_i).take\n if countryRow != nil\n countryName = countryRow.country_name\n end\n end\n \n if @user.state_id.to_i > 0\n stateRow = State.where(\"id = ? \",@user.state_id.to_i).take\n if stateRow != nil\n stateName = stateRow.state_name\n end\n end\n \n if @user.zip.to_s != \"\"\n fullAddress = URI.encode(@user.zip)\n end\n \n if @user.city.to_s !=\"\"\n if fullAddress.blank?\n fullAddress = URI.encode(@user.city)\n else\n fullAddress += \",\"+URI.encode(@user.city)\n end \n end\n \n if stateName !=\"\"\n if fullAddress.blank?\n fullAddress = URI.encode(stateName)\n else\n fullAddress += \",\"+URI.encode(stateName)\n end \n end\n \n if countryName !=\"\"\n if fullAddress.blank?\n fullAddress = URI.encode(countryName)\n else\n fullAddress += \",\"+URI.encode(countryName)\n end \n end\n \n #render text: fullAddress and return\n if !fullAddress.blank?\n lat_long = Geocoder.coordinates(fullAddress)\n cUser = User.find(@user.id);\n if lat_long!=nil\n cUser.update_attributes(:latitude => lat_long[0],:longitude => lat_long[1])\n end \n end \n end \n end\n \n set_flash_message :notice, :updated\n # Sign in the user bypassing validation in case his password changed\n sign_in @user, :bypass => true\n redirect_to after_update_path_for(@user)\n else\n render \"edit\"\n end\n end", "def password=(new_password); end", "def update\n @user = User.find(params[:id])\n @user.updating_password = false\n \trespond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_password\n\t\t@admin = current_admin\n\t\tif(@admin.update_attributes(params[:admin]))\n\t\t\tredirect_to root_path\n\t\telse\n\t\t\trender :action => \"reset\"\n\t\tend\n\tend", "def update\n params[:account].delete(:preferred_smtp_password) if params[:account][:preferred_smtp_password].blank?\n respond_to do |format|\n if @account.update_attributes(params[:account])\n format.html { redirect_to dm_core.admin_account_url, notice: \"Account was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.77665645", "0.7309094", "0.71718764", "0.7104889", "0.70890087", "0.70554173", "0.70554173", "0.70554173", "0.70554173", "0.70554173", "0.70554173", "0.70554173", "0.70554173", "0.70554173", "0.70554173", "0.7014014", "0.7005517", "0.700447", "0.7002106", "0.69960284", "0.6981885", "0.6970675", "0.69696224", "0.6969584", "0.6969584", "0.6945366", "0.69326127", "0.68932396", "0.6883737", "0.6800039", "0.67884976", "0.67884976", "0.6779113", "0.67737323", "0.67726105", "0.67525697", "0.6752195", "0.6722596", "0.671074", "0.671074", "0.6690581", "0.6686238", "0.6685998", "0.6684502", "0.6681382", "0.6663775", "0.66474736", "0.66339076", "0.66234845", "0.66232336", "0.66213036", "0.661451", "0.66125286", "0.66125286", "0.6609615", "0.6608392", "0.6606097", "0.65947556", "0.6588827", "0.65866446", "0.65865755", "0.65633553", "0.65623134", "0.656229", "0.6560109", "0.65560436", "0.65560436", "0.6549221", "0.65435016", "0.6534102", "0.6516005", "0.6513658", "0.6509609", "0.6502437", "0.6502437", "0.6496947", "0.6496947", "0.6496947", "0.64965975", "0.64873695", "0.6475431", "0.64643985", "0.6461469", "0.6456178", "0.6438374", "0.6436076", "0.6429663", "0.6424981", "0.64244235", "0.6413317", "0.6408713", "0.64060163", "0.6401145", "0.6394382", "0.63927186", "0.639266", "0.6392196", "0.63921213", "0.6390689", "0.6387645" ]
0.64902127
79
Returns the language as reported by the HTTP client.
def language if !block_given? return @j_del.java_method(:language, []).call() end raise ArgumentError, "Invalid arguments when calling language()" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def language\n @grpc.language\n end", "def get_lang_from_headers\n\t\t\t@env['HTTP_ACCEPT_LANGUAGE'].to_s[0, 2]\n\t\tend", "def language\n return @language\n end", "def language\n fetch('nation.language')\n end", "def language\n @language ||= LanguageDetector.new\n end", "def language\n return proper_language(self.parameters[:language]) if self.parameters[:language]\n return session_lang = proper_language(self.session[:language]) if self.session[:language]\n \n lang = self.env['HTTP_ACCEPT_LANGUAGE'] || ''\n m = lang.match(/^[a-zA-Z]{2}(\\-[a-zA-Z]{2})?/)\n\n return TranslatorExtension.defaults[:language] unless m\n match = m[0]\n return proper_language(match)\n end", "def language (value = nil)\n\t\tif value\n\t\t\traise_if_error C.glyr_opt_lang(to_native, value)\n\t\telse\n\t\t\tto_native[:lang]\n\t\tend\n\tend", "def lang\n\t\t\t@data[\"lang\"]\n\t\tend", "def pbGetLanguage()\n case System.user_language[0..1]\n when \"ja\" then return 1 # Japanese\n when \"en\" then return 2 # English\n when \"fr\" then return 3 # French\n when \"it\" then return 4 # Italian\n when \"de\" then return 5 # German\n when \"es\" then return 7 # Spanish\n when \"ko\" then return 8 # Korean\n end\n return 2 # Use 'English' by default\nend", "def language \n \"language\" \n end", "def message_language\n return @message_language\n end", "def language\n self\n end", "def negotiate_language\n host = request.env['HTTP_X_FORWARDED_HOST'] || request.env['HTTP_HOST'] || \"www.omdb.org\"\n if !local_request? and host.split(\":\").first.split(\".\").first != \"www\"\n lang = host.split(\":\").first.split('.').first\n elsif request.env['HTTP_ACCEPT_LANGUAGE'].to_s.blank?\n lang = 'en'\n else\n lang = request.env['HTTP_ACCEPT_LANGUAGE'].split(',')[0]\n lang = lang.split('-')[0] if lang =~ /-/\n end\n # fall back to english if the language is currently not supported\n if not LOCALES.keys.include?( lang )\n lang = 'en'\n end\n # :TODO: This might throw a RecordNotFound Exception, but we'll\n # deal with that later on. currently its nice to see if a language\n # is not supported.\n Globalize::Language.find_by_iso_639_1(lang)\n end", "def language; end", "def language; end", "def language; end", "def language; end", "def language\n if @language.nil?\n @language = FeedTools::XmlHelper.select_not_blank([\n FeedTools::XmlHelper.try_xpaths(self.channel_node, [\n \"language/text()\",\n \"dc:language/text()\",\n \"@dc:language\",\n \"@xml:lang\",\n \"xml:lang/text()\"\n ], :select_result_value => true),\n FeedTools::XmlHelper.try_xpaths(self.root_node, [\n \"@xml:lang\",\n \"xml:lang/text()\"\n ], :select_result_value => true)\n ])\n if @language.blank?\n @language = \"en-us\"\n end\n @language.gsub!(/_/, \"-\")\n @language = @language.downcase\n if @language.split('-').size > 1\n @language =\n \"#{@language.split('-').first}-\" +\n \"#{@language.split('-').last.upcase}\"\n end\n end\n return @language\n end", "def lang; end", "def lang; end", "def lang; end", "def lang; end", "def language\n read_attribute(:language) || Language::MULTIPLE_LANGUAGES\n end", "def language\n attributes.fetch(:language)\n end", "def language\n attributes.fetch(:language)\n end", "def language #:nodoc\n return '' if read_attribute(:language).nil?\n read_attribute(:language).to_sym\n end", "def get_locale_from_http_header\n return DEFAULT_LANGUAGE if request.env['HTTP_ACCEPT_LANGUAGE'].nil?\n locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n return locale if I18N_ALL_LANGUAGES.include?( locale)\n return DEFAULT_LANGUAGE\n end", "def language_client; end", "def language\n \tread_attribute(:language) || Language::MULTIPLE_LANGUAGES\n\tend", "def language\n if ladnn?\n ['zxx'] # MARC code for 'No linguistic content'\n else\n # If it's populated, DLCS uses MARC IDs, not labels, so we don't need to map like w/ resource_type\n map_field(:language)\n end\n end", "def language\n case \n when self.ENU || self.ENG then \"ENG\"\n when self.SPM || self.SPE then \"SPE\"\n when self.FRC || self.FRF then \"FRF\"\n when self.ITI then \"ITI\"\n when self.DUN then \"DUN\"\n when self.GED then \"GED\"\n end\n end", "def locale\n if self.language\n LANGUAGE_CODE[self.language]\n end\n end", "def pbGetLanguage()\n getUserDefaultLangID=Win32API.new(\"kernel32\",\"GetUserDefaultLangID\",\"\",\"i\") rescue nil\n ret=0\n if getUserDefaultLangID\n ret=getUserDefaultLangID.call()&0x3FF\n end\n if ret==0 # Unknown\n ret=MiniRegistry.get(MiniRegistry::HKEY_CURRENT_USER,\n \"Control Panel\\\\Desktop\\\\ResourceLocale\",\"\",0)\n ret=MiniRegistry.get(MiniRegistry::HKEY_CURRENT_USER,\n \"Control Panel\\\\International\",\"Locale\",\"0\").to_i(16) if ret==0\n ret=ret&0x3FF\n return 0 if ret==0 # Unknown\n end\n return 1 if ret==0x11 # Japanese\n return 2 if ret==0x09 # English\n return 3 if ret==0x0C # French\n return 4 if ret==0x10 # Italian\n return 5 if ret==0x07 # German\n return 7 if ret==0x0A # Spanish\n return 8 if ret==0x12 # Korean\n return 2 # Use 'English' by default\nend", "def current_language\n @@current_language\n end", "def language\n fetch('dnd.languages')\n end", "def language\n match(/Language\\s+:\\s+([\\w]+)$/)\n end", "def language\n @values.fetch('ai.device.language') { \n @values['ai.device.language'] = nil\n }\n end", "def site_language\n @attributes[:site_language]\n end", "def locale_from_http_header\n language = request.env['HTTP_ACCEPT_LANGUAGE']\n unless language.blank?\n http_locale = language.scan(/^[a-z]{2}-[A-Z]{2}/)\n unless http_locale.blank?\n http_locale = http_locale.first\n else\n http_locale = language.scan(/^[a-z]{2}/).first\n end\n end\n end", "def language\n ENV['NETAXEPT_LANGUAGE'] || 'no_NO'\n end", "def language\n from_index[:language]\n end", "def get_lang\n\t\t\tif @cookies['lang']\n\t\t\t\t# we have a cookie - do not set it at all, just read\n\t\t\t\tif @cookies['lang'].is_a?(Hash)\n\t\t\t\t\tcur_lang = @cookies['lang'][:value].to_sym\n\t\t\t\telse\n\t\t\t\t\tcur_lang = @cookies['lang'].to_sym\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t# no cookie - set it, don't validate yet\n\t\t\t\tcur_lang = get_lang_from_headers\n\t\t\t\t@cookies['lang'] = {value: cur_lang, expires:(Time.now+cookie_expiration_time)}\n\t\t\t\tcur_lang = cur_lang.to_sym\n\t\t\tend\n\t\t\t\n\t\t\t# validate the language\n\t\t\tlangs = %w[pl en].map(&:to_sym)\n\t\t\tcur_lang = (langs.include?(cur_lang) ? cur_lang : :en)\n\t\t\t\n\t\t\treturn cur_lang\n\t\tend", "def language(doc)\n node = doc.at('/html/@lang')\n if node\n lang = node.text\n if lang.present?\n lang.split(/[^a-zA-Z]/, 2).first.downcase\n end\n end\n end", "def default_lang\n GamePlay::Load::DEFAULT_GAME_LANGUAGE\n end", "def extract_locale_from_accept_language_header\n # One source of client supplied information would be an Accept-Language HTTP header.\n # People may set this in their browser\n if (request.env['HTTP_ACCEPT_LANGUAGE'] != nil)\n request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n #request.env['HTTP_ACCEPT_LANGUAGE']\n end\n end", "def language; languages.first; end", "def language; languages.first; end", "def extract_locale_from_accept_language_header\n lang = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n logger.info \"INFO: Language #{lang} determined from header\"\n lang\n end", "def language\n attributes[\"language\"] || \"en\"\n end", "def language\n text(data.at_xpath(\"#{data_root}/did/langmaterial/language/@langcode\"))\n end", "def language\n tag = self.languages.first\n return tag ? tag.name : nil\n end", "def select_language\n I18n.backend.send(:init_translations) unless I18n.backend.initialized?\n lang = PatientHelper.languages(primary_language)&.dig(:code)&.to_sym || :en\n lang = :en unless %i[en es es-PR so fr].include?(lang)\n lang\n end", "def human\n I18n.t(language, scope: :languages)\n end", "def language\n language = case\n when @node.document.is_a?(::Nokogiri::XML::Document) && @node.attributes[\"xml:lang\"]\n @node.attributes[\"xml:lang\"].to_s\n when @node.document.is_a?(::Nokogiri::XML::Document) && @node.attributes[\"lang\"]\n @node.attributes[\"lang\"].to_s\n when @node.attribute(\"lang\")\n @node.attribute(\"lang\").to_s\n else\n parent && parent.element? && parent.language\n end\n end", "def locale\n lang = params.fetch(:language, I18n.default_locale).to_sym\n I18n.available_locales.include?(lang) ? lang : I18n.default_locale\n end", "def lang\n language = \"#{@lang}\".strip.downcase\n { #Aliases to languages names\n \"eng\" => [\"en\",\"en-us\",\"english\"],\n \"ita\" => [\"it\"],\n \"por\" => [\"pt\",\"pt-br\",\"portuguese\"],\n \"spa\" => [\"sp\"]\n }.each do |value,names|\n return \" -l #{value} \" if names.include? language\n end\n return \" -l #{language} \" if language.size > 0\n \"\"\n rescue\n \"\"\n end", "def display_language\n default = I18n.locale.try {|l| l.to_s.gsub(/\\-.*$/, '')} || \"en\"\n\n this_doc = self.language_obj.try(:iso_639_1)\n\n return nil if this_doc == default\n\n self.language_str\n end", "def extract_locale_from_accept_language_header\n request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z] {2} /).first\n end", "def get_language(code, options = {})\n root = get_root\n object_from_response(GogoKit::Language,\n GogoKit::LanguageRepresenter,\n :get,\n \"#{root.links['self'].href}/languages/#{code}\",\n options)\n end", "def valid_language\n locale = extract_locale_from_accept_language_header\n logger.debug \"* Extracted Locale ID: #{locale}\"\n if !locale.blank? &&\n (locale == 'de' ||\n locale == 'en')\n locale\n else\n DEFAULT_LANGUAGE\n end\n end", "def valid_language\n locale = extract_locale_from_accept_language_header\n logger.debug \"* Extracted Locale ID: #{locale}\"\n if !locale.blank? &&\n (locale == 'de' ||\n locale == 'en')\n locale\n else\n DEFAULT_LANGUAGE\n end\n end", "def language_code\n self[:language_code] || (self.person ? self.person.default_language : Utility.language_code)\n end", "def language_code\n self[:language_code] || (self.person ? self.person.default_language : Utility.language_code)\n end", "def language_code\n self[:language_code] || (self.person ? self.person.default_language : Utility.language_code)\n end", "def language_server; end", "def lang locale\n if translations.find_by(locale: locale).try(:automated?)\n \"#{locale}-x-mtfrom-de\"\n else\n locale.to_s\n end\n end", "def language\n return 'en' if code == \"ind2:0\"\n \n return 'se' if code == \"ind2:4\"\n\n return nil\n end", "def extract_locale_from_accept_language_header\n lang = request.env['HTTP_ACCEPT_LANGUAGE']\n lang.split(\",\")[0].to_sym if lang\n end", "def default_language\n @default_language || :en\n end", "def language\n @language ||= begin\n primary = languages.max_by { |(_, size)| size }\n primary && primary[0]\n end\n end", "def detectLang(path)\n # The language detector is not doing well for subs, so we will just always assume english...\n return 'en'\n\n lang = $languageDetector.language_iso(getCleanText(path))\n if (lang != nil)\n return lang.to_s()\n end\n\n return UNKNOWN_LANG\nend", "def user_language\n USER_LANGUAGE[spoken_language]\n end", "def extract_locale_from_accept_language_header\n request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n end", "def extract_locale_from_accept_language_header\n request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n end", "def extract_locale_from_accept_language_header\n request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n end", "def language_name_of_text\n if self.language_of_text\n self.language_of_text.human\n end\n end", "def language(property)\n @languages.fetch(property.to_s, @default_language) if !coerce(property)\n end", "def language\n compiler && @compiler.class.language\n end", "def get_locale_from_session\n if (session && session[:language])\n logger.debug \"*** Language from Session '#{session[:language]}'\"\n lang = session[:language]\n else\n lang = default_language\n end\n lang\n end", "def current_language\n @attributes[:current_language]\n end", "def available_languages\n AppConfig.available_languages\n end", "def code\n @grpc.language_code\n end", "def get_language(retina_name, body)\n resource_path = '/text/detect_language'\n verb = 'POST'\n query_params = { 'retina_name' => retina_name}\n post_data = body\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 RetinaSDK::Model::LanguageRest.new(JSON.parse(response.body, symbolize_names: true))\n end", "def language_code\n if self.class.globalized?\n unless @original_language.nil?\n code = @original_language.code\n else\n code = Globalize::Locale.base_language.code\n end\n elsif Globalize::Locale.language.nil?\n code = Globalize::Locale.base_language.code\n else\n code = Globalize::Locale.language.code\n end\n code\n end", "def locale\n @grpc.locale\n end", "def locale\n @grpc.locale\n end", "def get_languages\n response = get_siteinfo('languages')\n ret = {}\n response['query']['languages'].each { |l| ret[l['code']] = l['*'] }\n ret\n end", "def languages\n get(\"/repos/show/#{owner.login}/#{name}/languages\")['languages']\n end", "def language_of_text\n @descriptive_detail.language_of_text || @default_language_of_text\n end", "def get_language_list\n call :get_language_list\n end", "def lang\n if self.attributes['xml:lang']\n return self.attributes['xml:lang'].to_s\n elsif self.parent != nil\n return self.parent.lang\n else\n return nil\n end\n end", "def language_code\n @language_code ||= code_parts[0]\n end", "def language\n return OrderedStringHelper.deserialize(super )\n end", "def language_tag\n return @language_tag\n end", "def to_lang\n session[:lang_to]\n end", "def current\n RequestStore.store[:alchemy_current_language] || default\n end", "def extract_locale_from_accept_language_header\n locale = \"en_US\"\n locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first \\\n if not request.env['HTTP_ACCEPT_LANGUAGE'].nil?\n return locale\n end", "def language\n @language ||= if %W[rbx maglev].any? { |name| engine == name }\n CPlusPlus\n elsif platform =~ /java/\n Java\n else\n C\n end\n end", "def extract_locale_from_accept_language_header\n if request.env['HTTP_ACCEPT_LANGUAGE']\n request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first.to_sym\n end\n end", "def locale\n @locale || YodleeApi.locale\n end" ]
[ "0.79275894", "0.78630966", "0.774996", "0.763481", "0.75697213", "0.74921197", "0.7480894", "0.7476675", "0.74477047", "0.73808897", "0.7352768", "0.7340096", "0.72298646", "0.72244525", "0.72244525", "0.72244525", "0.72244525", "0.721546", "0.71767336", "0.71767336", "0.71767336", "0.71767336", "0.7161175", "0.71519345", "0.71519345", "0.7151065", "0.713199", "0.7130228", "0.7124055", "0.71100557", "0.7100844", "0.70714885", "0.70631164", "0.7058962", "0.7030512", "0.7003687", "0.6998973", "0.69447565", "0.6916601", "0.6893663", "0.68916625", "0.68902177", "0.6885552", "0.6874874", "0.68650186", "0.6864349", "0.6864349", "0.6863001", "0.6847756", "0.683795", "0.68237853", "0.6817869", "0.68107677", "0.6807634", "0.680202", "0.678154", "0.6766392", "0.67612064", "0.67344296", "0.67211443", "0.6720182", "0.6712182", "0.6712182", "0.6712182", "0.67060906", "0.6702532", "0.6700139", "0.66978925", "0.6696797", "0.66872823", "0.668066", "0.6675428", "0.66718364", "0.66718364", "0.66718364", "0.6648264", "0.66325843", "0.6610778", "0.66105914", "0.6609432", "0.6608617", "0.6598008", "0.65896815", "0.6584922", "0.6581154", "0.6581154", "0.65807563", "0.65792245", "0.6578056", "0.6565538", "0.6562548", "0.65534484", "0.6543196", "0.6540561", "0.6534138", "0.6533506", "0.6533431", "0.6524671", "0.6520248", "0.6504339" ]
0.6809053
53
Returns the country as reported by the HTTP client.
def country if !block_given? return @j_del.java_method(:country, []).call() end raise ArgumentError, "Invalid arguments when calling country()" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def country\n ISO3166::Country[@country_code]\n end", "def country\n data['country']\n end", "def country\n RAILS_DEFAULT_LOGGER.debug(\"profile.country -- returning #{setting(:company_country)}\")\n \n setting(:company_country).to_s\n end", "def country\n 'United Kingdom'\n end", "def country\n location[2] || location[1]\n end", "def country\n @country || @default_country || 'GB'\n end", "def country\n self[:C]\n end", "def country(opts = {})\n data, _status_code, _headers = country_with_http_info(opts)\n data\n end", "def country\n if(@country_code.to_i == 280)\n IsoCountryCodes.find(276) #since 1990 we use 176 for whole germany, 280 was for \"west germany\" WTF\n else\n IsoCountryCodes.find(@country_code)\n end\n end", "def get_country\n @single_city_data[\"sys\"][\"country\"]\n end", "def country()\n country = Country.find_by_id(@country_id)\n return country\n end", "def country\n 'Australia'\n end", "def country_code\n if self.uk?\n UK_COUNTRY_CODE\n else\n IE_COUNTRY_CODE\n end\n end", "def country\n @country ||= begin\n valid_countries.find do |iso2|\n @data[iso2][Core::MAIN_COUNTRY_FOR_CODE] == 'true'\n end || valid_countries.first || countries.first\n end\n end", "def country_code\n return @country_code\n end", "def get_country_name\n subdivision = Geonames::WebService.country_subdivision @latitude, @longitude\n subdivision.country_name\n end", "def country\n client.places.get_countries.select{|hash| hash[\"cid\"] == @params[:country].to_i}.first[:title]\n end", "def country\n @country ||= I18n.default_locale\n end", "def get_country_code\n Geonames::WebService.country_code @latitude, @longitude\n end", "def represented_country; end", "def country\n @country\n end", "def country_name\n ISO3166::Country[country_code].name if country_code.present?\n end", "def country\n params['country']\n end", "def country_code\n @country_code.to_s\n end", "def user_country\n USER_COUNTRY[country]\n end", "def country_name\n countryfull = ISO3166::Country[country]\n countryfull.translations[I18n.locale.to_s] || countryfull.name\n end", "def country_name\n country = ISO3166::Country[country_code]\n # country.translations[I18n.locale.to_s] || country.name\n # country.name\n end", "def country\n @country ||= IsoCountryCodes.find(alpha2)\n end", "def country_name\n iso_country = ISO3166::Country[country] # `country` should be code like 'AU'\n iso_country.translations[I18n.locale.to_s] || iso_country.name\n end", "def get_country_name_lib country_code\n country = Carmen::Country.coded(country_code)\n if country\n country.name\n else\n \"N/A\"\n end\n end", "def country_name\n country = ISO3166::Country[country_code]\n country.translations[I18n.locale.to_s] || country.name\n end", "def country_name\n country = ISO3166::Country[country_code]\n country.translations[I18n.locale.to_s] || country.name\n end", "def country_name\n country = ISO3166::Country[country_code]\n country.translations[I18n.locale.to_s] || country.name\n end", "def country_code\n end", "def country_code\n decode hash[\"CountryCode\"]\n end", "def country_name\n cc = carmen_country\n\n cc ? \"#{cc.name}\" : ''\n end", "def country\n \tself.contry\n end", "def country\n query_root_node(\"gdacs:country/text()\", @@NAMESPACES)\n end", "def get_country(ip=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'ip', ip)\n\t\t\tclient.queue_service_action_call('system', 'getCountry', 'KalturaCountry', 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 country_code\n end", "def country; end", "def country; end", "def country; end", "def country_code\n \"+#{fetch('country_code')}\"\n end", "def country_code; end", "def country_code; end", "def pbGetCountry()\n getUserGeoID=Win32API.new(\"kernel32\",\"GetUserGeoID\",\"l\",\"i\") rescue nil\n if getUserGeoID\n return getUserGeoID.call(16)\n end\n return 0\nend", "def country_name(multilingual = false)\n if self.country\n country_data = ISO3166::Country[self.country]\n\t\t\tif country_data and multilingual\n\t\t\t country_data.translations[I18n.locale.to_s] || country_data.name\n\t\t\telsif country_data\n\t\t\t country_data.name\n\t\t\telse\n\t\t\t self.country\n\t\t\tend\n else\n \"\"\n end\n end", "def format_country(country)\n return country if country == '' || country == 'Global'\n\n begin\n IsoCountryCodes.find(country).name\n rescue\n # Fallback to raw value\n country\n end\n end", "def country_name(country_code)\n country = ISO3166::Country[country_code]\n country.name\n end", "def get_country(str)\n data = check_local_db(str)\n\n if data.nil? \n data = Geocoder.search(str)\n\n #has to parse through geocode data to find correct result\n data.first.address_components.each do |obj|\n data = obj[\"short_name\"] if obj[\"types\"][0] == \"country\"\n end\n\n save_to_db(str, data)\n end\n\n return data\n end", "def country\n self.well_info.country\n end", "def get_country(device_access_id)\n DeviceAccess.find(device_access_id).access_country\n end", "def country_code\n @root.xpath('./ns:CountryCode/text()').to_s\n end", "def office_country\n self.dig_for_string(\"agentSummary\", \"office\", \"officeAddress\", \"country\")\n end", "def countries\n document[\"nationality\"].collect {|nation| nation[\"$\"]} rescue nil\n end", "def get_country(code, options = {})\n root = get_root\n object_from_response(GogoKit::Country,\n GogoKit::CountryRepresenter,\n :get,\n \"#{root.links['self'].href}/countries/#{code}\",\n options)\n end", "def country\n Faker::Address.country\n end", "def country\n Faker::Address.country\n end", "def country_code\n cc = carmen_country\n\n cc ? \"#{cc.code.upcase}\" : nil\n end", "def country(hostname)\n case @database_type\n when Edition::CITY_REV0, Edition::CITY_REV1, Edition::CITY_REV1_V6\n city(hostname)\n\n when Edition::REGION_REV0, Edition::REGION_REV1\n region(hostname)\n\n when Edition::NETSPEED, Edition::NETSPEED_REV1\n netspeed(hostname)\n\n when Edition::COUNTRY, Edition::PROXY, Edition::COUNTRY_V6\n ip = lookup_ip(hostname)\n if @ip_bits > 32\n\tipaddr = IPAddr.new ip\n\tcode = (seek_record(ipaddr.to_i) - COUNTRY_BEGIN)\n else\n\t# Convert numeric IP address to an integer\n\tipnum = iptonum(ip)\n\tcode = (seek_record(ipnum) - @database_segments[0])\n end\n read_country(code, hostname, ip)\n else\n throw \"Invalid GeoIP database type #{@database_type}, can't look up Country by IP\"\n end\n end", "def country\n city.country\n end", "def registered_country; end", "def country_or_region\n return @country_or_region\n end", "def country_us()\n @request_data = {\n\t\t\t\"type\"\t\t=> \"home\",\n \"ip\" => \"12.25.205.51\",\n \"session\" => \"new\",\n \"cuid\" => \"new\",\n \"lang\" => \"en\",\n \"site\" => \"ctshirts\",\n \"currentURI\" => \"http://www.ctshirts.co.uk\",\n \"previousURI\" => \"http://www.ctshirts.co.uk\",\n \"clientToken\" => \"677ab692r2t3u4t\", \n \"recContent\" => \"refCodeOnly\",\n }\n @json_request = \"\"\n @response_times = []\n end", "def countries(opts = {})\n data, status_code, headers = countries_with_http_info(opts)\n return data\n end", "def country_code\n Geocoder.search(hotel.city).first.country_code\n rescue Exception\n 'CZ'\n end", "def country\n query = create_query(\n :Location, :regexp_search, regexp: \"#{params[:country]}$\"\n )\n show_selected_locations(query, link_all_sorts: true)\n end", "def get_country_setting\n service_response = ClientManagement::GetCountrySetting.new(params).perform\n render_api_response(service_response)\n end", "def country=(value)\n\t\t\t@country = value\n\t\tend", "def carmen_country\n return unless country.is_a?(String)\n\n Carmen::Country.named(country) || Carmen::Country.coded(country)\n end", "def get_country_short_from_ip(remote_ip)\n begin\n geoip = GeoIP.new(\"#{Rails.root}/lib/GeoIP.dat\")\n country = geoip.country(remote_ip)\n\n if country != nil and country.country_code > 0\n short = translate_site(country.country_code2) # Se if we have a GB that should be UK\n return short\n end\n rescue\n return false\n end\n return false\n end", "def country_code\n (self.country.nil? ? nil : self.country.code)\n end", "def get_country_name country_code\n country = Country.find(\n :first,\n :conditions => [\"LOWER(Code) = ?\", country_code]\n )\n if country\n country.Name\n else\n \"N/A\"\n end\n end", "def country_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.country ...'\n end\n # resource path\n local_var_path = '/country'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<CountryMetadata>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#country\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def country=(value)\n @country = value\n\n @format = case country_code\n when nil, '' then nil\n else LocalPostal::Format.from_country_code(country_code)\n end\n end", "def country_gb()\n @request_data = {\n\t\t\t\"type\"\t\t=> \"home\",\n \"ip\" => \"89.187.117.101\",\n \"session\" => \"new\",\n \"cuid\" => \"new\",\n \"lang\" => \"en\",\n \"site\" => \"ctshirts\",\n \"currentURI\" => \"http://www.ctshirts.co.uk\",\n \"previousURI\" => \"http://www.ctshirts.co.uk\",\n \"clientToken\" => \"677ab692r2t3u4t\", \n \"recContent\" => \"refCodeOnly\",\n }\n @json_request = \"\"\n @response_times = []\n end", "def country_list\n get_request( \"/api/v2_1/api/countries\")\n end", "def geoip_country_code(ip)\n geoip = GeoIP.new(Settings.geoip.db_path)\n geoip.country(ip).country_code2\nend", "def office_country_code\n self.dig_for_string(\"agentSummary\", \"office\", \"officeAddress\", \"countryCode\")\n end", "def get_country_name( code )\n # Strip and lowercase code\n new_code = code.strip.downcase\n # Find country by code. If not found, default to empty string.\n country = $COUNTRIES.find do |record|\n record[:code] == new_code.downcase\n end || ''\n\n return country.length > 0 ? \"The country you selected is #{country[:name]}.\" :\n 'That country code is not in our database.'\nend", "def get_node_country(node_city)\n @nodes[node_city].country\n end", "def has_country\n query_root_node(\"lgdo:hasCountry/text()\", @@NAMESPACES).to_s\n end", "def country(code, name); end", "def countries\r\n\t\t\tCOUNTRIES\r\n\t\tend", "def get_countries\n perform(:get, 'enum/countries', nil, nonauth_headers).body\n end", "def countries_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CountriesApi#countries ...\"\n end\n \n # resource path\n local_var_path = \"/countries/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'languageCode'] = opts[:'language_code'] if opts[:'language_code']\n query_params[:'key'] = opts[:'key'] if opts[:'key']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CountryList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CountriesApi#countries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_country_from_http_accept_language\n\n #\"HTTP_ACCEPT_LANGUAGE\\\"=>\\\"en-us,en;q=0.5\\\"\n accept_language = request.env['HTTP_ACCEPT_LANGUAGE']\n \n language = 'en'\n locale = 'us'\n \n unless accept_language.nil?\n language = accept_language[0,2] unless accept_language.length < 2\n locale = accept_language[3,2] unless accept_language.length < 5\n end\n \n case locale\n when 'us' then\n @customer.country = 'US'\n when 'ca' then\n @customer.country = 'CA'\n when 'gb' then \n @customer.country = 'GB'\n end \n end", "def country_fr()\n @request_data = {\n\t\t\t\"type\"\t\t=> \"home\",\n \"ip\" => \"178.251.201.141\",\n \"session\" => \"new\",\n \"cuid\" => \"new\",\n \"lang\" => \"en\",\n \"site\" => \"ctshirts\",\n \"currentURI\" => \"http://www.ctshirts.co.uk\",\n \"previousURI\" => \"http://www.ctshirts.co.uk\",\n \"clientToken\" => \"677ab692r2t3u4t\", \n \"recContent\" => \"refCodeOnly\",\n }\n @json_request = \"\"\n @response_times = []\n\t\tend", "def get_countries\n \tresponse = invoke(\"web:GetCountries\", :soap_action => :none)\n\n \tnode = response.document.xpath('//ns:GetCountriesResult', ns)[0]\n \tparse_country_description(node)\n end", "def country_codes; end", "def country_codes; end", "def country_codes; end", "def country_codes; end", "def country_codes; end", "def country_codes; end", "def country_code_alpha2\n country_code == 'EL' ? 'GR' : country_code\n end", "def location\n c = Country.find_country_by_alpha2(country)\n country_name = !c.nil? ? c.name : nil\n if (postcode and country)\n return postcode + \", \" + (country_name or country)\n else\n return (postcode or country_name or country)\n end\n end", "def country_imgcode\n COUNTRIES[@country].img_code\n end", "def selected_country_code(address)\n address.country_code.blank? ? 'AU' : address.country_code\n end" ]
[ "0.79101694", "0.7850603", "0.7815305", "0.77775955", "0.7724138", "0.7642468", "0.7615027", "0.7606179", "0.7601508", "0.75596166", "0.7522739", "0.7517659", "0.7453556", "0.7448401", "0.7440457", "0.74026144", "0.73998547", "0.7368711", "0.7275662", "0.7275027", "0.7223354", "0.7212317", "0.7203967", "0.7138518", "0.71127015", "0.7103231", "0.7099941", "0.7074415", "0.7045054", "0.70290625", "0.7028776", "0.7028776", "0.7028776", "0.7015675", "0.6958738", "0.6913395", "0.6891176", "0.6864342", "0.68594", "0.68502474", "0.6826185", "0.6826185", "0.6826185", "0.68122184", "0.67922217", "0.67922217", "0.67859745", "0.67751443", "0.6770477", "0.6726431", "0.6687732", "0.66840374", "0.66629845", "0.66607285", "0.6659911", "0.6634118", "0.6609442", "0.6596296", "0.6596296", "0.6580747", "0.65794367", "0.6566348", "0.653571", "0.65330523", "0.65131176", "0.64712864", "0.64347476", "0.64239335", "0.64167154", "0.6377034", "0.6359082", "0.63492614", "0.6348218", "0.63453966", "0.63265663", "0.632469", "0.62887406", "0.62856066", "0.62802196", "0.6269772", "0.62669164", "0.62426645", "0.62357765", "0.62298983", "0.6227964", "0.6213723", "0.61918956", "0.6181211", "0.6167849", "0.6152759", "0.6129129", "0.6129129", "0.6129129", "0.6129129", "0.6129129", "0.6129129", "0.6123598", "0.6118998", "0.6099805", "0.6096149" ]
0.71875936
23
Returns the variant as reported by the HTTP client.
def variant if !block_given? return @j_del.java_method(:variant, []).call() end raise ArgumentError, "Invalid arguments when calling variant()" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variant\n self.class.variant\n end", "def variant\r\n return nil if variants?\r\n variants.first\r\n end", "def variant; end", "def variant; end", "def variant\n return nil if variants?\n variants.first\n end", "def result_variant\n custom_result_variant? ? custom_result_variant : read_attribute(:result_variant)\n end", "def get_variant(identifier, override = nil)\n # identifier object to handle finding and caching the\n # experiment\n identifier = GxApi::ExperimentIdentifier.new(identifier)\n\n Celluloid::Future.new do\n # allows us to override and get back a variant\n # easily that conforms to the api\n if override.nil?\n self.get_variant_value(identifier)\n else\n Ostruct.new(self.default_values.merge(name: override))\n end\n end\n end", "def variation\n variations.first\n end", "def get_variant_value(identifier)\n data = Gxapi.with_error_handling do\n Timeout::timeout(2.0) do\n Gxapi.cache.fetch(self.cache_key(identifier)) do\n @interface.get_variant(identifier).to_hash\n end\n end\n end\n Ostruct.new(\n data.is_a?(Hash) ? data : self.default_values\n )\n end", "def flavour\n variables[:flavour]\n end", "def flavor\n return @flavor\n end", "def get_api_version\n _make_request(:types)['version'].to_s\n end", "def version\n return @discovery_document['version']\n end", "def version\n @version_obj ||= fetcher.get(Fastly::Version, service_id, version_number)\n end", "def version\n @version_obj ||= fetcher.get(Fastly::Version, service_id, version_number)\n end", "def version\n self.class.get(\"/get/version\")\n end", "def get_version\n request('getVersion')\n end", "def protocol\n response = get(:protocol)\n version = response.body\n version.to_i rescue 0\n end", "def version\n fetch('vehicle.version')\n end", "def variants; end", "def get_variant\n @product = Spree::Product.find_by :slug => params[:product_id]\n @variant = @product.find_variant_by_options(params[:ids].split(','))\n if @variant\n respond_to do |format|\n format.json {render json: {variant_id: @variant.id, image_ids: @variant.image_ids}}\n end\n end\n end", "def client_version\n ClientVersion\n end", "def content_type\n response&.response&.content_type\n end", "def variant_url\n if Rails.application.fastly_enabled?\n FastlyLocation.new(attachment).url\n else\n attachment.processed.url\n end\n end", "def show\n @variant = Variant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @variant }\n end\n end", "def show\n @variant = Variant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @variant }\n end\n end", "def client_protocol_version\n match = @automation_client << VERSION_CONSTANT_NAME >> /\\d*/\n version = match[0].to_i\n return version\n end", "def get_version()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('system', 'getVersion', 'string', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend", "def get_head_variant(html)\n node = html.css(\".pos-header .var .v[title='Variant form']\")\n node.map(&:text) unless node.empty?\n end", "def get_selected_variant_data\n @variant = Spree::Variant.where(:id => params[:variant_id]).first\n @sku = @dispatch_no = @variant.sku+\"_\"+Time.now.strftime('%y%m%d%H%L')\n price = @variant.price\n respond_to do |format|\n format.json { render :json => {:variant => @variant,\n :sku => @sku, :price => price }}\n end\n end", "def document_type\n unless @version\n version = self['VERSION'].to_s\n\n case version\n when '2.1'\n @version = VCARD21\n when '3.0'\n @version = VCARD30\n when '4.0'\n @version = VCARD40\n else\n # We don't want to cache the version if it's unknown,\n # because we might get a version property in a bit.\n return UNKNOWN\n end\n end\n\n @version\n end", "def type\n type_and_version[0]\n end", "def set_request_variant\n request.variant = :mobile if request.user_agent =~ /android|Android|blackberry|iphone|ipod|iemobile|mobile|webos/\n request.variant = :android_app if request.user_agent =~ /AndroidApp/\n puts \"--------------\"+request.variant.to_s+\"--------------\"\n end", "def variation\n params[:variation]\n end", "def http_version\n @parser.http_version\n end", "def version\n detect_product('GSA').version\n end", "def value\n error! unless self.kind_of?(HTTPSuccess)\n end", "def variant\n shop = params[:shop]\n product_id = params[:id]\n variant_id = params[:variant_id]\n image_url = params[:url]\n\n begin\n url = \"http://variantimages.shopifyapps.com/jquery-preload.js?shop=#{shop}&id=#{product_id}\"\n content = open(url).read\n\n if match = content.match(/variantData = ([^;]+);/)\n variant_url = URI(image_url)\n variant_url.path = variant_path([\n File.dirname(variant_url.path),\n JSON.parse(match[1])[variant_id][\"filename\"].split('.').first,\n File.basename(variant_url.path).split('_').last,\n ])\n image_url = variant_url.to_s\n end\n rescue => e\n end\n\n redirect_to image_url\n end", "def getVersion\r\n\t\t\t\t\treturn @version\r\n\t\t\t\tend", "def http_version\n @http_version ||= [\n 'HTTP_VERSION',\n 'SERVER_PROTOCOL',\n ].map{ |x| rack_environment[x] }.find.first.to_s.split('/').last\n end", "def detection_type\n return @detection_type\n end", "def get_version(version)\n decode_doc(@tc_storage.get(version))\n end", "def version\n media_types.first.version\n end", "def current_version\n @retries = 1\n begin\n @api_client.get_entity_request(@id)\n rescue StandardError => e\n # Periodically, these requests will fail with \"Unknown mime type: text/plain\"\n if @retries < 3\n @retries += 1\n current_version\n else\n puts e.inspect\n puts e.backtrace\n end\n end\n end", "def client_version\n self.class.client_version\n end", "def value\n error! unless self.kind_of?(Net::HTTPSuccess)\n end", "def content_type\n self.class.response_content_type\n end", "def get_version\n response = self.class.get(\"/service/#{$service_id}/version/#{$service_version}\", {\n headers: {\"Fastly-Key\" => $key}\n })\n end", "def version\n @grpc.attributes[\"x-goog-version\"]\n end", "def value\n if @value_set\n @value\n else\n value_from_response\n end\n end", "def default_version\n return @versions[:large] if @versions.key?(:large)\n return @versions[:medium] if @versions.key?(:medium)\n return @versions[:small] if @versions.key?(:small)\n end", "def version\n api_execute('/version', :get).body\n end", "def version\n ret = @client.call('Bugzilla.version')\n handle_faults(ret)\n ret['version']\n end", "def content_type\n response.content_type\n end", "def variants\n self.class.variant_reflections.map { |reflection| send(reflection[:name]) }\n end", "def select_type\n case @options[\"format\"]\n when \"rdfxml\" then 'application/rdf+xml'\n when \"ntriples\" then 'text/plain'\n when \"turtle\" then 'application/x-turtle'\n when \"n3\" then 'text/rdf+n3'\n when \"trix\" then 'application/trix'\n when \"trig\" then 'application/x-trig'\n else 'Unknown'\n end\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def sku\n variant.sku if variant\n end", "def version\n read_property 'Version'\n end", "def get_kind\n\t\tend", "def cloudversion\n clouddata && clouddata['version']\n end", "def last_master_variant\n inactive_master_variants.try(:last)\n end", "def set_variant\n # request.variant = :phone if request.user_agent.include?('iPhone')\n # o con la gema browser\n request.variant = :phone if browser.device.mobile?\n end", "def type\n response[\"type\"]\n end", "def type\n response[\"type\"]\n end", "def http_response\n return @http_response\n end", "def find_easy_ab_variant(user, experiment)\n grouping = ::EasyAb::Grouping.find_by(user_id: user.id, experiment: experiment)\n grouping ? grouping.variant : nil\n end", "def supplier_variant(supplier)\n self.supplier_variants.where(supplier_id: supplier).first\n end", "def iOSVersion\n\treturn server_version[\"iOS_version\"]\nend", "def version\n render json: { result: 'Ok', version: '1', protocol: 'EBUio-PlugIt' }\n end", "def vtv\n vtv = version_tracker_version\n vtv = version if vtv.blank?\n vtv\n end", "def variation; self[:variation]; end", "def flavor\n fetch('dessert.flavor')\n end", "def ver\n @values['ver']\n end", "def version\n self[:version]\n end", "def accepted_version\n return @accepted_version\n end", "def load_variant\r\n @variant_id = cookies.delete(:load_variant)\r\n if @variant_id\r\n params[:id] = @variant_id\r\n end\r\n end", "def get\n @value\n end", "def get_version_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VersionApi.get_version ...'\n end\n # resource path\n local_var_path = '/version'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Version')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VersionApi#get_version\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def kind \n return @raw.kind \n end", "def new\n @variant = Variant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @variant }\n end\n end", "def raw_response\n @raw_response\n end", "def kind\n return @kind\n end", "def kind\n return @kind\n end", "def get_product_variant_options_config(id)\n @client.raw('get', \"/ecommerce/products/#{id}/variant-options-config\")\n end", "def variant(*args)\n Rscons.application.variant(*args)\n end", "def meta_header_adapter\n if @transport_class == Transport::HTTP::Faraday\n version = '0'\n adapter_version = case @arguments[:adapter]\n when :patron\n version = Patron::VERSION if defined?(::Patron::VERSION)\n {pt: version}\n when :net_http\n version = if defined?(Net::HTTP::VERSION)\n Net::HTTP::VERSION\n elsif defined?(Net::HTTP::HTTPVersion)\n Net::HTTP::HTTPVersion\n end\n {nh: version}\n when :typhoeus\n version = Typhoeus::VERSION if defined?(::Typhoeus::VERSION)\n {ty: version}\n when :httpclient\n version = HTTPClient::VERSION if defined?(HTTPClient::VERSION)\n {hc: version}\n when :net_http_persistent\n version = Net::HTTP::Persistent::VERSION if defined?(Net::HTTP::Persistent::VERSION)\n {np: version}\n else\n {}\n end\n {fd: Faraday::VERSION}.merge(adapter_version)\n elsif defined?(Transport::HTTP::Curb) && @transport_class == Transport::HTTP::Curb\n {cl: Curl::CURB_VERSION}\n elsif defined?(Transport::HTTP::Manticore) && @transport_class == Transport::HTTP::Manticore\n {mc: Manticore::VERSION}\n end\n end", "def browser_version\n return @parsed_ua.version ? @parsed_ua.version : 'Unknown'\n end", "def get\n data[\"_value\"]\n end", "def variant=(variant); end", "def version\n version_property ? version_property.ruby_value : nil\n end", "def respond_to\n mimes = Rack::Accept::MediaType.new request.env['HTTP_ACCEPT']\n accepted = AcceptableModel::Artist.version_mapper.collect { |mime| mime[:version] }\n response = mimes.best_of(accepted)\n content_type response\n response\n end" ]
[ "0.7293755", "0.6976324", "0.6937698", "0.6937698", "0.69355714", "0.62715393", "0.5941457", "0.58998424", "0.58715093", "0.58378416", "0.5807799", "0.5795691", "0.57241064", "0.57078874", "0.57078874", "0.56420225", "0.5597744", "0.5595913", "0.5570064", "0.5568805", "0.5555371", "0.55510515", "0.5546254", "0.55378985", "0.5528665", "0.5528665", "0.551528", "0.55067956", "0.55008364", "0.5495392", "0.5493056", "0.5491444", "0.54097486", "0.54095215", "0.5398041", "0.53905475", "0.53752434", "0.5368669", "0.5357753", "0.53474396", "0.5339912", "0.53346467", "0.53265023", "0.5317927", "0.53157264", "0.5288353", "0.5261057", "0.5260331", "0.52570456", "0.52519196", "0.5249564", "0.52417606", "0.5236885", "0.5234828", "0.5231421", "0.52284694", "0.52223337", "0.52223337", "0.52223337", "0.52223337", "0.52223337", "0.52223337", "0.52223337", "0.52223337", "0.52223337", "0.52220535", "0.5211851", "0.5204234", "0.5197747", "0.51970327", "0.5193802", "0.51835537", "0.51835537", "0.5177655", "0.5176591", "0.51640123", "0.5148967", "0.5147452", "0.5145591", "0.51449645", "0.5144844", "0.5140775", "0.5138523", "0.513657", "0.5127639", "0.5125637", "0.51254946", "0.5122793", "0.5117751", "0.51151675", "0.5111967", "0.5111967", "0.51106673", "0.510378", "0.5094081", "0.5093731", "0.5084804", "0.50823647", "0.5080144", "0.50801265" ]
0.59694105
6
In the previous exercise, we developed a recursive solution to calculating the nth Fibonacci number. In a language that is not optimized for recursion, some (not all) recursive methods can be extremely slow and require massive quantities of memory and/or stack space. Ruby does a reasonably good job of handling recursion, but it isn't designed for heavy recursion; as a result, the Fibonacci solution is only useful up to about fibonacci(40). With higher values of nth, the recursive solution is impractical. (Our tail recursive solution did much better, but even that failed at around fibonacci(8200).) Fortunately, every recursive method can be rewritten as a nonrecursive (procedural) method. Rewrite your recursive fibonacci method so that it computes its results without recursion. Examples:
def fibonacci(n, num1=1, num2=1) return 1 if n <= 2 (n - 2).times do num1, num2 = num2, num1 + num2 end num2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nthFibonacci(n)\r\n if n == 1\r\n return 1\r\n\r\n elsif n == 2\r\n return 1\r\n\r\n else n > 2\r\n n = nthFibonacci(n-1) + nthFibonacci(n-2)\r\n end\r\nend", "def fib(n)\n if n == 0 || n == 1\n return n\n else\n fib(n-1) + fib(n-2)\n end\nend", "def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n\n return fib(n-1) + fib(n-2)\nend", "def fib(n)\n return 1 if n == 2\n return 0 if n == 1\n\n fib(n-1) + fib(n-2)\nend", "def fib(n)\n return 0 if n <= 0\n return 1 if n == 1\n\n fib(n - 1) + fib(n - 2)\nend", "def fib(n)\n if n == 0\n 0\n elsif n == 1 || n == 2\n 1\n else fib(n - 2) + fib(n - 1)\n end\nend", "def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n \n\n fib(n - 1) + fib(n - 2)\nend", "def fib(n)\n # your implementation here\n if n==0 then\n 1\n elsif n==1 then\n 1\n else \n fib(n-2) + fib(n-1)\n end\nend", "def fibonacci(n)\n \n return n if n == 1\n \n if n > 2 \n fibonacci(n-1) + fibonacci(n-2)\n else\n fibonacci(n-1)\n end\nend", "def nth_fibonacci(n) \n if n == 1\n return 0\n elsif n == 2\n return 1\n end\n return nth_fibonacci(n-1) + nth_fibonacci(n-2)\nend", "def fib(n)\r\n if n == 1 then\r\n 10\r\n elsif n == 0 then\r\n 1\r\n else\r\n fib(n - 1) + fib(n - 2)\r\n end\r\nend", "def fib(n)\n if (n <= 1) \n return n;\n else\n return fib(n-1)+fib(n-2);\n end\nend", "def fib(n)\n return n if n <= 1\n fib(n-1) + fib(n-2)\nend", "def fib(n)\n return 1 if n == 1 || n == 2\n fib(n-1) + fib(n-2)\nend", "def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n return 1 if n == 2\n # return 2 if n == 3\n fib(n - 1) + fib(n - 2)\nend", "def fibonacci(n)\n raise ArgumentError, \"n cannot be less than 0\" if n < 0\n return 0 if n == 0 \n\n old_sum, new_sum = 0, 1\n return fib_helper(old_sum, new_sum, n)\nend", "def fib(n)\n if n == 0 || n == 1\n return n\n else\n fib(n - 1) + fib(n - 2)\n end\n end", "def fib(n)\n return 0 if n == 0\n fib_helper(0, 1, n-1)\nend", "def fib(n)\n if n == 1 || n == 2\n return 1\n end\n return fib(n - 1) + fib(n - 2)\nend", "def fib(n)\n if n == 1 || n == 2\n return 1\n end\n return fib(n-1) + fib(n-2)\nend", "def fib(n)\n if n == 1 || n == 2\n return 1\n end\n return fib(n-1) + fib(n-2)\nend", "def fib(n)\n\n if n == 1 or n == 2\n return 1\n else\n return fib(n-1) + fib(n-2)\n end\n\nend", "def recursive_fib n\n return 1 if n == 1 || n == 2\n recursive_fib(n-1) + recursive_fib(n-2)\nend", "def fib(n)\n return n if n < 2\n fib(n-1) + fib(n-2)\nend", "def fib n\n return n if n < 2\n fib(n - 1) + fib(n - 2)\nend", "def fib(n)\n if n == 1 || n == 2\n n\n else\n fib(n-1) + fib(n-2)\n end\nend", "def fib(n)\n return n if (0..1).include? n\n fib(n-1) + fib(n-2)\nend", "def fibonacci(n)\r\n if n == 0\r\n return 0\r\n elsif n == 1\r\n return 1\r\n else\r\n return fibonacci(n-1) + fibonacci(n-2)\r\n end\r\nend", "def fib(n)\n return 1 if n <= 2\n fib(n - 1) + fib(n - 2)\nend", "def fib n\n if n == 0\n 0\n elsif n == 1\n 1\n else\n fib(n-2) + fib(n-1)\n end\nend", "def fibonacci(n)\n return 0 if n == 0\n return 1 if n == 1\n\n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fibonacci(n)\n return n if n == 1 || n == 0 \n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fibonacci(n)\n if n <= 1\n return n\n else\n return fibonacci(n - 1) + fibonacci(n - 2)\n end\nend", "def fibonacci(n)\n return n unless n > 1\n fibonacci(n -1) + fibonacci(n -2)\nend", "def fib(n)\n if n < 2\n 1\n else\n fib(n-2) + fib(n-1)\n end\nend", "def fib(n)\n return 1 if n <= 2\n fib(n-1) + fib(n-2)\nend", "def fibonacci(n)\n if n == 0 or n == 1\n return n\n else\n return fibonacci(n - 1) + fibonacci(n - 2)\n end\nend", "def recursive_fib(n, a=0, b=1)\r\n if n == 0\r\n return a\r\n else\r\n recursive_fib(n - 1, b, a + b)\r\n end\r\nend", "def fibonacci(n)\n if n < 2\n return n\n else\n fibonacci(n-1) + fibonacci(n-2)\n end\nend", "def fib(n)\n return fib_num[n] if fib_num[n]\n\n fib_num[n - 2] = fib(n - 2) unless fib_num[n - 2]\n fib_num[n - 1] = fib(n - 1) unless fib_num[n - 1]\n\n return (fib_num[n - 2] + fib_num[n - 1])\n end", "def fib n\n return n if n < 2\n fib(n-2) + fib(n-1)\nend", "def fib(n)\n return 0 if n < 0\n return n if n < 2\n return fib(n-1) + fib(n-2)\nend", "def fibonacci(n)\n return 1 if n == 1\n return 1 if n == 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fib_rec( n )\n $call_count += 1\n # Define the base case\n if n < 2\n return 1\n else\n # do the recursive calculation:\n return fib_rec( n - 1 ) + fib_rec( n - 2 )\n end\n\nend", "def get_nth_fib(n)\n if n == 0 || n == 1\n return 0\n elsif n == 2\n return 1\n else\n return get_nth_fib(n-1) + get_nth_fib(n-2)\n end\n\nend", "def fibonacci n\n return n if n < 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fib(nth)\n return 1 if nth == 1 || nth == 2\n fib(nth - 2) + fib(nth - 1)\nend", "def fibonacci(nth)\n return 1 if nth <= 2\n fibonacci(nth - 1) + fibonacci(nth - 2)\nend", "def fibonacci(nth)\n return 1 if nth <= 2\n fibonacci(nth - 1) + fibonacci(nth - 2)\nend", "def fibonacci(nth)\n return 1 if nth <= 2\n fibonacci(nth - 1) + fibonacci(nth - 2)\nend", "def fibonacci(nth)\n return 1 if nth <= 2\n fibonacci(nth - 1) + fibonacci(nth - 2)\nend", "def fib(n)\n if n <= 2\n n\n else\n fib(n-1) + fib(n-2)\n end\nend", "def fibonacci(n)\n return 0 if n == 1\n return 1 if n == 2\n return fibonacci(n-1)+fibonacci(n-2)\nend", "def fib(n)\n #if n > 4000000\n #\treturn puts n\n #end\n return n if (0..1).include? n\n fib(n-1) + fib(n-2) if n > 1\nend", "def fib(n)\n return nil if n < 1\n return 1 if n == 1 || n == 2\n fib(n-1) + fib(n-2)\nend", "def fibonacci(nth)\n return 1 if nth <= 2\n\n fibonacci(nth - 1) + fibonacci(nth - 2)\nend", "def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def recursive_fib(n)\n if n<2\n return n\n else\n return (recursive_fib(n-1)+recursive_fib(n-2))\n end \nend", "def fibonacci(n)\n if n < 2\n n\n else\n fibonacci(n - 1) + fibonacci(n - 2)\n end\nend", "def get_nth_fib(n)\n if n == 2\n return 1\n elsif n == 1\n return 0\n else\n return get_nth_fib(n - 1) + get_nth_fib(n - 2)\n end\nend", "def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 2) + fibonacci(n - 1)\nend", "def fibonacci(n)\n if n < 2\n return n\n else\n return fibonacci(n-1) + fibonacci(n-2)\n end\nend", "def fib(n)\n\treturn n if (n < 2)\n\treturn fib(n - 1) + fib(n - 2)\nend", "def fib_basic(n)\n if (0..1).include? n\n return n\n else\n (fib_basic(n - 1) + fib_basic(n - 2))\n end\nend", "def fibonacci(n)\n if n <= 2\n 1\n else\n fibonacci(n - 1) + fibonacci(n - 2)\n end\nend", "def fibonacci(n)\n return 1 if n == 1 || n == 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fibonacci(n)\n return 1 if n == 1 || n == 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fib(n)\n if n<2\n return n\n else\n return fib(n-2)+fib(n-1)\n end\nend", "def fibonacci(n)\n return n if (0..1).include? n\n (fibonacci(n - 1) + fibonacci(n - 2))\nend", "def fib(n)\n if n < 2\n n\n else\n fib(n-1)+fib(n-2)\n end\nend", "def fib(n)\n # edge cases:\n if n < 0\n raise Exception, 'Index was negative. No such thing as a negative index in a series.'\n elsif n == 0 || n == 1\n return n\n end\n\n # we'll be building the fibonacci series from the bottom up\n # so we'll need to track the previous 2 numbers at each step\n prev_prev = 0\n prev = 1\n current = prev + prev_prev\n\n # since we already initialized up to the 2nd number in the series\n # we take n - 2 steps ahead to reach n (.times is exclusive)\n (n - 1).times do\n current = prev + prev_prev\n prev_prev = prev\n prev = current\n end\n\n current\nend", "def iterative_nth_fib(n)\n return 1 if n <= 2\n a = 1\n b = 1\n i = 3\n while i <= n\n new_a = b\n b = a + b\n a = new_a\n i += 1\n end\n b\nend", "def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 1 ) + fibonacci(n - 2)\nend", "def fibonacci(n)\n\treturn 0 if n == 0\n\treturn 1 if n == 1\n\tfibonacci(n-1) + fibonacci(n-2)\nend", "def fibonacci( n )\n return n if n <= 1 \n fibonacci( n - 1 ) + fibonacci( n - 2 ) \nend", "def fibonacci(n)\n return 1 if n == 1 || n == 2\n\n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fibonacci_recursive n\n return n if n < 2\n fibonacci_recursive(n-1) + fibonacci_recursive(n-2)\nend", "def fibonacci_recursive(n)\n if n == 0 || n == 1\n return n\n end\n # ex n = 5: fib(4) + fib(3) ==> fib(3) + fib(2) ==> fib(2) + 1 =\n return fibonacci_recursive(n-1) + fibonacci_recursive(n-2)\nend", "def recursive_fibonacci(n)\n n <= 1 ? n : fibonacci( n - 1 ) + fibonacci( n - 2 )\nend", "def fibonacci( n )\n return n if ( 0..1 ).include? n\n ( fibonacci( n - 1 ) + fibonacci( n - 2 ) )\nend", "def fibonacci( n )\n return n if ( 0..1 ).include? n\n ( fibonacci( n - 1 ) + fibonacci( n - 2 ) )\nend", "def fibonacci( n )\n return n if ( 0..1 ).include? n\n ( fibonacci( n - 1 ) + fibonacci( n - 2 ) )\nend", "def fibonacci(n)\n return 1 if n <= 2\n \n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fibonacci(n)\n if n == 0\n 1\n elsif n == 1\n 1\n else\n fibonacci(n-2) + fibonacci(n-1)\n end\nend", "def fibs(n)\n return n if n <= 1\n fibs(n - 1) + fibs(n - 2)\nend", "def fibonacci(n)\n if n.nil?\n raise ArgumentError.new(\"Invalid\")\n elsif n < 0\n raise ArgumentError.new(\"Invalid\")\n end\n\n return 0 if n == 0\n\n num_one = 0\n num_two = 1\n fib_n = 1\n\n count = n - 1\n\n count.times do\n fib_n = num_one + num_two\n num_one = num_two\n num_two = fib_n\n end\n\n return fib_n\nend", "def fibonacci(n)\n n = fibonacci( n - 1 ) + fibonacci( n - 2 ) if n > 1\n n\nend", "def fibo_nth(n)\n puts \"computing fibo for n=#{n}\" if @debug\n\n case n\n when 0 then 0\n when 1 then 1\n else fibo_nth(n-2) + fibo_nth(n-1)\n end\nend", "def fibonacci(n)\n if n == 1 || n == 2\n 1\n else\n fibonacci(n-1) + fibonacci(n-2)\n end\nend", "def fibonacci(n)\n raise ArgumentError, ('argument n cannot be a negative number') if n < 0\n return n if n == 1 || n == 0 #base case\n return fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fib(n)\n # return base cases of 0, 1\n return n if n == 0 || n == 1\n # call the function again to add the previous two numbers\n return fib(n-2)+fib(n-1)\nend", "def fibonnaci(n)\n if n == 1 || n == 2\n 1\n else\n fibonnaci(n - 1) + fibonnaci(n - 2)\n end\nend", "def recursive_fibonacci(n)\n if (n == 1)\n return 0\n elsif (n == 2 || n == 3)\n return 1\n end\n return recursive_fibonacci(n - 2) + recursive_fibonacci(n - 1)\n end", "def fibonacciRecursive(n)\n\tif n <= 1\n\t\treturn n\n\telse\n\t\treturn fibonacciRecursive(n - 1) + fibonacciRecursive(n - 2)\n\tend\nend", "def find_fib_nth(n)\n if n == 0\n 1\n elsif n == 1\n 1\n else\n return (find_fib_nth(n - 2) + find_fib_nth(n - 1))\n end\nend", "def fib (n)\n # return appropriate starter values if n is 0 or 1\n if n == 0 \n return 0\n elsif n == 1\n return 1\n end\n # set up initial constants\n prevNum = 0\n currNum = 1\n # Loop through fibonacci numbers, starting at index 2.\n 2.upto(n) do\n nextNum = prevNum + currNum\n prevNum = currNum\n currNum = nextNum\n end\n return currNum\nend", "def fibonacci(n)\n\tif n == 0 || n == 1\n\t\treturn 1\n\telse\n\t\treturn fibonacci(n-1) + fibonacci(n-2)\n\tend\nend", "def fib(n)\n return n if n < 2 #Allows us to weed out any n-values that would give us negative values. Fib(0) and fib (1) would give us negative values.\n fib(n - 1) + fib(n - 2)\nend", "def fib(n, a = 0, b = 1)\n return a if n == 0\n return b if n == 1 && a == 0\n\n fib(n - 1, b, a + b)\nend", "def fibonacciTailRecursion(n)\n return \"ERROR: fibonacci is not count for negative numbers \" if n < 0\n return n if n < 2\n\n return fibonacciTailRecursion(n-1) + fibonacciTailRecursion(n-2)\nend" ]
[ "0.85162926", "0.84584576", "0.8449039", "0.84365934", "0.8417097", "0.8397812", "0.8395192", "0.8393697", "0.8388913", "0.838095", "0.8380568", "0.8376776", "0.8376623", "0.83753824", "0.83729166", "0.8372365", "0.83718103", "0.83632404", "0.8362587", "0.8360072", "0.8360072", "0.835657", "0.83560556", "0.8343676", "0.83393055", "0.8339164", "0.83367175", "0.83320856", "0.8327337", "0.83260196", "0.8324853", "0.83226883", "0.831714", "0.8315522", "0.83150816", "0.83134973", "0.8310538", "0.83092827", "0.83090127", "0.82992727", "0.82950556", "0.82916075", "0.8288688", "0.8288232", "0.828252", "0.8282401", "0.8279169", "0.82772833", "0.82772833", "0.82772833", "0.82772833", "0.827503", "0.8271641", "0.8270502", "0.82702327", "0.8269159", "0.8264499", "0.8264499", "0.8263265", "0.82606477", "0.8255455", "0.8255135", "0.8253582", "0.8253534", "0.82500756", "0.82419145", "0.8241832", "0.8241832", "0.824029", "0.8239498", "0.82346326", "0.82329935", "0.82316524", "0.82298625", "0.8229311", "0.82220095", "0.82178813", "0.8216274", "0.8215452", "0.82142603", "0.82136023", "0.82136023", "0.82136023", "0.8208724", "0.82023305", "0.8194057", "0.81894046", "0.81832886", "0.81822217", "0.8178939", "0.8178278", "0.81728923", "0.815811", "0.81578475", "0.8147969", "0.8146087", "0.81417084", "0.81407183", "0.81393564", "0.81362534", "0.81176686" ]
0.0
-1
times complexity: O(n!). Increasing one letter would increase the number of combinations by a factor if the total number of letters in string
def second_anagram?(str1, str2) return false unless str1.length == str2.length str2_arr = str2.chars str1_copy = str1.dup.chars str1.chars.each_with_index do |letter, idx| return false unless str2_arr.include?(letter) str2_arr.delete_at(str2_arr.index(letter)) if str2_arr.include?(letter) end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rampant_repeats(string, hash)\n new_str = \"\"\n string.each_char do |char| \n if hash[char]\n hash[char].times { new_str += char }\n else\n new_str += char\n end\n end\n new_str\nend", "def lexical_combinations(strings)\n l = []\n if strings.length == 1\n l.add(strings)\n else\n strings.each do |letter|\n others = strings.except(letter)\n lexical_combinations(others).each do |subcombo|\n l.add([letter] + subcombo)\n l.add([letter + subcombo.first] + subcombo.butfirst)\n end\n end\n end\n l\nend", "def rampant_repeats(str, hash)\n n_str = ''\n str.each_char do |char|\n if hash.has_key?(char) \n n_str += char * hash[char]\n else\n n_str += char\n end\n end\n n_str\nend", "def rampant_repeats(str, hash)\n new_str = \"\"\n str.each_char do |char|\n if hash.has_key?(char)\n hash[char].times { new_str += char }\n else\n new_str += char\n end\n end\n new_str\nend", "def rampant_repeats(string, hash)\n new_str = \"\"\n string.each_char do |char|\n if hash.key?(char)\n hash[char].times { new_str += char }\n else\n new_str += char \n end\n end\n new_str\nend", "def letter_combinations(digits)\n\n map = \"- - abc def ghi jkl mno pqrs tuv wxyz\".split\n charsets = digits.chars.map { |d| map[d.to_i].chars }\n digits == \"\" ? [] : [''].product(*charsets).map(&:join)\n\nend", "def StringReduction(str)\n until str.split(\"\").uniq.length == 1\n str = str.sub(/ab|ba/, \"c\").\n sub(/ac|ca/, \"b\").\n sub(/cb|bc/, \"a\")\n end\n str.size \nend", "def rampant_repeats(str, hash)\n new_str = ''\n str.each_char do |char|\n if hash.has_key?(char)\n hash[char].times do\n new_str << char\n end\n else\n new_str << char\n end\n end\n new_str\nend", "def rampant_repeats(string, hash)\n new_str = ''\n\n string.each_char do |char|\n if hash.has_key?(char)\n new_str += (char*hash[char])\n else\n new_str += char\n end\n end\n new_str\nend", "def rampant_repeats(str, hash)\n new_str = \"\"\n\n str.each_char do |char|\n if hash.has_key?(char)\n new_str += char * hash[char]\n else\n new_str += char\n end\n end\n new_str\nend", "def rampant_repeats(str, hash)\n str.chars.map { |c| hash.key?(c) ? c * hash[c] : c }.join\nend", "def repeatedString(s, n)\n char_array = s.split('')\n count_of_a_in_string = 0\n char_array.each do |letter|\n if letter == \"a\"\n count_of_a_in_string += 1\n end\n end\n\n factor = n/s.length()\n reminder = n % s.length()\n count_of_a_in_final_string = factor * count_of_a_in_string\n\n reminder.times do |index|\n count_of_a_in_final_string += 1 unless s[index] != \"a\"\n end\n count_of_a_in_final_string\nend", "def rampant_repeats(str, hash)\n\n new_str = \"\"\n\n str.each_char { |char| new_str += char * ( hash[char] || 1) }\n\n new_str\n\nend", "def letter_combinations(digits)\n\n DIGIT_HASH = {\n '2' => ['a', 'b', 'c'],\n '3' => ['d', 'e', 'f'],\n '4' => ['g', 'h', 'i'],\n '5' => ['j', 'k', 'l'],\n '6' => ['m', 'n', 'o'],\n '7' => ['p', 'q', 'r', 's'],\n '8' => ['t', 'u', 'v'],\n '9' => ['w', 'x', 'y', 'z']\n }\n\n res = []\n\n digits.each do |digit|\n \n if res.empty?\n res = DIGIT_HASH[digit]\n else\n temp_array = []\n res.each do |stored|\n DIGIT_HASH[digit].each do |new_letter|\n temp_array.push(stored + new_letter)\n end\n end\n res = temp_array\n end\n\n end\n\n res\nend", "def rampant_repeats(str, hash)\n (str.split(\"\").map do |char| \n if hash.keys.include?(char)\n # if hash.has_key?(char)\n char * hash[char] \n else\n char\n end\n end).join(\"\")\nend", "def rampant_repeats(str, hash)\n (str.split(\"\").map do |char| \n if hash.keys.include?(char)\n char * hash[char] \n else\n char\n end\n end).join(\"\")\nend", "def LetterCountI(str)\n\n str = str.split\n repeating_letters = []\n str.each do |word| \n word = word.split(\"\")\n letters = Hash.new(0)\n word.each { |letter| letters[letter] += 1 }\n selected_letters = letters.select { |key, value| value > 1 }\n repeating_letters << selected_letters.keys.length\n end\n if (repeating_letters.select {|l| l >= 1}).empty?\n return -1\n else\n max = repeating_letters.max\n return str[repeating_letters.index(max)]\n end\nend", "def print_combinations(str)\n return if !str || str.length == 0\n str_length = str.length\n char_count = 1\n while char_count <= str_length\n start_index = 0\n print_current(start_index, char_count, str, str_length)\n char_count += 1\n end\n return\nend", "def distinct_subseq_ii(s)\n alphabets = ('a'..'z').to_a\n dict = Array.new(27, 0)\n mod = 10 ** 9 + 7\n total = 1\n s.chars.each do |char|\n index = alphabets.index(char) + 1\n combo = total * 2 - dict[index]\n dict[index] = total # if 'c' ever appears again, it will clash with the current combos.\n total = combo < 0 ? 0 + mod : combo % mod\n end\n total - 1 # subtract empty string\nend", "def letter_combinations(digits)\n dictionary = {\n '1' => [],\n '2' => ['a', 'b', 'c'],\n '3' => ['d', 'e', 'f'],\n '4' => ['g', 'h', 'i'],\n '5' => ['j', 'k', 'l'],\n '6' => ['m', 'n', 'o'],\n '7' => ['p', 'q', 'r', 's'],\n '8' => ['t', 'u', 'v'],\n '9' => ['w', 'x', 'y', 'z']\n }\n\n res = [[]]\n digits.split(\"\").each do |num|\n ltrs = dictionary[num]\n res = permute(res, ltrs)\n end\n\n new_res = []\n res.each { |bucket| new_res << bucket.join(\"\") }\n new_res \nend", "def rampant_repeats(str, hash)\n # loop through str chars, if char is a hash key, multiply by that keys value, and add\n # if not a key, add as-is\n new_str = \"\"\n\n str.each_char do |letter|\n if hash.has_key?(letter)\n new_str += letter * hash[letter]\n else\n new_str += letter\n end\n end\n new_str\nend", "def frequent_letters(string)\n hash = Hash.new(0)\n results = []\n\n string.each_char do |char|\n hash[char] += 1\n end\n\n hash.each do |k, v|\n if v > 2\n results << k\n end\n end\n\n return results\nend", "def frequent_letters(string)\n count_letters = Hash.new{0}\n frequent_letter = []\n string.each_char do |char|\n count_letters[char] += 1\n if count_letters[char] > 2 && frequent_letter.include?(char) == false\n frequent_letter << char\n end\n end\n return frequent_letter.reverse\nend", "def permutations(string)\n # base case\n if string.length == 0\n return string\n end\n\n results = []\n\n i = 0\n while i < string.length\n first_letter = string[i]\n rest = string[i+1..-1]\n permutes = permutations(rest)\n \n permutes.each do |permuties|\n results.push(first_letter += permuties)\n end\n end\n\n return results\n\nend", "def rampant_repeats(str, hash)\n repeated = \"\"\n # iterate through str chars, if chars is in hash.keys, add to output chars * key.value\n str.each_char do |letter|\n if hash.keys.include?(letter)\n repeated += letter * hash[letter]\n else\n repeated += letter\n end\n end\n\n repeated\nend", "def frequent_letters(string)\n hash = Hash.new(0)\n string.each_char do |char|\n hash[char] += 1\n end\n\n hash.keys.select { |k| hash[k] > 2 }\nend", "def solution(s)\n return 0 if s.empty?\n t = 0\n ('A'..'Z').to_a.each do |c|\n t += s.count(c)\n end\n t + 1\nend", "def permutations(string)\n string.chars.permutation(string.length).map(&:join).uniq\nend", "def frequent_letters(string)\n frequent = []\n letters_count = Hash.new(0)\n\n string.each_char { | char | letters_count[char] += 1 }\n letters_count.each do | k, v |\n if v > 2\n frequent << k\n end\n end\n\n return frequent\nend", "def palin_perm(str)\n # remove unnecessary spaces\n str.delete!(' ')\n\n # create hash[char] = count\n hash = Hash[\n str.downcase\n .split('')\n .group_by { |c| c }\n .map { |k, v| [k, v.size] }\n ]\n\n # Set limit for odd characters based on str length\n odd_test = str.length.odd? ? 2 : 1\n\n # Test that odd characters in str do not exceed limit\n hash.values.select(&:odd?).length < odd_test\nend", "def frequent_letters(str)\n letter_count = Hash.new(0)\n str.each_char { |char| letter_count[char] += 1 }\n\n frequent_chars = []\n letter_count.each do |char, num|\n if num > 2\n frequent_chars << char\n end\n end\n return frequent_chars\nend", "def solve(s)\n alphabet = ('a'..'z').to_a\n s.gsub(/[aeiou]/, ' ').split.map { |l| l.chars.map { |i| alphabet.index(i) + 1 }.sum }.max\nend", "def num_repeats(string)\r\n idx_str = 0\r\n idx2 = idx_str+1\r\n counter = 0\r\n repeated_letter = \"\"\r\n while idx_str < string.length\r\n if !repeated_letter.include? string[idx_str]\r\n while idx2 < string.length\r\n if string[idx_str] == string[idx2]\r\n repeated_letter += string[idx_str]\r\n counter +=1\r\n break\r\n end\r\n idx2 +=1\r\n end\r\n end\r\n idx_str += 1\r\n idx2 = idx_str+1\r\n end\r\n return counter\r\nend", "def frequent_letters(string)\n hash = Hash.new(0)\n string.each_char { |char| hash[char] += 1 }\n\n frequent = []\n hash.each_key do |k|\n if hash[k] > 2\n frequent << k\n end\n end\n return frequent\nend", "def letter_freq(string)\n length = string.length\n i = 0\n \n max_letter = \"\"\n max_count = 0\n \n count = 1\n \n while i < length\n if string[i] == string[i+1]\n count += 1\n else\n if count > max_count\n max_count = count\n max_letter = string[i]\n end\n count = 1\n end\n i += 1\n end\n \n return \"#{max_letter}#{max_count}\"\nend", "def permutations(string)\nend", "def string_compress( string )\n string_array = string.split( '' )\n \n current_letter = result = string_array[ 0 ]\n count = 1\n index = 1\n \n while index < string_array.length\n comparison_letter = string_array[ index ]\n \n if comparison_letter == current_letter\n count += 1\n else\n result += count.to_s\n \n current_letter = comparison_letter\n \n result += comparison_letter\n \n count = 1\n end\n \n if result.length + 1 >= string.length \n return string\n end\n \n if index == string_array.length - 1\n result += count.to_s\n end\n \n index += 1\n end\n \n result\nend", "def compress_string(str)\n # compressed string will be the uniqued string * 2 because of the count\n comp_length = str.chars.uniq.length * 2\n\n # check if compressed string will be shorter than input string\n if comp_length < str.length\n compressed_string = \"\"\n count = 1\n # iterate over the string\n str.each_char.with_index do |letter, index|\n # if following letter in string is same, increment the count\n # else add letter and count to compressed_string var\n if letter == str[index+1]\n count += 1\n else\n compressed_string << letter\n compressed_string << count.to_s\n count = 1\n end\n end\n compressed_string\n else\n str\n end\nend", "def encode_repeating(my_string)\r\n i = 0\r\n j = 0\r\n letter = my_string[i]\r\n while i < my_string.length\r\n j += 1 while my_string[j + 1] == letter\r\n if j - i >= 2\r\n my_string[(i + 1)..j] = (j - i + 1).to_s\r\n end\r\n additional = 0\r\n additional = 1 if j > i\r\n i += 1 + additional\r\n j = i\r\n letter = my_string[i]\r\n end\r\n return my_string\r\nend", "def longest_duplicated_letter(str)\n return if str.nil? || str.empty?\n max = 0\n k = 0\n sum = 1\n candidate = str[0]\n (1...str.size).each do |i|\n if str[i] == candidate \n sum += 1\n if max < sum\n k = i\n max = sum\n end\n else\n candidate = str[i]\n sum = 1\n end\n end\n [max,str[k]]\nend", "def jumble_sort(str, alphabet = nil)\n alphabet ||= ('a'..'z').to_a\n final_str = \"\"\n \n alphabet.each do |alpha_char|\n if str.include?(alpha_char)\n str.count(alpha_char).times do\n final_str += alpha_char\n end\n end\n end\n \n final_str\nend", "def permutations(string)\n string.chars.permutation(string.length).to_a.map { |arr| arr.join }.uniq\nend", "def count_letters(string)\n i = 0\n \n length = string.length\n count = 1\n \n summary_string = \"\"\n \n while i < length\n if string[i] == string[i+1]\n count += 1\n else\n summary_string << \"#{string[i]}#{count}\"\n count = 1\n end\n i += 1\n end\n \n if summary_string.length < length\n return summary_string\n else\n return string\n end\nend", "def jumble_sort(str, alphabet = nil)\n return str.chars.sort.join(\"\") if alphabet.nil?\n new_string = \"\"\n alphabet.each do |letter|\n (str.count(letter)).times do\n new_string += letter\n end\n end\n new_string\nend", "def combination(chars_array)\n array_of_letters = chars_array.map { |digit| @letters[digit] }\n combination = array_of_letters.shift.product(*array_of_letters).map(&:join)\n end", "def string_compression(str)\n str_array = str.split(\"\")\n current_letter = str_array.first\n output = [current_letter]\n current_count = 1\n\n indx = 1\n while indx < str_array.length\n if current_letter == str_array[indx]\n current_count += 1\n else\n output << current_count unless current_count == 1\n current_count = 1\n current_letter = str_array[indx]\n output << current_letter\n end\n indx += 1\n end\n output.join(\"\")\nend", "def Lexicographic(myString)\n\n origArray = myString.split(//)\n newArr = origArray.permutation.to_a\n counter = 1\n newArr.each do |x|\n if counter == 1000000\n print counter, \"--> \", x.join, \"\\n\"\n break\n else\n counter = counter + 1\n end\n end\nend", "def matching_characters(str)\n matching_letters = Hash.new([])\n unique_chars_count = 0\n str.each_char.with_index do |letter, idx|\n matching_letters[letter] += [idx] if str.count(letter) > 1\n end\n matching_letters.each do |letter, indices|\n current_count = str[indices.first + 1...indices.last].chars.uniq.size\n unique_chars_count = current_count if current_count > unique_chars_count\n end\n unique_chars_count\nend", "def rampant_repeats(s, h)\n s.chars.map do |c|\n if h[c]\n c * h[c]\n else\n c\n end\n end.join(\"\")\nend", "def repeatedString(s, n)\r\n # Write your code here\r\n numOfA = 0\r\n index = 0\r\n \r\n if s.length == 1 && s[0] == 'a'\r\n return n\r\n elsif s.length == 1 && s[0] != 'a'\r\n return 0\r\n \r\n else\r\n firstRoundUpperLimit = n < s.length ? n : s.length\r\n \r\n for i in 0 ... firstRoundUpperLimit\r\n if s[i] === 'a'\r\n numOfA = numOfA + 1\r\n end\r\n end\r\n\r\n if (numOfA > 0 && n > s.length) \r\n repeatingOccurrences = (n / s.length) - 1\r\n remainingOccurrences = n % s.length\r\n\r\n\r\n\r\n numOfA = numOfA + (numOfA * repeatingOccurrences)\r\n\r\n for j in 0 ... remainingOccurrences\r\n if s[j] === 'a'\r\n numOfA = numOfA + 1\r\n end\r\n end\r\n end\r\n\r\n \r\n end\r\n return numOfA\r\nend", "def permutations(str)\n permutation(str.chars)\nend", "def frequent_letters(string)\n array = []\n count = Hash.new(0)\n string.each_char { |c| count[c] += 1 }\n count.each { |k, v| array << k if v > 2}\n array\nend", "def jumble_sort(str, alphabet = (\"a\"..\"z\"))\n char_count = Hash.new(0)\n str.each_char { |c| char_count[c] += 1 }\n jumbled_str = \"\"\n alphabet.each do |c|\n (0...char_count[c]).each { |n| jumbled_str << c }\n end\n jumbled_str\nend", "def love_letter string\n arr = string.chars\n alpha = ('a'..'z').to_a\n count = 0\n\n arr.each_with_index do |x,xi|\n while arr[xi] != arr[-(xi+1)]\n opposite = arr[-(xi+1)]\n cur_letter = [opposite, arr[xi]].max\n a_index = alpha.index(cur_letter) - 1\n new_char = alpha[a_index]\n\n if opposite > arr[xi]\n arr[-(xi+1)] = new_char\n count +=1\n else\n arr[xi] = new_char\n count +=1\n end\n end\n end\n count\nend", "def making_anagrams(string1, string2)\n matching_chars = 0\n visited_chars = Hash.new\n \n longest_string = string1.length > string2.length ? string1 : string2\n \n longest_string.each_char do |ch|\n if visited_chars[ch]\n next\n else\n visited_chars[ch] = true\n matching_chars += [string1.count(ch), string2.count(ch)].min\n end\n end\n \n string1.length + string2.length - matching_chars * 2\nend", "def jumble_sort(str, alphabet = nil)\n return str.chars.sort.join if alphabet == nil\n\n arr = []\n cur_len = 0\n alphabet.each do |c|\n break if cur_len >= str.length\n\n if str.include?(c)\n num = str.count(c)\n arr.push(c * num)\n cur_len += num\n end\n end\n\n arr.join\nend", "def most_repeated_letter(string)\n letter = \"\"\n count = 0\n \n length = string.length\n i = 0\n current_count = 1\n \n while i < length \n if string[i] == string[i+1]\n current_count += 1\n else\n if current_count > count\n count = current_count\n letter = string[i]\n end\n current_count = 1\n end\n \n i += 1\n end\n \n return \"#{letter}#{count}\"\nend", "def check_permutations(str1, str2)\n return false unless str1.length == str2.length\n letters = Hash.new\n str1.length.times do |idx|\n n = str1[idx]\n m = str2[idx]\n letters[n] ? letters[n][0] += 1 : letters[n] = [1, 0]\n letters[m] ? letters[m][1] += 1 : letters[m] = [0, 1]\n end\n\n letters.each do |_, (n,m)|\n return false unless n == m\n end\n\n true\nend", "def solve(words, letters)\n hash = Hash.new(0)\n hash2 = Hash.new(0)\n letters.each_char do |char|\n hash[char] += 1\n end\n \n longest = 0\n \n words.each_with_index do |word, idx|\n word.each_char.with_index do |char, idx|\n if !hash[char] || hash[char] <= 0\n next\n end\n if hash[char] > 0\n hash[char] -= 1\n end\n end\n \n end\n return longest\nend", "def compress_solution_two(str)\n str_chars = str.chars\n str_size = str_chars.size\n return str if str_size < compressed_size(str_chars, str_size)\n\n compressed_str = ''\n count_consecutive = 0\n str_chars.each.with_index do |char, index|\n count_consecutive += 1\n next_char_different = ((index + 1) == str_size || (str_chars[index + 1] != char))\n if next_char_different\n compressed_str << char\n compressed_str << count_consecutive.to_s\n count_consecutive = 0\n end\n end\n compressed_str\nend", "def permutations(str)\nend", "def num_repeats(string)\n\tio = 0\n\ti = io + 1\n\tyo = 0\n\ty = yo + 1\n\tletters = []\n\tcounter = 0\n\n\twhile io < string.length\n\t\twhile i <= string.length\n\t\t\tif string[io] == string[i]\n\t\t\t\tletters.push(string[io])\n\t\t\t\tio += 1\n\t\t\t\ti = io + 1\n\t\t\t\twhile yo < letters.length\n\t\t\t\t\t\tif string[io] == letters[yo]\n\t\t\t\t\t\t\tio += 1\n\t\t\t\t\t\t\ti = io + 1\n\t\t\t\t\t\t\tyo = 1\n\t\t\t\t\t\telse yo += 1\n\t\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\tcounter += 1\n\t\t\tend\n\n\t\ti += 1\n\t\tend\n\t\tio += 1\n\t\ti = io + 1\n\tend\n\treturn counter\n\nend", "def num_repeats(string)\n tallies = {}\n\n (0..string.length - 1).each do |idx|\n letter = string[idx]\n tallies[letter] ||= 0\n tallies[letter] += 1\n end\n\n count_tallies_greater_than_two(tallies)\nend", "def num_repeats(string)\n \nidx1 = 0 #Made a counter for first loop\nidx2 = 0 #Made another counter for the second loop\nrepeat_count = 0 #Assigned a variable to tally the number of letters that had repeated in the string\ncurrent_repeat_count= []\nidx3 = 0\n while idx1 < string.length #The characters in the string will be scanned over and over again until it reaches the string.length\n idx2 = idx1 + 1 #the the second loop will always be 1 element ahead of the idx1 to scan them properly\n \n while idx2 < string.length #Same logic with the first loop\n unless current_repeat_count[idx3] == string[idx2]\n if string[idx1] == string[idx2] #if the current element of idx1 is the same with the current element of idx2, \n current_repeat_count << string[idx2]\n repeat_count = repeat_count + 1# repeat_count will increase by 1 each time\n end\n end\n \n idx2 = idx2 + 1 #idx2 will increase by 1 to go to the next element\n end\n idx1 = idx1 + 1 #after the first round of the first element pairs up with the rest of the elements, 1 will be added \n end #to go the next element to be compared with the rest\n \n return repeat_count #once it's done, the code returns the tally of repeated letters. \n\nend", "def solution(n)\n\t(1..n).map(&:to_s).map(&:chars).join.chars.map(&:to_i).reduce(:+)\nend", "def count_word_combinations( text )\n combinations = @word_combinations_database.find_all{|v| text.index( v )}\n combinations.each{|combination|\n add_word( combination )\n }\n return combinations\n end", "def double_letter_count(string)\n repeating_letters = 0\n string.each_char.with_index do |char, i|\n if string[i] == string[i + 1]\n repeating_letters += 1\n end\n end\n return repeating_letters\nend", "def double_letter_count(string)\r\n repeats = 0\r\n oldChar = ''\r\n string.each_char do |char|\r\n if oldChar == char\r\n repeats += 1\r\n end\r\n oldChar = char\r\n end\r\n return repeats\r\nend", "def num_repeats(string)\n found_letters = []\n idx1 = 0\n while idx1 < string.length\n idx2 = idx1 + 1\n while idx2 < string.length\n if string[idx1] == string[idx2] && !found_letters.include?(string[idx1])\n found_letters.push(string[idx1])\n end\n idx2 += 1\n end\n idx1 += 1\n end \n return found_letters.length\nend", "def capital_permutations(str)\n output = []\n str.chars.each_with_index do |char, index|\n if index == 0\n output << char\n output << char.upcase\n else\n new_output = []\n output.each do |string|\n new_output << string + char\n new_output << string + char.upcase\n end\n output = new_output\n end\n end\n output\nend", "def permutation(string)\n return [string] if string.size < 2\n char = string[0]\n total_perms = []\n perms = permutation(string[1..-1])\n\n perms.each do |perm|\n (0..perm.length).each do |i|\n total_perms << perm[0...i] + char + perm[i..-1]\n end\n end\n\n total_perms\nend", "def frequent_letters(string)\n output = []\n count_table = Hash.new(0)\n\n string.each_char do |char|\n count_table[char] += 1\n if count_table[char] == 3\n output.push(char)\n end\n end\n\n return output\nend", "def compress_solution_one(str)\n compressed_str = ''\n count_consecutive = 0\n str_chars = str.chars\n str_size = str_chars.size\n str_chars.each.with_index do |char, index|\n count_consecutive += 1\n next_char_different = ((index + 1) == str_size || (str_chars[index + 1] != char))\n if next_char_different\n compressed_str << char\n compressed_str << count_consecutive.to_s\n count_consecutive = 0\n end\n end\n compressed_str.length < str_size ? compressed_str : str\nend", "def permutations(string)\n string.chars.permutation.to_a.map(&:join).uniq\nend", "def str_perm_efficient(string, k, n)\n if k == n\n puts string\n else\n for i in k..n\n string[i], string[k] = string[k], string[i] # fixing one element\n str_perm_efficient(string, k+1, n) # calling perm on remaining string\n string[k], string[i] = string[i], string[k] # Swap back the previously swapped elements\n end\n end\nend", "def stringCompression(string_value)\n\t\n\tstart_counter = 0\n\tend_counter = 0\n\n\thash_with_count = {}\n\tstring_returned = \"\"\n\twhile(true)\n\n\t\t#If the counter is starting ahead of the string size..time to break loop\n\t\tif start_counter > string_value.length-1\n\t\t\t#Is the string just itself with their 'one' counterparts?\n\t\t\tif string_value.length * 2 == string_returned.length\n\t\t\t\treturn string_value\n\t\t\tend\n\n\t\t\t\treturn string_returned\n\t\tend\n\n\n\t\tif string_value[start_counter] == string_value[end_counter]\n\n\t\t\tcurrent_letter = string_value[start_counter]\n\n\t\t\tif hash_with_count[current_letter].nil?\n\t\t\t\thash_with_count[current_letter] = 1\n\t\t\telse\n\t\t\t\thash_with_count[current_letter] += 1\n\t\t\tend\n\n\n\t\t\tend_counter += 1\n\n\t\t#Means there is a new letter\n\t\telse\n\t\t\tstring_returned += \"#{current_letter}#{hash_with_count[current_letter]}\"\n\t\t\t#Time to start checking with this new letter\n\t\t\tstart_counter = end_counter\n\t\t\thash_with_count.clear\n\n\t\tend\n\n\n\tend\n\nend", "def love_letter string\n\n count = 0\n\n arr = string.chars\n\n alpha = ('a'..'z').to_a\n\n arr.each_with_index do |x,xi|\n while arr[xi] != arr[-(xi+1)]\n opposite = arr[-(xi+1)]\n cur_letter = [arr[xi], opposite].max\n\n alpha_index = alpha.index(cur_letter)\n\n if opposite > arr[xi]\n arr[-(xi+1)] = alpha[alpha_index - 1]\n count += 1\n end\n\n if arr[xi] > opposite\n arr[xi] = alpha[alpha_index-1]\n count +=1\n end\n\n end\n end\n\n count\n\nend", "def num_repeats(string)\n # Keep track of letters\n lettercount = []\n num_rpt_letters=0 \n \n # Walk through string\n i=0\n while i<string.length\n \n # Check whether letter has already been counted\n letterfound = false\n j=0\n \n while j<lettercount.length\n # If letter has already appeared, increment the count\n if string[i]==lettercount[j][0]\n lettercount[j][1]+=1\n letterfound = true\n break\n end\n j+=1\n end\n \n # Letter is not in lettercount, add it\n if !letterfound\n lettercount.push([string[i], 1])\n end\n \n i+=1\n end\n \n # Go through lettercount, and see how many appeared in our string more than once\n i=0\n while i<lettercount.length\n puts(lettercount[i][0] + lettercount[i][1].to_s)\n if lettercount[i][1] > 1\n num_rpt_letters += 1\n end\n i += 1\n end\n \n \n return num_rpt_letters\n \nend", "def repeatedString(s, n)\n count = s.count(\"a\")\n rep = (n / s.length)\n if n % s.length != 0\n short_s = s.slice(0, n % s.length)\n return (count * rep) + short_s.count(\"a\")\n else\n return (count * rep)\n end\n \nend", "def max_beauty(string)\n chars = Hash.new { |h,k| h[k] = 0 }\n\n string.chars.each do |char|\n chars[char] += 1\n end\n\n next_value = 26\n beauty = 0\n chars.sort_by { |key, value| -value }.each do |_, count|\n beauty += count * next_value\n next_value -= 1\n end\n\n beauty\nend", "def combine(draw_input)\n letters_amount = Array(0..(draw_input.length-1))\n combinations = letters_amount.map{ |x| (letters_amount - [x]).map{ |z| draw_input[z] } }\n smaller_combinations = combinations.map { |e| combine(e) }.flatten(1) + [draw_input]\n smaller_combinations.uniq.reject(&:empty?)\nend", "def accum(s)\n\tletters = s.split(\"\")\n accumulated_letters = []\n\n i = 0\n while i < letters.length()\n accumulated_letters.push(letters[i].upcase + (letters[i].downcase * i))\n i += 1\n end\n\n accumulated_letters.join(\"-\")\nend", "def count_letters(str)\r\n index, result, equal_temp, temp = 0, [], [], str[0]\r\n str = str.downcase\r\n\r\n while index < str.length\r\n\r\n if temp == str[index + 1]\r\n equal_temp << temp\r\n else\r\n result << equal_temp\r\n equal_temp << temp\r\n equal_temp = []\r\n end\r\n\r\n temp = str[index + 1]\r\n index += 1\r\n end\r\n\r\n result\r\nend", "def find_all_combos(str=[\"\"],arr={})\n if str.length == 1\n return str\n end\n i = 0\n #iterate over each string\n while i < str.length\n j = 0\n if !arr[str[i]]\n arr[str[i]] = true\n end\n while j < str.length\n #create a new string by combining with the other strings\n if j != i\n new_str = str[i] + str[j]\n\n new_arr = [new_str]\n \n k = 0\n #build a new array with the string\n while k < str.length\n if(k != i && k!=j)\n new_arr.push(str[k])\n end\n k+=1\n end\n arr[new_str] = true\n find_all_combos(new_arr,arr)\n end\n j+=1\n end\n i+=1\n end\n return arr\nend", "def list_of_combinations(word) \n word = word.split(\"\")\n wordlist = []\n\n index1 = 0\n index2 = 1\n\n loop do \n combination = word[index1..index2].join(\"\")\n wordlist << combination\n index2 += 1\n if index2 >= word.length\n index1 += 1\n index2 = index1 + 1\n end\n\n if index1 >= word.length-1\n break\n end\n \n end\n wordlist\nend", "def non_unique_letters(string)\n alpha = ('a'..'z').to_a\n our_new_letters = []\n counters = Hash.new(0)\n arr = string.downcase.split(\"\").select {|letter| string.count(letter) > 1}\n arr.each do |c|\n counters[c] += 1\n our_new_letters << c if counters[c] <= 1\n end\n our_new_letters.select {|x| alpha.include?(x)}\nend", "def compress(string)\n compressed_string = []\n count_consecutive = 0\n\n ##\n # Here is a simple counter: count_consecutiv will add 1 each time\n # next string letter is the same. If next array element is not the the same\n # will write letter and counter after the letter. Once it happened will set\n # counter back to 0.\n #\n for i in 0..string.length - 1\n count_consecutive +=1\n\n if string.chars[i] != string.chars[i+1]\n if count_consecutive == 1\n compressed_string << string.chars[i].to_s\n count_consecutive = 0\n else\n compressed_string << string.chars[i].to_s + count_consecutive.to_s\n count_consecutive = 0\n end\n end\n end\n compressed_string.join\nend", "def permutations(string)\n permute(string, 0, string.length)\nend", "def returnPermutationsBefore(multiLetterDivisor)\n \n #Define functions used by this function\n \n #--------------------------------------------------------------- \n \n #function that returns sum of all elements before given position\n #This function is used to track how many alphabetically preceding\n #letters are still available for our mathematical calculation\n \n def sumPrecedingArrayEntries(array, position)\n sum = 0\n for i in 0..position-1\n sum += array[i]\n end\n return sum\n end\n\n #---------------------------------------------------------------\n \n #Function that calculates the permutations that can alphabetically\n #precede the given spot in word using given parameters. This function gives\n #the count for each letter and its results are summed together.\n \n def findPermutationsBefore(noToPermutate, availablePrecedingLetters,\n multiLetterDivisor) \n return (getFactorial(noToPermutate-1) * availablePrecedingLetters) / (multiLetterDivisor)\n end\n \n #---------------------------------------------------------------\n\n #variable for running count of permutations that alphabetically\n #precede the given word as we loop and parse through given word\n \n permutationsBefore = 0\n \n #Array to keep track of which letters have been consumed.\n #Could also update totalLettersBefore in hash table\n #and parse hash table but array better suited for sequential\n #parsing by index\n \n usedLettersArray = Array.new(@uniqueLetterCount, 0)\n \n #Loop to parse through @arrayOfChars (original, unsorted word)\n \n for i in 0..@length-2\n \n #For sake of readability, use currentLetterData to reference\n #inner hash for each letter.\n #Thus @letterHash[@arrayOfChars[i]][\"totalLettersBefore\"] becomes\n #currentLetterData[\"totalLettersBefore\"]\n \n currentLetterData = @letterHash[@arrayOfChars[i]]\n \n #sumPrecedingArrayEntries parses usedLettersArray and returns\n #the sum of all entries prior to given index (alphabetical\n #index of currentLetter). Thus, this call returns number of\n #consumed letters that precede currentLetter\n \n qtyPrecedingUsedLetters = sumPrecedingArrayEntries(usedLettersArray,\n currentLetterData[\"alphabeticalIndex\"])\n \n #update qtyPrecedingAvailableLetters by subtracting used letters\n #from currentLetter's totalLettersBefore obtained from hash table. \n \n qtyPrecedingAvailableLetters = currentLetterData[\"totalLettersBefore\"] -\n qtyPrecedingUsedLetters\n \n #Add the permutations for current spot to running total.\n \n permutationsBefore += findPermutationsBefore(@length-i,\n qtyPrecedingAvailableLetters, multiLetterDivisor)\n \n #To prepare for next iteration, update multiLetterDivisor as needed\n #after consuming current character. Update usedLettersArray after\n #updating multiLetterDivisor. NOTE: multiLetterDivisor is a copy\n #of instance variable @multiLetterDivisor. Copy is used so that\n #@multiLetterDivisor remains preserved for other functions such as\n #printAlphabeticalPositionUserFriendly\n \n #To see how multiLetterDivisor works, imagine a word with 3 A's.\n #Initially this letter contributes 3! to multiLetterDivisor.\n #After 1 A is used, we divide multiLetterDivisor by\n #(occurrences of A - number of A's consumed). We make this update\n #Before updating usedLettersArray. So for first consumption\n #multiLetterDivisor gets divided by 3-0 = 3. After dividing by 3 A\n #contributes 3!/3 = 2! to the collective divisor. Next time A is consumed\n #multiLetterDivisor gets divided by 3-1 = 2. So after 2 A's are\n #consumed, A contributes 2!/2 = 1 to multiLetterDivisor.\n \n multiLetterDivisor /= (currentLetterData[\"occurrencesOfLetter\"] -\n usedLettersArray[currentLetterData[\"alphabeticalIndex\"]])\n usedLettersArray[currentLetterData[\"alphabeticalIndex\"]] += 1\n end\n return permutationsBefore\n end", "def dups_denominator(word)\n sum = 1\n\n word.chars.uniq.each do |unique_letter|\n word_count = word.count unique_letter\n sum *= factorial(word_count) if (word_count) > 1\n end\n\n sum\nend", "def string_compressor(string)\n array = string.split(//).sort\n count = 1\n result = \"\"\n\n array.each_with_index do |letter, index|\n if array[index] == array[index + 1]\n count += 1\n elsif array[index] != array[index + 1]\n result << letter + count.to_s\n count = 1\n end\n end\n result\nend", "def string_compression(str)\n new_str = \"\"\n counter = 1\n current_letter = str[0]\n str.split(\"\")[1..-1].each do |letter|\n if letter == current_letter\n counter += 1\n else\n new_str += counter.to_s + current_letter\n current_letter = letter\n counter = 1\n end\n end\n new_str += counter.to_s + current_letter\n if new_str.length >= str.length\n return str\n else\n return new_str\n end\nend", "def sherlock(str)\n str_len = str.length\n str_arr = str.split('')\n substrings_count = {}\n result = 0\n str_arr.each_with_index do |alpha, index|\n n = str_len - index\n n.times do |pos|\n ss = str_arr[index..(index+pos)].sort.join('')\n substrings_count[ss] = substrings_count[ss] ? substrings_count[ss]+1 : 1\n end\n end\n\n substrings_count.each do |key, val|\n result = result + ((val*(val-1))/2) if val > 1\n end\n result\nend", "def is_permutation2 str1, str2\n if str1.length != str2.length\n return false\n end\n\n letters = {}\n\n str1.chars.each do |char|\n if !letters[char]\n letters[char] = 1\n end\n letters[char] += 1\n end\n\n str2.chars.each do |char|\n #if letters[char] < 1\n # return false\n #end\n letters[char] -= 1\n if (letters[char] < 0)\n return false\n end\n end\n\n return true\nend", "def num_repeats(string)\n\tcount = 0\n\tdix = 0\n\tnew = \"\"\n\twhile dix < string.length\n\t\tletter = string[dix]\n\t\tunless new.include?(letter)\n\t\t\tnew = new + letter\n\t\telse\n\t\t #...\n\t\tend\n\t\tdix2 = dix + 1\n\t\twhile dix2 < string.length\n\t\t\tif letter == string[dix2]\n\t\t\t\tcount +=1\n\t\t\t\tbreak\n\t\t\tend\n\t\t\tdix2 +=1\n\t\tend\n\t\tdix += 1\n\tend\n\tputs(count.to_s)\n\treturn count\n\n\nend", "def frequent_letters(string)\n count = Hash.new(0)\n string.each_char { |char| count[char] += 1 }\n\n frequents = []\n count.each do |char, num|\n if num > 2\n frequents << char\n end\n end\n return frequents\nend", "def brute_force_compress(str)\n compressed_str = ''\n count_consecutive = 0\n str.each_char.with_index do |char, index|\n count_consecutive += 1\n next_char_different = ((index + 1) == str.chars.size || (str.chars[index + 1] != char))\n if next_char_different\n compressed_str << (char << count_consecutive.to_s)\n count_consecutive = 0\n end\n end\n compressed_str.length < str.length ? compressed_str : str\nend", "def get_perms(input_string)\n return [\"\"] if input_string.length == 0\n return [input_string] if input_string.length == 1\n input_array = input_string.split(\"\")\n letter = input_array.pop\n words = get_perms(input_array.join(\"\"))\n perms = []\n words.each do |word|\n (word.length+1).times do |idx|\n perms.push(word.dup.insert(idx,letter))\n end\n end\n perms\nend", "def calculate_alphabet(str)\nend", "def permutation(string)\n return [string] if string.size < 2\n char = string[0]\n perms = permutation(string[1..-1])\n result = []\n perms.each do |perm|\n result << char + perm\n (1..perm.length-1).each do |i|\n result << perm[0..i-1] + char + perm[i..-1]\n end\n result << perm + char\n end\n result.uniq\nend", "def best_letter string\n alphabet = ('a'..'z').to_a\n frequency_hash = Hash['a' => 1]\n alphabet.each do |x|\n frequency_hash[x] = alphabet_frequency(string, x)\n end\n #puts frequency_hash\n number_alphabet [(alphabet_number(frequency_hash.min_by{|k,v| v}.first.split(\"\")).first + 1) % 26]\nend" ]
[ "0.7041091", "0.69983584", "0.6995064", "0.69941944", "0.6987236", "0.69822466", "0.6966957", "0.6936604", "0.6925985", "0.6900158", "0.6896553", "0.6879707", "0.6862617", "0.68618906", "0.68446636", "0.6809561", "0.67533654", "0.6738742", "0.67109346", "0.66958284", "0.667426", "0.6663816", "0.6654202", "0.6625635", "0.6623888", "0.6595713", "0.6583993", "0.6572011", "0.65616894", "0.65579385", "0.6554068", "0.655226", "0.6536369", "0.65297514", "0.6478143", "0.6476714", "0.6464288", "0.64606166", "0.64602625", "0.64570796", "0.64463115", "0.64429504", "0.6439046", "0.6434671", "0.6428704", "0.6428502", "0.64249414", "0.6424213", "0.64187", "0.6416835", "0.6415767", "0.6413283", "0.641261", "0.6404212", "0.6395341", "0.6391363", "0.63814825", "0.638075", "0.6378998", "0.6378549", "0.6373335", "0.63705283", "0.63683504", "0.6367428", "0.6361155", "0.6351381", "0.6346968", "0.6341549", "0.6337078", "0.63353753", "0.63216776", "0.63172245", "0.6306697", "0.6306604", "0.63028044", "0.629154", "0.6277123", "0.6273424", "0.6271383", "0.62659276", "0.62638646", "0.6249064", "0.6235321", "0.62340397", "0.6231217", "0.6229797", "0.622492", "0.6217645", "0.62129354", "0.62125087", "0.62087905", "0.62070966", "0.6186731", "0.61864495", "0.618288", "0.61820513", "0.6181776", "0.61771005", "0.61760306", "0.61750144", "0.6174492" ]
0.0
-1
time complexity: O(n^2) Assuming that Arrayindex is O(n) since it iterates through the array of n elements to find the index value
def third_anagram?(str1, str2) str1.chars.sort == str2.chars.sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magic_slow(arr)\n arr.each_with_index do |val, index|\n if val === index\n return index\n end\n end\nend", "def magic_slow(arr)\n arr.each_with_index do |val, index|\n return index if val === index\n end\nend", "def find_element_index(array, value_to_find)\n array.length.times do |index|\n if array[index] == value_to_find\n return index\n end\n end\n nil\nend", "def linear_search(array, n, x)\n answer_index = 'NOT-FOUND'\n array.each_with_index do |a, i|\n if a == x\n answer_index = i\n end\n end\n answer_index\nend", "def find_element_index(array, value_to_find)\n i=0 \n k = value_to_find\n while i<array.length do\n if array[i]==k\n number=i \n i+=1 \n else \n i+=1 \n end\n end\n return number\nend", "def find_element_index(array, value_to_find)\n counter = 0 \n \n while counter < array.length do\n if array[counter] == value_to_find\n return counter\n end \n counter += 1 \n end \nend", "def find_element_index(array, value_to_find)\n array.length.times do |count|\n if array[count] == value_to_find\n return count\n end\n end\n nil\nend", "def find_element_index(array, value_to_find)\n count = 0\n value_index = nil\n while count < array.length do\n if array[count] == value_to_find\n value_index = count\n end\n count += 1\n end\n value_index\nend", "def find_element_index(array, value_to_find)\n array.length.times do |count|\n if array[count] == value_to_find \n return count\nend\nend\nnil\nend", "def find_index_of_value_in_array(value, array)\n index = 0\n while index < array.length do \n if array[index] == value\n return index\n end\n index += 1\n end\n nil\nend", "def index_match(array)\n # write your code here\n array.each_with_index do |num, index|\n if num == index \n return num\n end\n end\n -1\nend", "def find_element_index(array, value_to_find)\n count = 0\n while count < array.length do \n if array[count] == value_to_find\n return count\n end \n count += 1 \n end\n nil \nend", "def find_index(array, target)\n index = 0\n found_index = nil\n\n array.each do |element|\n if element == target\n found_index = index\n end\n index += 1\n end\n\n found_index\nend", "def search_array(arr, x)\n index_count = 0\n index_result = 0\n until index_count == arr.length\n if arr[index_count] == x\n index_result = index_count\n end\n index_count += 1\n end\n search_array = index_result\nend", "def search_array(array, num)\n answer = nil\n (array.length+1).times do | index |\n if array[index] == num\n answer = index\n end\n end\n answer\nend", "def find_element_index(array, value_to_find) #<-- this is a shorter solution with .find_index\n # Add your solution here\n array.find_index(value_to_find)\nend", "def search(array, index_target)\r\n\tindex = 0 \r\n\t\r\nwhile index < array.length \r\n\tif array[index] == index_target\r\n\t\treturn index \r\n\telse \r\n\t\tnil \r\n\tend\r\n\tindex += 1 \r\nend \r\nend", "def find_element_index(array, value_to_find)\n # Add your solution here\n array.index(value_to_find)\nend", "def find_magic_index(array)\n array.each_with_index do |element, index|\n if element == index \n return element\n end \n end \n -1 \nend", "def slow_dance(tile, array)\n array.each_with_index do |el, i|\n return i if el == tile\n end\nend", "def find(array, target)\n array.each_with_index do |element,index|\n return index if (element == target)\n end\n nil\nend", "def linear_search(sorted_array, desired_item)\n index = 0\n sorted_array.length.times do \n if desired_item == sorted_array[index]\n break \n else \n index += 1\n end\n if index > sorted_array.length - 1\n index = nil \n end\n end\n return index \nend", "def linear_search(array, target)\n for i in 0...array.length\n if array[i] == target\n return i\n end\n end\n\n return -1\nend", "def search_array(arr, value)\n index = 0\n arr.each do |item|\n if item == value\n return index\n end\n index += 1\n end\n nil\nend", "def find_element_index(array, value_to_find)\n array.index(value_to_find)\nend", "def linear_search(array, target)\n for i in 0..(array.length - 1)\n if array[i] == target\n return i\n end\n end\n return -1\nend", "def find_element_index(array, value_to_find)\n array.find_index(value_to_find)\nend", "def search(arr, x)\n (0..arr.count).each do |i|\n return i if arr[i] == x\n end\n -1\nend", "def find_even_index(arr)\n arr.each_index do |idx|\n return idx if arr[0...idx].sum == arr[idx + 1..-1].sum\n end\n -1\nend", "def test_index_array\r\n\t\tarr = [\"a\", \"b\", \"c\", \"a\", \"b\", \"d\", \"c\"]\r\n\t\tassert_equal({\"a\"=>[0,3], \"b\"=>[1,4], \"c\"=>[2,6], \"d\"=>[5]}, arr.find_values_index())\r\n\tend", "def search_array (array, number)\n counter = 0\n index = []\n array.each do |value|\n index << counter if value == number\n counter += 1\n end\n index.empty? ? nil : index\n end", "def find_even_index(arr)\n arr.length.times do |i|\n if arr[0...i].reduce(0, :+) == arr[i+1..-1].reduce(0, :+)\n return i\n end\n end\n -1\nend", "def fibonacci_index(array)\n fibonacci_sequence = create_fibonacci(array.size)\n new_array = array.select { |num| fibonacci_sequence.include?(array.index(num)) }\nend", "def find_even_index(array)\n array.size.times do |i|\n left_array = array[0...i]\n right_array = array[(i+1)..-1]\n return i if left_array.sum == right_array.sum\n end\n -1\nend", "def findIndex(a, x)\n\tn = a.length\n\ti = n - 1\n\tj = 0\n\twhile a[i][j] != x do\n\t\tif a[i][j + 1] <= x then\n\t\t\tj += 1\n\t\telse\n\t\t\ti -= 1\n\t\tend\n\tend\n\treturn i, j\nend", "def search_array(array, x)\n i = 0\n\n array.each do | y |\n if y == x\n return i\n end\n i += 1\n end\n return nil\nend", "def linear_search(object, array)\n i = 0\n until array[i] == object || array[i] == nil\n i += 1\n end\n array[i] == object ? i : nil\n end", "def search_array (array, integer)\n array.each_with_index do |item, index|\n if item == integer\n return index\n end\n end\nend", "def find_index_of_element(arr=[120, 34, 12, 127, 12, 123, 140])\n results_arr = Array.new\n arr.each_with_index do |el, i|\n results_arr.push(i) if (arr[i] > arr[0]) && (arr[i] < arr[-1])\n end\n print results_arr.last\nend", "def find_even_index(arr)\n return 0 if arr[1..-1].sum == 0\n for n in 1..arr.size - 1\n right = arr[n + 1..-1]\n left = arr[0..n - 1]\n return n if left.sum == right.sum\n end\n -1\nend", "def search_array(arr, x)\r\n index = 0 \r\n default = nil\r\n arr.each do if x == arr[index]\r\n return index\r\n # default = index\r\n end\r\n index += 1\r\n end\r\n return default \r\nend", "def magic_index(array)\n array.each_with_index do |val, index|\n return index if val == index\n end\n \"no magic index\"\nend", "def search_array (array, integer)\n\tarray.length.times do |index|\n\t if array[index] == integer\n\t return index\n\t end\n\tend\n\tnil\nend", "def search_array(arr, num)\n\tindex = 0\n\tarr.each do |value|\n\t\tif value == num\n\t\t\treturn index\n\t\tend\n\tindex +=1\n\tend\n\treturn nil\nend", "def find_even_index(array)\n array.length.times do |middle_idx|\n part1 = [0] \n part2 = [0]\n array.each_with_index do |num, idx|\n part1 << num if idx < middle_idx\n part2 << num if idx > middle_idx\n end\n return middle_idx if part1.reduce(:+) == part2.reduce(:+)\n end\n -1\nend", "def search_array(array, integer)\n index = 0\n while index < array.length\n if array[index] == integer\n return index\n else \n nil\n index += 1\n end\n end\nend", "def search_array(array, value)\n idx = 0\n array.each do\n if array[idx] == value \n return idx\n end\n idx += 1\n if idx == array.length\n print \"nil\"\n return nil\n end\n end\nend", "def find(arr, item)\n i = 0\n item_index = nil\n while item_index.nil? && i < arr.length\n if arr[i] == item\n item_index = i\n end\n\n i += 1\n end\n\n item_index\nend", "def retrieve_element_from_index(array, index_number)\n array[index_number]\nend", "def retrieve_element_from_index(array, index_number)\n array[index_number]\nend", "def subarray(array)\n sum_to_index = {}\n i = 0\n sum = 0\n while i < array.length do\n sum += array[i]\n if sum_to_index[0]\n return [0, sum_to_index[0]]\n elsif sum_to_index[sum]\n return [sum_to_index[sum] + 1, i]\n else\n sum_to_index[sum] = i\n end\n i += 1\n end\nend", "def slow_dance(step, array)\n index = 0\n array.each_with_index do |el, i|\n index = i if el == step\n end\n index\nend", "def retrieve_element_from_index(array, index_number)\n return array[index_number]\nend", "def search_array(integers, target)\n idx = 0\n\n while idx < integers.length\n if integers[idx] == target\n return idx\n elsif idx == integers.length\n nil\n else\n idx += 1\n end\n end\nend", "def find_even_index(arr)\n i = 0\n a = 0\n b = 1\n for i in 0...arr.length\n a = arr.slice(0, i).sum\n b = arr.slice(i + 1, arr.length - 1).sum\n if a != b && i == arr.length - 1\n return -1\n elsif a != b\n i += 1\n else\n return i\n end\n end\nend", "def linear_search(array, search_value)\n array.each_with_index do |element, index|\n if element == search_value\n return index\n elsif element > search_value\n break\n end\n end\n\n return nil\nend", "def nameri arr, query \n len = arr.length\n for idx in 0 .. len - 1 do\n if query == arr[idx]\n return idx \n else \n end\n end\nend", "def search_array(array, search_int)\n # have an empty array to store the index array numbers\n index_array = []\n\n length_of_array = array.length - 1\n\n # convert array and index to string\n array_string = array.map {|x| x.to_s}\n index_string = search_int.to_s\n\n # make a counter for 0 to array lenght numbers\n for x in 0..length_of_array\n index_array << x.to_s\n end\n\n # make the two arrays into a hash\n p array_index = Hash[index_array.zip(array_string.map {|i| i.split})]\n\n # convert back to an integer\n\n if array_index[index_string] == nil\n p nil\n else\n p array_index[index_string].map {|i| i.to_i}\n end\n\n\nend", "def slow_dance(tile, tiles_array)\n tiles_array.each_with_index do |direction, idx|\n return idx if direction == tile\n end\nend", "def array_search(array, integer)\n count = 0\n stored_index_matches = []\n integer_index = nil\n while count < array.length\n if array[count] == integer\n integer_index = count\n stored_index_matches << integer_index\n count += 1\n else\n count += 1\n end\n end\n if integer_index == nil #<--determines what the method's\n integer_index #<--return value should be, either\n else #<--nil or an array containing index\n stored_index_matches #<--numbers for matching integers\n end\nend", "def slow_dance(direction, arr)\n arr.each_with_index do |el, i|\n return i if el == direction\n end\nend", "def slow_dance(target_tile, tiles_array)\n tiles_array.each_with_index do |tile, index|\n return index if target_tile == tile\n end\n\n nil\nend", "def search_array(arr, int)\n\ti = 0\n\twhile i < arr.length\n\t\tif arr[i] == int\n\t\t\treturn i \n\t\tend\n\ti += 1\n\tend\nend", "def find_element_index_consecutive(array, ele)\n index = ele - array[0]\n index = index < 0 ? array.length + index : index\n index\nend", "def simple_search(arr, number)\n\tmatching_index = nil\n\tcurrent_index = 0\n\tarr.each do |num|\n\t\tif num == number\n\t\t\tmatching_index = current_index\n\t\tend\n\t\tcurrent_index += 1\n\tend \n\tmatching_index\nend", "def slow_dance(target, tiles_array)\n tiles_array.each_with_index do |tile, idx|\n return idx if tile == target\n end\nend", "def index_of element\n @index.key @data.index(element)\n end", "def getMin(arr) \t\n\tminInd = 0\n\tfor i in 1..$n-1 do\n\t\tif (arr[i] < arr[minInd])\n\t\t\tminInd = i\n end \n end \n\treturn minInd\nend", "def find_max_index(array)\n max_value = array[0]\n max_index = 0\n\n array.each.with_index do |value, i|\n if value > max_value\n max_value = value\n max_index = i\n end\n end\n\n max_index\nend", "def search_array(input_array, searched_elt)\n # Examples \n # arr = [42, 89, 23, 1]\n #p search_array(arr, 1)\n #=> 3\n #p search_array(arr, 24)\n #=> nil\n #= end \n \n # loop on the array 'array_of_integers'\n # if 'searched_integer' is found, take the index \n result = 0\n tab_index = 0 \n input_array.each do |i|\n if (i == searched_elt)\n result = tab_index\n end \n tab_index += 1\n end\n\n if result == 0 \n puts \"Element not found\"\n else\n return (result)\n end \n\nend", "def find_even_index(arr)\n left_sum = 0\n right_sum = arr.sum\n arr.each_with_index do |e, ind|\n right_sum -= e\n\n return ind if left_sum == right_sum\n\n left_sum += e\n end\n\n -1\nend", "def slow_dance(direction, array)\n array.each_with_index do |el, idx|\n return idx if el == direction\n end\nend", "def array_sum_with_index(arr)\n sum = 0\n arr.each_with_index {|n, i| sum += n*i}\n sum\nend", "def slow_dance(dir, array)\n array.each.with_index do |el, idx|\n return idx if dir == el\n end\nend", "def get_index_of_position(target_position, ary)\n ary.each_index do |i|\n current_position = ary[i][1]\n if current_position == target_position\n return i\n end\n end\n end", "def search_array(array, integer)\n index = 0\n result = nil # variable to store result\n\n array.each do |number| # for each item in the array, check whether it is equal to the integer.\n if number == integer\n result = index # save current index as result when integer is found in array.\n break\n end\n index += 1 # each time the number does not match, increment the index.\n end\n return result\nend", "def index_of element\n @index.key @vector.index(element)\n end", "def find_index(array,search)\n temp = array.clone\n indices = Array.new()\n \n while true\n this_index = temp.index(search) \n if this_index.nil? == false\n temp.delete_at(this_index)\n indices.push this_index\n else\n break\n end\n end\n temp.clear\n return indices\n end", "def slow_dance(direction, array)\n array.each_with_index do |tile, idx|\n return idx if tile == direction\n end\nend", "def search(array, value, index=0)\n return false if index >= array.length\n return true if array[index] == value\n\n return search(array, value, index+1)\nend", "def search(nums, target)\n nums.each_with_index do |num, index|\n return index if num == target\n end\n -1\nend", "def slow_dance(direction, array)\n array.each_with_index do |tile, idx|\n return idx if tile == direction\n end\n\n nil\nend", "def find_pair(array,sum)\n indices = []\n hash = Hash.new\n array.each_with_index do |element,i|\n if hash[sum - element] != nil then\n indices.push(\"#{hash[sum - element]},#{i}\")\n end\n hash[element] = i\n end\n indices\nend", "def all_indices(elem, array)\r\n indices = []\r\n array.each_with_index do |element, index|\r\n (indices << index) if element == elem\r\n end\r\n indices\r\n end", "def solve(nums)\n nums.each_with_index do |n, i|\n if nums[i] == i\n return i\n end\n end\n return -1\nend", "def search_array(array, int)\n\ti = 0\n\twhile i < array.length\n\t\tif array[i] == int\n\t\t\treturn i\n\t\tend\n\t\ti += 1\n\tend\n\n\treturn nil\nend", "def index(element); end", "def find_linear(data,val)\n (0..data.length-1).each do |i|\n if data[i] == val\n return i\n end\n end\n return -1\nend", "def find_k(k,arr)\n\t#need to sort the array\n\t#then can do negative index to find it\n\t#we can use quicksort\n\tdriver(lt,rt)\n\t#its sorted\n\t#then find the kth element, easy\n\tk = k * -1\n\tarr[k]\nend", "def slow_dance(dir, arr)\n arr.each_with_index do |el, idx|\n return idx if dir == el\n end\nend", "def find_index array, item\n\tl,r = 0, array.length-1\n\n\twhile l <= r\n\t\tm = (r+l) / 2\n\t\tcomp = yield item, array[m]\n\t\tif comp == false\n\t\t\t# Items compare the same\n\t\t\treturn false\n\t\telsif comp == -1 \n\t\t\tr = m - 1\n\t\telse\n\t\t\tl = m + 1\n\t\tend\n\tend\n\n\tl\nend", "def search_array(array, interger)\n\t index = 0 \n while index < array.length\n\n \tif array[index] == interger\n p index\n end \n index += 1\n end\nend", "def arr_search(arr, num)\r\n\tindex = 0\r\n\tarr.each do |search|\r\n\t\tif (index < arr.length && search == num)\r\n\t\t puts index\r\n\t\tend \r\n\t\tindex += 1\r\n\tend \r\nend", "def find_missing(array, n)\n i = 0\n\n (1..n).each { |number| i = i ^ number }\n array.each { |number| i = i ^ number }\n\n i\nend", "def search(array, value, index = 0)\n return false if index >= array.length\n return true if array[index] == value\n return search(array, value, index + 1)\nend", "def find_singleton(array)\n array.each_with_index do |element, index|\n if element != array[index - 1] and element != array[index + 1]\n return element\n end \n end\n -1\nend", "def find(index)\n x = index\n while @parent_array[x] != 0\n x = @parent_array[x]\n end\n return x\n end", "def array_sum_by_index(arr)\n\nend", "def element_at(arr, index)\n arr[index]\nend", "def find_even_index(arr)\r\n last_index = arr.size - 1\r\n arr.each_index do |index|\r\n if index == 0\r\n left_side = []\r\n right_side = arr[(index + 1)..-1]\r\n elsif index == last_index\r\n left_side = arr[0..(last_index - 1)]\r\n right_side = []\r\n else\r\n left_side = arr[0..(index - 1)]\r\n right_side = arr[(index + 1)..-1]\r\n end\r\n return index if left_side.sum == right_side.sum\r\n end\r\n \r\n -1\r\nend", "def find_pair(array,sum)\n indices = []\n for i in 0...array.length\n for j in i+1...array.length\n indices.push(\"#{i},#{j}\") if array[i] + array[j] == sum\n end\n end\n indices\nend" ]
[ "0.76936775", "0.76405734", "0.7598911", "0.7491657", "0.7457418", "0.73879373", "0.73876333", "0.73775446", "0.73423237", "0.7314086", "0.72672254", "0.72628343", "0.72334456", "0.7212229", "0.71682715", "0.71651036", "0.7160097", "0.7143638", "0.71259207", "0.70957476", "0.7095158", "0.7080912", "0.7038359", "0.703678", "0.70280594", "0.7026967", "0.6995652", "0.6912112", "0.6907513", "0.6896998", "0.6865558", "0.6829439", "0.6821778", "0.6806038", "0.68021816", "0.6780815", "0.67783844", "0.67707133", "0.6759898", "0.6759667", "0.67526734", "0.6741605", "0.6723742", "0.67099035", "0.6700827", "0.66988134", "0.6698462", "0.6686387", "0.6685963", "0.6685963", "0.66741806", "0.66721696", "0.6672111", "0.666832", "0.66679233", "0.6651295", "0.6647466", "0.6629543", "0.66287816", "0.6623907", "0.66005695", "0.65973794", "0.65746826", "0.65735453", "0.65696836", "0.6564315", "0.65640986", "0.6559576", "0.6522466", "0.65153235", "0.65068316", "0.6475474", "0.6469882", "0.64655334", "0.64598", "0.64593416", "0.64564556", "0.6455045", "0.64525354", "0.64515823", "0.6449965", "0.64449424", "0.6440221", "0.64399403", "0.64355516", "0.6431872", "0.6422624", "0.64212465", "0.6418425", "0.64079773", "0.64033926", "0.63880706", "0.6383303", "0.6378007", "0.6377058", "0.6373876", "0.63683414", "0.6359518", "0.6358709", "0.6351888", "0.63492763" ]
0.0
-1
time complexity: O(n^2) or O(nlogn) for average/best case if ruby uses quicksort since avearage and best case are a lot better than second method, third is slightly better
def fourth_anagram?(str1, str2) hash_1 = Hash.new(0) hash_2 = Hash.new(0) str1.chars.each do |letter| hash_1[letter] += 1 end str2.chars.each do |letter| hash_2[letter] += 1 end hash_1 == hash_2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_quick_sort(arr)\r\n if arr.length < 2\r\n return arr #Base case: arrays with 0 or 1 element are already “sorted.”\r\n else\r\n pivot = arr[0] #Recursive case\r\n less = arr[(1...arr.length)].select{|x| x <= pivot} #Sub-array of all the elements less than the pivot\r\n greater = arr[(1...arr.length)].select{|x| x > pivot} #Sub-array of all the elements greater than the pivot\r\n return use_quick_sort(less) + [pivot] + use_quick_sort(greater)\r\n end\r\nend", "def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend", "def alternate_quicksort(array)\n return array if array.size < 2\n\n left = []\n right = []\n\n pivot_index = array.size - 1\n pivot_value = array[pivot_index]\n\n array.pop\n\n array.each do |item|\n item < pivot_value ? left.push(item) : right.push(item)\n end\n\n quicksort(left) + [pivot_value] + quicksort(right)\nend", "def quick_sort(a)\n array = a\n \n # already sorted!\n return array if array.length <= 1\n \n pivot = array.length / 2\n \n lower = []\n higher = []\n array.length.times do |i|\n next if i == pivot\n \n if array[i] >= array[pivot]\n higher << array[i]\n else\n lower << array[i]\n end\n end\n \n return quick_sort(lower) + [array[pivot]] + quick_sort(higher)\nend", "def quicksort (a)\n return [] if a.empty? || a.nil?\n p = a.shift\n quicksort(a.select { |n| n < p }) + [p] + quicksort(a.select { |n| n >= p })\nend", "def quicksort(arr, low, high)\n if low < high\n pivot_index = partition(arr, low, high)\n\n quicksort(arr, low, pivot_index - 1)\n quicksort(arr, pivot_index + 1, high)\n end\nend", "def quicksort(arr)\n\n return arr if arr.length == 1\n\n pivot_arr = arr.first\n\n first_half = arr[1..-1].select { |val| val < arr.first }\n second_half = arr[1..-1].select { |val| val >= arr.first }\n\n return quicksort(first_half) + [pivot_arr] + quicksort(second_half)\n\nend", "def quicksort(arr)\n return arr if arr.length <= 1\n pivot_arr = [arr.first]\n left_side = arr[1..-1].select {|num| num < arr.first}\n right_side = arr[1..-1].select {|num| num > arr.first}\n left_side + pivot_arr + right_side\nend", "def quick_sort(arr)\n return arr if arr.length <= 1\n pivot_arr = [arr.first]\n left_side = arr[1..-1].select { |el| el < arr.first } # one of these needs = for\n right_side = arr[1..-1].select { |el| el >= arr.first } # duplicates of base case\n\n quick_sort(left_side) + piviot_arr + quick_sort(right_side)\nend", "def quick_sort arr, first, last\n return arr if last <= first\n pivot = arr[last]\n j = first\n\n for i in first..last-1 do\n if pivot > arr[i]\n arr[i], arr[j] = arr[j], arr[i]\n j+= 1\n end\n end\n arr[j], arr[last] = arr[last], arr[j]\n quick_sort(arr, first, j-1)\n quick_sort(arr, j+1, last)\nend", "def quick_sort(arr)\n return arr if arr.length <= 1\n pivot_arr = [arr.first]\n left_side = arr[1..-1].select{ |el| el < pivot_arr[0] }\n right_side = arr[1..-1].select{ |el| el >= pivot_arr[0] }\n quick_sort(left_side) + pivot_arr + quick_sort(right_side)\nend", "def quicksort(array)\n return array if array.size < 2\n\n left = []\n equal = []\n right = []\n pivot = array[0]\n\n array.each do |i|\n if i < pivot\n left << i\n elsif i == pivot\n equal << i\n else\n right << i\n end\n end\n return quicksort(left) + equal + quicksort(right)\nend", "def quick_sort(array)\nend", "def quick_sort(array)\n return array if array.size <= 1\n pivot = array.shift\n left = array.select { |el| el < pivot }\n right = array.select { |el| el >= pivot }\n\n quick_sort(left) + [pivot] + quick_sort(right)\nend", "def quick_sort(lst)\n return lst if lst.length <= 1\n pivot = lst.shuffle.shift\n left, right = lst.partition {|val| val < pivot}\n quick_sort(left) + quick_sort(right)\nend", "def quicksort(array)\n # debugger\n return [] if array.empty?\n smaller = []\n larger = []\n array.each do |item|\n if item < array.last\n smaller << item\n elsif item > array.last\n larger << item\n end\n end\n\n quicksort(smaller) + [array.last] + quicksort(larger)\nend", "def quickSortHelper(ia, left, h)\n if (left < h)\n p = partition(ia, left, h) #get partition index of the array\n quickSortHelper(ia, left, p - 1) #sort from low to partition index -1\n quickSortHelper(ia, p + 1, h) #sort from p + 1 to high\n end\nend", "def quick_sort(arr)\n \n if arr.length <= 1\n return arr\n end \n\n pivot = arr[0]\n left = []\n right = []\n\n #seperate into left and right \n arr[1..-1].each do |num|\n if num < pivot\n left.push(num)\n else\n right.push(num)\n end \n end \n\n result = quick_sort(left) + [pivot] + quick_sort(right)\n\n return result \n\nend", "def quicksort_pivot\n (self[0] + self[-1] + self.sample)/3.0\n end", "def quick_sort (arr, left, right)\n arr_index = partition(arr, left, right)\n if left < arr_index - 1 # sort left half\n quick_sort(arr, left, arr_index - 1)\n end\n\n if arr_index < right # sort right half\n quick_sort(arr, arr_index, right)\n end\n\n # if left < arr_index && arr_index < right\n # puts \"arr: #{arr}\"\n # arr\n # end\n\nend", "def qsort(a, lower, upper)\r\n if lower < upper\r\n mid = partition(a, lower, upper)\r\n qsort(a, lower, mid)\r\n qsort(a, mid+1, upper)\r\n end\r\n return a\r\nend", "def poorly_written_ruby(*arrays)\n combined_array = []\n\n arrays.each do |array|\n combined_array.concat(array)\n end\n \n def quick_sort(collection)\n return collection if collection.length <= 1\n pivot = collection.sample\n\n left = Array.new\n right = Array.new\n\n collection.each do |x|\n if x <= pivot\n left << x\n else\n right << x\n end\n end\n\n quick_sort(left) + quick_sort(right)\n\n end\n\n def buckethash_sort(collection)\n\n buckets = Hash.new\n\n (\"A\"..\"Z\").each do |x|\n buckets[x] = Array.new\n end\n\n collection.each do |x|\n if buckets.key?(x[0])\n buckets[x[0]] << x\n end\n end\n\n buckets.each_key do |key|\n buckets[key] = quick_sort(buckets[key])\n end\n\n buckets.values.flatten\n\n end\n\n buckethash_sort(combined_array)\n\nend", "def quicksort(arr)\n return arr if length < 2\n\n rand_idx = rand(arr.length)\n until rand_idx != 0\n rand_idx = rand(arr.length)\n end\n arr[0], arr[rand_idx] = arr[rand_idx], arr[0]\n\n pivot = arr.shift\n left, right = [], []\n\n arr.each do |num|\n if num < pivot\n left.push(num)\n else\n right.push(num)\n end\n end\n\n return quicksort(left) + [pivot] + quicksort(right)\nend", "def quick_sort(arr, left = 0, right = arr.length - 1)\n if left < right\n pivot_index = pivot_helper(arr, left, right)\n\n quick_sort(arr, left, pivot_index - 1)\n quick_sort(arr, pivot_index + 1, right)\n end\n return arr\nend", "def sort(arr)\n return arr if arr.length < 1\n\n pivot = arr.pop\n less = arr.select { |item| item < pivot}\n more = arr.select { |item| item >= pivot}\n\n sort(less) + [pivot] + sort(more)\nend", "def quicksort(array)\n return array if array.length <= 1\n\n pivot = array.shift\n equal = [pivot]\n less = []\n greater = []\n\n while (array.length > 0)\n e = array.shift\n\n less << e if e < pivot\n greater << e if e > pivot\n equal << e if e == pivot\n end\n\n quicksort(less) + equal + quicksort(greater)\nend", "def quick(array, low_index, high_index)\n return unless low_index < high_index\n\n # partition array\n i = (low_index - 1) # index of smallest element\n pivot = array[high_index] # pivot from highest element\n\n # go through all array elements from\n # lowest to highest index provided\n # if current value is less than pivot\n # move value to the left of pivot\n (low_index..high_index).each do |j|\n next unless array[j] < pivot\n\n i += 1 # increase index of smallest element\n\n # swap positions of elements\n array[i], array[j] = array[j], array[i]\n end\n\n partition = (i + 1)\n array[partition], array[high_index] =\n array[high_index], array[partition]\n\n # recursive sorting of split array\n quick(array, low_index, partition - 1)\n quick(array, partition + 1, high_index)\n\n array\nend", "def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend", "def quicksort(arr)\n return arr if arr.length <= 1\n\n pivot = arr.pop\n smaller = arr.map{|x| x if x <= pivot}.compact\n bigger = arr.map{|x| x if x > pivot}.compact\n\n return quicksort(smaller) + [pivot] + quicksort(bigger)\nend", "def function_a(av)\n#code\n\ti = 0\n\tarray = []\n\twhile i < av.size\n\t\tarray << av[i].to_i\n\t\ti += 1\n\tend\n\tpa = array.sort\n\trange = pa[pa.size - 1] - pa[0]\n\tx = 0\n\ti = 0\n\twhile i < pa.size\n\t\tx += pa[i].to_i\n\t\ti += 1\n\tend\n\tif pa.size % 2 == 1\n\t\tmedian = pa[pa.size / 2]\n\telse\n\t\tmedian = (pa[pa.size / 2].to_f + pa[(pa.size - 1) / 2].to_f) / 2\n\tend\n\tmean = (x.to_f / (pa.size).to_f).to_f\n\tmulti = pa.inject(Hash.new(0)) { |x,y| x[y] += 1; x }\n\tmode = pa.max_by { |x| multi[x] }\n\tputs \"Min: \" + pa[0].to_s,\n\t\t\"Max: \" + pa[pa.size - 1].to_s,\n\t\t\"Mean: \" + mean.to_s,\n\t\t\"Median: \" + median.to_s,\n\t\t\"Mode: \" + mode.to_s,\n\t\t\"Range: \" + range.to_s\n\tav.clear\nend", "def quick_sort(arr)\n return [] if arr.empty?\n first, *remaining = arr\n left, right = remaining.partition{ |x| x < first }\n quick_sort(left) + [first] + quick_sort(right)\nend", "def perform_quick_sort(low, high)\n return if low >= high\n pivot = @array[rand(low..high)]\n i = low\n j = high\n while (i<=j)\n i += 1 while i<=j && @array[i] < pivot\n j -= 1 while i<=j && @array[j] > pivot\n break if i>j\n swap(@array, i, j)\n i += 1\n j -= 1\n end\n perform_quick_sort(low, j) if low < j\n perform_quick_sort(i, high) if i < high\n end", "def quick_sort(arr, low = 0, high = arr.size - 1)\n return unless low < high\n\n partition_index = partition(arr, low, high)\n quick_sort(arr, low, partition_index - 1)\n quick_sort(arr, partition_index + 1, high)\n end", "def quick_sort(array)\n if array.length < 3\n if array.length == 2\n if array[0] > array[1]\n array[0], array[1] = array[1], array[0]\n end\n end\n return array\n else\n pivot = array[array.length-1]\n left_arr = []\n right_arr = []\n array.each do |element|\n if element < pivot\n left_arr << element\n elsif element > pivot\n right_arr << element\n end\n end\n x = quick_sort(left_arr)\n y = quick_sort(right_arr)\n final = []\n final << x\n final << pivot\n final << y\n return final\n end\nend", "def quick_sort(array, &prc)\n return array if array.length <= 1\n prc ||= Proc.new { |el1, el2| el1 - el2 }\n\n part_idx = array.length / 2\n part_val = array[part_idx]\n\n left = []\n right = []\n\n array.each_with_index do |el, idx|\n next if idx == part_idx\n prc.call(el, part_val) <= 0 ? left << el : right << el\n end\n\n quick_sort(left, &prc) + [part_val] + quick_sort(right, &prc)\nend", "def quick_sort(array=@base)\n return [] if array.empty?\n pivot = array.pop\n left, right = array.partition {|e| e < pivot}\n quick_sort(left) + [pivot] + quick_sort(right)\n end", "def quicksort(arr)\n return arr if arr.length <= 1\n\n pivot, left, right = arr[0], [], []\n\n arr[1..-1].each do |el|\n el < pivot ? left << el : right << el\n end\n quicksort(left).concat([pivot]).concat(right)\nend", "def quick_sort(arr, s, e)\n return if s >= e\n pIndex = partition(arr, s, e)\n quick_sort(arr,s,pIndex-1)\n quick_sort(arr,pIndex+1, e)\nend", "def quicksort arr, lo, hi\n if lo < hi\n p = partition(arr, lo, hi);\n quicksort(arr, lo, p);\n quicksort(arr, p+1, hi);\n end\n end", "def solution(a)\n n = a.size\n a.sort!\n\n count = 0\n for i in 0...n-2 do\n k = i+2\n for j in i+1...n-1 do\n while k < n and a[i] + a[j] > a[k] do\n k += 1\n end\n count += k - j - 1\n end\n end\n count\nend", "def qsort(arr)\n\treturn arr if arr.length <= 1\n\n\tpivot = arr.first\n\n\t# split_i = index between < pivot and > pivot\n\tsplit_i = 1\n\t\n\t# Actual partitioning\n\tarr.each_with_index do |el, index|\n\t\tnext if index == 0\n\t\tif el < pivot\n\t\t\tarr[split_i], arr[index] = el, arr[split_i]\n\t\t\tsplit_i += 1\n\t\tend\n\tend\n\n\tarr[0], arr[split_i - 1] = arr[split_i - 1], arr[0]\n\n\treturn qsort(arr[0...split_i - 1]) + [pivot] + qsort(arr[split_i..-1])\nend", "def quick_sort(array)\n # Base case\n return array if array.length <= 1\n\n left = []\n right = []\n\n # Uses random to select a pivot in case the array is already sorted\n # to avoid running in quadriatic time\n pivot_idx = rand(array.length)\n pivot = array[pivot_idx]\n\n array.each_with_index do |n, i|\n next if i == pivot_idx\n\n # If n < pivot, put it in the left array, else put it in the right array\n n < pivot ? left << n : right << n\n end\n\n # Concats the sorted left array with the pivot and the sorted right array\n quick_sort(left).concat([pivot]).concat(quick_sort(right))\nend", "def quicksort(a)\n return a if a.length <= 1\n pivot = a.delete_at(rand(a.length))\n l, g, sorted_a = [], [], []\n a.each { |el| el <= pivot ? l << el : g << el }\n sorted_a << quicksort(l) << pivot << quicksort(g)\nend", "def partition(array, start_index = 0, finish_index = (array.size - 1))\n # if there is no subarray to sort, return\n return if start_index >= finish_index\n\n # choose the pivot to be the last element of the array\n pivot = array[finish_index]\n # left and right are going to be indices,\n # left for the element at the left of the pivot,\n # and right for the element at the right of the\n # pivot by the moment the pivot is placed where it should be\n left, right = nil, nil\n\n # iterate from the start index to the finish index\n (start_index...finish_index).each do |i|\n # if the element is less than the pivot value\n if array[i] < pivot\n # if there is a right index\n if right\n # swap the elements at the right index and the\n # current index\n array[right], array[i] = array[i], array[right]\n # the left index is now the right index\n left = right\n # the right index is the next element after itself\n right += 1\n else\n # if there is no right index, left is going to be the\n # current index\n left = i\n end\n else\n # if the element's value is greater than or equal to\n # the pivot's value\n if !right\n # if there is no right index, the right index is\n # the current index\n right = i\n end\n end\n end\n # if there is a right index, swap the pivot with the element at the\n # right index\n array[finish_index], array[right] = array[right], array[finish_index] if right\n # if the median was found, return\n return if array[0...(array.size / 2)].all? {|n| n < array[array.size / 2]}\n # partition the from the start index to the left index if there is a left\n # index\n partition(array, start_index, left) if left\n # partition from right's next index to the finish index if there is a right\n # index\n partition(array, right + 1, finish_index) if right\nend", "def sort arr\n return arr if arr.length <= 1\n middle = arr.pop\n less = arr.select{|x| x < middle}\n more = arr.select{|x| x >= middle}\n sort(less) + [middle] + sort(more)\nend", "def quick_sort(arr, start_index=0, end_index=nil)\n # default the end_index to the array size - 1 ==)) zero based indexing\n end_index ||= (arr.size - 1)\n # base case to stop our recursion\n return unless start_index < end_index\n pivot_index = partition(arr, start_index, end_index)\n quick_sort(arr, start_index, pivot_index - 1)\n quick_sort(arr, pivot_index + 1, end_index)\n arr\nend", "def quicksort(array, low=0, high=nil)\n # Sort the whole array, by default\n if high == nil\n high = array.count - 1\n end\n\n if low < high\n p = partition array, low, high\n quicksort array, low, p-1\n quicksort array, p+1, high\n end\n\n return array\nend", "def quick_sort(arr)\n return arr if arr.length <= 1\n\n ref = arr.shift\n left = quick_sort(arr.select{|x| x.length <= ref.length})\n right = quick_sort(arr.select{|x| x.length > ref.length})\n\n left + [ref] + right\nend", "def improved_poorly_written_ruby(*arrays)\n sorted = []\n arrays.flatten.each do |v|\n size = sorted.size\n if sorted.empty?\n sorted.push(v)\n else\n i = 0\n while i < size\n item = sorted[i]\n if item > v\n sorted.insert(i, v)\n break\n elsif i == size - 1\n sorted.push(v)\n break\n end\n i += 1\n end\n end\n end\n sorted\nend", "def simple_quicksort(array)\n left = []\n right = []\n pivot = [array.first]\n\n return [] if array.empty?\n\n quick_sort_partition(array, left, right)\n return pivot if (left + right).empty?\n\n result = simple_quicksort(left) + pivot + simple_quicksort(right)\n puts result.join(' ') unless result.empty?\n result\nend", "def qqsort(arr)\n # returns array if it's empty or contains only one item\n return arr if arr.length <= 1\n\n # sets a pivot to the first element of the array\n pivot = arr.pop\n\n # defines two empty arrays to store\n # greater than and less than the pivot\n lessThan, greaterThan = [], []\n\n # push to left if i is less than pivot\n # push to right if i is greater than pivot\n # using a ternary operator\n arr.each do |i|\n i < pivot ? lessThan.push(i) : greaterThan.push(i)\n end\n\n # recursively calls quick sort on left and right arrays\n sortedLeft = qqsort(lessThan)\n sortedRight = qqsort(greaterThan)\n\n # concatenates left array, pivot, and right array \n sortedLeft + [pivot] + sortedRight\nend", "def quicksort array\n len = array.length \n #base case\n return array if len <= 1\n\n $numOfcomparisons += len - 1 \n\n #set pivot value to last element and move it to first element in the array\n pivot, array[len-1], array[0] = array[len-1], array[0], pivot\n #initialize counters\n # i = boundary in array for which all elements are less then pivot\n # j = boundary in array for which all elements are greater than pivot\n i, j = 1, 1\n\n #partition the array according to the definitions of i and j\n (len-1).times do\n if array[j] < pivot\n# array[j], array[i] = array[j], array[i]\n temp = array[j]\n array[j] = array[i]\n array[i] = temp\n i += 1\n end\n j += 1\n end\n \n #insert pivot into sorted position before recursing\n array[0], array[i-1] = array[i-1], pivot\n \n #recurse on the array around the pivot\n return (quicksort(array[0,i-1]) << pivot << quicksort(array[i,len]))\nend", "def sort arr\r\n\treturn arr if arr.length <= 1\r\n\r\n\tmiddle = arr.pop\r\n\tless = arr.select{|x| x < middle}\r\n\tmore = arr.select{|x| x >= middle}\r\n\r\n\tsort(less) + [middle] + sort(more)\r\nend", "def quicksort(list, left, right)\n # Checks if the left array item is bigger than the right array item\n if left < right\n # Sends the items for inspection and splitting them up in 2 arrays\n switch = partition(list, left, right)\n # Recursive function to make sure it does all the elements\n quicksort(list, left, switch-1)\n quicksort(list, switch+1, right)\n end\nend", "def my_quick_sort(&prc)\n prc ||= Proc.new{|a,b| a <=> b}\n return self if self.length <= 1\n mdix = self.length()/2\n left = []\n right = []\n # debugger\n self.each_with_index do |item, idx|\n case prc.call(item,self[mdix])\n when -1 #a smaller\n left << item\n when 0\n left << item if idx != mdix\n when 1\n right << item\n end\n end\n # debugger\n left.my_quick_sort(&prc) + [self[mdix]] + right.my_quick_sort(&prc)\n end", "def dominant(arr)\n merge_sort(arr)[-1]\nend", "def okay_two_sum?(arr, target)\n sorted = arr.sort # n log n => quicksort => is nlogn DOMINANT\n sorted.each_with_index do |num, i| # => O(n)\n # return true if sorted[i] + sorted[-1 - i] == target\n return true if sorted[i + 1 .. - 1].bsearch {|number| target - num <=> number} # => O(log(n))\n # ASK TA ABOUT BSEARCH\n # bsearch {|ele| pivot <=> ele}\n end\n false\nend", "def quick_sort(array)\n return array if array.length <= 1\n pivot = array.delete_at(rand(array.length)) \n # Pick a pivot at random. Ruby’s delete_at method will delete the item at \n # the specified index, which in this case would be a rand index in the range of array.length. \n # We’re saving the value of that item to pivot.\n \n left = Array.new # Create a new left and right subarray.\n right = Array.new\n \n array.each do |x| \n # Loop through every element in the array and compare it to the pivot. If the value is less than pivot, \n # add element to the left subarray. If value is greater than pivot, add element to the right subarray.\n if x <= pivot\n left << x\n else\n right << x\n end\n end\n \n return *quick_sort(left), pivot ,*quick_sort(right) \n # After the first pass when every value less than the pivot is on \n # the left hand side and every value greater than the pivot is on the right hand side, we break into two subarrays \n # and apply quick sort to each half (pick a new pivot, compare elements, break into two subarrays).\n \n end", "def sort arr\n return arr if arr.length <= 1\n \n middle = arr.pop\n less = arr.select{|x| x < middle}\n more = arr.select{|x| x >= middle}\n\n sort(less) + [middle] + sort(more)\nend", "def sort arr\n return arr if arr.length <= 1\n \n middle = arr.pop\n less = arr.select{|x| x < middle}\n more = arr.select{|x| x >= middle}\n\n sort(less) + [middle] + sort(more)\nend", "def quick_sort(low_index = @low_index, high_index = @high_index)\n if(low_index < high_index)\n pivot_position = process_pivot(low_index, high_index)\n quick_sort(low_index, pivot_position - 1)\n quick_sort(pivot_position + 1, high_index)\n end\n end", "def merge_sort(array)\n return array if array.length <= 1\n\n mid_point = array.length / 2\n\n left_hand = merge_sort(array.take(mid_point))\n right_hand = merge_sort(array.drop(mid_point))\n\n merge_sort_compare(left_hand, right_hand)\n #left_hand + right_hand\nend", "def sort arr\n return arr if arr.length <= 1\n middle = arr.pop\n lesss = arr.select{|x| x < middle}\n more = arr.select{|x| x>= middle}\n\n sort(less) + [middle] + sort(more)\nend", "def mothrah_sort (an_array)\n\tdef move_to_end (value, array)\n\t\tarray.delete(value)\n\t\tarray.push(value)\n\tend\n\tpos = 0\n\twhile pos < an_array.length \n\t\tif an_array[pos] > an_array[pos + 1]\n\t\t\tmove_to_end(an_array[pos], an_array)\n\t\telse\n\t\t\tpos += 1\n\t\tend\n\tend\n\tan_array\nend", "def quickSort(arr,low,high)\n if low < high then\n # pi is partitioning index, arr[p] is now\n # at right place\n pivot = partition(arr,low,high)\n\n # Separately sort elements before\n # partition and after partition\n quickSort(arr, low, pivot-1)\n quickSort(arr, pivot+1, high)\n end\n return arr\n end", "def quicksort(to_sort, left_bound = 0, right_bound = to_sort.length - 1)\n\treturn to_sort if right_bound - left_bound < 1\n\t# Choose a random pivot between left_bound and right_bound and set pivot\n\tpivot_idx = choose_pivot_idx(left_bound, right_bound)\n\tpivot = to_sort[pivot_idx]\n\n\t# Swap pivot with lower bound of array (first element of subarray to sort)\n\tto_sort[left_bound], to_sort[pivot_idx] = to_sort[pivot_idx], to_sort[left_bound]\n\n\t# i is the index of the split between < pivot and > pivot\n\ti = left_bound + 1\n\n\t(left_bound + 1).upto(right_bound) do |idx|\n\t\tif to_sort[idx] < pivot\n\t\t\t# Swap the last element that is < pivot with to_sort[idx]\n\t\t\tto_sort[i], to_sort[idx] = to_sort[idx], to_sort[i]\n\t\t\ti += 1\n\t\tend\n\tend\n\n\t# Put the pivot in its correct place by swapping\n\tto_sort[left_bound], to_sort[i - 1] = to_sort[i - 1], to_sort[left_bound]\n\n\tquicksort(to_sort, i, right_bound)\n\tquicksort(to_sort, left_bound, i - 2)\n\n\treturn to_sort\nend", "def quicksort(ary)\n qsort_help(ary, 0, ary.length - 1)\n ary\n end", "def calculation(nums) \n sum = 0\n max = nums[0]\n\n nums.each do |num| # O(n)\n sum += num\n\n if max < num\n max = num\n end\n end\n\n average = sum / nums.length\n\n sorted_nums = nums.sort # O(n log n)\n if sorted_nums.length % 2 == 0\n index_one = (sorted_nums.length / 2) - 1\n index_two = (sorted_nums.length / 2)\n median = (sorted_nums[index_one] + sorted_nums[index_two]) / 2\n else\n index = ((sorted_nums.length / 2) + 1) - 1\n median = sorted_nums[index]\n end\n\n return {max: max, sum: sum, average: average, median: median}\nend", "def sorted_squares(nums)\n # This takes O(n)\n nums.map! { |num| num**2 }\n # This can take Ο(n logn)\n bubble_sort(nums)\nend", "def quick_sort_comparisons(arr, l = 0, r = arr.length - 1)\n return [arr, 0] if (l >= r || arr.length <= 1)\n new_l, mid, new_r = partition_best_of_three(arr, l, r)\n comp = r - l\n _, comp_rec_l = quick_sort_comparisons(arr, new_l, mid - 1)\n _, comp_rec_r = quick_sort_comparisons(arr, mid + 1, new_r)\n total_comp = comp_rec_l + comp_rec_r + comp\n [arr, total_comp]\nend", "def quicksort(list)\n bottom, top = [], []\n top[0] = 0\n bottom[0] = list.size\n i = 0\n while i >= 0 do\n l = top[i]\n r = bottom[i] - 1;\n if l < r\n pivot = list[l]\n while l < r do\n r -= 1 while (list[r] >= pivot && l < r)\n if (l < r)\n list[l] = list[r]\n l += 1\n end\n l += 1 while (list[l] <= pivot && l < r)\n if (l < r)\n list[r] = list[l]\n r -= 1\n end\n end\n list[l] = pivot\n top[i+1] = l + 1\n bottom[i+1] = bottom[i]\n bottom[i] = l\n i += 1\n else\n i -= 1\n end\n end\n list \nend", "def quick_sort(&prc)\n end", "def partial_quick_sort(arr, i, j, k)\n if i < j\n index_pivot = rand(i..j)\n pivot = arr[index_pivot]\n arr.delete_at(index_pivot)\n left, right = arr[i..j].partition { |e| e.size > pivot.size }\n arr[i..j] = left + [pivot] + right\n index = left.size + i\n partial_quick_sort(arr, i, index - 1, k)\n partial_quick_sort(arr, index + 1, j, k) if index < k - 1\n end\nend", "def quick_sort(array)\n return array if array.length <= 1\n\n pivot = array[0]\n left = []\n right = []\n\n array[1..-1].each do |el|\n if el.length < pivot.length\n left << el\n else\n right << el\n end\n end\n\n dom_oct(left) + [pivot] + dom_oct(right)\n\nend", "def merge_sort(array)\n# base case of array size 1\n return array if array.size == 1\n \n# first half array\n first_half = array[0..((array.size-1)/ 2)]\n \n# second half array\n second_half = array [(((array.size - 1) / 2) + 1)..array.size - 1]\n \n# idk which array is bigger, just make sure that one gets the median, the other gets below or above it\n \n# get the sorted first half by calling the method on the first half \n first_half = merge_sort(first_half)\n second_half = merge_sort(second_half)\n \n# merge the first & second half\n merge(first_half, second_half)\nend", "def merge_sort array\n return array if array.length <= 1\n # arr1, arr2 = array.each_slice((array.size/2.0).round).to_a # Seems to be a bit slower than the method below\n arr1 = array[0..((array.length/2 - 1))]\n arr2 = array[(array.length/2)..(array.length-1)]\n return merge_arrays(merge_sort(arr1), merge_sort(arr2)) # Divide and conquer!\nend", "def solution(a)\n return 0 if a.length < 3\n a.sort!\n\n for i in 0..(a.length - 3)\n return 1 if a[i] + a[i + 1] > a[i + 2]\n end\n return 0\nend", "def quicksort array\n len = array.length \n #base case\n return array if len <= 1\n\n $numOfcomparisons += len - 1 \n puts \"Number of Comparisons = #{$numOfcomparisons}\"\n puts \"Input Array --> #{array.to_s}\"\n \n #set pivot value to the median of the first, middle and last array elements\n first = array[0]\n last = array[len-1]\n middleIndex = (len % 2 != 0 ? len / 2 : (len - 1) / 2)\n middle = array[middleIndex]\n# puts \"----------------------------------\"\n puts \"First: #{first} <*> last: #{last} <*> middle: #{middle}\"\n# puts \"----------------------------------\"\n \n if ((middle > first) && (first > last)) || ((middle < first) && (first < last)) \n pivot = first\n #no need to swap pivots for first element\n elsif ((first < last) && (last < middle)) || ((first > last) && (last > middle))\n pivot, array[len-1], array[0] = array[len-1], array[0], pivot\n else # middlecase\n pivot, array[middleIndex], array[0] = array[middleIndex], array[0], pivot\n end\n# puts \"Pivot sorted Array --> #{array.to_s}\"\n puts \"Pivot: #{pivot} <*> ArrayLength = #{len}\"\n #initialize counters\n # i = boundary in array for which all elements are less then pivot\n # j = boundary in array for which all elements are greater than pivot\n i, j = 1, 1\n\n #partition the array according to the definitions of i and j\n (len-1).times do\n# puts \"------------------------\"\n puts \"array[#{i}] -> #{array[i]} <*> array[#{j}] -> #{array[j]}\"\n# puts \"------------------------\"\n if array[j] < pivot\n array[j], array[i], i = array[i], array[j], i+1\n end\n j += 1\n end\n \n #insert pivot into sorted position before recursing\n array[0], array[i-1] = array[i-1], pivot\n \n #recurse on the array around the pivot\n puts \"Output Array --> #{array.to_s}\"\n leftPivot = array[0,i-1]\n puts leftPivot.to_s\n rightPivot = array[i,len]\n puts rightPivot.to_s\n \n return (quicksort(leftPivot) << pivot << quicksort(rightPivot))\nend", "def qsort(arr)\nend", "def better_subsum(arr) # o(n)\n largest = 0 \n sum = 0 \n i = 0 \n j = 0\n\n while i != arr.length-1\n largest += arr[j]\n sum = largest if largest > sum \n if j == arr.length-1 \n i+=1 \n j = i \n largest = 0 \n else\n j+=1\n end \n end \n sum \n end", "def quick_sort_non_ip(array) #takes an array of integers as an argument\n if array.length <= 1\n return array\n else\n pivot = array.sample\n array.delete_at(array.index(pivot)) # remove the pivot\n #puts \"Picked pivot of: #{pivot}\"\n less = []\n greater = []\n\n array.each do |x|\n if x <= pivot\n less << x\n else\n greater << x\n end\n end\n\n sorted_array = []\n sorted_array << quick_sort_non_ip(less)\n sorted_array << pivot\n sorted_array << quick_sort_non_ip(greater)\n\n # using Array.flatten to remove subarrays\n sorted_array.flatten!\n end\nend", "def my_quick_sort(&prc)\n end", "def quick_sort(list)\n sl = list.clone\n return sl if sl.size <= 1\n pivot = sl.pop\n left, right = sl.partition { |e| e < pivot }\n quick_sort(left) + [pivot] + quick_sort(right)\nend", "def quick_sort(s_arr, first, last)\n i = first\n j = last\n tmp = 0\n x = s_arr[first + (last - first) / 2]\n while (i <= j)\n\n while (s_arr[i].created_at > x.created_at)\n i+=1\n end\n while (s_arr[j].created_at < x.created_at)\n j-=1\n end\n\n if(i <= j)\n if (s_arr[i].created_at < s_arr[j].created_at)\n tmp = s_arr[i]\n s_arr[i] = s_arr[j]\n s_arr[j] = tmp\n end\n i+=1\n j-=1\n end\n end\n quick_sort(s_arr, i, last) if (i < last)\n quick_sort(s_arr, first, j) if (first < j)\n\n end", "def test_runtime(size,bound,iterations)\n\n # table header\n puts(\" Arraygröße | ins_sort! | max_sort! | min_sort! \");\n puts(\"------------------------------------------------\");\n\n # measure runtime for the three sorting algorithms\n for i in 0..iterations-1 do\n\n array_size = (2**i) * size;\n # generate random array\n test_array = random_array(array_size,bound);\n # since all sorting functions are mutable\n # functions, we have to copy the generated\n # array in order to use the same array_size\n # for all sorting functions; otherwise\n # the second sorting function will work\n # on an already sorted array.\n\n # measure runtime for `ins_sort!`\n ins_sort_array = test_array.clone;\n ins_sort_time = Time.now;\n ins_sort!(test_array);\n ins_sort_time = Time.now - ins_sort_time;\n\n # measure runtime for `max_sort!`\n max_sort_array = test_array.clone;\n max_sort_time = Time.now;\n max_sort!(test_array);\n max_sort_time = Time.now - max_sort_time;\n\n # measure runtime for `min_sort!`\n min_sort_array = test_array.clone;\n min_sort_time = Time.now;\n min_sort!(test_array);\n min_sort_time = Time.now - min_sort_time;\n\n # pretty print table output\n tab1 = \" \" * 3;\n tab2 = \" \" * 4;\n print(tab1);\n print_array_size(array_size);\n print(tab2);\n print_float(ins_sort_time);\n print(tab2);\n print_float(max_sort_time);\n print(tab2);\n print_float(min_sort_time);\n print(\"\\n\");\n end;\nend", "def my_quick_sort(&prc)\n\n end", "def quicksort_r(arr)\n\treturn arr if arr.size <= 1\n\tpivot = arr.shift\n\tleft, right = arr.partition{|el| el <= pivot}\n\tquicksort_r(left) + [pivot] + quicksort_r(right)\nend", "def my_quick_sort(&prc)\n return self if length <=1\n\n prc ||= Proc.new {|a,b| a <=> b}\n\n pivot = shift\n left = my_select {|el| prc.call(el, pivot) < 0}\n right = my_select {|el| prc.call(el, pivot) >= 0}\n\n left.my_quick_sort(&prc) + [pivot] + right.my_quick_sort(&prc)\n end", "def quick_sort(array, p, r)\n return array if p >= r\n q = partition(array, p, r)\n quick_sort(array, p, q - 1)\n quick_sort(array, q + 1, r)\nend", "def merge_sort array\n size = array.size\n if size < 2\n array\n else\n merge_array = array.each_slice((size/2.0).round).to_a\n array_a = merge_sort(merge_array[0])\n array_b = merge_sort(merge_array[1])\n new_array = []\n a = 0\n b = 0\n while new_array.size != size\n if array_a.nil? || array_a[a].nil?\n return new_array += array_b[b..-1]\n elsif array_b.nil? || array_b[b].nil?\n return new_array += array_a[a..-1]\n elsif array_a[a] < array_b[b]\n new_array << array_a[a]\n a += 1\n else\n new_array << array_b[b]\n b += 1\n end\n end\n end\nend", "def sum_of_two_smallest_numbers(arr)\n arr.sort[0] + arr.sort[1]\nend", "def dominant_sort(fish)\n return fish if fish.length <= 1\n\n mid = fish.length / 2\n\n left = fish[0...mid]\n right = fish[mid..-1]\n\n left_sorted = dominant_sort(left)\n right_sorted = dominant_sort(right)\n\n sorted = dominant_merge(left_sorted, right_sorted)\nend", "def better_than_average(arr, points)\n\n a = arr.count\n b = arr.inject(:+)\n median = b/a\n\n if median < points\n return true\n else\n return false\n end\nend", "def fast_sort(array, left_index, right_index)\n if left_index < right_index\n key = array[left_index]\n key_index = left_index\n (left_index + 1..right_index).each do |index|\n if array[index] < key\n temp = array[index]\n array.delete_at(index)\n array.insert(key_index, temp)\n key_index += 1\n end\n end\n fast_sort(array, left_index, key_index-1)\n fast_sort(array, key_index + 1, right_index)\n end\nend", "def quick_sort(array)\n\n # base case\n if array.length <= 1\n return array\n end\n\n pivot = array.delete_at(array.length - 1) # remove the pivot\n left = []\n right = []\n\n #Loop through the array, comparing items to pivot and collecting them into left and right arrays\n # array.each do |x|\n # if x <= pivot\n # left << x\n # else\n # right << x\n # end\n # end\n\n left, right = array.partition {|num| num < pivot}\n\n # recursively call \"quicksort\" on your left and right arrays.\n sorted_array = []\n sorted_array << quick_sort(left)\n sorted_array << pivot\n sorted_array << quick_sort(right)\n\n # using Array.flatten to remove sub-arrays\n sorted_array.flatten!\nend", "def array_sort(arr)\nx = arr.length\nif x == 1\nelsif x == 2\n if arr[0] > arr[1]\n arr[0], arr[1] = arr[1], arr[0]\n end\nelse\n loop do\n modified = FALSE\n (x-2).times do |x|\n if (arr[x] < arr[x + 1]) && (arr[x] < arr[x + 2])\n if arr[x + 2] < arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x], arr [x + 2], arr[x + 1]\n modified = TRUE\n end\n elsif (arr[x + 1] < arr[x]) && (arr[x + 1] < arr[x + 2])\n if arr[x] < arr[x + 2]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr[x], arr[x + 2]\n modified = TRUE\n elsif arr[x + 2] < arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr [x + 2], arr[x]\n modified = TRUE\n elsif arr[x + 2] == arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr[x], arr[x + 2]\n modified = TRUE\n end\n elsif (arr[x + 2] < arr[x]) && (arr[x + 2] < arr[x + 1])\n if arr[x] < arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x], arr[x + 1]\n modified = TRUE\n elsif arr[x + 1] < arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x + 1], arr[x]\n modified = TRUE\n elsif arr[x] == arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x], arr[x + 1]\n modified = TRUE\n end\n end\n end\n break if modified == FALSE\n end\nend\n arr\nend", "def quicksort!(left_index, right_index)\r\n # Base case: the subarray has 0 or 1 elements:\r\n if right_index - left_index <= 0\r\n return\r\n end\r\n\r\n # Partition the range of elements and grab the index of the pivot:\r\n pivot_index = partition!(left_index, right_index)\r\n\r\n # Recursively call this quicksort! method on whatever \r\n # is to the left of the pivot:\r\n quicksort!(left_index, pivot_index - 1)\r\n\r\n # Recursively call this quicksort! method on whatever \r\n # is to the right of the pivot:\r\n quicksort!(pivot_index + 1, right_index)\r\nend", "def process_pivot(low_index, high_index)\n \n pivot = arr[high_index]\n i = 0\n j = 0\n\n while(i < high_index)\n if(arr[i] <= pivot)\n swap(i, j) unless i == j\n j += 1\n end \n i += 1\n\n end \n swap(high_index, j)\n return j \n end", "def bucket_sort(array, min, max)\n return array if array.size < 2\n\n b_size = 10\n # if we instanciate this with [] it instanciat eit with the same object\n # then when we insert to on of the indeces it inserts to all\n bucket = Array.new((max - min + 1)/b_size + 1)\n array.each do |a|\n if bucket[a/b_size].nil?\n bucket[a/b_size] = [a]\n else\n bucket[a/b_size] << a\n end\n end\n\n bucket.each do |b|\n insertion_sort_more_efficient(b)\n end\n \n bucket.flatten\nend", "def optimized_largest_subsum(arr)\n max = arr.first\n sum = arr.first \n arr.shift\n arr.each do |el|\n sum += el\n if el > max && el > sum \n max = el \n sum = el \n elsif sum > max\n max = sum\n end \n end \n max\nend", "def bigSorting(unsorted)\n\nend" ]
[ "0.684919", "0.6805209", "0.67857414", "0.6746708", "0.67374927", "0.6715681", "0.6706067", "0.67055213", "0.66810817", "0.66353905", "0.66278857", "0.6626826", "0.6613694", "0.6597561", "0.65968776", "0.65596324", "0.65003526", "0.6494324", "0.6487843", "0.64789873", "0.6474459", "0.6467971", "0.6465608", "0.64549", "0.6452015", "0.645155", "0.6450338", "0.6434854", "0.64341676", "0.6429779", "0.6425677", "0.6410715", "0.6406317", "0.63976717", "0.6342998", "0.6342926", "0.6333599", "0.6324198", "0.6303713", "0.62951285", "0.62758476", "0.62755823", "0.62748724", "0.6268525", "0.6261129", "0.62595963", "0.62563026", "0.6216278", "0.6207328", "0.62055707", "0.62033343", "0.61952955", "0.61938256", "0.6189145", "0.6185765", "0.6182167", "0.6177463", "0.61750776", "0.6170054", "0.6170054", "0.615655", "0.6153088", "0.6131127", "0.61253387", "0.6117284", "0.6116177", "0.6114414", "0.61039716", "0.60997516", "0.609742", "0.60969996", "0.60952187", "0.6091831", "0.609155", "0.609049", "0.60843796", "0.6069783", "0.606862", "0.6066192", "0.6058198", "0.60559464", "0.60460806", "0.60438305", "0.6037269", "0.6033354", "0.60203624", "0.60187083", "0.601458", "0.6012423", "0.6008744", "0.5998652", "0.5986279", "0.59853077", "0.59848607", "0.5978249", "0.5967933", "0.5958398", "0.59535646", "0.59529513", "0.59486693", "0.59359086" ]
0.0
-1
time complexity: O(n). Time taken to iterate through one array depends on size of array: n. Doing this a fixed number times still results in O(n). BONUS
def fourth_anagram_bonus?(str1, str2) hash = Hash.new(0) str1.chars.each do |letter| hash[letter] += 1 end str2.chars.each do |letter| hash[letter] -= 1 end hash.values.all? { |v| v == 0 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend", "def find_missing(array, n)\n i = 0\n\n (1..n).each { |number| i = i ^ number }\n array.each { |number| i = i ^ number }\n\n i\nend", "def naive(array)\n max = -10000\n for i in (0..array.length - 1)\n for j in (i..array.length - 1)\n total = array[i..j].inject { |m,k| m + k }\n max = total if total > max\n end\n end\n max\nend", "def fds(n)\n\n # arr = []\n # (n + 1).times.each{|e| arr << e if e > 0}\n # arr.flat_map.reduce(:*)\n # arr.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n (1..n).to_a.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n\nend", "def find_all arr, n\n answer = []\n (0..arr.length - 1).each do |i|\n if arr[i] == n\n answer << i\n end\n end\n answer\nend", "def mutateTheArray(n, a)\n prv = 0\n (0...a.size).each do |i|\n nxt = i < (a.size - 1) ? a[i+1] : 0\n tmp = a[i]\n a[i] += nxt + prv\n prv = tmp\n end\n a\nend", "def oddities(array)\n odd_element_array = []\n index = 0\n loop do\n break if index >= array.size\n odd_element_array << array[index] if index.even?\n index += 1\n end\n odd_element_array\nend", "def sorted_squared_array_n_nlogn(values)\n values.collect!{|val| val*val}\n merge_sort(values)\nend", "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend", "def solution(arr)\n arr.map do |i|\n arr_without_i = arr.select { |item| item != i }\n arr_without_i.reduce { |n, acc| acc *= n }\n end\nend", "def sorted_squared_array_n_n(values)\n len = values.size - 1 \n first_i = 0\n last_i = len\n output = Array.new(len+1) \n while(len > -1)\n if(values[first_i].abs > values[last_i].abs)\n output[len] = values[first_i] * values[first_i]\n first_i += 1\n else\n output[len] = values[last_i] * values[last_i]\n last_i -= 1\n end\n len -= 1\n end\n output\nend", "def each_cons(array, n)\n array.each_index do |index|\n break if index + n - 1 >= array.size\n yield(*array[index..(index + n - 1)])\n end\nend", "def sum_of_sums_2(array)\n total_sum = 0\n i = 0\n len = array.size\n \n while i < len\n total_sum += array[0..i].inject { |sum, j| sum + j }\n i += 1\n end\n total_sum\nend", "def each_cons(array, n)\r\n array.each_index do |index|\r\n break if index + n -1 >= array.size\r\n yield(*array[index..(index + n - 1)])\r\n end\r\n nil\r\nend", "def oddities(array)\n result = []\n index = 0\n\n loop do\n result << array[index]\n index += 2\n break if index >= array.size\n end\n\n result\nend", "def fold_array(array, runs)\n #sets variables\n current = array\n results = []\n\n i=0\n #folds the array over n runs\n while i < runs\n results = []\n\n #folds current array into results\n j= 0\n\n while j < current.length/2\n #adds first from left and first from right, then second...third...n....\n #iterate j\n results[j] = current[j] + current[-(j+1)]\n j += 1\n end\n\n #if current[] is odd, append the middle element to results[]\n if (current.length.odd?)\n results << current[current.length/2]\n end\n\n #update current, iterate i\n current = results\n i += 1\n\n end\n\n return results\nend", "def sub_sum(list)\n sub_arr = []\n (0...list.length).each do |i| #O(n)\n (i...list.length).each do |j| #O(n)\n sub_arr << list[i..j] if i <= j\n end\n end\n largest_continuous_sub_sum1(sub_arr)\nend", "def rearrange_array(array)\n # size of an array\n n = array.size\n # iterate \n (0...n).each do |iter|\n array[iter] = array[iter]+(array[array[iter]]%n)*n\n end\n p array, n\n (0...n).each do |iter|\n p array[iter]\n array[iter] = (array[iter]/n)\n end\n array\nend", "def oddities(array)\n count = 0\n new_array = []\n loop do\n break if array.size == 0\n new_array << array[count]\n count += 2\n break if count >= array.size\n end\n new_array\nend", "def oddities(array)\n odd_elements = []\n index = 0\n while index < array.size\n odd_elements << array[index]\n index += 2\n end\n odd_elements\nend", "def oddities(array)\n odd_elements = []\n index = 0\n while index < array.size\n odd_elements << array[index]\n index += 2\n end\n odd_elements\nend", "def sum_to_n?(array, n)\n if array.empty? and n==0 or (array.size==1 and array[0] == n)\n return true\nend\na=array.combination(2).to_a\na.map! { |row| row.reduce(:+) }\na.each { |e|\n if e==n\n return true\n end }\n false\n end", "def oddities(array)\n elements = []\n index = 0\n while index < array.size\n elements << array[index]\n index += 2\n end\n elements\nend", "def solution(n)\n array = Array.new\n (1..n).each do\n array.push(0)\n end\n while (array.length >= 16)\n (1..16).each do\n array.pop\n end \n end\n array.length\nend", "def chunk(array, n)\n arr_result = []\n sub_arr = []\n i = 0\n while i < array.length\n num = array[i]\n \n if sub_arr.length == n\n arr_result << sub_arr\n sub_arr = []\n end \n sub_arr << num\n\n i += 1\n end\n arr_result << sub_arr\n arr_result\nend", "def sum_numbers(arr, n)\n sum = 0\n index = 0\n\n arr.each do |i|\n if index != n \n sum += i\n else\n return sum\n end\n\n index += 1\n end\nend", "def oddities(array)\n new_array = []\n index_range = (1..array.size-1)\n for n in index_range do \n new_array << array[n] if n.odd?\n end\n new_array\nend", "def find_unsorted_subarray(nums)\n \nend", "def sum_to_n? arr, n\n if arr.size>=2\n for x in arr\n target = n-x\n tmp = arr.dup\n tmp.delete_at(tmp.index(x))\n return true if tmp.include?(target)\n end\n end\n false\nend", "def oddities(arr)\n counter = 0\n return_array = []\n loop do\n return_array << arr[counter]\n counter += 2\n break if counter >= arr.size\n end\n return_array.compact\nend", "def oddities(array)\n result = []\n index = 0\n\n while index < array.size\n result << array[index]\n index += 2\n end\n\n result\nend", "def count_adjacent_sums(array, n)\n\nend", "def arrayManipulation(n, queries)\n arr = Array.new(n + 2, 0)\n\n queries.each do |a, b, k|\n arr[a] += k\n arr[b + 1] -= k\n end\n\n max_sum = 0\n sum = 0\n arr.filter { |diff| diff != 0 }.each do |diff|\n sum += diff\n max_sum = [max_sum, sum].max\n end\n\n max_sum\nend", "def solution(a)\n # In production environment this will be my solution:\n # a.uniq.size\n #\n # But since this is a coding challenge, my assumption\n # is that you're looking for a by-hand O(N*logN) solution\n\n return 0 if a.empty?\n\n n = a.size\n ary = a.sort\n uniques = 1\n (1...n).each do |i|\n uniques += 1 if ary[i] != ary[i - 1]\n end\n uniques\nend", "def solution(n, a)\n counters = Array.new(n, 0)\n max = 0\n a.each do |item|\n if item >= 1 && item <= n\n counters[item - 1] += 1\n max = counters[item - 1] if counters[item - 1] > max\n elsif item == n + 1\n counters = Array.new(n, max)\n end\n end\n\n counters\nend", "def sum_array_of_arrays(some_array) \n big_sum = 0 \n \n some_array.each do |x|\n big_sum = big_sum + sum_array(x)\n end\n \n big_sum\n \n end", "def oddities(array)\n odd_values = []\n index = 0\n \n while index < array.size\n odd_values << array[index]\n index += 2\n end\n odd_values\nend", "def long_subarrays(arr)\n res =[]\n window = arr.length\n while window>=1\n idx = 0\n while idx+window<=arr.length\n sub_arr = arr.slice(idx, window)\n p sub_arr\n res << sub_arr\n idx += 1\n end\n window -= 1\n end\n res.map{|el| el.inject(0){|acc, el2| acc+el2}}.sort.last\nend", "def equalizeArray(arr)\n arr = arr.sort\n count = 0; j = 0\n for i in 0..(arr.length-1)\n if arr[j] != arr[i]\n j += 1\n count+=1\n end\n end\n count\nend", "def three_sum_fastest(arr)\n count = 0\n\n (0..arr.length - 2).each { |i|\n set = Set.new\n\n (i + 1..arr.length - 1).each { |j|\n if set.include?(-arr[i] - arr[j])\n count += 1\n end\n\n set.add(arr[j])\n }\n }\n count\nend", "def each_cons(arr, n)\n arr.each_with_index do |el, idx|\n break if idx + n > arr.size\n if n < 3\n yield(el, arr[idx + 1])\n else\n yield([el, arr.slice((idx + 1), (n - 1))].flatten)\n end\n end\nend", "def contiguous_sub_array_sum(array, target)\n sum = 0\n last_value = array.first\n n = array.length\n (1..(n - 1)).each do |i|\n \n end\nend", "def sum_to_n? arr, n\n #arr.product(arr).any? {|c| sum(c) == n && c[0] != c[1] } ----1.3\n arr = arr.sort\n low = 0\n high = arr.length - 1\n while low < high\n if arr[low] + arr[high] == n\n return true\n end\n arr[low] + arr[high] < n ? low += 1 : high -= 1 \n end\n return false\nend", "def sum_to_n?(array, n)\n\n array_size = array.size\n\n i = 0\n\n while i < array_size do\n argument = array.slice!(0)\n array.each{|x| return true if x + argument == n}\n i += 1\n end\n return false\nend", "def sum_to_n? arr, n\n if arr.size>=2\n for a in arr\n if arr.include?(n-a) and (a != n-a or arr.count(a) > 1)\n return true\n end\n end\n end\n false\nend", "def pretentious_primes(arr, n) \n arr.map { |ele| nth_prime(ele,n) }\nend", "def my_function2(arr)\n final_arr = []\n first_half = []\n first_product = 1\n last_half = []\n arr.each_with_index do |n, i|\n first_half = arr[0...i]\n last_half = arr[i+1..-1]\n first_product = first_half.reduce(:*) || 1\n last_product = last_half.reduce(:*) || 1\n products = first_product * last_product\n final_arr.push(products)\n end\n return \"Products: #{final_arr}\"\nend", "def oddities(array)\n new_array = []\n\n index = 0\n while index < array.size\n new_array << array[index] if index.even?\n index += 1\n end\n new_array\nend", "def my_min_2(array)#O(n)\n array.inject do |acc, ele|#O(n)\n if acc < ele\n acc\n else\n ele\n end\n end\nend", "def bad_contig_subsum(arr)\n # n! || n^3 ?\n sub_arrays = []\n arr.each_index do |i|\n (i...arr.length).each do |j|\n sub_arrays << arr[i..j]\n end\n end\n\n # above * n^2 ? << bottleneck\n max = sub_arrays.first.inject(&:+)\n sub_arrays.each do |sub_arr|\n sub_sum = sub_arr.inject(&:+)\n max = sub_sum if sub_sum > max\n end\n max\nend", "def arrayManipulation(n, queries)\n nums = Array.new(n+1, 0)\n queries.each do |query|\n nums[query[0]-1] += query[2]\n nums[query[1]] -= query[2]\n end\n\n max = nums.first\n (1..nums.length-1).each do |i|\n nums[i] += nums[i - 1]\n max = nums[i] if nums[i] > max && i < (nums.size - 1)\n end\n\n max\nend", "def solution(n, a)\n max = 0\n counters = Array.new(n, max)\n a.each do |counter|\n if counter == n + 1\n counters.fill(max)\n else\n counters[counter - 1] += 1\n max = counters[counter - 1] if counters[counter - 1] > max\n end\n end\n counters\nend", "def naive_algorithm(arr)\n\tproduct = 0\n\tarr.each do |i|\n\t arr.each do |j|\n\t \tp = arr[i] * arr[j]\n\t \tproduct = p if product < p\n\t end\t\n\tend\t\t\n\tproduct\nend", "def arrayManipulation(n, queries)\r\n arr = Array.new(n, 0)\r\n\r\n queries.each do |query|\r\n left = query[0] - 1\r\n right = query[1] - 1\r\n summand = query[2]\r\n\r\n arr[(left..right)] = arr[(left..right)].map { |a| a + summand }\r\n end\r\n\r\n arr.max\r\nend", "def three_sum_fast(arr)\n arr = merge_sort(arr)\n count = 0\n\n (0..arr.length - 1).each { |i|\n (i + 1..arr.length - 1).each { |j|\n if bin_search(arr, -arr[i] - arr[j]) > j\n count += 1\n end\n }\n }\n count\nend", "def sum_of_sums(array)\n new_array = []\n array.size.times do |n|\n new_array << array[0..n]\n end\n new_array.flatten.reduce(:+)\nend", "def oddities2(arr)\n index = 0\n result = []\n loop do\n break if index >= arr.size\n result << arr[index]\n index += 2\n end\n result\nend", "def arr(n)\n\n return [n] if !n.kind_of?(Array)\n\n butts = []\n\n n.each do |ele|\n\n butts += arr(ele)\n end\n\n # if n.kind_of?(Array) == false\n # butts << n\n \n # else\n # arr(n[0])\n # end\n\n butts\n \n\nend", "def productify(array)\n len = array.length\n left = Array.new(len){1}\n right = Array.new(len){1}\n\n # step 1 create left array and right array O(n)\n array.each_index do |i|\n next if i == 0\n left[i] = left[i - 1] * array[i - 1]\n right[len - i - 1] = right[len - 1] * array[len - i]\n end\n\n # step 2 multiply products O(n)\n array.each_index do |i|\n array[i] = left[i] * right[i]\n end\n\n # step 3 return results\n array\n\n # time complexity O(n + n) => O(n)\nend", "def lAS(n: 0)\n array = [1]\n puts \"#{array.inspect}\"\n previous = array.first\n new_array = []\n counter = 0\n \n n.times do\n previous = array.first\n counter = 0\n new_array = []\n \n array.each do |element|\n if(element == previous)\n counter = counter + 1\n else\n new_array << counter\n new_array << previous\n counter = 1\n previous = element\n end\n end\n \n new_array << counter\n new_array << previous\n array = new_array.dup\n puts \"#{array.inspect}\"\n end\nend", "def checkArray(a)\n\tn = a.length-1\n\tcount = 0\n\tfor i in 0..n do\n\t\tfor j in (i+1)..n do\n\t\t\tfor k in (j+1)..n do\n\t\t\t\tif (a[i] + a[j] + a[k] == 0)\n\t\t\t\t\tcount += 1\n\t\t\t\t\treturn count;\n\t\t\t\telse\n\t\t\t\t\treturn count;\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend", "def oddities(array)\n new_array = []\n i = 0\n while i < array.size\n new_array << array[i]\n i += 2\n end\n new_array\nend", "def sum_to_n? arr, n\n len = arr.length\n\n #Returns false when the length of the array is 0.\n if len == 0 then\n return false\n end\n #Iterates through the array to find the first index\n i = 0\n while i < len-1 do\n #Iterate through the rest of the elements of the array\n j = i+1\n while j <= len-1 do\n if arr[i]+arr[j] == n then\n return true\n end\n j+=1\n end\n i+=1\n end\n return false\nend", "def sum_of_sums(array)\n n = 1\n running_total = 0\n while n <= array.size\n running_total += array.first(n).reduce(:+)\n n += 1\n end\n running_total\nend", "def sum_to_n? arr, n\n \n if arr.size>=2\n for x in arr\n if arr.include?(n-x) and x != n-x or arr.count(x) > 1\n return true\n end\n end\n end\n \n false\nend", "def total(array)\n x = 0\n while x < array.length\n array.each do |n|\n x += n\n end\n end\n return x\nend", "def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend", "def my_min(array) # O(n) - Linear\n counter = array[0]\n\n (1...array.length).each do |i|\n if counter > array[i]\n counter = array[i]\n end\n end\n counter\nend", "def mutiply_all_element_of_an_array_excep_itself2(array_n)\n total_mutiplication_value = 1\n result_array = []\n \n array_n.each do |elm|\n total_mutiplication_value = elm * total_mutiplication_value\n end\n \n puts \"Total mutiplication : #{total_mutiplication_value}\"\n \n array_n.each do |elm|\n result = divide_by_bit_shift(total_mutiplication_value, elm)\n result_array.push(result[0])\n end\n \n\n return result_array\nend", "def solution(n, a)\n # write your code in Ruby 2.2\n arr = [0] * n\n max_c = 0\n \n a.each_with_index do |value,index|\n if value == n + 1\n arr = [max_c] * n\n else\n arr[value - 1] = arr[value - 1] + 1\n max_c = (arr[value -1] > max_c ? arr[value -1] : max_c)\n end\n end\n arr\nend", "def sub_sum(array)\n sums = []\n i = 0\n j = 0\n\n while i < array.length\n while j < array.length\n sums << array[i..j]\n j += 1\n end\n i += 1\n j = i\n end\n sums.sort_by{|x| x.reduce(:+)}.last.reduce(:+)\n end", "def find_missing_number(array, n)\n sum = (1..n).reduce(:+) # sum from 1 to n\n array.each do |el|\n sum -= el\n end\n return sum\nend", "def amicable_numbers(n)\r\n numbers = Array.new\r\n 2.upto(n) do |x|\r\n y = d(x)\r\n if !numbers.include?(y)\r\n numbers.push(x,y) if d(y) == x && y != x\r\n end\r\n end\r\n return numbers\r\nend", "def solve(array, n)\n num_of_patches = 0\n\n 1.upto(n).each do |i|\n if !array.include?(i)\n array << i\n return num_of_patches if patched?(array, n)\n num_of_patches += 1\n end\n end\nend", "def oddities(array)\nselected_index = []\nindex = 0\n\n\tloop do \n\tcurrent_array = array[index]\n\t\tif index.even?\n\t\t\tselected_index << current_array\n\t\tend\n\tindex += 1\n\tbreak if index == array.size\n\tend\nselected_index\n\nend", "def chunk(array, n)\n \n results = []\n until array.empty?\n results << array.shift(n)\n end\n \n results\n\nend", "def evenities1(array)\n index = 1\n even_array = []\n while index < array.length\n even_array << array[index]\n index += 2\n end\n even_array\nend", "def sum_to_n? arr, n\n if arr.length > 1\n for i in arr do\n ndx = arr.find_index(i)\n x = arr.delete_at(ndx)\n if arr.include?(n - x)\n return true\n end\n arr.insert(ndx, x)\n end\n end\n return false\nend", "def two_number_sum array, n \n\tarray.sort!\n\treverse_index = array.size - 1 \n\tindex = 0\n\twhile index >= reverse_index\n\t\tif array[index] + array[reverse_index] > n\n\t\t\treverse_index -= 1\n\t\telsif array[index] + array[reveres_index] < n\n\t\t\tindex += 1\n\t\telse\n\t\t\tputs \"#{array[index]} + #{array[reverse_index]}\"\n\t\t\tindex += 1\n\t\tend\n\tend\nend", "def example1(n)\n arr = [0, 1 ,2, 3, 5]\n i = 3 \n while(i <= n)\n arr[i] = arr[i - 1] + arr[i - 2]\n i += 1\n end\n\n arr[n]\n\nend", "def oddities(array)\n odd_array = []\n array.each_with_index do |e, idx|\n odd_array << e if idx.even?\n end\n odd_array\nend", "def f(n)\n # your code here\n result = []\n possibles = (2..n).flat_map{ |s| [*2..n].combination(s).map(&:join).to_a }\n p possibles\n possibles.each do |i|\n x = 0\n temp_arr = []\n temp = i.split('').map { |j| j.to_i }\n p temp\n while x < temp.length do \n if i[x + 1] != i[x] + 1 || i[x + 1] == nil\n temp_arr << i[x]\n end\n x += 1\n end\n result << temp_arr\n end\n result.length\nend", "def largest_contiguous_subsum(array)\n sums_list = []\n sums = []\n\n idx1 = 0\n\n while idx1 < array.length #O(n)\n idx2 = idx1 #O(1)\n while idx2 < array.length #O(n)\n sums_list << array[idx1..idx2] #O(n)\n idx2 += 1\n end\n idx1 += 1\n end\n\n sums_list.each do |list| #O(n)\n sums << list.reduce {|sum, num| sum + num} #O(n)\n end\n sums.max\nend", "def running_time(array)\n cnt = 0\n (1...(array.length)).each do |x|\n y = x\n while y.positive?\n break unless array[y - 1] > array[y]\n\n temp_num = array[y]\n array[y] = array[y - 1]\n array[y - 1] = temp_num\n cnt += 1\n y -= 1\n end\n end\n cnt\nend", "def nth_subset(n)\n # Ruby allows us to index integers as if they were arrays of bits,\n # so we can check if an element should be included in the result by testing if the ith bit of n is 1\n each_with_index.map { |e, i| e if n[i] == 1 }.compact\n end", "def find_lis_brute_force array\n max_count = -1\n # Generate all the possible sets. This is done by generating all binary numbers from 1 to 2^n.\n # The presence of a 0 in the binary number at a position will grant entry to the element at that position to the set\n for i in 1..((2**array.count) - 1)\n itr = array.count - 1\n set = []\n while i > 0\n if i%2 == 1\n set << array[itr]\n end\n i = i/2\n itr -= 1\n end\n max_count = max(max_count, evaluate(set))\n end\n return max_count\nend", "def oddities(array)\n result = []\n count = 0\n array.each do |element|\n result << element if count.even?\n count += 1\n end\n result\nend", "def oddities(array)\n odd_array = []\n array.each_with_index { |e, idx| odd_array << e if idx.even? }\n odd_array\nend", "def oddities(int_array)\n index = 0\n odds = []\n\n while index < int_array.size\n odds.push(int_array[index])\n index += 2\n end\n odds\nend", "def solution(a)\n return 0 if a.uniq.size != a.size\n \n max = a.size \n sum = (1 + max) * max / 2\n \n array_sum = a.inject(0, &:+) \n sum == array_sum ? 1 : 0 \nend", "def canBeSum(n, array, cache)\n\ti = 0\n\twhile array[i] <= n / 2\n\t\tif cache[n-array[i]] # array.include?(n-array[i]) is OK, but very slow\n\t\t\treturn true\n\t\tend\n\n\t\ti += 1\n\tend\n\n\treturn false\nend", "def findDiffSquares(n)\n sum = 0\n (1..n).each { |i|\n (1..n).each { |j|\n sum += i*j unless i == j\n }\n }\n sum\nend", "def solution(array)\n result = Array.new(array.length, 0)\n\n array.each do |element|\n if result[element - 1]\n result[element - 1] += 1\n else\n result[element - 1] = 1\n end\n end\n\n result.uniq.size == 1 ? 1 : 0\nend", "def select_every_n(arr, n=1)\n arr.each_index.select {|index| index%n==0}.map{|index| index=arr[index]}\nend", "def product_array(num_array)\n product_arr = []\n num_array.each_with_index do |num1, i|\n product = 1\n num_array.each_with_index do |num2, j|\n product *= num2 unless i == j\n end\n product_arr.push(product)\n end\n product_arr\nend", "def subarray_bitwise_o_rs(a)\n result_set = Set.new()\n a.size.times do |i|\n (1..a.size-i).each do |length|\n subarray = a[i, length]\n #puts subarray.inspect\n result = subarray.reduce(0) do |bor, elem|\n bor | elem\n end\n #puts result\n result_set << result\n end\n end\n result_set.size\nend", "def count(arr)\n count = 0\n arr_length_half = arr.length / 2\n\n arr_length_half.times do |i|\n if arr [i] > arr[- i - 1]\n count += arr[i]\n else\n count += arr[-i - 1]\n end\n end\n count\nend", "def n_naught_brute_vs_recursive(a)\n time_brute = Benchmark.realtime { brute_force_maximum_subarray(a) }\n time_recursive = Benchmark.realtime { maximum_subarray(a, 0, a.length - 1) }\n\n while time_brute < time_recursive do\n a << a.sample\n time_brute = Benchmark.realtime { brute_force_maximum_subarray(a) }\n time_recursive = Benchmark.realtime { maximum_subarray(a, 0, a.length - 1) }\n end\n\n result = a.length\nend", "def gather(n=0)\n array = []\n sum = 0\n (0...n).each do |i|\n sum += i\n array << sum\n end\n return array\n end", "def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend", "def sort_array(array)\n n = array.size\n return array if n < 2\n (0..n - 2).each do |i|\n (i + 1..n - 1).each do |j|\n next if array[i].even? || array[j].even?\n interchange(array, i, j) if array[i] > array[j]\n end\n end\n array\nend" ]
[ "0.6822312", "0.6779808", "0.67635864", "0.6642449", "0.66346014", "0.6612032", "0.6534354", "0.6510438", "0.64791", "0.6464567", "0.6436358", "0.6422412", "0.6422141", "0.63889235", "0.6339677", "0.6314298", "0.6305751", "0.62965363", "0.6279386", "0.6275939", "0.627577", "0.6274728", "0.6261532", "0.62435174", "0.6241873", "0.6234834", "0.6222029", "0.62206054", "0.6220355", "0.62162405", "0.6210762", "0.6210569", "0.62095135", "0.62054974", "0.62043035", "0.6198216", "0.61974704", "0.6197385", "0.61912787", "0.6185154", "0.61756897", "0.6172355", "0.61670417", "0.6166941", "0.61598575", "0.6152552", "0.61495036", "0.6146622", "0.6145657", "0.6138835", "0.6134554", "0.61293536", "0.61275965", "0.6126154", "0.6123524", "0.61204404", "0.6119974", "0.6116841", "0.6115452", "0.6113442", "0.61052775", "0.61051494", "0.6097037", "0.60889596", "0.60882324", "0.60860044", "0.6080406", "0.6080018", "0.6074453", "0.60724574", "0.6066964", "0.60661983", "0.6064751", "0.60628206", "0.60581553", "0.60578346", "0.60496795", "0.6044922", "0.60446876", "0.6042482", "0.6038419", "0.60379046", "0.60352767", "0.60313255", "0.6024012", "0.6023921", "0.60219234", "0.60142905", "0.60114294", "0.6011101", "0.60103554", "0.6009343", "0.6008984", "0.60051626", "0.59920263", "0.5991796", "0.599111", "0.5990682", "0.59841293", "0.59818304", "0.59787166" ]
0.0
-1
Method call to require f5icontrol after chef_gem has had a chance to run
def load_dependencies require 'f5-icontrol' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_cloudflare_cookbook_gems\n return if defined? @@cloudflare_cookbook_gems_loaded\n chef_gem 'cloudflare' do\n action :install\n version '2.0.1'\n end\n require 'resolv'\n require 'cloudflare'\n @@cloudflare_cookbook_gems_loaded = true\nend", "def _monkey_patch_old_chef!\n require 'chef/event_dispatch/dispatcher'\n instance = self\n orig_method = Chef::EventDispatch::Dispatcher.instance_method(:library_file_loaded)\n Chef::EventDispatch::Dispatcher.send(:define_method, :library_file_loaded) do |filename|\n instance.events = self\n instance.monkey_patched = false\n @subscribers |= [instance]\n Chef::EventDispatch::Dispatcher.send(:define_method, :library_file_loaded, orig_method)\n orig_method.bind(self).call(filename)\n end\n end", "def monkey_patch_old_chef!\n return if @monkey_patched\n require 'chef/event_dispatch/dispatcher'\n instance = self\n orig_method = Chef::EventDispatch::Dispatcher.instance_method(:library_file_loaded)\n Chef::EventDispatch::Dispatcher.send(:define_method, :library_file_loaded) do |filename|\n instance.events = self\n instance.monkey_patched = false\n @subscribers << instance\n Chef::EventDispatch::Dispatcher.send(:define_method, :library_file_loaded, orig_method)\n orig_method.bind(self).call(filename)\n end\n @monkey_patched = true\n end", "def load_chef_fetcher\n Chef::Log.debug \"Load Chef Server fetcher from: #{cookbook_vendor_path}\"\n $LOAD_PATH.unshift(cookbook_vendor_path)\n require 'chef-server/fetcher'\n end", "def require_chef_vault!\n @require_chef_vault ||=\n begin\n error_message = \"Knife bootstrap requires version 2.6.0 or higher of the chef-vault gem to configure vault items\"\n require \"chef-vault\"\n if Gem::Version.new(ChefVault::VERSION) < Gem::Version.new(\"2.6.0\")\n raise error_message\n end\n\n true\n rescue LoadError\n raise error_message\n end\n end", "def init\n clone_appd_cookbook\n chef_gem \"install berkshelf\"\n end", "def test_harness_dependencies(*)\n return unless platform[/n(5|6)k/]\n skip_if_nv_overlay_rejected(agent)\n\n # Vxlan has a hard requirement to disable feature fabricpath on n5/6k\n cmd = 'no feature-set fabricpath'\n command_config(agent, cmd, cmd)\nend", "def run_ohai\n @ohai.require_plugin(\"os\")\n end", "def bc_install_layout_1_chef(bc, path, barclamp)\n\n log_path = File.join '/var', 'log', 'barclamps'\n FileUtils.mkdir log_path unless File.directory? log_path\n log = File.join log_path, \"#{bc}.log\"\n system \"date >> #{log}\"\n puts \"Capturing chef install logs to #{log}\" if DEBUG\n chef = File.join path, 'chef'\n cookbooks = File.join chef, 'cookbooks'\n databags = File.join chef, 'data_bags'\n roles = File.join chef, 'roles'\n\n #upload the cookbooks\n if File.directory? cookbooks\n FileUtils.cd cookbooks\n knife_cookbook = \"knife cookbook upload -o . -a -V -k /etc/chef/webui.pem -u chef-webui\"\n unless system knife_cookbook + \" >> #{log} 2>&1\"\n puts \"\\t#{path} #{knife_cookbook} upload failed. Examine #{log} for more into\"\n exit 1\n end\n puts \"\\texecuted: #{path} #{knife_cookbook}\" if DEBUG \n else\n puts \"\\tNOTE: could not find cookbooks #{cookbooks}\" if DEBUG\n end\n \n #upload the databags\n if File.exists? databags\n Dir.entries(databags).each do |bag|\n next if bag == \".\" or bag == \"..\"\n bag_path = File.join databags, bag \n FileUtils.chmod 0755, bag_path\n chmod_dir 0644, bag_path\n FileUtils.cd bag_path\n knife_bag = \"knife data bag create #{bag} -V -k /etc/chef/webui.pem -u chef-webui\"\n unless system knife_bag + \" >> #{log} 2>&1\"\n puts \"\\t#{knife_bag} failed. Examine #{log} for more information.\"\n exit 1\n end\n puts \"\\texecuted: #{path} #{knife_bag}\" if DEBUG\n\n json = Dir.entries(bag_path).find_all { |r| r.end_with?(\".json\") }\n json.each do |bag_file|\n knife_databag = \"knife data bag from file #{bag} #{bag_file} -V -k /etc/chef/webui.pem -u chef-webui\"\n unless system knife_databag + \" >> #{log} 2>&1\"\n puts \"\\t#{knife_databag} failed. Examine #{log} for more information.\"\n exit 1\n end\n puts \"\\texecuted: #{path} #{knife_databag}\" if DEBUG\n end\n end\n else\n puts \"\\tNOTE: could not find databags #{databags}\" if DEBUG\n end\n\n #upload the roles\n if File.directory? roles\n FileUtils.cd roles\n Dir.entries(roles).find_all { |r| r.end_with?(\".rb\") }.each do |role|\n knife_role = \"knife role from file #{role} -V -k /etc/chef/webui.pem -u chef-webui\"\n unless system knife_role + \" >> #{log} 2>&1\"\n puts \"\\t#{knife_role} failed. Examine #{log} for more information.\"\n exit 1\n end\n puts \"\\texecuted: #{path} #{knife_role}\" if DEBUG\n end\n else\n puts \"\\tNOTE: could not find roles #{roles}\" if DEBUG\n end\n\n puts \"Barclamp #{bc} (format v1) Chef Components Uploaded.\" \n\n end", "def install_chef_gem(nr)\n # let chef_gem install the gem for us\n at_compile_time do\n chef_gem nr.gem_name do\n %w(options version source).each do |attr|\n value = new_resource.send(attr.to_sym)\n send(attr.to_sym, value) unless value.nil?\n end\n end\n end\n end", "def bootstrap!\n reset!\n require_relative 'kernel'\n end", "def initialize(script, timeout: -1)\n # This Powershell DLL source lives here: https://github.com/chef/chef-powershell-shim\n # Every merge into that repo triggers a Habitat build and verification process.\n # There is no mechanism to build a Windows gem file. It has to be done manually running manual_gem_release.ps1\n # Bundle install ensures that the correct architecture binaries are installed into the path.\n @powershell_dll = Gem.loaded_specs[\"chef-powershell\"].full_gem_path + \"/bin/ruby_bin_folder/#{ENV[\"PROCESSOR_ARCHITECTURE\"]}/Chef.PowerShell.Wrapper.dll\"\n exec(script, timeout: timeout)\n end", "def bootstrap!\n reset!\n require_relative 'kernel'\n end", "def setup_gui\n \n end", "def bc_install_layout_1_chef(bc, path, barclamp, options={})\n options = {:debug => false}.merge! options\n debug = options[:debug] or ENV['DEBUG'] === \"true\"\n \n log_path = File.join '/var', 'log', 'barclamps'\n FileUtils.mkdir log_path unless File.directory? log_path\n log = File.join log_path, \"#{bc}.log\"\n system \"date >> #{log}\"\n puts \"DEBUG: Capturing chef install logs to #{log}\" if debug\n chef = File.join path, 'chef'\n cookbooks = File.join chef, 'cookbooks'\n databags = File.join chef, 'data_bags'\n roles = File.join chef, 'roles'\n \n #upload the cookbooks\n if File.directory? cookbooks\n FileUtils.cd cookbooks\n knife_cookbook = \"knife cookbook upload -o . -a -V -k /etc/chef/webui.pem -u chef-webui\"\n unless system knife_cookbook + \" >> #{log} 2>&1\"\n puts \"\\t#{path} #{knife_cookbook} upload failed. Examine #{log} for more into\"\n exit 1\n end\n puts \"DEBUG: \\texecuted: #{path} #{knife_cookbook}\" if debug \n else\n puts \"DEBUG: \\tNOTE: could not find cookbooks #{cookbooks}\" if debug\n end\n \n #upload the databags\n if File.exists? databags\n Dir.entries(databags).each do |bag|\n next if bag == \".\" or bag == \"..\"\n bag_path = File.join databags, bag \n FileUtils.chmod 0755, bag_path\n chmod_dir 0644, bag_path\n FileUtils.cd bag_path\n knife_bag = \"knife data bag create #{bag} -V -k /etc/chef/webui.pem -u chef-webui\"\n unless system knife_bag + \" >> #{log} 2>&1\"\n puts \"\\t#{knife_bag} failed. Examine #{log} for more information.\"\n exit 1\n end\n puts \"\\texecuted: #{path} #{knife_bag}\" if debug\n \n json = Dir.entries(bag_path).find_all { |r| r.end_with?(\".json\") }\n json.each do |bag_file|\n knife_databag = \"knife data bag from file #{bag} #{bag_file} -V -k /etc/chef/webui.pem -u chef-webui\"\n unless system knife_databag + \" >> #{log} 2>&1\"\n puts \"\\t#{knife_databag} failed. Examine #{log} for more information.\"\n exit 1\n end\n puts \"DEBUG: \\texecuted: #{path} #{knife_databag}\" if debug\n end\n end\n else\n puts \"DEBUG: \\tNOTE: could not find databags #{databags}\" if debug\n end\n \n #upload the roles\n if File.directory? roles\n FileUtils.cd roles\n Dir.entries(roles).find_all { |r| r.end_with?(\".rb\") }.each do |role|\n knife_role = \"knife role from file #{role} -V -k /etc/chef/webui.pem -u chef-webui\"\n unless system knife_role + \" >> #{log} 2>&1\"\n puts \"\\t#{knife_role} failed. Examine #{log} for more information.\"\n exit 1\n end\n puts \"DEBUG: \\texecuted: #{path} #{knife_role}\" if debug\n end\n else\n puts \"DEBUG: \\tNOTE: could not find roles #{roles}\" if debug\n end\n \n puts \"Barclamp #{bc} (format v1) Chef Components Uploaded.\" \n \nend", "def setup\n yield self\n require \"power_api\"\n end", "def run_init_script; end", "def knife\n @knife ||= begin\n lf = create_log_file\n Chef::Knife::Bootstrap.load_deps\n kb = Chef::Knife::Bootstrap.new\n kb.ui = Chef::Knife::UI.new(lf, lf, lf, {verbosity: 2})\n kb\n end\n end", "def install_bootloader\n raise RuntimeError, \"Not implemented in base class\"\n end", "def init\n require File.expand_path( '../irbtools.rb', File.dirname(__FILE__) )\n end", "def boot\n @labfile = TestLab::Labfile.load(labfile_path)\n @labfile.testlab = self\n\n Dir.chdir(@repo_dir)\n end", "def require_faux_gem\n rel_main = \"./#{real_main_file_name}\"\n Dir.chdir( folder_lib ){\n require \"./#{real_main_file_name}\"\n }\n end", "def manual_bootstrap_for_node\n validate!([:bootstrap_pass])\n\n #Where the validation pem and chef-client exist on\n #the chef workstation this is run from\n validation_pem_path = Chef::Config[:validation_key]\n puts \"Using client key #{validation_pem_path}\"\n chef_client_path = Chef::Config[:knife][:chef_client_aix_path]\n puts \"Using chef-client located in #{chef_client_path}\"\n\n if validation_pem_path.nil? or chef_client_path.nil?\n puts \"No client validation pem or chef-client installable specified in knife.rb. Skipping Chef Bootstrap...\"\n return nil\n end\n\n #Where to place these files on the target server\n remote_chef_client_path = \"/tmp/2014-02-06-chef.11.10.0.0.bff\"\n remote_validation_pem_path = \"/etc/chef/validation.pem\"\n\n #For some reason, Net::SSH and Net::SCP only work on\n #AIX using :kex => \"diffie-hellman-group1-sha1\" and\n # :encryption => [\"blowfish-cbc\", \"3des-cbc\"]\n # :paranoid => false (avoids host key verification)\n Net::SSH.start(get_config(:ip_address), \n get_config(:bootstrap_user) || \"root\", \n :password => get_config(:bootstrap_pass), \n :kex => \"diffie-hellman-group1-sha1\",\n :encryption => [\"blowfish-cbc\", \"3des-cbc\"],\n :paranoid => false) do |ssh| \n\n #Copy the chef-client .bff file to the client machine in /tmp\n puts \"Copying chef client binary to client\"\n ssh.scp.upload!(chef_client_path, remote_chef_client_path)\n\n #Run the install command\n puts \"Running chef client install\"\n output = ssh.exec!(\"installp -aYFq -d #{remote_chef_client_path} chef\")\n Chef::Log.debug(\"Chef Client install output:\\n#{output}\")\n\n #Run the configure client command\n puts \"Running knife configure client command\"\n output = ssh.exec!(\"knife configure client -s #{get_config(:register_node)} /etc/chef\")\n Chef::Log.debug(\"Knife Configure output:\\n#{output}\")\n\n #Copy the validation key to /etc/chef on the client\n puts \"Uploading validation.pem to client\"\n ssh.scp.upload!(validation_pem_path, remote_validation_pem_path)\n\n #Edit /etc/chef/client.rb so that it points at the location of the validator\n puts \"Adding validator key path to client.rb\"\n cmd = %Q{echo \"validator_key '#{remote_validation_pem_path}'\" >> /etc/chef/client.rb}\n output = ssh.exec!(cmd)\n Chef::Log.debug(\"#{output}\")\n\n #Register the client node with the Chef server, by running chef-client\n #Add additional handling of this command to determine if the chef-client\n #run finished successfully or not.\n puts \"Running chef-client to register as a Chef node\"\n output = \"\"\n stderr_out = \"\"\n exit_code = nil\n ssh.exec(\"chef-client\") do |ch, success|\n unless success\n abort \"FAILED: chef-client command failed to execute on client\"\n end\n ch.on_data do |ch,data|\n output+=data\n end\n ch.on_extended_data do |ch,type,data|\n stderr_out+=data\n end\n ch.on_request(\"exit-status\") do |ch,data|\n exit_code = data.read_long\n end\n end\n ssh.loop\n if exit_code != 0\n puts \"Initial chef-client run failed. Please verify client settings and rerun chef-client to register this server as a node with #{get_config(:register_node)}\"\n return nil\n end\n Chef::Log.debug(\"chef-client command output:\\n#{output}\")\n end\n end", "def load_current_resource\n @osx_pkg = Chef::Resource::OsxPkgPackage.new(new_resource.name)\n Chef::Log.debug(\"Checking for package #{new_resource.name}\")\n @osx_pkg.installed(installed?)\nend", "def file_mgmt_demo(screen, button)\n\n $instruct1 = screen.get_named_widget(\"Instruct1\")\n $instruct2 = screen.get_named_widget(\"Instruct2\")\n $instruct3 = screen.get_named_widget(\"Instruct3\")\n $instruct4 = screen.get_named_widget(\"Instruct4\")\n $instruct5 = screen.get_named_widget(\"Instruct5\")\n $instruct6 = screen.get_named_widget(\"Instruct6\")\n $instruct7 = screen.get_named_widget(\"Instruct7\")\n\n if (button == \"INFO\")\n \n display(\"CFS_KIT FILE_MGMT_DEMO_INFO_SCREEN\",0,50) \n\n elsif (button == \"NEXT\")\n \n $fmd_step += 1\n $fmd_demo = 0\n \n if ($fmd_step <= FMD_LAST_STEP)\n fmd_set_instruct_text($fmd_step)\n end\n\n case $fmd_step\n when 1\n display(\"CFS_KIT FILE_MGMT_SCREEN\",1500,50) \n # Use direct commands without verify to keep response fast\n cmd(\"CFE_EVS ENA_APP_EVENT_TYPE with APP_NAME FM, BITMASK 0x01\") # Enable debug events\n wait (1)\n cmd(\"CFE_EVS ENA_APP_EVENT_TYPE with APP_NAME TFTP, BITMASK 0x01\") # Enable debug events\n when 2..FMD_LAST_STEP\n # Keep case statement for maintenance\n else\n # Use direct commands without verify to keep response fast\n cmd(\"CFE_EVS DIS_APP_EVENT_TYPE with APP_NAME FM, BITMASK 0x01\") # Disable debug events\n wait (1)\n cmd(\"CFE_EVS DIS_APP_EVENT_TYPE with APP_NAME TFTP, BITMASK 0x01\") # Disable debug events\n $fmd_step = 0\n clear(\"CFS_KIT FILE_MGMT_SCREEN\")\n clear(\"CFS_KIT FILE_MGMT_DEMO_SCREEN\")\n clear(\"CFS_KIT FILE_MGMT_DEMO_INFO_SCREEN\")\n end # Step Case\n \n elsif (button == \"DEMO\")\n \n case $fmd_step\n\n # 1 - Send directory cmd\n when 1\n if ($fmd_demo == 0)\n Osk::flight.send_cmd(\"FM\",\"SEND_DIR_PKT with DIRECTORY #{Osk::FLT_SRV_DIR}, DIR_LIST_OFFSET 0\")\n # Don't increment fmd_demo; okay if user repeatedly sends the directory cmd\n end\n \n # 2 - Create new directory\n when 2\n if ($fmd_demo == 0)\n Osk::flight.send_cmd(\"FM\",\"CREATE_DIR with DIRECTORY #{FMD_FLT_TEMP_DIR}\")\n wait (1)\n Osk::flight.send_cmd(\"FM\",\"SEND_DIR_PKT with DIRECTORY #{Osk::FLT_SRV_DIR}, DIR_LIST_OFFSET 0\")\n # Don't increment fmd_demo; okay if user repeatedly sends the create dir to see an error\n end\n\n # 3 - Put file from ground to flight \n when 3\n if ($fmd_demo == 0)\n Osk::Ops::put_flt_file(FMD_GND_PUT_FILE,FMD_FLT_PUT_FILE)\n wait (1)\n Osk::flight.send_cmd(\"FM\",\"SEND_DIR_PKT with DIRECTORY #{FMD_FLT_TEMP_DIR}, DIR_LIST_OFFSET 0\")\n # Don't increment fmd_demo; okay if user repeatedly sends the command\n end\n\n # 4 - Write directory listing to file and transfer to the ground\n when 4\n if ($fmd_demo == 0)\n Osk::flight.send_cmd(\"FM\",\"WRITE_DIR_TO_FILE with DIRECTORY #{Osk::FLT_SRV_DIR}, FILENAME #{FMD_FLT_TEMP_DIR}/#{Osk::TMP_BIN_FILE}, SIZE_TIME_MODE 1\")\n wait (2)\n Osk::flight.send_cmd(\"FM\",\"SEND_DIR_PKT with DIRECTORY #{FMD_FLT_TEMP_DIR}, DIR_LIST_OFFSET 0\")\n $fmd_demo += 1\n elsif ($fmd_demo == 1)\n if (Osk::Ops.get_flt_file(\"#{FMD_FLT_TEMP_DIR}/#{Osk::TMP_BIN_FILE}\",\"#{Osk::GND_SRV_DIR}/#{Osk::TMP_BIN_FILE}\"))\n Osk::Ops::launch_tbl_mgr(Osk::REL_SRV_DIR, Osk::TMP_BIN_FILE, Osk::TBL_MGR_DEF_FM_DIR)\n else\n raise \"FM Demo - File transfer from flight to ground failed\" \n end \n # Don't increment fmd_demo; okay if user repeatedly sends the last command\n end\n\n # 5 - Delete files in demo directory and delete demo directory\n when 5\n if ($fmd_demo == 0)\n Osk::flight.send_cmd(\"FM\",\"DELETE_ALL_FILES with DIRECTORY #{FMD_FLT_TEMP_DIR}\")\n wait (2)\n Osk::flight.send_cmd(\"FM\",\"SEND_DIR_PKT with DIRECTORY #{FMD_FLT_TEMP_DIR}, DIR_LIST_OFFSET 0\")\n $fmd_demo += 1\n elsif ($fmd_demo == 1)\n Osk::flight.send_cmd(\"FM\",\"DELETE_DIR with DIRECTORY #{FMD_FLT_TEMP_DIR}\")\n wait (2)\n Osk::flight.send_cmd(\"FM\",\"SEND_DIR_PKT with DIRECTORY #{Osk::FLT_SRV_DIR}, DIR_LIST_OFFSET 0\")\n # Don't increment fmd_demo; okay if user repeatedly sends the command\n end\n\n end # Step Case\n end # Demo button\n \nend", "def post_install; end", "def apply_after_hooks\n @current_recipe = nil\n say_wizard \"Running Bundler install. This will take a while.\"\n run 'bundle install'\n say_wizard \"Running after Bundler callbacks.\"\n @after_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}\n\n @current_recipe = nil\n say_wizard \"Running before end callbacks.\"\n @before_end_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}\n\n @current_recipe = nil\n say_wizard \"Running after everything callbacks.\"\n @after_everything_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}\nend", "def setup\n required_version = YAML.load_file(\"#{@repository_path}/chef_versions.yml\")['workstation']\n Bundler.with_unbundled_env do\n exit_status, stdout, _stderr = @cmd_runner.run_cmd '/opt/chef-workstation/bin/chef --version', expected_code: [0, :command_error]\n existing_version =\n if exit_status == :command_error\n 'not installed'\n else\n expected_match = stdout.match(/^Chef Workstation version: (.+)\\.\\d+$/)\n expected_match.nil? ? 'unreadable' : expected_match[1]\n end\n log_debug \"Current Chef version: #{existing_version}. Required version: #{required_version}\"\n @cmd_runner.run_cmd \"curl -L https://omnitruck.chef.io/install.sh | #{@cmd_runner.root? ? '' : 'sudo '}bash -s -- -P chef-workstation -v #{required_version}\" unless existing_version == required_version\n end\n end", "def invoke_setup!\n source_command_wrapper\n @setup_block.call(self) if @setup_block\n end", "def pleaserun_setup\n chef_gem 'pleaserun' do\n compile_time true\n version '>= 0.0.30'\n end\n\n require 'pleaserun/namespace'\n require 'pleaserun/platform/base'\n\n target_platform = platform\n target_platform_version = platform_version || target_version\n\n if target_platform.nil? || target_platform.empty?\n require 'pleaserun/detector'\n if target_platform_version.nil?\n target_platform, target_platform_version = PleaseRun::Detector.detect\n else\n target_platform = PleaseRun::Detector.detect\n end\n Chef::Log.info \"[dropwizard_pleaserun] autodetected #{target_platform} \" \\\n \"/ #{target_platform_version}\"\n end\n\n Chef::Log.info \"[dropwizard_pleaserun] platform: #{target_platform} / \" \\\n \"version: #{target_platform_version}\"\n\n require \"pleaserun/platform/#{target_platform}\"\n platform_klass = load_platform(target_platform)\n\n pr = platform_klass.new(target_platform_version.to_s)\n pr.name = app_name\n pr.user = user unless user.nil?\n pr.group = group unless group.nil?\n pr.description = description unless description.nil?\n pr.umask = umask unless umask.nil?\n pr.runas = runas unless runas.nil?\n pr.chroot = chroot unless chroot.nil?\n pr.chdir = chdir unless chdir.nil?\n pr.nice = nice unless nice.nil?\n pr.prestart = prestart unless prestart.nil?\n pr.program = program\n pr.args = args unless args.empty?\n pr.log_directory = log_directory unless log_directory.nil?\n\n pr\nend", "def pre_execute_checks\n validate_terraform_installed\n ensure_output_directory\n Dir.chdir(@opts.get(:input_dir)) do\n puts '=> Fetching modules...'\n tf_get\n end\n end", "def initialSSHTasks(ssh)\n win_env_fix = %q{echo 'export PATH=\"$PATH:/cygdrive/c/opscode/chef/embedded/bin\"' > \"$HOME/chef-client\"; echo 'prev_dir=\"`pwd`\"; for __dir in /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Session\\ Manager/Environment;do cd \"$__dir\"; for __var in `ls * | grep -v TEMP | grep -v TMP`;do __var=`echo $__var | tr \"[a-z]\" \"[A-Z]\"`; test -z \"${!__var}\" && export $__var=\"`cat $__var`\" >/dev/null 2>&1; done; done; cd \"$prev_dir\"; /cygdrive/c/opscode/chef/bin/chef-client.bat $@' >> \"$HOME/chef-client\"; chmod 700 \"$HOME/chef-client\"; ( grep \"^alias chef-client=\" \"$HOME/.bashrc\" || echo 'alias chef-client=\"$HOME/chef-client\"' >> \"$HOME/.bashrc\" ) ; ( grep \"^alias mu-groom=\" \"$HOME/.bashrc\" || echo 'alias mu-groom=\"powershell -File \\\"c:/Program Files/Amazon/Ec2ConfigService/Scripts/UserScript.ps1\\\"\"' >> \"$HOME/.bashrc\" )}\n win_installer_check = %q{ls /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Installer/}\n lnx_installer_check = %q{ps auxww | awk '{print $11}' | egrep '(/usr/bin/yum|apt-get|dpkg)'}\n lnx_updates_check = %q{( test -f /.mu-installer-ran-updates || ! test -d /var/lib/cloud/instance ) || echo \"userdata still running\"}\n win_set_pw = nil\n\n if windows? and !@config['use_cloud_provider_windows_password']\n # This covers both the case where we have a windows password passed from a vault and where we need to use a a random Windows Admin password generated by MU::Cloud::Server.generateWindowsPassword\n pw = @groomer.getSecret(\n vault: @config['mu_name'],\n item: \"windows_credentials\",\n field: \"password\"\n )\n win_check_for_pw = %Q{powershell -Command '& {Add-Type -AssemblyName System.DirectoryServices.AccountManagement; $Creds = (New-Object System.Management.Automation.PSCredential(\"#{@config[\"windows_admin_username\"]}\", (ConvertTo-SecureString \"#{pw}\" -AsPlainText -Force)));$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::Machine); $DS.ValidateCredentials($Creds.GetNetworkCredential().UserName, $Creds.GetNetworkCredential().password); echo $Result}'}\n win_set_pw = %Q{powershell -Command \"& {(([adsi]('WinNT://./#{@config[\"windows_admin_username\"]}, user')).psbase.invoke('SetPassword', '#{pw}'))}\"}\n end\n\n # There shouldn't be a use case where a domain joined computer goes through initialSSHTasks. Removing Active Directory specific computer rename.\n set_hostname = true\n hostname = nil\n if !@config['active_directory'].nil?\n if @config['active_directory']['node_type'] == \"domain_controller\" && @config['active_directory']['domain_controller_hostname']\n hostname = @config['active_directory']['domain_controller_hostname']\n @mu_windows_name = hostname\n set_hostname = true\n else\n # Do we have an AD specific hostname?\n hostname = @mu_windows_name\n set_hostname = true\n end\n else\n hostname = @mu_windows_name\n end\n win_check_for_hostname = %Q{powershell -Command '& {hostname}'}\n win_set_hostname = %Q{powershell -Command \"& {Rename-Computer -NewName '#{hostname}' -Force -PassThru -Restart; Restart-Computer -Force }\"}\n\n begin\n # Set our admin password first, if we need to\n if windows? and !win_set_pw.nil? and !win_check_for_pw.nil?\n output = ssh.exec!(win_check_for_pw)\n raise MU::Cloud::BootstrapTempFail, \"Got nil output from ssh session, waiting and retrying\" if output.nil?\n if !output.match(/True/)\n MU.log \"Setting Windows password for user #{@config['windows_admin_username']}\", details: ssh.exec!(win_set_pw)\n end\n end\n if windows?\n output = ssh.exec!(win_env_fix)\n output = ssh.exec!(win_installer_check)\n raise MU::Cloud::BootstrapTempFail, \"Got nil output from ssh session, waiting and retrying\" if output.nil?\n if output.match(/InProgress/)\n raise MU::Cloud::BootstrapTempFail, \"Windows Installer service is still doing something, need to wait\"\n end\n if set_hostname and !@hostname_set and @mu_windows_name\n output = ssh.exec!(win_check_for_hostname)\n raise MU::Cloud::BootstrapTempFail, \"Got nil output from ssh session, waiting and retrying\" if output.nil?\n if !output.match(/#{@mu_windows_name}/)\n MU.log \"Setting Windows hostname to #{@mu_windows_name}\", details: ssh.exec!(win_set_hostname)\n @hostname_set = true\n # Reboot from the API too, in case Windows is flailing\n if [email protected]?\n @cloudobj.reboot\n else\n reboot\n end\n raise MU::Cloud::BootstrapTempFail, \"Set hostname in Windows, waiting for reboot\"\n end\n end\n else\n output = ssh.exec!(lnx_installer_check)\n if !output.nil? and !output.empty?\n raise MU::Cloud::BootstrapTempFail, \"Linux package manager is still doing something, need to wait (#{output})\"\n end\n if !@config['skipinitialupdates']\n output = ssh.exec!(lnx_updates_check)\n if !output.nil? and output.match(/userdata still running/)\n raise MU::Cloud::BootstrapTempFail, \"Waiting for initial userdata system updates to complete\"\n end\n end\n end\n rescue RuntimeError => e\n raise MU::Cloud::BootstrapTempFail, \"Got #{e.inspect} performing initial SSH connect tasks, will try again\"\n end\n\n end", "def require_gems; end", "def do_boot\n Kernel.require Rucola::RCApp.root_path + '/config/boot'\n end", "def post_install\n end", "def load_gem_plugins; end", "def chef_api_client\n @chef_api_client ||= begin\n require \"chef/api_client\"\n Chef::ApiClient\n end\n end", "def plugin_setup!\n # Check azure cli version due to azure changed `azure` to `az` in azure-cli2.0\n get_azure_cli_version\n set_default_image_reference!\n end", "def configure_chef_only_once\r\n bootstrap_options = value_from_json_file(handler_settings_file,'runtimeSettings','0','handlerSettings', 'publicSettings', 'bootstrap_options')\r\n bootstrap_options = eval(bootstrap_options) ? eval(bootstrap_options) : {}\r\n\r\n if File.directory?(\"#{bootstrap_directory}\")\r\n puts \"#{Time.now} Bootstrap directory [#{bootstrap_directory}] already exists, skipping creation...\"\r\n else\r\n puts \"#{Time.now} Bootstrap directory [#{bootstrap_directory}] does not exist, creating...\"\r\n FileUtils.mkdir_p(\"#{bootstrap_directory}\")\r\n end\r\n\r\n puts \"#{Time.now} Creating chef configuration files\"\r\n\r\n copy_settings_file\r\n\r\n load_settings\r\n\r\n begin\r\n require 'chef/azure/core/bootstrap_context'\r\n\r\n config = configure_settings(bootstrap_options)\r\n\r\n Chef::Config[:validation_key_content] = @validation_key\r\n Chef::Config[:client_key_content] = @client_key\r\n Chef::Config[:chef_server_ssl_cert_content] = @chef_server_ssl_cert\r\n template_file = File.expand_path(File.dirname(File.dirname(__FILE__)))\r\n runlist = @run_list.empty? ? [] : escape_runlist(@run_list)\r\n load_cloud_attributes_in_hints if ! @ohai_hints.empty?\r\n\r\n if windows?\r\n context = Chef::Knife::Core::WindowsBootstrapContext.new(config, runlist, Chef::Config, config[:secret])\r\n template_file += \"\\\\bootstrap\\\\windows-chef-client-msi.erb\"\r\n bootstrap_bat_file ||= \"#{ENV['TMP']}/bootstrap.bat\"\r\n template = IO.read(template_file).chomp\r\n bash_template = Erubis::Eruby.new(template).evaluate(context)\r\n File.open(bootstrap_bat_file, 'w') {|f| f.write(bash_template)}\r\n bootstrap_command = \"cmd.exe /C #{bootstrap_bat_file}\"\r\n else\r\n context = Chef::Knife::Core::BootstrapContext.new(config, runlist, Chef::Config, config[:secret])\r\n template_file += '/bootstrap/chef-full.erb'\r\n template = IO.read(template_file).chomp\r\n bootstrap_command = Erubis::Eruby.new(template).evaluate(context)\r\n end\r\n\r\n result = shell_out(bootstrap_command)\r\n result.error!\r\n puts \"#{Time.now} Created chef configuration files\"\r\n\r\n # remove the temp bootstrap file\r\n FileUtils.rm(bootstrap_bat_file) if windows?\r\n rescue Mixlib::ShellOut::ShellCommandFailed => e\r\n Chef::Log.warn \"chef-client configuration files creation failed (#{e})\"\r\n @chef_client_error = \"chef-client configuration files creation failed (#{e})\"\r\n return\r\n rescue => e\r\n Chef::Log.error e\r\n @chef_client_error = \"chef-client configuration files creation failed (#{e})\"\r\n return\r\n end\r\n\r\n if @extended_logs == 'true'\r\n @chef_client_success_file = windows? ? \"c:\\\\chef_client_success\" : \"/tmp/chef_client_success\"\r\n end\r\n\r\n # Runs chef-client with custom recipe to set the run_list and environment\r\n begin\r\n current_dir = File.expand_path(File.dirname(File.dirname(__FILE__)))\r\n first_client_run_recipe_path = windows? ? \"#{current_dir}\\\\first_client_run_recipe.rb\" : \"#{current_dir}/first_client_run_recipe.rb\"\r\n if !config[:first_boot_attributes][\"policy_name\"].nil? and !config[:first_boot_attributes][\"policy_group\"].nil?\r\n command = \"chef-client -j #{bootstrap_directory}/first-boot.json -c #{bootstrap_directory}/client.rb -L #{@azure_plugin_log_location}/chef-client.log --once\"\r\n else\r\n command = \"chef-client #{first_client_run_recipe_path} -j #{bootstrap_directory}/first-boot.json -c #{bootstrap_directory}/client.rb -L #{@azure_plugin_log_location}/chef-client.log --once\"\r\n end\r\n command += \" -E #{config[:environment]}\" if config[:environment]\r\n result = shell_out(command)\r\n result.error!\r\n rescue Mixlib::ShellOut::ShellCommandFailed => e\r\n Chef::Log.error \"First chef-client run failed. (#{e})\"\r\n @chef_client_error = \"First chef-client run failed (#{e})\"\r\n return\r\n rescue => e\r\n Chef::Log.error e\r\n @chef_client_error = \"First chef-client run failed (#{e})\"\r\n end\r\n\r\n params = \"-c #{bootstrap_directory}/client.rb -L #{@azure_plugin_log_location}/chef-client.log --once \"\r\n\r\n # Runs chef-client in background using scheduled task if windows else using process\r\n if windows?\r\n puts \"#{Time.now} Creating scheduled task with runlist #{runlist}..\"\r\n schtask = \"SCHTASKS.EXE /Create /TN \\\"Chef Client First Run\\\" /RU \\\"NT Authority\\\\System\\\" /RP /RL \\\"HIGHEST\\\" /SC ONCE /TR \\\"cmd /c 'C:\\\\opscode\\\\chef\\\\bin\\\\chef-client #{params}'\\\" /ST \\\"#{Time.now.strftime('%H:%M')}\\\" /F\"\r\n\r\n begin\r\n result = @extended_logs == 'true' ? shell_out(\"#{schtask} && touch #{@chef_client_success_file}\") : shell_out(schtask)\r\n result.error!\r\n @chef_client_run_start_time = Time.now\r\n\r\n # call to run scheduled task immediately after creation\r\n result = shell_out(\"SCHTASKS.EXE /Run /TN \\\"Chef Client First Run\\\"\")\r\n result.error!\r\n rescue Mixlib::ShellOut::ShellCommandFailed => e\r\n Chef::Log.error \"Creation or running of scheduled task for first chef-client run failed (#{e})\"\r\n @chef_client_error = \"Creation or running of scheduled task for first chef-client run failed (#{e})\"\r\n rescue => e\r\n Chef::Log.error e\r\n @chef_client_error = \"Creation or running of scheduled task for first chef-client run failed (#{e})\"\r\n end\r\n puts \"#{Time.now} Created and ran scheduled task for first chef-client run with runlist #{runlist}\"\r\n else\r\n command = @extended_logs == 'true' ? \"chef-client #{params} && touch #{@chef_client_success_file}\" : \"chef-client #{params}\"\r\n @child_pid = Process.spawn command\r\n @chef_client_run_start_time = Time.now\r\n Process.detach @child_pid\r\n puts \"#{Time.now} Successfully launched chef-client process with PID [#{@child_pid}]\"\r\n end\r\n end", "def pre_install; end", "def run_solo\n gempath = `gem env`.grep(/EXECUTABLE DIRECTORY/).first.split(/:/).last.chomp\n @solo = File.join(gempath, \"chef-solo\")\n @solo_config_path = File.join(File.expand_path(\"~\"), \"chef-solo\")\n FileUtils.mkdir_p(@solo_config_path)\n solo_config =<<EOSOLO\n file_cache_path \"#{@solo_config_path}\"\n cookbook_path \"#{@solo_config_path}/cookbooks\"\nEOSOLO\n File.open(\"#{@solo_config_path}/chef-solo.conf\", \"w\") { |f| f.write solo_config }\n\n FileUtils.mkdir_p(\"#{@solo_config_path}/cookbooks/app_code/recipes\")\n File.open(\"#{@solo_config_path}/cookbooks/app_code/recipes/deploy.rb\", \"w\") { |f| f.write @cookbook }\n runlist = '{ \"run_list\": \"app_code::deploy\" }'\n File.open(\"#{@solo_config_path}/deploy_runlist.js\", \"w\") { |f| f.write runlist }\n# Run chef-solo to deploy your code!\n puts \"Running chef-solo\"\n puts `#{@solo} -c #{@solo_config_path}/chef-solo.conf -j #{@solo_config_path}/deploy_runlist.js`\n exit(1) unless $?.success?\n end", "def require_with_grace(r) require r; rescue LoadError; block_given? ? yield : abort(\"#{$!.message}\\n\\n try executing: gem install '#{r}'\") end", "def create_icontrol(hostname) # rubocop:disable AbcSize\n load_dependencies\n f5_creds = chef_vault_item(node['f5-bigip']['credentials']['databag'], node['f5-bigip']['credentials']['item'])\n if node['f5-bigip']['credentials']['host_is_key']\n f5_creds = f5_creds[hostname]\n else\n f5_creds = f5_creds[node['f5-bigip']['credentials']['key']] unless node['f5-bigip']['credentials']['key'].empty?\n end\n F5::IControl.new(hostname,\n f5_creds['username'],\n f5_creds['password'],\n interfaces).get_interfaces\n end", "def load_user_interface()\n\t# locate the enclosing folder and get the bricks file within it\n\tfolder = File.dirname( $0 )\n\tgui_path = File.join( folder, \"gui.bricks\" )\n\turl = Java::File.new( gui_path ).toURI.toURL\n\t\n\t# generate a window reference resource and pass the desired constructor arguments\n\twindow_reference = WindowReference::getDefaultInstance( url, \"MainWindow\" )\n\t\n\tmain_controller = ControlApp.new window_reference\n\tmain_controller.displayWindow\nend", "def load_user_interface()\n\t# locate the enclosing folder and get the bricks file within it\n\tfolder = File.dirname( $0 )\n\tgui_path = File.join( folder, \"gui.bricks\" )\n\turl = Java::File.new( gui_path ).toURI.toURL\n\t\n\t# generate a window reference resource and pass the desired constructor arguments\n\twindow_reference = WindowReference::getDefaultInstance( url, \"MainWindow\" )\n\t\n\tmain_controller = ControlApp.new window_reference\n\tmain_controller.displayWindow\nend", "def run\n begin\n Kitchenplan::Log.info \"Kitchenplan run ready to begin.\"\n Kitchenplan::Log.debug \"Started with options: #{options.inspect}\"\n Kitchenplan::Log.info \"Validating dependencies for platform '#{self.platform.name}'...\"\n self.platform.prerequisites()\n if self.resolver.nil?\n\tKitchenplan::Log.info \"Checking for resolvers again now that dependencies are satisfied ... \"\n\tdetect_resolver(debug=@use_debug,config_dir=options[:config_dir])\n\tself.resolver.debug = @use_debug unless self.resolver.nil?\n\tKitchenplan::Log.warn \"Still couldn't find a resolver after installing prerequisites!\" if self.resolver.nil?\n end\n Kitchenplan::Log.info \"Generating Chef configs...\"\n generate_chef_config()\n Kitchenplan::Log.info \"Verifying cookbook dependencies using '#{self.resolver.name}'...\" unless self.resolver.nil?\n ping_google_analytics()\n update_cookbooks() unless self.resolver.nil?\n use_solo = options[:chef_mode].include?(\"solo\") ? true : false\n log_level = options[:log_level]\n log_file = options[:log_file]\n recipes = self.config['recipes']\n Kitchenplan::Log.debug \"self.resolver.config_dir = #{self.resolver.config_dir}\" unless self.resolver.nil?\n Kitchenplan::Log.debug \"self.config = #{self.config}, recipes = #{self.config['recipes']}\"\n self.platform.sudo(self.platform.run_chef(use_solo=use_solo,log_level=log_level,log_file=log_file,recipes=recipes))\n Kitchenplan::Log.info \"Chef run completed.\"\n self.exit!(\"Kitchenplan run complete. Exiting normally.\",0)\n rescue RuntimeError => e\n\tKitchenplan::Log.error \"An error was encountered shelling out and running a command to configure your system.\"\n\tKitchenplan::Log.error \"This could be due to a bug in Kitchenplan or an unexpected configuration on your system.\"\n\tKitchenplan::Log.error \"Failed command: #{e.message}\"\n\tKitchenplan::Log.error \"Stack trace:\"\n\te.backtrace.each { |l| Kitchenplan::Log.error \" #{l}\" }\n\tself.fatal!(\"Kitchenplan could not run successfully and is exiting with errors.\",-2)\n end\n end", "def testNoCallUIWithResolvedDeps\n lCalled = false\n setupAppDir do\n setupRegressionUI('RDI::Test::Flows::UIFlows::RegressionUI') do\n # Call the installer expecting the GUI to appear\n lDesc = getSimpleDesc\n lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensure_dependencies( [ lDesc ], {\n :possible_context_modifiers => {\n 'DummyBinary' => [\n [\n [ 'SystemPath', \"#{@RepositoryDir}/Binaries\" ]\n ]\n ]\n },\n :preferred_views => [ 'RegressionUI' ]\n } )\n assert_equal(nil, lError)\n assert_equal( { 'DummyBinary' => [ [ 'SystemPath', \"#{@RepositoryDir}/Binaries\" ] ] }, lCMApplied )\n assert_equal( [], lIgnoredDeps )\n assert_equal( [], lUnresolvedDeps )\n # Get the plugin back\n @Installer.access_plugin('Views', 'RegressionUI') do |iPlugin|\n # Check that it was called correctly\n lCalled = iPlugin.Called\n end\n end\n end\n assert_equal(false, lCalled)\n end", "def setup\n # Create Object from CPBI Library (cpbi_lib.rb)\n @cpbi_backend = CPBI_lib.new\n @driver = @cpbi_backend.driver\n @wait = @cpbi_backend.wait\n end", "def load_cookbook!\n @cookbook = current_cookbook\n end", "def library_load_start(file_count)\n puts 'compiling cookbooks'\n end", "def on_startup\n\t\t# Check for modules that failed to load\n\t\tif (framework.modules.failed.length > 0)\n\t\t\tprint_error(\"WARNING! The following modules could not be loaded!\")\n\t\t\tframework.modules.failed.each_pair do |file, err|\n\t\t\t\tprint_error(\"\\t#{file}: #{err}\")\n\t\t\tend\n\t\tend\n\t\tframework.events.on_ui_start(Msf::Framework::Revision)\n\n\t\t# Build the banner message\n\t\trun_single(\"banner\")\n\t\tself.on_command_proc = Proc.new { |command| framework.events.on_ui_command(command) }\n\tend", "def import\n export_from_veewee\n box_file = work_dir.join(\"#{IMAGE_NAME}.box\")\n log.info \"Importing #{veewee_provider} image into Vagrant\"\n system \"vagrant box add 'autoyast' #{box_file} --force\"\n end", "def after_bootstrap\n end", "def bootstrap(raise_on_fail:false)\n ext = Dir.glob(\"./lib/*/extension.rb\").first\n if ext\n begin\n require(ext)\n rescue =>e\n stack = e.backtrace[0..4].join(\"\\n\")\n raise Thor::Error.new(\"Loading ./lib/*/extension.rb failed with: #{e}\\n#{stack}\")\n end\n Extensions.controlling\n else\n return _maybe_fail(raise_on_fail)\n end\n end", "def after_exec_command\n # bootstrap the server\n bootstrap\n rescue CloudExceptions::BootstrapError => e\n ui.fatal(e.message)\n cleanup_on_failure\n raise e\n rescue => e\n error_message = \"Check if --connection-protocol and --image-os-type is correct. #{e.message}\"\n ui.fatal(error_message)\n cleanup_on_failure\n raise e, error_message\n end", "def cookbook\n require 'halite/gem'\n @cookbook ||= Halite::Gem.new(gemspec)\n end", "def load_minimal_gems\r\n end", "def cfs_kit_launch_app(screen, app)\n\n\n if (app == \"UPDATE_TUTORIAL\")\n # An exception will report any errors \n if cfs_kit_create_tutorial_screen\n prompt (\"Successfuly created tutorial screen file #{tutorial_scr_file}\\nusing #{tutorial_def_file}\")\n end\n elsif (app == \"PROTO_APPP\")\n #TODO - Investigate generic text table editor or tutorial screen\n\t Cosmos.run_process(\"ruby lib/OskCfeFileViewer -f '/mnt/hgfs/OpenSatKit/cosmos/cfs_kit/file_server/cfe_es_syslog.dat'\")\n\t #Cosmos.run_process(\"ruby lib/OskTxtFileViewer -f '/mnt/hgfs/OpenSatKit/cosmos/test.json'\")\n #require 'osk_tbl_editor'\n #Cosmos.run_process(\"ruby lib/OskTblEditor\")\n\t #require 'cfs_fcx_cmdgen'\n #Cosmos.run_process(\"ruby lib/CfsFcxCmdGen\")\n #Cosmos.run_process(\"ruby tools/ConfigEditor\")\n #Cosmos::OskTblEditor.run\n #Cosmos.run_cosmos_tool('ConfigEditor')\n\n elsif (app == \"TUTORIAL\")\n cfs_kit_launch_tutorial_screen\n end\n\nend", "def pre_hard_load(mod); end", "def initialise_environment(environment, pull_drupal_data_image, system_exec)\n environment.initialize_environment\n if pull_drupal_data_image\n puts '- Pulling drupal_data image from Docker Hub...'\n system_exec.execute_docker_compose(environment, :pull, %w(drupal_data));\n puts '- Completed pull of drupal_data image from Docker Hub.'\n end\nend", "def install_gem(nr, checkout_path)\n gemspec_file = ::File.join(\n checkout_path, \"#{nr.gem_name}.gemspec\"\n )\n at_compile_time do\n ruby_block \"install vault plugin #{nr.gem_name}\" do\n block do\n require 'rubygems/dependency_installer'\n require 'rubygems/specification'\n\n ::Dir.chdir(checkout_path)\n gemspec = ::Gem::Specification.load(gemspec_file)\n gem = if Gem::Package.respond_to?(:build)\n Gem::Package.build(gemspec)\n else\n require 'rubygems/builder'\n Gem::Builder.new(gemspec).build\n end\n inst = ::Gem::DependencyInstaller.new\n inst.install gem\n Gem.clear_paths\n end\n end\n end\n end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "def cookbook_clean_start\n end", "def configure_chef\n # setup logger for mixlib-shellout gem to consume instead of the chef\n # v0.10.10 behavior of not logging ShellOut calls by default. also setup\n # command failure exception and callback for legacy reasons.\n ::Mixlib::ShellOut.default_logger = ::Chef::Log\n ::Mixlib::ShellOut.command_failure_callback = lambda do |params|\n failure_reason = ::RightScale::SubprocessFormatting.reason(params[:status])\n expected_error_codes = Array(params[:args][:returns]).join(' or ')\n ::RightScale::Exceptions::Exec.new(\"\\\"#{params[:args][:command]}\\\" #{failure_reason}, expected #{expected_error_codes}.\",\n params[:args][:cwd])\n end\n\n # Chef run mode is always solo for cook\n Chef::Config[:solo] = true\n\n # determine default cookbooks path. If debugging cookbooks, place the debug pat(s) first, otherwise\n # clear out the list as it will be filled out with cookbooks needed for this converge as they are downloaded.\n if CookState.use_cookbooks_path?\n Chef::Config[:cookbook_path] = [CookState.cookbooks_path].flatten\n @audit.append_info(\"Using development cookbooks repositories path:\\n\\t- #{Chef::Config[:cookbook_path].join(\"\\n\\t- \")}\")\n else\n # reset the cookbook path. Will be filled out with cookbooks needed for this execution\n Chef::Config[:cookbook_path] = []\n end\n # add the rightscript cookbook if there are rightscripts in this converge\n Chef::Config[:cookbook_path] << @right_scripts_cookbook.repo_dir unless @right_scripts_cookbook.empty?\n\n # must set file cache path and ensure it exists otherwise evented run_command will fail\n file_cache_path = File.join(AgentConfig.cache_dir, 'chef')\n Chef::Config[:file_cache_path] = file_cache_path\n FileUtils.mkdir_p(Chef::Config[:file_cache_path])\n\n Chef::Config[:cache_options][:path] = File.join(file_cache_path, 'checksums')\n FileUtils.mkdir_p(Chef::Config[:cache_options][:path])\n\n # Where backups of chef-managed files should go. Set to nil to backup to the same directory the file being backed up is in.\n Chef::Config[:file_backup_path] = nil\n\n # Chef 11+ defaults client_fork to true which cause Chef::Client to fork\n # This create problems with right_popen - right_popen expects to be used inside running EM reactor\n # EM seems not to play well with forking\n Chef::Config[:client_fork] = false\n\n # Chef 11+ allow concurrent execution of the recipes in different theads,\n # by setting different lockfile per thread.\n Chef::Config[:lockfile] = File.join(Chef::Config[:file_cache_path], \"chef-client-#{@thread_name}-running.pid\")\n\n true\n end", "def run(&block)\n update_appd_cookbook\n generate_solo_config\n generate_node_config\n @ssh.exec \"chef-solo --config /tmp/solo.rb --json-attributes /tmp/node.json --force-formatter --log_level error --format appd\", sudo: true do |ch, stream, data, cmd|\n yield data\n end\n end", "def loader\n @loader ||= Chef::Knife::Core::ObjectLoader.new(Chef::Role, ui)\n end", "def configure_fabric(aws_node, node_config)\n aws_node.vm.synced_folder \"#{GEN_PATH}/channel/\", '/vagrant/channel', type: 'rsync'\n aws_node.vm.synced_folder \"#{GEN_PATH}/crypto-config/\", '/vagrant/crypto-config', type: 'rsync'\n node_config['fabric'].each do |fabric|\n role = fabric['role']\n docker_yaml = fabric['docker']\n couchdb_port = fabric['couchdb_port']\n aws_node.vm.provision 'docker' do |d|\n d.pull_images \"hyperledger/fabric-#{role}:x86_64-#{HYPERLEDGER_VERSION}\"\n if role == 'peer'\n # Download and run couchdb\n d.pull_images 'yeasy/hyperledger-fabric-couchdb'\n # TODO: In future, couchdb should not publish port\n # but only expose them for incresed security,\n # and peer containers should link to couchdb\n d.run 'yeasy/hyperledger-fabric-couchdb', args: \"-e COUCHDB_PASSWORD=password -e COUCHDB_USER=admin -p #{couchdb_port}:5984\"\n # Pre-load fabric image for chaincode instantiation\n d.pull_images \"hyperledger/fabric-ccenv:x86_64-#{HYPERLEDGER_VERSION}\"\n end\n end\n\n if role == 'peer'\n aws_node.vm.provision 'shell', inline: \"docker tag hyperledger/fabric-ccenv:x86_64-#{HYPERLEDGER_VERSION} hyperledger/fabric-ccenv\"\n # wait for couchdb\n aws_node.vm.provision 'shell', inline: wait_for_port('0.0.0.0', couchdb_port)\n end\n\n # Remove version tag on the image by tagging it\n aws_node.vm.provision 'shell', inline: \"docker tag hyperledger/fabric-#{role}:x86_64-#{HYPERLEDGER_VERSION} hyperledger/fabric-#{role}\"\n\n # wait until network is up\n aws_node.vm.provision 'shell', inline: WAIT_FOR_NETWORK\n\n docker_compose_file_name = \"/vagrant/docker/#{docker_yaml}\"\n aws_node.vm.provision :docker_compose, yml: docker_compose_file_name, options: '', compose_version: DOCKER_COMPOSE_VERSION\n end\nend", "def after_created\n Array(action).each do |act|\n case act\n when :enable\n enable_plugin_shim!\n when :disable\n disable_plugin_shim!\n end\n end\n end", "def load_current_resource\n @current_resource = Chef::Resource::Php5FpmPool.new(@new_resource.name)\n #default entries, will override if file exists and can find a matching configuration key\n #Overwrite\n @current_resource.overwrite(@new_resource.overwrite)\n #Base Pool Configuration\n @current_resource.pool_name(@new_resource.pool_name)\n @current_resource.pool_user(@new_resource.pool_user)\n @current_resource.pool_group(@new_resource.pool_group)\n @current_resource.listen_address(@new_resource.listen_address)\n @current_resource.listen_port(@new_resource.listen_port)\n @current_resource.listen_allowed_clients(@new_resource.listen_allowed_clients) # <<<<<<<<<< Need to complete\n @current_resource.listen_owner(@new_resource.listen_owner)\n @current_resource.listen_group(@new_resource.listen_group)\n @current_resource.listen_mode(@new_resource.listen_mode)\n @current_resource.use_sockets(@new_resource.use_sockets)\n @current_resource.listen_socket(@new_resource.listen_socket)\n @current_resource.listen_backlog(@new_resource.listen_backlog)\n #PM Configuration\n @current_resource.pm(@new_resource.pm)\n @current_resource.pm_max_children(@new_resource.pm_max_children)\n @current_resource.pm_start_servers(@new_resource.pm_start_servers)\n @current_resource.pm_min_spare_servers(@new_resource.pm_min_spare_servers)\n @current_resource.pm_max_spare_servers(@new_resource.pm_max_spare_servers)\n @current_resource.pm_process_idle_timeout(@new_resource.pm_process_idle_timeout)\n @current_resource.pm_max_requests(@new_resource.pm_max_requests)\n @current_resource.pm_status_path(@new_resource.pm_status_path)\n #Ping Status\n @current_resource.ping_path(@new_resource.ping_path)\n @current_resource.ping_response(@new_resource.ping_response)\n #Logging\n @current_resource.access_format(@new_resource.access_format)\n @current_resource.request_slowlog_timeout(@new_resource.request_slowlog_timeout)\n @current_resource.request_terminate_timeout(@new_resource.request_terminate_timeout)\n @current_resource.access_log(@new_resource.access_log)\n @current_resource.slow_log(@new_resource.slow_log)\n #Misc\n @current_resource.chdir(@new_resource.chdir)\n @current_resource.chroot(@new_resource.chroot)\n @current_resource.catch_workers_output(@new_resource.catch_workers_output)\n @current_resource.security_limit_extensions(@new_resource.security_limit_extensions)\n @current_resource.rlimit_files(@new_resource.rlimit_files)\n @current_resource.rlimit_core(@new_resource.rlimit_core)\n #PHP INI\n @current_resource.php_ini_values(@new_resource.php_ini_values)\n @current_resource.php_ini_flags(@new_resource.php_ini_flags)\n @current_resource.php_ini_admin_values(@new_resource.php_ini_admin_values)\n @current_resource.php_ini_admin_flags(@new_resource.php_ini_admin_flags)\n #ENV Variables\n @current_resource.env_variables(@new_resource.env_variables)\n #Auto Resource Provisioning\n @current_resource.auto_calculate(@new_resource.auto_calculate)\n @current_resource.percent_share(@new_resource.percent_share)\n @current_resource.round_down(@new_resource.round_down)\n\n #if the file exists, load current state\n if file_exists?(@current_resource.pool_name)\n\n #Tmp hash holding for our PHP and ENV Variables\n tmp_flags = {}\n tmp_values = {}\n tmp_admin_flags = {}\n tmp_admin_values = {}\n tmp_env_variables = {}\n\n #open the file for read\n ::File.open(\"#{ node[\"php_fpm\"][\"pools_path\"] }/#{ @current_resource.pool_name }.conf\", \"r\") do |fobj|\n\n #loop through each line\n fobj.each_line do |fline|\n\n #Split the line for configuration value\n lstring = fline.split('=').at(1)\n #Get the conf variable if there is one\n #Need to extract the variable name first\n conf_file_variable = fline.scan(/\\[.*?\\]/).first\n !conf_file_variable.nil? ? conf_file_variable = conf_file_variable.sub('[', '').sub(']', '') : nil\n\n #Start base configuration\n configuration_exists(fline,\"user =\") ? @current_resource.pool_user(lstring.chomp.strip) : nil\n if configuration_exists(fline,\"group =\") && !configuration_exists(fline,\"listen.group =\")\n @current_resource.pool_group(lstring.chomp.strip)\n end\n\n #Pull address and port // If we are using sockets bypass\n if configuration_exists(fline,\"listen =\") && !@current_resource.use_sockets\n if fline =~ /.*\\..*\\..*\\..*:.*/ #do a check on a valid ip address/port combination, if no match, just set new to current\n #split away the address and port\n sp_address = lstring.split(':').at(0)\n sp_port = lstring.split(':').at(1)\n #remove newline chars and whitespacing\n @current_resource.listen_address(sp_address.chomp.strip)\n @current_resource.listen_port(sp_port.chomp.strip.to_i)\n end #don't apply the current resource | this is for a socket to ip transition | will work for modify as well\n elsif configuration_exists(fline,\"listen =\") && @current_resource.use_sockets ## Only for sockets\n @current_resource.listen_socket(lstring.chomp.strip)\n end\n\n #Finish out base configuration options\n configuration_exists(fline,\"listen.allowed_clients =\") ? @current_resource.listen_allowed_clients(lstring.chomp.strip) : nil\n configuration_exists(fline,\"listen.owner =\") ? @current_resource.listen_owner(lstring.chomp.strip) : nil\n configuration_exists(fline,\"listen.group =\") ? @current_resource.listen_group(lstring.chomp.strip) : nil\n configuration_exists(fline,\"listen.mode =\") ? @current_resource.listen_mode(lstring.chomp.strip) : nil\n configuration_exists(fline,\"listen.backlog =\") ? @current_resource.listen_backlog(lstring.chomp.strip) : nil\n\n #Start PM configuration\n configuration_exists(fline,\"pm =\") ? @current_resource.pm(lstring.chomp.strip) : nil\n configuration_exists(fline,\"pm.max_children =\") ? @current_resource.pm_max_children(lstring.chomp.strip.to_i) : nil\n configuration_exists(fline,\"pm.start_servers =\") ? @current_resource.pm_start_servers(lstring.chomp.strip.to_i) : nil\n configuration_exists(fline,\"pm.min_spare_servers =\") ? @current_resource.pm_min_spare_servers(lstring.chomp.strip.to_i) : nil\n configuration_exists(fline,\"pm.max_spare_servers =\") ? @current_resource.pm_max_spare_servers(lstring.chomp.strip.to_i) : nil\n configuration_exists(fline,\"pm.process_idle_timeout =\") ? @current_resource.pm_process_idle_timeout(lstring.chomp.strip) : nil\n configuration_exists(fline,\"pm.max_requests =\") ? @current_resource.pm_max_requests(lstring.chomp.strip.to_i) : nil\n configuration_exists(fline,\"pm.status_path =\") ? @current_resource.pm_status_path(lstring.chomp.strip) : nil\n\n #Start ping status\n configuration_exists(fline,\"ping.path =\") ? @current_resource.ping_path(lstring.chomp.strip) : nil\n configuration_exists(fline,\"ping.response =\") ? @current_resource.ping_response(lstring.chomp.strip) : nil\n\n #Start logging\n configuration_exists(fline,\"access.format =\") ? @current_resource.access_format(lstring.chomp.strip) : nil\n configuration_exists(fline,\"request_slowlog_timeout =\") ? @current_resource.request_slowlog_timeout(lstring.chomp.strip.to_i) : nil\n configuration_exists(fline,\"request_terminate_timeout =\") ? @current_resource.request_terminate_timeout(lstring.chomp.strip.to_i) : nil\n configuration_exists(fline,\"access.log =\") ? @current_resource.access_log(lstring.chomp.strip) : nil\n configuration_exists(fline,\"slowlog =\") ? @current_resource.slow_log(lstring.chomp.strip) : nil\n\n #Start misc\n configuration_exists(fline,\"chdir =\") ? @current_resource.chdir(lstring.chomp.strip) : nil\n configuration_exists(fline,\"chroot =\") ? @current_resource.chroot(lstring.chomp.strip) : nil\n configuration_exists(fline,\"catch_workers_output =\") ? @current_resource.catch_workers_output(lstring.chomp.strip) : nil\n configuration_exists(fline,\"security.limit_extensions =\") ? @current_resource.security_limit_extensions(lstring.chomp.strip) : nil\n configuration_exists(fline,\"rlimit_files =\") ? @current_resource.rlimit_files(lstring.chomp.strip.to_i) : nil\n configuration_exists(fline,\"rlimit_core =\") ? @current_resource.rlimit_core(lstring.chomp.strip.to_i) : nil\n\n #Start PHP INI\n configuration_exists(fline,\"php_value[#{conf_file_variable}] =\") && !@current_resource.php_ini_values.nil? ? tmp_values[\"#{conf_file_variable}\"] = lstring.chomp.strip : nil\n configuration_exists(fline,\"php_flag[#{conf_file_variable}] =\") && !@current_resource.php_ini_flags.nil? ? tmp_flags[\"#{conf_file_variable}\"] = lstring.chomp.strip : nil\n configuration_exists(fline,\"php_admin_value[#{conf_file_variable}] =\") && !@current_resource.php_ini_admin_values.nil? ? tmp_admin_values[\"#{conf_file_variable}\"] = lstring.chomp.strip : nil\n configuration_exists(fline,\"php_admin_flag[#{conf_file_variable}] =\") && !@current_resource.php_ini_admin_flags.nil? ? tmp_admin_flags[\"#{conf_file_variable}\"] = lstring.chomp.strip : nil\n\n #Start ENV Variables\n configuration_exists(fline,\"env[#{conf_file_variable}] =\") && !@current_resource.env_variables.nil? ? tmp_env_variables[\"#{conf_file_variable}\"] = lstring.chomp.strip : nil\n\n end\n\n #Reset current resource hashes on PHP and ENV Variables\n @current_resource.php_ini_values(tmp_values)\n @current_resource.php_ini_flags(tmp_flags)\n @current_resource.php_ini_admin_values(tmp_admin_values)\n @current_resource.php_ini_admin_flags(tmp_admin_flags)\n\n end\n\n #flag that they current file exists\n @current_resource.exists = true\n end\n\n #If we are to auto_calculate, then call the method\n if @current_resource.auto_calculate\n\n #Call auto_calculate\n auto_calculate(@new_resource.pm, (@new_resource.percent_share / 100.00), @new_resource.round_down)\n\n end\n\nend", "def find_toolbox_parts\n unless @found_plugins # cache it as its expensive\n # TODO: exceptions\n SD::Plugins.load \"built-in\", lambda {|url|ControlRegister.java_class.resource url}\n\n # check for the plugins folder\n plugin_yaml = $PLUGIN_DIR\n if Dir.exist? plugin_yaml\n Dir[\"#{plugin_yaml}/*\"].each do |plugin_path|\n if plugin_path.end_with? \".css\" # overload styles\n olss = @GridPane.stylesheets.to_a\n @GridPane.stylesheets.clear # required to cause refresh\n @GridPane.stylesheets.add_all(*olss, \"file:\" + plugin_path)\n next\n end\n SD::Plugins.load(plugin_path, if plugin_path.end_with? \".jar\"\n require plugin_path\n class_loader = java.net.URLClassLoader.new([java.net.URL.new(\"file:#{plugin_path}\")].to_java(java.net.URL))\n lambda {|url| class_loader.find_resource(url.gsub(%r{^/}, ''))}\n else\n lambda {|url| java.net.URL.new(\"file:#{plugin_path}/#{url}\")}\n end)\n end\n end\n @toolbox_bits = SD::Plugins.controls.group_by{|x| x.category}\n @toolbox_bits.keys.each do |key|\n lfp = nil\n @accord.panes << (titled_pane(text: \"Toolbox - #{key.nil? ? \"Ungrouped\" : key}\") do\n sp = scroll_pane(fit_to_width: true, max_height: 1.0/0.0, max_width: 1.0/0.0) do\n setHbarPolicy Java::JavafxSceneControl::ScrollPane::ScrollBarPolicy::NEVER\n setPannable false\n setPrefHeight -1.0\n setPrefViewportWidth 0\n setPrefWidth -1.0\n styleClass.add \"toolbox-panes\"\n setContent(lfp = flow_pane(pref_height: 200, pref_width: 200))\n end\n setContent sp\n end)\n @toolbox_group[key] = lfp\n end\n @found_plugins = true\n end\n @toolbox_bits\n end", "def testCallUI\n lCalled = false\n setupAppDir do\n setupRegressionUI('RDI::Test::Flows::UIFlows::RegressionUI') do\n # Call the installer expecting the GUI to appear\n lDesc = getSimpleDesc\n lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensure_dependencies( [ lDesc ], {\n :preferred_views => [ 'RegressionUI' ]\n } )\n # Get the plugin back\n @Installer.access_plugin('Views', 'RegressionUI') do |iPlugin|\n # Check that it was called correctly\n lCalled = iPlugin.Called\n end\n end\n end\n assert_equal(true, lCalled)\n end", "def testNoCallUIWithExistingDeps\n lCalled = false\n setupAppDir do\n setupRegressionUI('RDI::Test::Flows::UIFlows::RegressionUI') do\n # Call the installer expecting the GUI to appear\n lDesc = getSimpleDesc\n # First install the dependency\n lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensure_dependencies( [ lDesc ], {\n :auto_install => DEST_LOCAL\n } )\n # Then try again with UI\n lError, lCMApplied, lIgnoredDeps, lUnresolvedDeps = @Installer.ensure_dependencies( [ lDesc ], {\n :preferred_views => [ 'RegressionUI' ]\n } )\n assert_equal(nil, lError)\n assert_equal( {}, lCMApplied )\n assert_equal( [], lIgnoredDeps )\n assert_equal( [], lUnresolvedDeps )\n # Get the plugin back\n @Installer.access_plugin('Views', 'RegressionUI') do |iPlugin|\n # Check that it was called correctly\n lCalled = iPlugin.Called\n end\n end\n end\n assert_equal(false, lCalled)\n end", "def gemspec_building_block; end", "def initialize chef_recipe\n super(chef_recipe.cookbook_name, chef_recipe.recipe_name, chef_recipe.run_context)\n\n # TODO: Support other distributions besides 'linux'\n node.default[\"serf\"][\"binary_url\"] = File.join node[\"serf\"][\"base_binary_url\"], \"#{node[\"serf\"][\"version\"]}\", \"serf_#{node[\"serf\"][\"version\"]}_linux_#{node[\"serf\"][\"arch\"]}.zip\"\n\n current_version = get_serf_installed_version\n if current_version\n Chef::Log.info \"Current Serf Version : [#{current_version}]\"\n end\n end", "def boot\n Rucola::Plugin.before_boot\n do_boot\n Rucola::Plugin.after_boot\n end", "def start\n require 'irbtools'\n end", "def declare_gemfile\n @flavor.class.do_declare_resources do\n # :nocov:\n lazy_vars = Chef::DelayedEvaluator.new do\n { gems: cookbook_gems, sources: gem_sources }\n end\n # :nocov:\n add_templates(%w(Gemfile), :create, variables: lazy_vars)\n end\n end", "def install\n unless self.has_executable?(\"chef-solo\")\n case self.pocketknife.can_install\n when nil\n # Prompt for installation\n print \"? #{self.name}: Chef not found. Install it and its dependencies? (Y/n) \"\n STDOUT.flush\n answer = STDIN.gets.chomp\n case answer\n when /^y/i, ''\n # Continue with install\n else\n raise NotInstalling.new(\"Chef isn't installed on node '#{self.name}', but user doesn't want to install it.\", self.name)\n end\n when true\n # User wanted us to install\n else\n # Don't install\n raise NotInstalling.new(\"Chef isn't installed on node '#{self.name}', but user doesn't want to install it.\", self.name)\n end\n\n unless self.has_executable?(\"ruby\")\n self.install_ruby\n end\n\n unless self.has_executable?(\"gem\")\n self.install_rubygems\n end\n\n self.install_chef\n end\n end", "def load_libraries()\n @cookbook_loader.each do |cookbook|\n cookbook.load_libraries\n end\n true\n end", "def setup\n java.lang.System.setProperty(\"vbox.home\", Travis::Worker.config.vms.vbox_home)\n\n require 'vboxjxpcom.jar'\n\n java_import 'org.virtualbox_4_1.VirtualBoxManager'\n java_import 'org.virtualbox_4_1.VBoxEventType'\n java_import 'org.virtualbox_4_1.LockType'\n java_import 'org.virtualbox_4_1.MachineState'\n java_import 'org.virtualbox_4_1.IMachineStateChangedEvent'\n java_import 'org.virtualbox_4_1.DeviceType'\n java_import 'org.virtualbox_4_1.AccessMode'\n java_import 'org.virtualbox_4_1.MediumType'\n java_import 'org.virtualbox_4_1.SessionState'\n end", "def wait_cbox_open(&block)\n wait_for_js_ready\n wait_event_to_fire(\"cbox_complete\", &block)\n wait_for_js_ready\n end", "def run(&block)\n register_cookbooks\n generate_solo_config && generate_node_config\n ssh.exec \"chef-solo --config #{CHEF_VAR_PATH}/solo.rb --json-attributes #{CHEF_VAR_PATH}/node.json #{\"--force-formatter --log_level error --format #{@formatter.first[0]}\" if @formatter && @formatter.any?}\", sudo: true do |ch, stream, data, cmd|\n yield data\n end\n end", "def recipe_load_complete\n puts 'done.'\n end", "def create_components\n model = Sketchup.active_model\n definitions = model.definitions\n\n coworker_safe = definitions.load File.join(@libPath, \"CWorker-Safe.skp\")\n UI.messagebox coworker_safe.name\n end", "def setup\n super\n handle_packages\n end", "def with_os_mock_and_reload(os, class_names = [], files = [])\n class_names = Array(class_names)\n files = Array(files)\n\n CLI::UI::OS.stubs(:current).returns(os)\n class_names.each { |classname| CLI::UI.send(:remove_const, classname) }\n files.each { |file| load(file) }\n\n yield\nensure\n CLI::UI::OS.unstub(:current)\n class_names.each { |classname| CLI::UI.send(:remove_const, classname) }\n files.each { |file| load(file) }\nend", "def autoloader; end", "def startup_hook; end", "def action_run\n notifying_block do\n # Top level directory for this test.\n directory new_resource.path do\n mode '777'\n end\n\n # Install and log the version.\n python_runtime new_resource.name do\n provider new_resource.runtime_provider if new_resource.runtime_provider\n version new_resource.version\n end\n test_version\n\n # Test python_package.\n python_package 'argparse' do\n # Needed for sqlparse but not in the stdlib until 2.7.\n python new_resource.name\n end\n python_package 'sqlparse remove before' do\n action :remove\n package_name 'sqlparse'\n python new_resource.name\n end\n test_import('sqlparse', 'sqlparse_before')\n python_package 'sqlparse' do\n python new_resource.name\n notifies :create, sentinel_file('sqlparse'), :immediately\n end\n test_import('sqlparse', 'sqlparse_mid')\n python_package 'sqlparse again' do\n package_name 'sqlparse'\n python new_resource.name\n notifies :create, sentinel_file('sqlparse2'), :immediately\n end\n python_package 'sqlparse remove after' do\n action :remove\n package_name 'sqlparse'\n python new_resource.name\n end\n test_import('sqlparse', 'sqlparse_after')\n\n # Use setuptools to test something that should always be installed.\n python_package 'setuptools' do\n python new_resource.name\n notifies :create, sentinel_file('setuptools'), :immediately\n end\n\n # Multi-package install.\n python_package ['pep8', 'pytz'] do\n python new_resource.name\n end\n test_import('pep8')\n test_import('pytz')\n\n # Create a virtualenv.\n python_virtualenv ::File.join(new_resource.path, 'venv') do\n python new_resource.name\n end\n\n # Install a package inside a virtualenv.\n python_package 'Pytest' do\n virtualenv ::File.join(new_resource.path, 'venv')\n end\n test_import('pytest')\n test_import('pytest', 'pytest_venv', python: nil, virtualenv: ::File.join(new_resource.path, 'venv'))\n\n # Create and install a requirements file.\n # Running this in a venv because of pip 8.0 and Ubuntu packaing\n # both requests and six.\n python_virtualenv ::File.join(new_resource.path, 'venv2') do\n python new_resource.name\n end\n file ::File.join(new_resource.path, 'requirements.txt') do\n content <<-EOH\nrequests==2.7.0\nsix==1.8.0\nEOH\n end\n pip_requirements ::File.join(new_resource.path, 'requirements.txt') do\n virtualenv ::File.join(new_resource.path, 'venv2')\n end\n test_import('requests', python: nil, virtualenv: ::File.join(new_resource.path, 'venv2'))\n test_import('six', python: nil, virtualenv: ::File.join(new_resource.path, 'venv2'))\n\n # Install a non-latest version of a package.\n python_virtualenv ::File.join(new_resource.path, 'venv3') do\n python new_resource.name\n end\n python_package 'requests' do\n version '2.8.0'\n virtualenv ::File.join(new_resource.path, 'venv3')\n end\n test_import('requests', 'requests_version', python: nil, virtualenv: ::File.join(new_resource.path, 'venv3'))\n\n # Don't run the user tests on Windows.\n unless node.platform_family?('windows')\n # Create a non-root user and test installing with it.\n test_user = \"py#{new_resource.name}\"\n test_home = ::File.join('', 'home', test_user)\n group 'g'+test_user do\n system true\n end\n user test_user do\n comment \"Test user for python_runtime_test #{new_resource.name}\"\n gid 'g'+test_user\n home test_home\n shell '/bin/false'\n system true\n end\n directory test_home do\n mode '700'\n group 'g'+test_user\n user test_user\n end\n test_venv = python_virtualenv ::File.join(test_home, 'env') do\n python new_resource.name\n user test_user\n end\n python_package 'docopt' do\n user test_user\n virtualenv test_venv\n end\n test_import('docopt', python: nil, virtualenv: test_venv, user: test_user)\n end\n\n end\n end", "def install_chef\n self.say(\"Installing chef...\")\n self.execute(\"gem install --no-rdoc --no-ri chef\", true)\n self.say(\"Installed chef\", false)\n end", "def tool_launch\n begin\n require 'bundler/setup'\n require 'cosmos'\n yield\n rescue Exception => error\n popup_error = error; popup_error = $cosmos_fatal_exception if defined? $cosmos_fatal_exception\n begin\n raise error if STDIN.isatty # Have a console\n raise error unless defined? $cosmos_fatal_exception or (error.class != SystemExit and error.class != Interrupt)\n case RUBY_PLATFORM\n when /mingw32/\n require 'fiddle'\n Fiddle::Function.new(Fiddle.dlopen('user32')['MessageBox'], [Fiddle::TYPE_LONG, Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_LONG], Fiddle::TYPE_LONG).call(0, \"#{popup_error.class}:#{popup_error.message}\\n\\n#{popup_error.backtrace.join(\"\\n\")}\\n\\nNote: Ctrl-C will copy this information to the clipboard.\", \"Error Starting COSMOS Tool\", 0x50030)\n when /darwin/\n system(\"osascript -e 'display notification \\\"#{popup_error.class}:#{popup_error.message}:#{popup_error.backtrace[0].tr(\"'\\\"`<>\", '')}\\\" with title \\\"Error Starting COSMOS Tool\\\"'\")\n else\n message = \"#{popup_error.class}:#{popup_error.message}\\\\n\\\\n#{popup_error.backtrace.join(\"\\\\n\").tr(\"'\\\"`<>\", '')}\"\n command = \"zenity --info --text=\\\"#{message}\\\" --title=\\\"Error Starting COSMOS Tool\\\"\"\n success = system(command)\n system(\"notify-send \\\"Error Starting COSMOS Tool\\\" \\\"#{message}\\\"\") unless success\n end\n ensure\n raise error\n end\n end\nend", "def autoloaders; end", "def install_dependencies\n recipe_eval do\n run_context.include_recipe 'chef-sugar::default'\n run_context.include_recipe 'build-essential::default'\n\n case node.platform_family\n when 'debian'\n package 'curl'\n package 'git-core'\n package 'libxml2-dev'\n package 'libxslt-dev'\n package 'zlib1g-dev'\n package 'ncurses-dev'\n package 'libssl-dev'\n when 'freebsd'\n package 'textproc/libxml2'\n package 'textproc/libxslt'\n package 'devel/ncurses'\n when 'mac_os_x'\n run_context.include_recipe 'homebrew::default'\n package 'libxml2'\n package 'libxslt'\n package 'openssl'\n when 'rhel'\n package 'curl'\n package 'bzip2'\n package 'file'\n package 'git'\n package 'libxml2-devel'\n package 'libxslt-devel'\n package 'ncurses-devel'\n package 'zlib-devel'\n package 'openssl-devel'\n end\n end\n end", "def bootstrap\n self.class.loadChefLib\n stashHostSSLCertSecret\n splunkVaultInit\n if !@config['cleaned_chef']\n begin\n leave_ours = @config['scrub_groomer'] ? false : true\n preClean(leave_ours)\n rescue RuntimeError => e\n MU.log e.inspect, MU::ERR\n sleep 10\n retry\n end\n @config['cleaned_chef'] = true\n end\n\n _nat_ssh_key, _nat_ssh_user, _nat_ssh_host, canonical_addr, ssh_user, ssh_key_name = @server.getSSHConfig\n\n MU.log \"Bootstrapping #{@server.mu_name} (#{canonical_addr}) with knife\"\n\n run_list = [\"recipe[mu-tools::newclient]\"]\n run_list << \"mu-tools::gcloud\" if @server.cloud == \"Google\" or @server.config['cloud'] == \"Google\"\n\n json_attribs = {}\n if !@config['application_attributes'].nil?\n json_attribs['application_attributes'] = @config['application_attributes']\n json_attribs['skipinitialupdates'] = @config['skipinitialupdates']\n end\n\n# XXX this seems to break Knife Bootstrap\n# vault_access = if !@config['vault_access'].nil?\n# @config['vault_access']\n# else\n# []\n# end\n\n @server.windows? ? max_retries = 25 : max_retries = 10\n @server.windows? ? timeout = 1800 : timeout = 300\n retries = 0\n begin\n load MU.myRoot+'/modules/mu/monkey_patches/chef_knife_ssh.rb'\n if [email protected]?\n kb = ::Chef::Knife::Bootstrap.new([canonical_addr])\n kb.config[:use_sudo] = true\n kb.name_args = \"#{canonical_addr}\"\n kb.config[:distro] = 'chef-full'\n kb.config[:ssh_user] = ssh_user\n kb.config[:ssh_verify_host_key] = :accept_new\n kb.config[:forward_agent] = ssh_user\n kb.config[:identity_file] = \"#{Etc.getpwuid(Process.uid).dir}/.ssh/#{ssh_key_name}\"\n kb.config[:ssh_identity_file] = \"#{Etc.getpwuid(Process.uid).dir}/.ssh/#{ssh_key_name}\"\n else\n kb = ::Chef::Knife::BootstrapWindowsWinrm.new([@server.mu_name])\n kb.name_args = [@server.mu_name]\n kb.config[:manual] = true\n kb.config[:winrm_transport] = :ssl\n kb.config[:winrm_port] = 5986\n kb.config[:session_timeout] = timeout\n kb.config[:operation_timeout] = timeout\n# kb.config[:bootstrap_curl_options] = \"\"\n if retries % 2 == 0\n kb.config[:host] = canonical_addr\n kb.config[:winrm_authentication_protocol] = :basic\n kb.config[:winrm_user] = @server.config['windows_admin_username']\n kb.config[:winrm_password] = @server.getWindowsAdminPassword\n else\n kb.config[:host] = @server.mu_name\n kb.config[:winrm_authentication_protocol] = :cert\n kb.config[:winrm_client_cert] = \"#{MU.mySSLDir}/#{@server.mu_name}-winrm.crt\"\n kb.config[:winrm_client_key] = \"#{MU.mySSLDir}/#{@server.mu_name}-winrm.key\"\n end\n# kb.config[:ca_trust_file] = \"#{MU.mySSLDir}/Mu_CA.pem\"\n # XXX ca_trust_file doesn't work for some reason, so we have to set the below for now\n kb.config[:winrm_ssl_verify_mode] = :verify_none\n kb.config[:msi_url] = \"https://www.chef.io/chef/download?p=windows&pv=2012&m=x86_64&v=#{MU.chefVersion}\"\n end\n\n # XXX this seems to break Knife Bootstrap\n # if vault_access.size > 0\n # v = {}\n # vault_access.each { |vault|\n # v[vault['vault']] = [] if v[vault['vault']].nil?\n # v[vault['vault']] << vault['item']\n # }\n # kb.config[:bootstrap_vault_json] = JSON.generate(v)\n # end\n\n kb.config[:json_attribs] = JSON.generate(json_attribs) if json_attribs.size > 1\n kb.config[:run_list] = run_list\n kb.config[:chef_node_name] = @server.mu_name\n kb.config[:bootstrap_product] = \"chef\"\n kb.config[:bootstrap_version] = MU.chefVersion\n kb.config[:channel] = \"stable\"\n # XXX key off of MU verbosity level\n kb.config[:log_level] = :debug\n # kb.config[:ssh_gateway] = \"#{nat_ssh_user}@#{nat_ssh_host}\" if !nat_ssh_host.nil? # Breaking bootsrap\n\n MU.log \"Knife Bootstrap settings for #{@server.mu_name} (#{canonical_addr}), timeout set to #{timeout.to_s}\", MU::NOTICE, details: kb.config\n if @server.windows? and @server.windowsRebootPending?\n raise MU::Cloud::BootstrapTempFail, \"#{@server.mu_name} has a pending reboot\"\n end\n Timeout::timeout(timeout) {\n MU::Cloud.handleNetSSHExceptions\n kb.run\n }\n # throws Net::HTTPServerException if we haven't really bootstrapped\n ::Chef::Node.load(@server.mu_name)\n rescue SystemExit, Timeout::Error, MU::Cloud::BootstrapTempFail, Net::HTTPServerException, HTTPClient::ConnectTimeoutError, WinRM::WinRMError, Net::SSH::AuthenticationFailed, Net::SSH::Disconnect, Net::SSH::ConnectionTimeout, Net::SSH::Proxy::ConnectError, Net::SSH::Exception, Errno::ECONNRESET, Errno::EHOSTUNREACH, Errno::ECONNREFUSED, Errno::EPIPE, SocketError, IOError => e\n if retries < max_retries\n retries += 1\n # Bad Chef installs are possible culprits of bootstrap failures, so\n # try scrubbing them when that happens.\n # On Windows, even a fresh install comes up screwy disturbingly\n # often, so we let it start over from scratch if needed. Except for\n # the first attempt, which usually fails due to WinRM funk.\n if !e.is_a?(MU::Cloud::BootstrapTempFail) and\n !(e.is_a?(WinRM::WinRMError) and @config['forced_preclean']) and\n !@config['forced_preclean']\n begin\n preClean(false) # it's ok for this to fail\n rescue StandardError => e\n end\n MU::Groomer::Chef.purge(@server.mu_name, nodeonly: true)\n @config['forced_preclean'] = true\n @server.reboot if @server.windows? # *sigh*\n end\n MU.log \"#{@server.mu_name}: Knife Bootstrap failed #{e.inspect}, retrying in #{(10*retries).to_s}s (#{retries} of #{max_retries})\", MU::WARN, details: e.backtrace\n sleep 10*retries\n retry\n else\n raise MuError, \"#{@server.mu_name}: Knife Bootstrap failed too many times with #{e.inspect}\"\n end\n rescue StandardError => e\nMU.log e.inspect, MU::ERR, details: e.backtrace\nsleep 10*retries\nretry\n end\n\n\n # Now that we're done, remove one-shot bootstrap recipes from the\n # node's final run list\n [\"mu-tools::newclient\"].each { |recipe|\n begin\n ::Chef::Knife.run(['node', 'run_list', 'remove', @server.mu_name, \"recipe[#{recipe}]\"], {})\n rescue SystemExit => e\n MU.log \"#{@server.mu_name}: Run list removal of recipe[#{recipe}] failed with #{e.inspect}\", MU::WARN\n end\n }\n knifeAddToRunList(\"role[mu-node]\")\n knifeAddToRunList(\"recipe[mu-tools::selinux]\")\n\n grantSecretAccess(@server.mu_name, \"windows_credentials\") if @server.windows?\n grantSecretAccess(@server.mu_name, \"ssl_cert\")\n\n saveChefMetadata\n knifeAddToRunList(\"recipe[mu-tools::updates]\") if !@config['skipinitialupdates']\n # Making sure all Windows nodes get the mu-tools::windows-client recipe\n if @server.windows?\n knifeAddToRunList(\"recipe[mu-tools::windows-client]\")\n run(purpose: \"Base Windows configuration\", update_runlist: false, max_retries: 20)\n elsif !@config['skipinitialupdates']\n run(purpose: \"Base configuration\", update_runlist: false, max_retries: 20)\n end\n ::Chef::Knife.run(['node', 'run_list', 'remove', @server.mu_name, \"recipe[mu-tools::updates]\"], {}) if !@config['skipinitialupdates']\n ::Chef::Knife.run(['node', 'run_list', 'remove', @server.mu_name, \"recipe[mu-tools::selinux]\"], {})\n\n # This will deal with Active Directory integration.\n if !@config['active_directory'].nil?\n if @config['active_directory']['domain_operation'] == \"join\"\n knifeAddToRunList(\"recipe[mu-activedirectory::domain-node]\")\n run(purpose: \"Join Active Directory\", update_runlist: false, max_retries: max_retries)\n elsif @config['active_directory']['domain_operation'] == \"create\"\n knifeAddToRunList(\"recipe[mu-activedirectory::domain]\")\n run(purpose: \"Create Active Directory Domain\", update_runlist: false, max_retries: 15)\n elsif @config['active_directory']['domain_operation'] == \"add_controller\"\n knifeAddToRunList(\"recipe[mu-activedirectory::domain-controller]\")\n run(purpose: \"Add Domain Controller to Active Directory\", update_runlist: false, max_retries: 15)\n end\n end\n\n if !@config['run_list'].nil?\n knifeAddToRunList(multiple: @config['run_list'])\n end\n\n saveDeployData\n end", "def bindfs_fuse_loaded(machine)\n machine.guest.capability(:bindfs_fuse_installed)\n end" ]
[ "0.55694366", "0.54253983", "0.5415826", "0.5322679", "0.5308375", "0.53036255", "0.5302987", "0.52542716", "0.51947176", "0.51940125", "0.5183185", "0.5179463", "0.51720065", "0.5168565", "0.5144749", "0.5132236", "0.5041891", "0.4918058", "0.4871463", "0.48664063", "0.48571324", "0.48375776", "0.48362848", "0.48281342", "0.4821919", "0.48218125", "0.48147509", "0.48130247", "0.47813523", "0.4780205", "0.47713277", "0.47595686", "0.47578454", "0.47517243", "0.4740522", "0.47386596", "0.4728813", "0.47268623", "0.47246885", "0.47219476", "0.47086358", "0.47051322", "0.47024545", "0.47012562", "0.47012562", "0.46996686", "0.46962157", "0.46887073", "0.4676566", "0.4667347", "0.4659138", "0.46537778", "0.4653688", "0.46509856", "0.46500802", "0.46484327", "0.4648088", "0.46456364", "0.4640279", "0.46369258", "0.4633098", "0.46321753", "0.46321753", "0.46321753", "0.46321753", "0.46321753", "0.46321753", "0.46318915", "0.46132147", "0.45967525", "0.45899343", "0.4589869", "0.45857438", "0.45856127", "0.45850804", "0.45777354", "0.457654", "0.4574866", "0.4569864", "0.45677385", "0.45667204", "0.45615765", "0.4559199", "0.4559188", "0.4556179", "0.4555696", "0.4549451", "0.4542058", "0.45394957", "0.45352224", "0.45340115", "0.45325062", "0.45305783", "0.45246616", "0.45241722", "0.45205817", "0.45120734", "0.45108294", "0.45089805", "0.4507226" ]
0.71074486
0
Interfaces to load from F5 icontrol
def interfaces [ 'LocalLB.Monitor', 'LocalLB.NodeAddressV2', 'LocalLB.Pool', 'LocalLB.VirtualServer', 'Management.DeviceGroup', 'System.ConfigSync', 'System.Failover', 'System.Inet' ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interface(filename, _hue = 0)\n if interface_exist?(filename_with_language = filename + ($options&.language || 'en')) ||\n interface_exist?(filename_with_language = filename + 'en')\n filename = filename_with_language\n end\n load_image(@interface_cache, filename, Interface_Path, @interface_data)\n end", "def interfaces\n InterfaceCollection.open\n end", "def load_dependencies\n require 'f5-icontrol'\n end", "def load_user_interface()\n\t# locate the enclosing folder and get the bricks file within it\n\tfolder = File.dirname( $0 )\n\tgui_path = File.join( folder, \"gui.bricks\" )\n\turl = Java::File.new( gui_path ).toURI.toURL\n\t\n\t# generate a window reference resource and pass the desired constructor arguments\n\twindow_reference = WindowReference::getDefaultInstance( url, \"MainWindow\" )\n\t\n\tmain_controller = ControlApp.new window_reference\n\tmain_controller.displayWindow\nend", "def load_user_interface()\n\t# locate the enclosing folder and get the bricks file within it\n\tfolder = File.dirname( $0 )\n\tgui_path = File.join( folder, \"gui.bricks\" )\n\turl = Java::File.new( gui_path ).toURI.toURL\n\t\n\t# generate a window reference resource and pass the desired constructor arguments\n\twindow_reference = WindowReference::getDefaultInstance( url, \"MainWindow\" )\n\t\n\tmain_controller = ControlApp.new window_reference\n\tmain_controller.displayWindow\nend", "def load_interface(interface)\n # This require will only run once. If we repeat it, it is not\n # loaded again\n require \"virtualbox/com/interface/#{@__version}/#{interface}\"\n\n # Find the module based on the version and name and return it\n Object.module_eval(\"::VirtualBox::COM::Interface::#{version_const}::#{interface}\")\n end", "def interface; end", "def interface; end", "def load_interface(flush_it = false)\n if flush_it\n dispose_bitmaps_from_cache_tab(@interface_cache)\n else\n @interface_cache = {}\n @interface_data = Yuki::VD.new(PSDK_PATH + '/master/interface', :read)\n end\n end", "def create_icontrol(hostname) # rubocop:disable AbcSize\n load_dependencies\n f5_creds = chef_vault_item(node['f5-bigip']['credentials']['databag'], node['f5-bigip']['credentials']['item'])\n if node['f5-bigip']['credentials']['host_is_key']\n f5_creds = f5_creds[hostname]\n else\n f5_creds = f5_creds[node['f5-bigip']['credentials']['key']] unless node['f5-bigip']['credentials']['key'].empty?\n end\n F5::IControl.new(hostname,\n f5_creds['username'],\n f5_creds['password'],\n interfaces).get_interfaces\n end", "def load; end", "def load; end", "def load; end", "def load\n end", "def load\n end", "def load\r\n \r\n end", "def extended_interfaces; end", "def load_interfaces_details( app_path )\n interfaces = Array.new\n interfaces_path = \"#{app_path}/interfaces/\"\n Dir.entries(interfaces_path).select {|entry| File.directory?(File.join(interfaces_path, entry)) && !(entry =='.' || entry == '..') }.each do |iface_dir|\n interfaces.push extract_interface_info( interfaces_path, iface_dir )\n end\n interfaces\nend", "def load\n end", "def read_bridged_interfaces\n end", "def interface; self.class.interface; end", "def included_interfaces; end", "def load!; end", "def interface_cache; end", "def load_framework_interfaces\n interfaces = Array.new\n components_directory = \"#{File.dirname(__FILE__)}/../\"\n Dir.entries(components_directory).select {|entry| File.directory?(File.join(components_directory, entry)) && !(entry =='.' || entry == '..') }.each do |iface_dir|\n interfaces.push(extract_interface_info( components_directory, iface_dir)) if File.exist?(\"#{components_directory}#{iface_dir}/index.html\")\n end\n interfaces\nend", "def load\n end", "def load\n end", "def load\n end", "def load\n raise NotImplementedError, 'You must be implement \"load\" method.'\n end", "def interface_image(filename)\n if interface_exist?(filename_with_language = filename + ($options&.language || 'en')) ||\n interface_exist?(filename_with_language = filename + 'en')\n filename = filename_with_language\n end\n load_image(@interface_cache, filename, Interface_Path, @interface_data, Image)\n end", "def import_gifts_inst\n end", "def fc_interfaces\n provider.fc_interfaces\n end", "def load_all; end", "def load_all; end", "def load_all; end", "def loader; end", "def interface_methods; end", "def loaded()\n end", "def autoloaders; end", "def define_ui_tasks\n @ui_files.each do | ui_file |\n ui_header = ui_header_path( ui_file )\n file ui_header => [ @objects_path, ui_file ] do |t|\n command = \"uic #{ ui_file } -o #{ ui_header }\"\n shell command\n end\n end\n end", "def config\r\n $ie.frame(:index, 2).image(:id, 'imgConfigure')\r\nend", "def load( name )\n\t\t\traise NotImplementedError,\n\t\t\t\t\"required method 'load' not implemented in '#{self.class.name}'\"\n\t\tend", "def versioned_interface(interface)\n loaded_interfaces[interface] ||= load_interface(interface)\n end", "def onLoad\n end", "def openCuratorInterface \n \"openCuratorInterface\" \n end", "def loadHandinPage()\n end", "def interfaces\n Vedeu::Interfaces.registered\n end", "def connect\n @interface.connect\n end", "def reload(file)\n mylog = Logger[Ciowa_log]\n data = file.read\n \n code_text = ''\n bindings_text = ''\n \n # Read the codefile and check for bindings embedded into it.\n codefile_path = file.path.sub(@@view_regex,C_iwa)\n if FileTest.exist?(codefile_path) and FileTest.readable?(codefile_path)\n File.open(codefile_path) do |codefile|\n codedata = codefile.read.gsub(/\\cM/,C_empty)\n code_text, bindings_text = *get_code_and_bindings(codedata)\n end\n else\n codedata = data.gsub(/\\cM/,C_empty)\n unless /<%.*?%>/m.match(codedata)\n codedata,codefile_path = defaultScript(file)\n codedata = codedata.gsub(/\\cM/,C_empty)\n code_text, bindings_text = *get_code_and_bindings(codedata)\n else\n codefile_path = file.path\n codedata = codedata.sub(/<%(.*?)%>/m, C_empty)\n code_text = $1\n codedata = codedata.sub(/<\\?(.*?)\\?>/m, C_empty)\n bindings_text = $1.gsub(BindingCommentsRegexp,C_empty) if $1\n data = codedata\n end\n end\n \n # Now check for a dedicated bindings file.\n # In a dedicated bindings file, one can have multiple bindings\n # blocks with comments (lines with a first non-whitespace character\n # of #) anywhere. This is just a feature to allow for some intelligent\n # organization of bindings and comments, if desired.\n bindingfile_path = file.path.sub(@@view_regex,C_bnd)\n if FileTest.exist?(bindingfile_path) and FileTest.readable?(bindingfile_path)\n File.open(bindingfile_path) do |bindingfile|\n bindingdata = bindingfile.read.gsub(/\\cM/,C_empty)\n bindingdata = bindingdata.gsub(/<\\?/,C_empty).gsub(/\\?>/,C_empty).gsub(BindingCommentsRegexp,C_empty) if bindingdata\n bindings_text << bindingdata\n end\n end\n \n # There's a bit of magic that has to occur, now. In order to\n # support the notion of the subdirectory that the script file\n # is found in relating to the namespace (using modules as\n # namespace) for the component, reload() needs to figure out\n # just what the namespace is supposed to be for the file, then\n # check to see if that namespace has a already been created,\n # create it if it has not, and finally eval the script file\n # content within the context of the namespace (module).\n \n # First, what's the namespace? Basically, we subtract the\n # Iowa docroot from the file path and see what is left.\n \n my_docroot = @docroot\n my_docroot << C_slash unless my_docroot[-1,1] == C_slash\n script_namespace_parts = file.path.gsub(/^#{my_docroot}/,C_empty).split(C_slash).reject {|x| x == C_empty}\n script_namespace_parts.delete(C_dot)\n script_namespace_parts.delete(C_dotdot)\n class_name = script_namespace_parts.pop.split(C_dot)[0]\n script_namespace_parts.unshift(CContentClasses)\n \n script_namespace = (['Iowa::Application'] + script_namespace_parts).join(ClassSeparator)\n\n pre = ''\n post = ''\n \n script_namespace_parts.each do |sym|\n pre << \"module #{sym}; extend IowaComponentMixins;\"\n post << \"end;\"\n end\n \n mylog.info \"Creating namespace #{script_namespace}\"\n eval(pre + post)\n eval(script_namespace)\n namespace_class = script_namespace.split(ClassSeparator).inject(Object) { |o,n| o.const_get n }\n \n begin \n # Now execute our code within the namespace.\n\n namespace_class.class_eval(code_text,codefile_path)\n new_class = \"#{script_namespace}::#{class_name}\".split(ClassSeparator).inject(Object) { |o,n| o.const_get n }\n\n bindings = BindingsParser.new((bindings_text ? bindings_text : C_empty),new_class).bindings\n\n fdn = File.dirname(file.path)\n compiled_template_file = File.join(fdn,\".#{new_class.name}.iwt\")\n load_precompiled = false\n if FileTest.exist?(compiled_template_file) and File.mtime(compiled_template_file) > checkMtime(file.path)\n begin\n mylog.info \"Loading precompiled template: #{compiled_template_file}\"\n @templateCache[file.path] = WeakRef.new(Marshal.load(File.read(compiled_template_file)))\n load_recompiled = true\n rescue Exception => e\n mylog.info \"Error with precompiled template: #{e}\"\n end\n end\n unless load_recompiled\n mylog.info \"Parsing #{file.path} into template cache\"\n if self.class.serializeCompiledTemplates && new_class.serializeCompiledTemplate\n @templateCache[file.path] = WeakRef.new(TemplateParser.new(data, bindings,new_class,fdn).root)\n else\n @templateCache[file.path] = TemplateParser.new(data, bindings,new_class,fdn).root\n end\n Logger[Ciowa_log].info(\" Done parsing #{file.path}\")\n end\n rescue Exception => e\n mylog.info \"There was an error while processing #{file.path}:\\n#{e.to_s}\\n#{e.backtrace}\\n\"\n end\n end", "def interface(data_set_name)\n Interfaces::BasicInterface.new(self, data_set_name)\n end", "def import_show \n end", "def import(ovf)\n end", "def interface(name, &block)\n raise Vedeu::Error::MissingRequired unless name\n raise Vedeu::Error::RequiresBlock unless block_given?\n\n attributes = { client: client(&block), name: name }\n\n interface = Vedeu::Interfaces::Interface\n .build(attributes, &block)\n .store\n\n add_buffers!(name)\n add_cursor!(name)\n add_editor!(name) if interface.editable?\n add_focusable!(name)\n add_keymap!(name)\n\n interface\n end", "def printInterface(pageName, concreteCode, ajaxcontrols=nil, css=nil, effects=nil, appData=\"\")\r\n findAjaxControls(ajaxcontrols) unless ajaxcontrols.nil?\r\n findCSS(css) unless css.nil?\r\n findEffects(effects) unless effects.nil?\r\n data = get_events(pageName)\r\n @eventData << \"if (interfaceName == '#{pageName}') { \\n\"\r\n data = \"{\\\"nodes\\\":[#{data}]}\" unless data.nil? or data.blank?\r\n @eventData << \"return '#{data}' \\n\" \r\n @eventData << \"} \\n\"\r\n data = get_decorations(pageName)\r\n @animData << \"if (interfaceName == '#{pageName}') { \\n\"\r\n data = \"{\\\"nodes\\\":[#{data}]}\" unless data.nil? or data.blank?\r\n @animData << \"return '#{data}' \\n\" \r\n @animData << \"} \\n\"\r\n data = get_transitions(pageName)\r\n @transData << \"if (interfaceName == '#{pageName}') { \\n\"\r\n data = \"{\\\"nodes\\\":[#{data}]}\" unless data.nil? or data.blank?\r\n @transData << \"return '#{data}' \\n\" \r\n @transData << \"} \\n\"\r\n begin\r\n # Exceptions raised by this code will\r\n # be caught by the following rescue clause\r\n concreteCode.each { |line|\r\n @bodyContent << line\r\n divId = line.slice(/<div id='\\S+'/)\r\n if (!divId.nil?)\r\n divId.slice!('<div id=\\'')\r\n divId.slice!('\\'')\r\n interfaceToInclude = @references[divId]\r\n if (!interfaceToInclude.nil?)\r\n interfObj = SWUI::Interface.find_by.interface_name(interfaceToInclude).execute.first\r\n\r\n if (interfObj.dynamic==\"true\") then\r\n compiler = AICompiler.new\r\n abstr_spec= SWUI::AbsInterface.preCompile(interfObj.abstract_spec.first,true, appData).first\r\n compiler.parseXML(abstr_spec)\r\n interfObj.concrete_code = compiler.concrete_code\r\n end\r\n \r\n codeToInclude = interfObj.concrete_code.first\r\n ajaxcontrolsToInclude = interfObj.ajaxcontrols.first\r\n cssToInclude = interfObj.concrete_interfaces.first\r\n effectsToInclude= interfObj.effects.first\r\n printInterface(interfaceToInclude, codeToInclude, ajaxcontrolsToInclude, cssToInclude, effectsToInclude, appData)\r\n end\r\n end\r\n }\r\n return true\r\n rescue Exception\r\n @bodyContent << \"Interface #{pageName} not found.\\n\"\r\n @bodyContent << $! \r\n return false\r\n end\r\n end", "def initialize()\n #path to openstudio library\n @lib_path = \"C:\\\\Program Files (x86)\\\\OpenStudio 1.2.0\\\\share\\\\openstudio\\\\OSApp\\\\hvaclibrary\\\\hvac_library.osm\"\n @library = BTAP::FileIO::load_osm(@lib_path, \"OpenStudio_Library\")\n end", "def interface\n @interface ||= EC2.find_interface(description)\n end", "def load\r\n\t\tload_file\r\n\t\tconfigure\r\n\tend", "def autoloader; end", "def cntrl_settg; det.image(:id, 'imgCtrlSettings'); end", "def load(name); end", "def load(path)\n fail MethodDenied, :load_cf if infobase.read_only?\n infobase.designer do\n loadCfg path\n end.run.wait.result.verify!\n path\n end", "def Com5 # Gestion variables\n \n end", "def control; tab.image(:name, 'imgControl'); end", "def load\n self.class.load self # pass the loading off to the class\n end", "def read_host_only_interfaces\n end", "def initialize\n @plugboard = eval(File.read(\"./parts/plugboard\"))\n end", "def load_data\n raise NotImplementedError\n end", "def initialize()\n @User32 = DL.dlopen(\"user32\")\n\n # we must determine the path we are in\n @path_to_clicker = File.expand_path(File.dirname(__FILE__))\n end", "def use(name)\n Vedeu::Interface.new(Vedeu::Interfaces.find(name))\n end", "def current_load\n NotImplementedError\n end", "def configure_icube\n XMLA.configure do |c|\n c.endpoint = \"http://localhost:8282/icCube/xmla\"\n c.catalog = \"GOSJAR\"\n end\nend", "def enumImager\n #callBackImagerEnum\n Imager.imagerEnumEvent = url_for(:action => :callBackImagerEnum)\n Imager.enumerate\n end", "def storages\n reflective_auto_load_adapter_extension\n storages # call the overrided method\n end", "def interface(name = '', &block)\n API::Interface.define({ name: name }, &block)\n end", "def interactive_generator\n webGui = WebGui.new(\"\")\n webGui.start\nend", "def monitor; tab.image(:name, 'imgMonitor'); end", "def import\n end", "def import\n end", "def import\n end", "def import\n end", "def set_cachenetflix_interface\n @cachenetflix_interface = CachenetflixInterface.find(params[:id])\n end", "def implements(intf)\n @intfs[intf.name] = intf\n end", "def load_path; end", "def registry; end", "def registry; end", "def methods() end", "def interfaces_list\n\t\t[\n\t\t\t{\n\t\t\t\t'uri' => '/',\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'purpose' => 'REST API Structure and Capability Discovery'\n\t\t\t}\n\t\t]\n\tend", "def src; end", "def src; end", "def src; end", "def open\n raise NotImplementedError, \"You must implement #open in your driver.\"\n end", "def name\n\t\t\"Interface Fingerprinter\"\n\tend", "def load\n @bot_ip = @network.bot_ip(@config) # Helper to set bot_ip\n case @config['type']\n when 'script'\n @lang_settings = lang_settings(@config['language'])\n filename = \"#{@name}#{@lang_settings[:file_type]}\"\n load_docker(filename)\n write_script(filename)\n when 'container', 'docker'\n # load the docker container set in the config\n load_passive unless @config['listen_type'] == 'active'\n load_active if @config['listen_type'] == 'active'\n when 'api'\n load_api\n else\n raise \"Plugin: #{@name}: only 'script', 'container', and 'api' are known\"\n end\n help_load\n end", "def set_ipranedge_interface\n @ipranedge_interface = IpranedgeInterface.find(params[:id])\n end", "def auto_io(name, read_size, input_io); end", "def load_runner(app = T.unsafe(nil)); end", "def load_runner(app = T.unsafe(nil)); end", "def initialize\n load_data\n end", "def load_all\n @internal_loader.load_all(self)\n end", "def methods; end", "def methods; end" ]
[ "0.64096326", "0.63061947", "0.6176119", "0.6064492", "0.6064492", "0.5966546", "0.59491605", "0.59491605", "0.59329134", "0.593005", "0.58747005", "0.58747005", "0.58747005", "0.58694535", "0.58694535", "0.58519673", "0.58460045", "0.58311874", "0.5830217", "0.572757", "0.57238626", "0.5722962", "0.56881803", "0.5684596", "0.5652232", "0.55395234", "0.55395234", "0.55395234", "0.5469966", "0.5446401", "0.53867936", "0.53823507", "0.5357174", "0.5357174", "0.5357174", "0.5308921", "0.5290254", "0.5278519", "0.5262339", "0.5218121", "0.52095485", "0.52024823", "0.5168529", "0.51489586", "0.5104905", "0.5086785", "0.5073903", "0.5067375", "0.5049524", "0.5026259", "0.5025899", "0.5021279", "0.50114423", "0.5008272", "0.49997935", "0.49612138", "0.49575225", "0.4956721", "0.4949677", "0.49377123", "0.4935713", "0.49349722", "0.49343246", "0.4922999", "0.48929486", "0.48895553", "0.48856217", "0.48815528", "0.4869458", "0.4862259", "0.48590997", "0.4850904", "0.48491812", "0.48486042", "0.4833921", "0.48275465", "0.48242512", "0.48242512", "0.48242512", "0.48242512", "0.4820663", "0.48136756", "0.480776", "0.48003316", "0.48003316", "0.47911942", "0.47841868", "0.4779673", "0.4779673", "0.4779673", "0.47793078", "0.47720173", "0.47602853", "0.47524878", "0.47338656", "0.47270182", "0.47270182", "0.47239625", "0.4713651", "0.47116736", "0.47116736" ]
0.0
-1
Retrieve/Create load balancer from list of load balancers for a resource
def load_balancer # rubocop:disable AbcSize raise 'Can not determine hostname to load client for' if @new_resource.f5.nil? @@load_balancers ||= [] add_lb(@new_resource.f5) if @@load_balancers.empty? add_lb(@new_resource.f5) if @@load_balancers.find { |lb| lb.name == @new_resource.f5 }.nil? @@load_balancers.find { |lb| lb.name == @new_resource.f5 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_balancer_data(balancer = nil)\n params = Smash.new(\"Action\" => \"DescribeLoadBalancers\")\n if balancer\n params[\"LoadBalancerNames.member.1\"] = balancer.id || balancer.name\n end\n result = all_result_pages(nil, :body,\n \"DescribeLoadBalancersResponse\", \"DescribeLoadBalancersResult\",\n \"LoadBalancerDescriptions\", \"member\") do |options|\n request(\n :method => :post,\n :path => \"/\",\n :form => options.merge(params),\n )\n end\n if balancer\n health_result = all_result_pages(nil, :body,\n \"DescribeInstanceHealthResponse\", \"DescribeInstanceHealthResult\",\n \"InstanceStates\", \"member\") do |options|\n request(\n :method => :post,\n :path => \"/\",\n :form => options.merge(\n \"LoadBalancerName\" => balancer.id || balancer.name,\n \"Action\" => \"DescribeInstanceHealth\",\n ),\n )\n end\n end\n result.map do |blr|\n (balancer || Balancer.new(self)).load_data(\n Smash.new(\n :id => blr[\"LoadBalancerName\"],\n :name => blr[\"LoadBalancerName\"],\n :state => :active,\n :status => \"ACTIVE\",\n :created => blr[\"CreatedTime\"],\n :updated => blr[\"CreatedTime\"],\n :public_addresses => [\n Balancer::Address.new(\n :address => blr[\"DNSName\"],\n :version => 4,\n ),\n ],\n :servers => [blr.get(\"Instances\", \"member\")].flatten(1).compact.map { |i|\n Balancer::Server.new(self.api_for(:compute), :id => i[\"InstanceId\"])\n },\n ).merge(\n health_result.nil? ? {} : Smash.new(\n :server_states => health_result.nil? ? nil : health_result.map { |i|\n Balancer::ServerState.new(\n self.api_for(:compute),\n :id => i[\"InstanceId\"],\n :status => i[\"State\"],\n :reason => i[\"ReasonCode\"],\n :state => i[\"State\"] == \"InService\" ? :up : :down,\n )\n },\n )\n )\n ).valid_state\n end\n end", "def describe_load_balancers(ids = [], options = {})\n ids = [*ids]\n params = {}\n params['Marker'] = options[:marker] if options[:marker]\n params['PageSize'] = options[:page_size] if options[:page_size]\n params.merge!(Fog::AWS.serialize_keys('LoadBalancerArns', ids)) if ids.any?\n params.merge!(Fog::AWS.serialize_keys('Names', options[:names])) if options[:names]\n request({\n 'Action' => 'DescribeLoadBalancers',\n :parser => Fog::Parsers::AWS::ELBV2::DescribeLoadBalancers.new\n }.merge!(params))\n end", "def get_loadbalancer(name=resource[:load_balancer])\n get_cloud_connection()\n args = []\n\n args << @connection_resource[:user]\n args << @connection_resource[:pass]\n args << @connection_resource[:location] if @connection_resource[:location]\n\n @loadbalancer_connection = Puppet::Type::Loadbalancer::ProviderElb.connection(*args)\n\n load_balancer = @loadbalancer_connection.load_balancers.find {|lb|\n lb.id == name\n }\n end", "def find(options = {})\n raise \"Unable to locate the LoadBalancer named '#{options[:name]}'\" unless options[:id]\n response = Profitbricks.request :get_load_balancer, load_balancer_id: options[:id]\n PB::LoadBalancer.new(response)\n end", "def load_current_resource\n\n @current_lb = load_balancer_by_name(new_resource.lb_name)\n\n @current_resource = Chef::Resource::LbLoadBalancer.new(new_resource.lb_name)\n @current_resource.lb_name(new_resource.lb_name)\n @current_resource.aws_access_key(new_resource.aws_access_key)\n @current_resource.aws_secret_access_key(new_resource.aws_secret_access_key)\n @current_resource.region(new_resource.region)\n @current_resource.listeners(new_resource.listeners)\n @current_resource.timeout(new_resource.timeout)\n\n if @current_lb\n @current_resource.availability_zones(@current_lb['AvailabilityZones'])\n @current_resource.instances(@current_lb['Instances'])\n end\n @current_resource.availability_zones || @current_resource.availability_zones([])\n @current_resource.instances || @current_resource.instances([])\n\n if new_resource.instances.nil? && new_resource.search_query\n new_resource.instances(search(:node, new_resource.search_query).map { |n| n['ec2']['instance_id']})\n end\n\n all_zones = availability_zone_for_instances(new_resource.instances)\n unique_zones = all_zones.compact.uniq\n\n if new_resource.availability_zones.nil?\n new_resource.availability_zones(unique_zones)\n end\nend", "def describe_load_balancers(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeLoadBalancers'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :server_id\n\t\t\targs[:query]['ServerId'] = optional[:server_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def add_lb(hostname)\n @@load_balancers << LoadBalancer.new(hostname, create_icontrol(hostname))\n end", "def attach_to_elbs(instance:, load_balancers:)\n check_arguments(instance: instance, load_balancers: load_balancers)\n\n if load_balancers.empty?\n log(\"No load balancers to attach to\")\n return {}\n end\n\n @lb_wait_params = []\n registered_instances = {} # return this\n\n load_balancers.each do |lb|\n params = {\n load_balancer_name: lb.load_balancer_name,\n instances: [{ instance_id: instance.ec2_instance_id }]\n }\n\n result = @elb_client.register_instances_with_load_balancer(params)\n\n registered_instances[lb.load_balancer_name] = result\n @lb_wait_params << params\n end\n\n log(\"Re-attaching instance #{instance.hostname} to all load balancers\")\n\n unless @regional_deploy\n wait_for_re_attach(@lb_wait_params)\n end\n\n registered_instances\n end", "def retrieve_elb(name)\n Clients.elb.describe_load_balancers(\n load_balancer_names: [name],\n ).load_balancer_descriptions[0]\nend", "def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :address\n\t\t\targs[:query]['Address'] = optional[:address]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :is_public_address\n\t\t\targs[:query]['IsPublicAddress'] = optional[:is_public_address]\n\t\tend\n\t\tif optional.key? :load_balancer_mode\n\t\t\targs[:query]['LoadBalancerMode'] = optional[:load_balancer_mode]\n\t\tend\n\t\tif optional.key? :load_balancer_name\n\t\t\targs[:query]['LoadBalancerName'] = optional[:load_balancer_name]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def fetch_from_ec2_loadbalancer\n instances_for_deploy = []\n loadbalancer lb_webserver, :web\n instances_for_deploy\nend", "def fetch_from_ec2_loadbalancer\n instances_for_deploy = []\n loadbalancer lb_webserver, :web\n instances_for_deploy\nend", "def describe_load_balancers(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeLoadBalancers'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :address\n\t\t\targs[:query]['Address'] = optional[:address]\n\t\tend\n\t\tif optional.key? :address_type\n\t\t\targs[:query]['AddressType'] = optional[:address_type]\n\t\tend\n\t\tif optional.key? :internet_charge_type\n\t\t\targs[:query]['InternetChargeType'] = optional[:internet_charge_type]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :master_zone_id\n\t\t\targs[:query]['MasterZoneId'] = optional[:master_zone_id]\n\t\tend\n\t\tif optional.key? :network_type\n\t\t\targs[:query]['NetworkType'] = optional[:network_type]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :security_status\n\t\t\targs[:query]['SecurityStatus'] = optional[:security_status]\n\t\tend\n\t\tif optional.key? :server_id\n\t\t\targs[:query]['ServerId'] = optional[:server_id]\n\t\tend\n\t\tif optional.key? :slave_zone_id\n\t\t\targs[:query]['SlaveZoneId'] = optional[:slave_zone_id]\n\t\tend\n\t\tif optional.key? :v_switch_id\n\t\t\targs[:query]['VSwitchId'] = optional[:v_switch_id]\n\t\tend\n\t\tif optional.key? :vpc_id\n\t\t\targs[:query]['VpcId'] = optional[:vpc_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def allocate_load_balancer(action_handler, lb_spec, lb_options, machine_specs)\n end", "def populate\n response = @connection.lbreq(\"GET\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@id.to_s)}\",@lbmgmtport,@lbmgmtscheme)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n data = JSON.parse(response.body)['loadBalancer']\n @id = data[\"id\"]\n @name = data[\"name\"]\n @protocol = data[\"protocol\"]\n @port = data[\"port\"]\n @algorithm = data[\"algorithm\"]\n @connection_logging = data[\"connectionLogging\"][\"enabled\"]\n @status = data[\"status\"]\n @timeout = data[\"timeout\"]\n true\n end", "def get_traffic_by_loadbalancer(loadbalancer_id, attributes = {}, headers = {})\n Validators::Traffic.validate_attributes!(attributes, :list)\n get!(\"traffics/loadbalancers/#{loadbalancer_id}\", attributes, headers)\n end", "def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :address_type\n\t\t\targs[:query]['AddressType'] = optional[:address_type]\n\t\tend\n\t\tif optional.key? :bandwidth\n\t\t\traise ArgumentError, 'bandwidth must be equal or greater than -1' unless optional[:bandwidth] < -1\n\t\t\traise ArgumentError, 'bandwidth must be equal or less than 1000' unless optional[:bandwidth] > 1000\n\t\t\targs[:query]['Bandwidth'] = optional[:bandwidth]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :internet_charge_type\n\t\t\targs[:query]['InternetChargeType'] = optional[:internet_charge_type]\n\t\tend\n\t\tif optional.key? :load_balancer_name\n\t\t\targs[:query]['LoadBalancerName'] = optional[:load_balancer_name]\n\t\tend\n\t\tif optional.key? :master_zone_id\n\t\t\targs[:query]['MasterZoneId'] = optional[:master_zone_id]\n\t\tend\n\t\tif optional.key? :max_conn_limit\n\t\t\targs[:query]['MaxConnLimit'] = optional[:max_conn_limit]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :security_status\n\t\t\targs[:query]['SecurityStatus'] = optional[:security_status]\n\t\tend\n\t\tif optional.key? :slave_zone_id\n\t\t\targs[:query]['SlaveZoneId'] = optional[:slave_zone_id]\n\t\tend\n\t\tif optional.key? :v_switch_id\n\t\t\targs[:query]['VSwitchId'] = optional[:v_switch_id]\n\t\tend\n\t\tif optional.key? :vpc_id\n\t\t\targs[:query]['VpcId'] = optional[:vpc_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def create_elb(elb)\n resp = aws_api_connect(\"ELB_Client\")\n begin\n pants = resp.create_load_balancer({\n load_balancer_name: elb[:name],\n listeners: [\n {\n protocol: elb[:protocol],\n load_balancer_port: elb[:port],\n instance_protocol: elb[:instnace_protocol],\n instance_port: elb[:instance_port],\n ssl_certificate_id: elb[:ssl_cert],\n },\n ],\n subnets: elb[:subnets],\n security_groups: elb[:security_groups],\n })\n rescue Aws::ElasticLoadBalancing::Errors::DuplicateLoadBalancerName\n puts \"Load Balancer #{elb[:name]} already exists, bypassing\"\n rescue Aws::ElasticLoadBalancing::Errors::Throttling\n puts \"api throttled, retrying\"\n # TODO: Add exponential backoff\n sleep(5)\n retry\n end\n end", "def createCLB(elbv1, sg_tcp_80_lb, pub_net1_id, pub_net2_id)\n # TODO: Remove CLB by name if create fails to fully create\n\n # Create CLB\n response = elbv1.create_load_balancer(load_balancer_name: 'AutoCLB',\n subnets: [pub_net1_id, pub_net2_id],\n security_groups: [sg_tcp_80_lb],\n listeners: [{ protocol: 'HTTP',\n load_balancer_port: 80,\n instance_protocol: 'HTTP',\n instance_port: 80 }])\n clb_dns_name = response.dns_name\n puts \"clb_dns_name = #{clb_dns_name}\"\n clb_dns_name # return\nend", "def create_load_balancer_pool_with_http_info(lb_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesLoadbalancerApi.create_load_balancer_pool ...'\n end\n # verify the required parameter 'lb_pool' is set\n if @api_client.config.client_side_validation && lb_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_pool' when calling ManagementPlaneApiServicesLoadbalancerApi.create_load_balancer_pool\"\n end\n # resource path\n local_var_path = '/loadbalancer/pools'\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(lb_pool)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LbPool')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesLoadbalancerApi#create_load_balancer_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @cabinet_balancer = Balancer.new(create_params)\n\n respond_to do |format|\n if @cabinet_balancer.save\n format.html { redirect_to cabinet_balancers_path, notice: I18n.t('created') }\n format.json { render :show, status: :created, location: @cabinet_balancer }\n else\n format.html { render :new }\n format.json { render json: @cabinet_balancer.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @cabinet_balancers = Balancer.all\n end", "def balancer_reload(balancer)\n if balancer.persisted?\n begin\n load_balancer_data(balancer)\n rescue Miasma::Error::ApiError::RequestError => e\n if e.response_error_msg.include?(\"LoadBalancerNotFound\")\n balancer.state = :terminated\n balancer.status = \"terminated\"\n balancer.valid_state\n else\n raise\n end\n end\n end\n balancer\n end", "def create\n @loadbalancer = Loadbalancer.new(params[:loadbalancer])\n @loadbalancer.account_id = @oeaccount.id\n respond_to do |format|\n if @loadbalancer.save\n format.html { redirect_to loadbalancers_url, notice: 'Loadbalancer was successfully created.' }\n format.json { render json: @loadbalancer, status: :created, location: @loadbalancer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @loadbalancer.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_load_balancer_pools_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesLoadbalancerApi.list_load_balancer_pools ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiServicesLoadbalancerApi.list_load_balancer_pools, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiServicesLoadbalancerApi.list_load_balancer_pools, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/loadbalancer/pools'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'LbPoolListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesLoadbalancerApi#list_load_balancer_pools\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create name, type, attributes = {}\n\n attribute_list = []\n\n attributes.each do |attr_name,values|\n [values].flatten.each do |value|\n attribute_list << { \n :attribute_name => attr_name, \n :attribute_value => value.to_s \n }\n end\n end\n\n client.create_load_balancer_policy(\n :load_balancer_name => load_balancer.name,\n :policy_name => name.to_s,\n :policy_type_name => type.to_s,\n :policy_attributes => attribute_list)\n\n LoadBalancerPolicy.new(load_balancer, name, :type => type.to_s)\n\n end", "def balancer_all(options = {})\n load_balancer_data\n end", "def balancer\n @balancer ||= RightSupport::Net::RequestBalancer.new(@@hostnames,\n :policy=>RightSupport::Net::Balancing::StickyPolicy)\n end", "def create_rightscale_tag_load_balancer(resource_name)\n ChefSpec::Matchers::ResourceMatcher.new('rightscale_tag_load_balancer', :create, resource_name)\n end", "def set_cabinet_balancer\n @cabinet_balancer = Balancer.find(params[:id])\n end", "def add_load_balancer(name, ports, ip_address)\n\n unless ports.is_a? Array\n ports = [ ports ]\n end\n\n if name.nil?\n name = \"lb#{RandomName.create(5,3)}\"\n end\n\n if ip_address.is_a? String\n ip_address = public_ipaddress \"#{name}-addr\" do\n dns_settings domain_name_label: ip_address\n end\n end\n\n lb = load_balancer name do\n\n if ip_address.nil?\n fics = frontend_ipconfigurations name: name + '-feconf'\n else\n fics = frontend_ipconfigurations name: name + '-feconf',\n public_ipaddress: ip_address\n end\n\n pools = backend_address_pools name: name + '-pool'\n\n ports.each do |port|\n\n p = probes name: name + \"-probe#{port}\",\n protocol: 'Tcp',\n port: port,\n number_of_probes: 2,\n interval_in_seconds: 15\n\n load_balancing_rules name: \"rule#{port}\",\n frontend_ipconfiguration: fics[0],\n backend_address_pool: pools[0],\n protocol: 'Tcp',\n frontend_port: port,\n backend_port: port,\n idle_timeout_in_minutes: 15,\n probe: p[0]\n end\n\n end\n\n end", "def create_load_balancer_listeners(lb_name, listeners)\n params = {}\n\n listener_protocol = []\n listener_lb_port = []\n listener_instance_port = []\n listener_instance_protocol = []\n listener_ssl_certificate_id = []\n listeners.each do |listener|\n listener_protocol.push(listener['Protocol'])\n listener_lb_port.push(listener['LoadBalancerPort'])\n listener_instance_port.push(listener['InstancePort'])\n listener_instance_protocol.push(listener['InstanceProtocol'])\n listener_ssl_certificate_id.push(listener['SSLCertificateId'])\n end\n\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.Protocol', listener_protocol))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.LoadBalancerPort', listener_lb_port))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.InstancePort', listener_instance_port))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.InstanceProtocol', listener_instance_protocol))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.SSLCertificateId', listener_ssl_certificate_id))\n\n request({\n 'Action' => 'CreateLoadBalancerListeners',\n 'LoadBalancerName' => lb_name,\n :parser => Fog::Parsers::AWS::ELB::Empty.new\n }.merge!(params))\n end", "def attach_load_balancer_to_subnets(subnet_ids, lb_name)\n params = Fog::AWS.indexed_param('Subnets.member', [*subnet_ids])\n request({\n 'Action' => 'AttachLoadBalancerToSubnets',\n 'LoadBalancerName' => lb_name,\n :parser => Fog::Parsers::AWS::ELB::AttachLoadBalancerToSubnets.new\n }.merge!(params))\n end", "def create_pool pool_name, monitor_name=nil\n monitor_name ||= 'http'\n\n response = put(\"http://#{@host}/loadbalancers/tenant/#{@tenant}/pools/#{pool_name}\",\n {\n :pool => {\n :name => pool_name,\n :method => 'RoundRobin',\n :port => '80',\n :enabled => 'true',\n :monitors => [monitor_name]\n }\n }.to_json)\n raise LBModelException.new \"Expected HTTP 202 but got #{response.code} instead\" unless response.code == 202\n\n parse_jobids response\n end", "def balancer_set_instances(balancer)\n balancer\n end", "def index\n @loadbalancers = getmydata(\"Loadbalancer\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loadbalancers }\n end\n end", "def test_00_describe_load_balancers\n items = @elb.describe_load_balancers\n assert items.is_a?(Array)\n end", "def get_balancer_manager\n @balancer_manager\n end", "def ready_load_balancer(action_handler, lb_spec, lb_options, machine_specs)\n end", "def read_load_balancer_pool_with_http_info(pool_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesLoadbalancerApi.read_load_balancer_pool ...'\n end\n # verify the required parameter 'pool_id' is set\n if @api_client.config.client_side_validation && pool_id.nil?\n fail ArgumentError, \"Missing the required parameter 'pool_id' when calling ManagementPlaneApiServicesLoadbalancerApi.read_load_balancer_pool\"\n end\n # resource path\n local_var_path = '/loadbalancer/pools/{pool-id}'.sub('{' + 'pool-id' + '}', pool_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'LbPool')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesLoadbalancerApi#read_load_balancer_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def add_loadbalancer_groups\n if any_hosts_as?(:loadbalancer)\n loadbalancer_group = {\n \"name\" => \"HAProxy Loadbalancer\",\n \"rule\" => [\"or\", [\"=\", \"name\", loadbalancer.node_name]], # pinned node\n \"parent\" => pe_infra_uuid,\n \"classes\" => {\n \"profile::loadbalancer\" => {}\n }\n }\n\n dispatcher.find_or_create_node_group_model(loadbalancer_group)\n end\n\n return unless any_hosts_as?(:compile_master)\n\n lb_export_rules = [\"or\"]\n lb_export_rules += [compile_master].flatten.map do |server|\n [\"=\", \"name\", server.node_name]\n end\n\n loadbalancer_exports_group = {\n \"name\" => \"Loadbalancer Exports(Compile Masters)\",\n \"rule\" => lb_export_rules, # pinned node\n \"parent\" => pe_infra_uuid,\n \"classes\" => {\n \"profile::loadbalancer_exports\" => {}\n }\n }\n dispatcher.find_or_create_node_group_model(loadbalancer_exports_group)\nend", "def new\n @loadbalancer = Loadbalancer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loadbalancer }\n end\n end", "def create\n @lb_pool = LbPool.new(params[:lb_pool])\n \n respond_to do |format|\n if @lb_pool.save \n flash[:notice] = 'Load Balancer Pool was successfully created.'\n format.html { redirect_to lb_pool_url(@lb_pool) }\n format.xml { head :created, :location => lb_pool_url(@lb_pool) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lb_pool.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end", "def convert_resource(name, resource)\n \n props = value_from_path(resource, [\"Properties\"]) || {}\n props = keys_to_underscore props\n \n case resource['Type']\n when \"AWS::EC2::Instance\"\n @output['nodes'] << convert_instance(name, resource)\n\n when \"AWS::ElasticLoadBalancing::LoadBalancer\"\n listeners = value_from_path(props, [\"listeners\"]) || []\n props[\"listeners\"] = listeners.map{|listener| \n fields_to_v1(:listener, fields_to_i(:listener, keys_to_underscore(listener)))\n } \n @output['services'] << { \"name\" => name, \"type\" => \"load_balancer\", \n \"provisioning\" => { \"load_balancer_options\" => props } }\n\n when \"AWS::AutoScaling::AutoScalingGroup\"\n @output['nodes'] << convert_auto_scaling_group(name, resource)\n end\n end", "def list_configs(lb_id, headers = {})\n get!(\"loadbalancers/#{lb_id}/configs\", {}, headers)\n end", "def load_balancer_names\n @group.load_balancer_names\n end", "def list_lb_services_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.list_lb_services ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.list_lb_services, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.list_lb_services, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/lb-services'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'LBServiceListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi#list_lb_services\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def add_to_lb(group)\n @haproxy.identity_filter(@load_balancer)\n # We don't have to identify the nodes in the group\n # for every action. I'm doing it here to make each\n # method easier to read\n @rpcutil.class_filter(group)\n begin\n @rpcutil.ping.each do |node|\n hostname = node.results[:sender]\n # Disable the nodes\n @haproxy.enable(:backend => 'puppetcamp', :server => hostname).each do |rpcresult|\n if rpcresult.results[:statuscode] != 0\n raise LoadBalancerAddException, hostname\n end\n end\n end\n ensure\n @haproxy.reset_filter\n @rpcutil.reset_filter\n end\nend", "def show\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loadbalancer }\n end\n end", "def init_brands\n response = @conn.get do |req|\n req.url \"/api/v1/brands\"\n req.headers = rest_headers\n end\n\n @brands = json(response.body)[:brands]\n end", "def balancer(*args)\n request = ::Hbase::BalancerUtils.create_balance_request(args)\n @admin.balance(request)\n end", "def set_load_balancer_name(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerName'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :load_balancer_name\n\t\t\targs[:query]['LoadBalancerName'] = optional[:load_balancer_name]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tself.run(args)\n\tend", "def detach_from_elbs(instance:)\n unless instance.is_a?(Aws::OpsWorks::Types::Instance)\n fail(ArgumentError, \"instance must be a Aws::OpsWorks::Types::Instance struct\")\n end\n\n all_load_balancers = @elb_client.describe_load_balancers\n .load_balancer_descriptions\n\n load_balancers = detach_from(all_load_balancers, instance)\n\n @lb_wait_params = []\n\n load_balancers.each do |lb|\n params = {\n load_balancer_name: lb.load_balancer_name,\n instances: [{ instance_id: instance.ec2_instance_id }]\n }\n\n remaining_instances = @elb_client\n .deregister_instances_from_load_balancer(params)\n .instances\n\n log(<<-MSG.split.join(\" \"))\n Will detach instance #{instance.hostname} from\n #{lb.load_balancer_name} (remaining attached instances:\n #{remaining_instances.count.to_s})\n MSG\n\n @lb_wait_params << params\n end\n \n unless @regional_deploy\n if @lb_wait_params.any?\n wait_for_detach(@lb_wait_params)\n else\n log(\"No load balancers found for instance #{instance.hostname}\")\n end\n end\n\n load_balancers\n end", "def elb_listener(elb)\n resp = aws_api_connect(\"ELB_Client\")\n begin\n pants = resp.create_load_balancer_listeners({\n load_balancer_name: elb[:name],\n listeners: [\n {\n protocol: elb[:protocol],\n load_balancer_port: elb[:port],\n instance_protocol: elb[:instnace_protocol],\n instance_port: elb[:instance_port],\n ssl_certificate_id: elb[:ssl_cert],\n },\n ],\n })\n rescue Aws::ElasticLoadBalancing::Errors::DuplicateListener\n puts \"Load Balancer listener #{elb[:name]} duplicate exists, skipping\"\n end\n end", "def get_elb(layer_name)\n layer_id = layers[layer_name].layer_id\n elbs = opsworks_client.describe_elastic_load_balancers(layer_ids:[layer_id])\n if elbs.elastic_load_balancers.size > 0\n name = elbs.elastic_load_balancers.first.elastic_load_balancer_name\n ELB.new(name)\n else\n nil\n end\n end", "def load_blog_list_from_local\n input = YAML.load(File.read('blogs.yaml'))['blogs']\n\n blogs = []\n input.each do |blog|\n blog_id = calculate_id_for(blog)\n item = {\n '__typename': 'Blog',\n '_version': 1,\n '_lastChangedAt': Time.now.to_i,\n id: blog_id,\n title: blog['title'],\n url: blog['url']\n }\n\n $ddb_client.put_item({\n table_name: BLOGS_TABLE,\n item: item\n })\n\n blogs.push(item)\n end\n\n p \"Added #{blogs.length} blogs\"\n { items: blogs, count: blogs.length }\nend", "def perform_reload\n api.balancer_reload(self)\n end", "def elastic_load_balancer(name=nil, &block)\n @elastic_load_balancer ||= name ? _elastic_load_balancer(name, &block) : _elastic_load_balancer\n end", "def new\n @load_balancer_check = LoadBalancerCheck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @load_balancer_check }\n end\n end", "def create_load_balancer_pool(lb_pool, opts = {})\n data, _status_code, _headers = create_load_balancer_pool_with_http_info(lb_pool, opts)\n data\n end", "def delete\n client.delete_load_balancer(:load_balancer_name => name)\n nil\n end", "def delete_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DeleteLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def bridges_list\n get \"bridges\"\n end", "def set_load_balancer_name(load_balancer_id, load_balancer_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerName'\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:query]['LoadBalancerName'] = load_balancer_name\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def status(response)\n region, environment, balancer = split_params(response)\n\n client = new_client(\"#{region}-#{environment}\")\n\n # get the IDs from the config and add it to the client\n # respond with an error if we don't recognize the user input\n\n begin\n balancer_ids(region, environment, balancer).each { |id| client.add_lb(id) }\n rescue MissingKey => e\n return response.reply(e.to_s)\n end\n\n # get the status of the LBs\n # do it within a begin block so we can catch\n # the exceptions thrown by SpaceCadet\n begin\n # get the details for all LBs we care about\n details = client.status\n\n # if we don't have any details, bail\n return response.reply(t('status.no_details', region: region, env: environment, balancer: balancer)) if details.empty?\n\n # otherwise, render the proper output and print it\n response.reply(render_template('status', output: render_status(details)))\n\n rescue DoubleDutch::SpaceCadet::Error => e # catch all SpaceCadet errors\n title = \"An error has occured trying to get the status of #{region}.#{environment}.#{balancer}:\"\n reply = render_template('exception', title: title, exception: e.class, message: e.message)\n response.reply(reply)\n\n rescue StandardError => e # catch all remaining errors\n title = \"A generic excpetion has been caught trying to get the status of #{region}.#{environment}.#{balancer}:\"\n reply = render_template('exception', title: title, exception: e.class, message: e.message)\n response.reply(reply)\n end\n end", "def attach_to_elb(instance, elb_name, subnet = nil)\n begin\n @log.info \"\"\n @log.info \"Adding to ELB: #{elb_name}\"\n elb = AWS::ELB.new\n AWS.memoize do\n unless subnet\n # Build list of availability zones for any existing instances\n zones = { }\n zones[instance.availability_zone] = instance.availability_zone\n elb.load_balancers[elb_name].instances.each do |elb_instance|\n zones[elb_instance.availability_zone] = elb_instance.availability_zone\n end\n \n # Build list of existing zones\n existing_zones = { }\n elb.load_balancers[elb_name].availability_zones.each do |zone|\n existing_zones[zone.name] = zone\n end\n \n # Enable zones\n zones.keys.each do |zone_name|\n elb.load_balancers[elb_name].availability_zones.enable(zones[zone_name])\n end\n \n # Disable zones\n existing_zones.keys.each do |zone_name|\n elb.load_balancers[elb_name].availability_zones.disable(existing_zones[zone_name]) unless zones.has_key?(zone_name)\n end\n end\n \n elb.load_balancers[elb_name].instances.register(instance)\n end\n rescue StandardError => bang\n @log.error \"Error adding to load balancers: \" + bang.to_s\n end\n end", "def list_lb_services_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.list_lb_services_0 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.list_lb_services_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi.list_lb_services_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/lb-services'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'LBServiceListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesLoadBalancingLoadBalancerServicesApi#list_lb_services_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list(mixins = nil)\n # TODO: impl filtering with mixins\n network = ::Occi::Core::Resources.new\n backend_network_pool = ::OpenNebula::VirtualNetworkPool.new(@client)\n rc = backend_network_pool.info_all\n check_retval(rc, Backends::Errors::ResourceRetrievalError)\n\n backend_network_pool.each do |backend_network|\n network << parse_backend_obj(backend_network)\n end\n\n network\n end", "def create_params\n params.require(:balancer).permit(:name)\n end", "def describe_load_balancer_attribute(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeLoadBalancerAttribute'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tself.run(args)\n\tend", "def set_load_balancer_status(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerStatus'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :load_balancer_status\n\t\t\targs[:query]['LoadBalancerStatus'] = optional[:load_balancer_status]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tself.run(args)\n\tend", "def blogs(options = { results: 1 })\n response = get_response(results: options[:results], name: @name)\n\n response[:blogs].collect do |b|\n Blog.new(name: b[:name], site: b[:site], url: b[:url])\n end\n end", "def migrate_elbs\n elbs_dir = \"#{@migration_root}/elb-load-balancers\"\n policies_dir =\"#{@migration_root}/elb-policies\"\n\n if !Dir.exists?(@migration_root)\n Dir.mkdir(@migration_root)\n end\n if !Dir.exists?(elbs_dir)\n Dir.mkdir(elbs_dir)\n end\n if !Dir.exists?(policies_dir)\n Dir.mkdir(policies_dir)\n end\n\n ELB::elbs.map do |elb_name, elb|\n puts \"Migrating load balancer #{elb_name}\"\n\n local_elb = LoadBalancerConfig.new(elb_name)\n tags = ELB::elb_tags(elb_name)\n attributes = ELB::elb_attributes(elb_name)\n local_elb.populate!(elb, tags, attributes)\n\n # Migrate the backend and listener policies if they do not already\n # exist locally and are not the default AWS policies\n listener_policies = local_elb.listeners.flat_map { |l| l.policies }\n backend_policies = local_elb.backend_policies.flat_map { |b| b.policy_names }\n\n (listener_policies + backend_policies).uniq.map do |policy_name|\n policy_file = \"#{policies_dir}/#{policy_name}.json\"\n # If it is not already migrated and not a default policy, create it\n if !File.file? policy_file\n if !ELB::default_policies.has_key? policy_name\n # Get the full policy description from the elb policies\n full_policy = ELB::elb_policies(elb_name)[policy_name]\n\n if full_policy.nil?\n puts \"Unable to migrate policy #{policy_name}\"\n else\n puts \"Migrating policy #{policy_name}\"\n json = JSON.pretty_generate(full_policy.to_cumulus_hash)\n File.open(policy_file, \"w\") { |f| f.write(json) }\n end\n end\n end\n end\n\n File.open(\"#{elbs_dir}/#{elb_name}.json\", \"w\") { |f| f.write(local_elb.pretty_json) }\n end\n\n end", "def balancer_health_check(balancer)\n balancer\n end", "def create_load_balancer_policy(lb_name, name, type_name, attributes = {})\n params = {}\n\n attribute_name = []\n attribute_value = []\n attributes.each do |name, value|\n attribute_name.push(name)\n attribute_value.push(value)\n end\n\n params.merge!(Fog::AWS.indexed_param('PolicyAttributes.member.%d.AttributeName', attribute_name))\n params.merge!(Fog::AWS.indexed_param('PolicyAttributes.member.%d.AttributeValue', attribute_value))\n\n request({\n 'Action' => 'CreateLoadBalancerPolicy',\n 'LoadBalancerName' => lb_name,\n 'PolicyName' => name,\n 'PolicyTypeName' => type_name,\n :parser => Fog::Parsers::AWS::ELB::Empty.new\n }.merge!(params))\n end", "def create\n @operations_check = OperationsCheck.find(params[:operations_check_id])\n @load_balancer_check = @operations_check.load_balancer_checks.create(load_balancer_check_params)\n\n respond_to do |format|\n if @load_balancer_check.save\n format.html { redirect_to operations_check_path(@operations_check, tab: \"load_balancers\"), \n notice: 'Load balancer check was successfully created.' }\n format.json { render json: @load_balancer_check, status: :created, location: @load_balancer_check }\n else\n format.html { redirect_to operations_check_path(@operations_check, tab: \"load_balancers\"),\n notice: 'Commit failed - you must give a ticket number if the check failed!' }\n format.json { render json: @load_balancer_check.errors, status: :unprocessable_entity }\n end\n end\n end", "def is_load_balancer?\n node_type.is_loadbalancer?\n end", "def add_http_load_balancer(name, ip_address=nil)\n\n add_load_balancer name, 80, ip_address\n\n end", "def delete_load_balancer(load_balancer_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DeleteLoadBalancer'\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def load_all_subnets\n set_rack_ip_offsets\n set_subnets\n \n @subnet = {}\n @ip_subnet.keys.each do |net|\n @subnet[net] = net_by_suffix(suffix: net)\n end\nend", "def bridges_create(params = {})\n post \"bridges\", params\n end", "def modify_load_balancer_attributes(lb_id, attributes)\n attributes = Fog::AWS.serialize_keys 'Attributes', attributes.map{ |property, value| { :Key => property, :Value => value } }\n request(attributes.merge(\n 'Action' => 'ModifyLoadBalancerAttributes',\n 'LoadBalancerArn' => lb_id,\n :parser => Fog::Parsers::AWS::ELBV2::ModifyLoadBalancerAttributes.new\n ))\n end", "def describe_load_balancer_attributes(lb_id)\n request({\n 'Action' => 'DescribeLoadBalancerAttributes',\n 'LoadBalancerArn' => lb_id,\n :parser => Fog::Parsers::AWS::ELBV2::DescribeLoadBalancerAttributes.new\n })\n end", "def update\n respond_to do |format|\n if @cabinet_balancer.update(create_params)\n format.html { redirect_to cabinet_balancers_path, notice: I18n.t('updated') }\n format.json { render :show, status: :ok, location: @cabinet_balancer }\n else\n format.html { render :edit }\n format.json { render json: @cabinet_balancer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_load_balancer_pool_with_http_info(pool_id, lb_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesLoadbalancerApi.update_load_balancer_pool ...'\n end\n # verify the required parameter 'pool_id' is set\n if @api_client.config.client_side_validation && pool_id.nil?\n fail ArgumentError, \"Missing the required parameter 'pool_id' when calling ManagementPlaneApiServicesLoadbalancerApi.update_load_balancer_pool\"\n end\n # verify the required parameter 'lb_pool' is set\n if @api_client.config.client_side_validation && lb_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_pool' when calling ManagementPlaneApiServicesLoadbalancerApi.update_load_balancer_pool\"\n end\n # resource path\n local_var_path = '/loadbalancer/pools/{pool-id}'.sub('{' + 'pool-id' + '}', pool_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(lb_pool)\n auth_names = ['BasicAuth']\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 => 'LbPool')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesLoadbalancerApi#update_load_balancer_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n respond_to do |format|\n if @loadbalancer.update_attributes(params[:loadbalancer])\n format.html { redirect_to @loadbalancer, notice: 'Loadbalancer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @loadbalancer.errors, status: :unprocessable_entity }\n end\n end\n end", "def services_web_application_name_servers_web_server_name_load_balancing_get_with_http_info(authorization, web_application_name, web_server_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LoadBalancingApi.services_web_application_name_servers_web_server_name_load_balancing_get ...\"\n end\n # verify the required parameter 'authorization' is set\n if @api_client.config.client_side_validation && authorization.nil?\n fail ArgumentError, \"Missing the required parameter 'authorization' when calling LoadBalancingApi.services_web_application_name_servers_web_server_name_load_balancing_get\"\n end\n # verify the required parameter 'web_application_name' is set\n if @api_client.config.client_side_validation && web_application_name.nil?\n fail ArgumentError, \"Missing the required parameter 'web_application_name' when calling LoadBalancingApi.services_web_application_name_servers_web_server_name_load_balancing_get\"\n end\n # verify the required parameter 'web_server_name' is set\n if @api_client.config.client_side_validation && web_server_name.nil?\n fail ArgumentError, \"Missing the required parameter 'web_server_name' when calling LoadBalancingApi.services_web_application_name_servers_web_server_name_load_balancing_get\"\n end\n # resource path\n local_var_path = \"/services/{Web Application Name}/servers/{Web Server Name}/load-balancing\".sub('{' + 'Web Application Name' + '}', web_application_name.to_s).sub('{' + 'Web Server Name' + '}', web_server_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :multi) if !opts[:'fields'].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 header_params[:'Authorization'] = authorization\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoadBalancingApi#services_web_application_name_servers_web_server_name_load_balancing_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_load_balancer_pools(opts = {})\n data, _status_code, _headers = list_load_balancer_pools_with_http_info(opts)\n data\n end", "def get_brands_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: BrandsApi.get_brands ...\"\n end\n # resource path\n local_var_path = \"/brands\"\n\n # query parameters\n query_params = {}\n query_params[:'includes'] = @api_client.build_collection_param(opts[:'includes'], :csv) if !opts[:'includes'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'order_by'] = @api_client.build_collection_param(opts[:'order_by'], :multi) if !opts[:'order_by'].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 = ['APIKeyHeader']\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 => 'InlineResponse200')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BrandsApi#get_brands\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def lb_get\n str = config_get('itd_service', 'load_balance', @get_args)\n return nil if str.nil?\n if str.include?('method') && str.include?('range')\n regexp = Regexp.new('load-balance *(?<bundle_select>method \\S+)?'\\\n ' *(?<bundle_hash>\\S+)?'\\\n ' *(?<proto>\\S+)?'\\\n ' *(?<start_port>range \\d+)?'\\\n ' *(?<end_port>\\d+)?'\\\n ' *(?<buckets>buckets \\d+)?'\\\n ' *(?<mask>mask-position \\d+)?')\n elsif str.include?('method')\n regexp = Regexp.new('load-balance *(?<bundle_select>method \\S+)?'\\\n ' *(?<bundle_hash>\\S+)?'\\\n ' *(?<buckets>buckets \\d+)?'\\\n ' *(?<mask>mask-position \\d+)?') unless str.include?('range')\n else\n regexp = Regexp.new('load-balance *(?<buckets>buckets \\d+)?'\\\n ' *(?<mask>mask-position \\d+)?')\n end\n regexp.match(str)\n end", "def register_instances_with_lb(lb_name, instance_ids)\n instances = instance_ids.map { |instance_id| { :instance_id => instance_id } }\n link = generate_request(\"RegisterInstancesWithLoadBalancer\",\n :load_balancer_name => lb_name, :instances => instances)\n request_info(link, QElbInstancesParser.new)\n rescue Exception\n on_exception\n end", "def balancer_ids(region, env, balancer)\n h = config.lb_hash\n\n # if either the <region> or <region>.<environment> key is missing: bail out\n raise MissingKey, t('general.missing_region', region: region) unless h.key?(region)\n raise MissingKey, t('general.missing_env', region: region, env: env) unless h[region].key?(env)\n\n # if the <region>.<environment>.<balancer> key is missing: bail out\n unless h[region][env].key?(balancer)\n raise MissingKey, t('general.missing_balancer', region: region, env: env, balancer: balancer)\n end\n\n # if the value for <region>.<environment>.<balancer> is not an Array: bail out\n raise MissingKey, t('general.balancer_not_arr') unless h[region][env][balancer].kind_of?(Array)\n\n # return the Array of IDs\n h[region][env][balancer]\n end", "def load_bills()\n params = {'history.active' => true}\n params['order'] = 'last_action_at'\n @bills = process('bills', 'bills', params)\n end", "def modify_load_balancer_attributes(lb_name, options)\n attributes = Fog::AWS.serialize_keys 'LoadBalancerAttributes', options\n request(attributes.merge(\n 'Action' => 'ModifyLoadBalancerAttributes',\n 'LoadBalancerName' => lb_name,\n :parser => Fog::Parsers::AWS::ELB::Empty.new\n ))\n end", "def load_droplets\n logger.debug 'Loading list of DigitalOcean droplets'\n self.droplets = api.droplets\n end", "def list_brands request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_brands_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Iap::V1::ListBrandsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def detach_from(load_balancers, instance)\n check_arguments(instance: instance, load_balancers: load_balancers)\n\n load_balancers.select do |lb|\n matched_instance = lb.instances.any? do |lb_instance|\n instance.ec2_instance_id == lb_instance.instance_id\n end\n\n if matched_instance && lb.instances.count > 1\n # We can detach this instance safely because there is at least one other\n # instance to handle traffic\n true\n elsif matched_instance && lb.instances.count == 1\n # We can't detach this instance because it's the only one\n log(<<-MSG.split.join(\" \"))\n Will not detach #{instance.hostname} from load balancer\n #{lb.load_balancer_name} because it is the only instance connected\n MSG\n\n false\n else\n # This load balancer isn't attached to this instance\n false\n end\n end\n end", "def initialize(load_balancer)\n @connection = load_balancer.connection\n @load_balancer = load_balancer\n @lbmgmthost = @connection.lbmgmthost\n @lbmgmtpath = @connection.lbmgmtpath\n @lbmgmtport = @connection.lbmgmtport\n @lbmgmtscheme = @connection.lbmgmtscheme\n populate\n return self\n end", "def read_load_balancer_pool(pool_id, opts = {})\n data, _status_code, _headers = read_load_balancer_pool_with_http_info(pool_id, opts)\n data\n end", "def remove_load_balancer_properties\n properties = []\n properties << :AccessLoggingPolicy\n properties << :AppCookieStickinessPolicy\n properties << :ConnectionDrainingPolicy\n properties << :CrossZone\n properties << :LBCookieStickinessPolicy\n properties << :LoadBalancerName\n properties << 'Listeners.PolicyNames'\n properties << 'Listeners.SSLCertificateId '\n properties << :Policies\n properties << :Scheme\n properties << :SecurityGroups\n properties << :Subnets\n add_patch Patches::RemoveProperty.new 'AWS::ElasticLoadBalancing::LoadBalancer', properties\n end" ]
[ "0.6786377", "0.6424232", "0.63619214", "0.6209401", "0.6137494", "0.61038476", "0.6097971", "0.60865533", "0.6055986", "0.60113305", "0.5921425", "0.5921425", "0.5898267", "0.5793097", "0.5780654", "0.573337", "0.57300085", "0.5679276", "0.56469196", "0.56383497", "0.5638228", "0.56266916", "0.5624882", "0.5593777", "0.5576382", "0.5570659", "0.556639", "0.55294406", "0.54708105", "0.5465842", "0.5438611", "0.538776", "0.5382327", "0.53771734", "0.5361745", "0.5252077", "0.5227063", "0.51630163", "0.51604956", "0.51544845", "0.51382905", "0.51349026", "0.50629073", "0.50486743", "0.5035592", "0.50309396", "0.5023346", "0.49906564", "0.4979277", "0.4952869", "0.49395475", "0.4933037", "0.49294966", "0.4911027", "0.49081454", "0.490132", "0.48855516", "0.48645708", "0.48600322", "0.4855608", "0.48253033", "0.48208386", "0.47922593", "0.47826675", "0.47735992", "0.47643313", "0.47602728", "0.47495946", "0.4725129", "0.47208476", "0.47043663", "0.47041982", "0.4680797", "0.46665567", "0.46562198", "0.46541026", "0.46247995", "0.4620181", "0.46175325", "0.46098545", "0.45852545", "0.45636153", "0.45550704", "0.45338243", "0.4526224", "0.4516687", "0.4511036", "0.45083335", "0.44987524", "0.44832733", "0.4480539", "0.44797245", "0.44794625", "0.4461999", "0.44586274", "0.44504914", "0.44503742", "0.4450137", "0.44401133", "0.44377148" ]
0.7323493
0
Add new load balancer to list of load balancers
def add_lb(hostname) @@load_balancers << LoadBalancer.new(hostname, create_icontrol(hostname)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_balancer # rubocop:disable AbcSize\n raise 'Can not determine hostname to load client for' if @new_resource.f5.nil?\n @@load_balancers ||= []\n add_lb(@new_resource.f5) if @@load_balancers.empty?\n add_lb(@new_resource.f5) if @@load_balancers.find { |lb| lb.name == @new_resource.f5 }.nil?\n @@load_balancers.find { |lb| lb.name == @new_resource.f5 }\n end", "def attach_to_elbs(instance:, load_balancers:)\n check_arguments(instance: instance, load_balancers: load_balancers)\n\n if load_balancers.empty?\n log(\"No load balancers to attach to\")\n return {}\n end\n\n @lb_wait_params = []\n registered_instances = {} # return this\n\n load_balancers.each do |lb|\n params = {\n load_balancer_name: lb.load_balancer_name,\n instances: [{ instance_id: instance.ec2_instance_id }]\n }\n\n result = @elb_client.register_instances_with_load_balancer(params)\n\n registered_instances[lb.load_balancer_name] = result\n @lb_wait_params << params\n end\n\n log(\"Re-attaching instance #{instance.hostname} to all load balancers\")\n\n unless @regional_deploy\n wait_for_re_attach(@lb_wait_params)\n end\n\n registered_instances\n end", "def add_to_lb(group)\n @haproxy.identity_filter(@load_balancer)\n # We don't have to identify the nodes in the group\n # for every action. I'm doing it here to make each\n # method easier to read\n @rpcutil.class_filter(group)\n begin\n @rpcutil.ping.each do |node|\n hostname = node.results[:sender]\n # Disable the nodes\n @haproxy.enable(:backend => 'puppetcamp', :server => hostname).each do |rpcresult|\n if rpcresult.results[:statuscode] != 0\n raise LoadBalancerAddException, hostname\n end\n end\n end\n ensure\n @haproxy.reset_filter\n @rpcutil.reset_filter\n end\nend", "def add_load_balancer(name, ports, ip_address)\n\n unless ports.is_a? Array\n ports = [ ports ]\n end\n\n if name.nil?\n name = \"lb#{RandomName.create(5,3)}\"\n end\n\n if ip_address.is_a? String\n ip_address = public_ipaddress \"#{name}-addr\" do\n dns_settings domain_name_label: ip_address\n end\n end\n\n lb = load_balancer name do\n\n if ip_address.nil?\n fics = frontend_ipconfigurations name: name + '-feconf'\n else\n fics = frontend_ipconfigurations name: name + '-feconf',\n public_ipaddress: ip_address\n end\n\n pools = backend_address_pools name: name + '-pool'\n\n ports.each do |port|\n\n p = probes name: name + \"-probe#{port}\",\n protocol: 'Tcp',\n port: port,\n number_of_probes: 2,\n interval_in_seconds: 15\n\n load_balancing_rules name: \"rule#{port}\",\n frontend_ipconfiguration: fics[0],\n backend_address_pool: pools[0],\n protocol: 'Tcp',\n frontend_port: port,\n backend_port: port,\n idle_timeout_in_minutes: 15,\n probe: p[0]\n end\n\n end\n\n end", "def add_lb(lb_id)\n @lbs = (@lbs << lb_id).uniq\n end", "def load_balancer_data(balancer = nil)\n params = Smash.new(\"Action\" => \"DescribeLoadBalancers\")\n if balancer\n params[\"LoadBalancerNames.member.1\"] = balancer.id || balancer.name\n end\n result = all_result_pages(nil, :body,\n \"DescribeLoadBalancersResponse\", \"DescribeLoadBalancersResult\",\n \"LoadBalancerDescriptions\", \"member\") do |options|\n request(\n :method => :post,\n :path => \"/\",\n :form => options.merge(params),\n )\n end\n if balancer\n health_result = all_result_pages(nil, :body,\n \"DescribeInstanceHealthResponse\", \"DescribeInstanceHealthResult\",\n \"InstanceStates\", \"member\") do |options|\n request(\n :method => :post,\n :path => \"/\",\n :form => options.merge(\n \"LoadBalancerName\" => balancer.id || balancer.name,\n \"Action\" => \"DescribeInstanceHealth\",\n ),\n )\n end\n end\n result.map do |blr|\n (balancer || Balancer.new(self)).load_data(\n Smash.new(\n :id => blr[\"LoadBalancerName\"],\n :name => blr[\"LoadBalancerName\"],\n :state => :active,\n :status => \"ACTIVE\",\n :created => blr[\"CreatedTime\"],\n :updated => blr[\"CreatedTime\"],\n :public_addresses => [\n Balancer::Address.new(\n :address => blr[\"DNSName\"],\n :version => 4,\n ),\n ],\n :servers => [blr.get(\"Instances\", \"member\")].flatten(1).compact.map { |i|\n Balancer::Server.new(self.api_for(:compute), :id => i[\"InstanceId\"])\n },\n ).merge(\n health_result.nil? ? {} : Smash.new(\n :server_states => health_result.nil? ? nil : health_result.map { |i|\n Balancer::ServerState.new(\n self.api_for(:compute),\n :id => i[\"InstanceId\"],\n :status => i[\"State\"],\n :reason => i[\"ReasonCode\"],\n :state => i[\"State\"] == \"InService\" ? :up : :down,\n )\n },\n )\n )\n ).valid_state\n end\n end", "def attach_load_balancer_to_subnets(subnet_ids, lb_name)\n params = Fog::AWS.indexed_param('Subnets.member', [*subnet_ids])\n request({\n 'Action' => 'AttachLoadBalancerToSubnets',\n 'LoadBalancerName' => lb_name,\n :parser => Fog::Parsers::AWS::ELB::AttachLoadBalancerToSubnets.new\n }.merge!(params))\n end", "def balancer_set_instances(balancer)\n balancer\n end", "def create\n @loadbalancer = Loadbalancer.new(params[:loadbalancer])\n @loadbalancer.account_id = @oeaccount.id\n respond_to do |format|\n if @loadbalancer.save\n format.html { redirect_to loadbalancers_url, notice: 'Loadbalancer was successfully created.' }\n format.json { render json: @loadbalancer, status: :created, location: @loadbalancer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @loadbalancer.errors, status: :unprocessable_entity }\n end\n end\n end", "def allocate_load_balancer(action_handler, lb_spec, lb_options, machine_specs)\n end", "def attach_to_elb(instance, elb_name, subnet = nil)\n begin\n @log.info \"\"\n @log.info \"Adding to ELB: #{elb_name}\"\n elb = AWS::ELB.new\n AWS.memoize do\n unless subnet\n # Build list of availability zones for any existing instances\n zones = { }\n zones[instance.availability_zone] = instance.availability_zone\n elb.load_balancers[elb_name].instances.each do |elb_instance|\n zones[elb_instance.availability_zone] = elb_instance.availability_zone\n end\n \n # Build list of existing zones\n existing_zones = { }\n elb.load_balancers[elb_name].availability_zones.each do |zone|\n existing_zones[zone.name] = zone\n end\n \n # Enable zones\n zones.keys.each do |zone_name|\n elb.load_balancers[elb_name].availability_zones.enable(zones[zone_name])\n end\n \n # Disable zones\n existing_zones.keys.each do |zone_name|\n elb.load_balancers[elb_name].availability_zones.disable(existing_zones[zone_name]) unless zones.has_key?(zone_name)\n end\n end\n \n elb.load_balancers[elb_name].instances.register(instance)\n end\n rescue StandardError => bang\n @log.error \"Error adding to load balancers: \" + bang.to_s\n end\n end", "def add_loadbalancer_groups\n if any_hosts_as?(:loadbalancer)\n loadbalancer_group = {\n \"name\" => \"HAProxy Loadbalancer\",\n \"rule\" => [\"or\", [\"=\", \"name\", loadbalancer.node_name]], # pinned node\n \"parent\" => pe_infra_uuid,\n \"classes\" => {\n \"profile::loadbalancer\" => {}\n }\n }\n\n dispatcher.find_or_create_node_group_model(loadbalancer_group)\n end\n\n return unless any_hosts_as?(:compile_master)\n\n lb_export_rules = [\"or\"]\n lb_export_rules += [compile_master].flatten.map do |server|\n [\"=\", \"name\", server.node_name]\n end\n\n loadbalancer_exports_group = {\n \"name\" => \"Loadbalancer Exports(Compile Masters)\",\n \"rule\" => lb_export_rules, # pinned node\n \"parent\" => pe_infra_uuid,\n \"classes\" => {\n \"profile::loadbalancer_exports\" => {}\n }\n }\n dispatcher.find_or_create_node_group_model(loadbalancer_exports_group)\nend", "def balancer_reload(balancer)\n if balancer.persisted?\n begin\n load_balancer_data(balancer)\n rescue Miasma::Error::ApiError::RequestError => e\n if e.response_error_msg.include?(\"LoadBalancerNotFound\")\n balancer.state = :terminated\n balancer.status = \"terminated\"\n balancer.valid_state\n else\n raise\n end\n end\n end\n balancer\n end", "def create\n @cabinet_balancer = Balancer.new(create_params)\n\n respond_to do |format|\n if @cabinet_balancer.save\n format.html { redirect_to cabinet_balancers_path, notice: I18n.t('created') }\n format.json { render :show, status: :created, location: @cabinet_balancer }\n else\n format.html { render :new }\n format.json { render json: @cabinet_balancer.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_http_load_balancer(name, ip_address=nil)\n\n add_load_balancer name, 80, ip_address\n\n end", "def create_load_balancer_listeners(lb_name, listeners)\n params = {}\n\n listener_protocol = []\n listener_lb_port = []\n listener_instance_port = []\n listener_instance_protocol = []\n listener_ssl_certificate_id = []\n listeners.each do |listener|\n listener_protocol.push(listener['Protocol'])\n listener_lb_port.push(listener['LoadBalancerPort'])\n listener_instance_port.push(listener['InstancePort'])\n listener_instance_protocol.push(listener['InstanceProtocol'])\n listener_ssl_certificate_id.push(listener['SSLCertificateId'])\n end\n\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.Protocol', listener_protocol))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.LoadBalancerPort', listener_lb_port))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.InstancePort', listener_instance_port))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.InstanceProtocol', listener_instance_protocol))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.SSLCertificateId', listener_ssl_certificate_id))\n\n request({\n 'Action' => 'CreateLoadBalancerListeners',\n 'LoadBalancerName' => lb_name,\n :parser => Fog::Parsers::AWS::ELB::Empty.new\n }.merge!(params))\n end", "def create_elb(elb)\n resp = aws_api_connect(\"ELB_Client\")\n begin\n pants = resp.create_load_balancer({\n load_balancer_name: elb[:name],\n listeners: [\n {\n protocol: elb[:protocol],\n load_balancer_port: elb[:port],\n instance_protocol: elb[:instnace_protocol],\n instance_port: elb[:instance_port],\n ssl_certificate_id: elb[:ssl_cert],\n },\n ],\n subnets: elb[:subnets],\n security_groups: elb[:security_groups],\n })\n rescue Aws::ElasticLoadBalancing::Errors::DuplicateLoadBalancerName\n puts \"Load Balancer #{elb[:name]} already exists, bypassing\"\n rescue Aws::ElasticLoadBalancing::Errors::Throttling\n puts \"api throttled, retrying\"\n # TODO: Add exponential backoff\n sleep(5)\n retry\n end\n end", "def elb_listener(elb)\n resp = aws_api_connect(\"ELB_Client\")\n begin\n pants = resp.create_load_balancer_listeners({\n load_balancer_name: elb[:name],\n listeners: [\n {\n protocol: elb[:protocol],\n load_balancer_port: elb[:port],\n instance_protocol: elb[:instnace_protocol],\n instance_port: elb[:instance_port],\n ssl_certificate_id: elb[:ssl_cert],\n },\n ],\n })\n rescue Aws::ElasticLoadBalancing::Errors::DuplicateListener\n puts \"Load Balancer listener #{elb[:name]} duplicate exists, skipping\"\n end\n end", "def balancer_all(options = {})\n load_balancer_data\n end", "def describe_load_balancers(ids = [], options = {})\n ids = [*ids]\n params = {}\n params['Marker'] = options[:marker] if options[:marker]\n params['PageSize'] = options[:page_size] if options[:page_size]\n params.merge!(Fog::AWS.serialize_keys('LoadBalancerArns', ids)) if ids.any?\n params.merge!(Fog::AWS.serialize_keys('Names', options[:names])) if options[:names]\n request({\n 'Action' => 'DescribeLoadBalancers',\n :parser => Fog::Parsers::AWS::ELBV2::DescribeLoadBalancers.new\n }.merge!(params))\n end", "def createCLB(elbv1, sg_tcp_80_lb, pub_net1_id, pub_net2_id)\n # TODO: Remove CLB by name if create fails to fully create\n\n # Create CLB\n response = elbv1.create_load_balancer(load_balancer_name: 'AutoCLB',\n subnets: [pub_net1_id, pub_net2_id],\n security_groups: [sg_tcp_80_lb],\n listeners: [{ protocol: 'HTTP',\n load_balancer_port: 80,\n instance_protocol: 'HTTP',\n instance_port: 80 }])\n clb_dns_name = response.dns_name\n puts \"clb_dns_name = #{clb_dns_name}\"\n clb_dns_name # return\nend", "def set_cabinet_balancer\n @cabinet_balancer = Balancer.find(params[:id])\n end", "def index\n @cabinet_balancers = Balancer.all\n end", "def balancer\n @balancer ||= RightSupport::Net::RequestBalancer.new(@@hostnames,\n :policy=>RightSupport::Net::Balancing::StickyPolicy)\n end", "def fetch_from_ec2_loadbalancer\n instances_for_deploy = []\n loadbalancer lb_webserver, :web\n instances_for_deploy\nend", "def fetch_from_ec2_loadbalancer\n instances_for_deploy = []\n loadbalancer lb_webserver, :web\n instances_for_deploy\nend", "def add_instance(instance)\n register_response = client.register_instances_with_load_balancer(load_balancer_name: name,\n instances: [{instance_id: instance.ec2_instance_id}])\n remaining_instance_count = register_response.instances.size\n puts \"Added #{instance.hostname} to ELB #{name}. Attached instances: #{remaining_instance_count}\".light_blue\n _wait_for_instance_health_check(instance)\n end", "def register_instances_with_lb(lb_name, instance_ids)\n instances = instance_ids.map { |instance_id| { :instance_id => instance_id } }\n link = generate_request(\"RegisterInstancesWithLoadBalancer\",\n :load_balancer_name => lb_name, :instances => instances)\n request_info(link, QElbInstancesParser.new)\n rescue Exception\n on_exception\n end", "def ready_load_balancer(action_handler, lb_spec, lb_options, machine_specs)\n end", "def add_bridges(*bridges)\r\n @bridges.push(*bridges)\r\n end", "def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :address\n\t\t\targs[:query]['Address'] = optional[:address]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :is_public_address\n\t\t\targs[:query]['IsPublicAddress'] = optional[:is_public_address]\n\t\tend\n\t\tif optional.key? :load_balancer_mode\n\t\t\targs[:query]['LoadBalancerMode'] = optional[:load_balancer_mode]\n\t\tend\n\t\tif optional.key? :load_balancer_name\n\t\t\targs[:query]['LoadBalancerName'] = optional[:load_balancer_name]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def balancer(*args)\n request = ::Hbase::BalancerUtils.create_balance_request(args)\n @admin.balance(request)\n end", "def perform_reload\n api.balancer_reload(self)\n end", "def load_balancer_names\n @group.load_balancer_names\n end", "def migrate_elbs\n elbs_dir = \"#{@migration_root}/elb-load-balancers\"\n policies_dir =\"#{@migration_root}/elb-policies\"\n\n if !Dir.exists?(@migration_root)\n Dir.mkdir(@migration_root)\n end\n if !Dir.exists?(elbs_dir)\n Dir.mkdir(elbs_dir)\n end\n if !Dir.exists?(policies_dir)\n Dir.mkdir(policies_dir)\n end\n\n ELB::elbs.map do |elb_name, elb|\n puts \"Migrating load balancer #{elb_name}\"\n\n local_elb = LoadBalancerConfig.new(elb_name)\n tags = ELB::elb_tags(elb_name)\n attributes = ELB::elb_attributes(elb_name)\n local_elb.populate!(elb, tags, attributes)\n\n # Migrate the backend and listener policies if they do not already\n # exist locally and are not the default AWS policies\n listener_policies = local_elb.listeners.flat_map { |l| l.policies }\n backend_policies = local_elb.backend_policies.flat_map { |b| b.policy_names }\n\n (listener_policies + backend_policies).uniq.map do |policy_name|\n policy_file = \"#{policies_dir}/#{policy_name}.json\"\n # If it is not already migrated and not a default policy, create it\n if !File.file? policy_file\n if !ELB::default_policies.has_key? policy_name\n # Get the full policy description from the elb policies\n full_policy = ELB::elb_policies(elb_name)[policy_name]\n\n if full_policy.nil?\n puts \"Unable to migrate policy #{policy_name}\"\n else\n puts \"Migrating policy #{policy_name}\"\n json = JSON.pretty_generate(full_policy.to_cumulus_hash)\n File.open(policy_file, \"w\") { |f| f.write(json) }\n end\n end\n end\n end\n\n File.open(\"#{elbs_dir}/#{elb_name}.json\", \"w\") { |f| f.write(local_elb.pretty_json) }\n end\n\n end", "def add_pool_members pool_names, member_lists\n response = post(\"http://#{@host}/loadbalancers/tenant/#{@tenant}/pools\",\n {\n :pool =>\n (pool_names.zip member_lists).map do |pool_name, members| {\n :services => members.map do |address,port| {\n :ip => address,\n :enabled => 'true',\n :name => address + ':' + port.to_s,\n :weight => \"10\",\n :port => port\n } end,\n :name => pool_name\n } end\n }.to_json)\n raise LBModelException.new \"Expected HTTP 202 but got #{response.code} instead\" unless response.code == 202\n\n parse_jobids response\n end", "def perform_save\n api.balancer_save(self)\n end", "def remove_load_balancer_properties\n properties = []\n properties << :AccessLoggingPolicy\n properties << :AppCookieStickinessPolicy\n properties << :ConnectionDrainingPolicy\n properties << :CrossZone\n properties << :LBCookieStickinessPolicy\n properties << :LoadBalancerName\n properties << 'Listeners.PolicyNames'\n properties << 'Listeners.SSLCertificateId '\n properties << :Policies\n properties << :Scheme\n properties << :SecurityGroups\n properties << :Subnets\n add_patch Patches::RemoveProperty.new 'AWS::ElasticLoadBalancing::LoadBalancer', properties\n end", "def create name, type, attributes = {}\n\n attribute_list = []\n\n attributes.each do |attr_name,values|\n [values].flatten.each do |value|\n attribute_list << { \n :attribute_name => attr_name, \n :attribute_value => value.to_s \n }\n end\n end\n\n client.create_load_balancer_policy(\n :load_balancer_name => load_balancer.name,\n :policy_name => name.to_s,\n :policy_type_name => type.to_s,\n :policy_attributes => attribute_list)\n\n LoadBalancerPolicy.new(load_balancer, name, :type => type.to_s)\n\n end", "def populate\n response = @connection.lbreq(\"GET\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@id.to_s)}\",@lbmgmtport,@lbmgmtscheme)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n data = JSON.parse(response.body)['loadBalancer']\n @id = data[\"id\"]\n @name = data[\"name\"]\n @protocol = data[\"protocol\"]\n @port = data[\"port\"]\n @algorithm = data[\"algorithm\"]\n @connection_logging = data[\"connectionLogging\"][\"enabled\"]\n @status = data[\"status\"]\n @timeout = data[\"timeout\"]\n true\n end", "def balancer_health_check(balancer)\n balancer\n end", "def is_load_balancer?\n node_type.is_loadbalancer?\n end", "def create_bridge(bridge)\n return if @bridges.keys.include? bridge\n\n OpenNebula.exec_and_log(\"#{command(:brctl)} addbr #{bridge}\")\n\n @bridges[bridge] = Array.new\n\n OpenNebula.exec_and_log(\"#{command(:ip)} link set #{bridge} up\")\n end", "def modify_load_balancer_attributes(lb_id, attributes)\n attributes = Fog::AWS.serialize_keys 'Attributes', attributes.map{ |property, value| { :Key => property, :Value => value } }\n request(attributes.merge(\n 'Action' => 'ModifyLoadBalancerAttributes',\n 'LoadBalancerArn' => lb_id,\n :parser => Fog::Parsers::AWS::ELBV2::ModifyLoadBalancerAttributes.new\n ))\n end", "def create\n @lb_pool = LbPool.new(params[:lb_pool])\n \n respond_to do |format|\n if @lb_pool.save \n flash[:notice] = 'Load Balancer Pool was successfully created.'\n format.html { redirect_to lb_pool_url(@lb_pool) }\n format.xml { head :created, :location => lb_pool_url(@lb_pool) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lb_pool.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cabinet_balancer.update(create_params)\n format.html { redirect_to cabinet_balancers_path, notice: I18n.t('updated') }\n format.json { render :show, status: :ok, location: @cabinet_balancer }\n else\n format.html { render :edit }\n format.json { render json: @cabinet_balancer.errors, status: :unprocessable_entity }\n end\n end\n end", "def enable_availability_zones_for_lb(lb_name, availability_zones)\n link = generate_request(\"EnableAvailabilityZonesForLoadBalancer\",\n :load_balancer_name => lb_name, :availability_zones => availability_zones)\n request_info(link, QElbAvailabilityZonesParser.new)\n rescue Exception\n on_exception\n end", "def add(service)\n @list ||= []\n @list << service unless @list.find{|s| s.url == service.url && s.verb == service.verb}\n @list\n end", "def describe_load_balancers(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeLoadBalancers'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :server_id\n\t\t\targs[:query]['ServerId'] = optional[:server_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :address_type\n\t\t\targs[:query]['AddressType'] = optional[:address_type]\n\t\tend\n\t\tif optional.key? :bandwidth\n\t\t\traise ArgumentError, 'bandwidth must be equal or greater than -1' unless optional[:bandwidth] < -1\n\t\t\traise ArgumentError, 'bandwidth must be equal or less than 1000' unless optional[:bandwidth] > 1000\n\t\t\targs[:query]['Bandwidth'] = optional[:bandwidth]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :internet_charge_type\n\t\t\targs[:query]['InternetChargeType'] = optional[:internet_charge_type]\n\t\tend\n\t\tif optional.key? :load_balancer_name\n\t\t\targs[:query]['LoadBalancerName'] = optional[:load_balancer_name]\n\t\tend\n\t\tif optional.key? :master_zone_id\n\t\t\targs[:query]['MasterZoneId'] = optional[:master_zone_id]\n\t\tend\n\t\tif optional.key? :max_conn_limit\n\t\t\targs[:query]['MaxConnLimit'] = optional[:max_conn_limit]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :security_status\n\t\t\targs[:query]['SecurityStatus'] = optional[:security_status]\n\t\tend\n\t\tif optional.key? :slave_zone_id\n\t\t\targs[:query]['SlaveZoneId'] = optional[:slave_zone_id]\n\t\tend\n\t\tif optional.key? :v_switch_id\n\t\t\targs[:query]['VSwitchId'] = optional[:v_switch_id]\n\t\tend\n\t\tif optional.key? :vpc_id\n\t\t\targs[:query]['VpcId'] = optional[:vpc_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def new\n @loadbalancer = Loadbalancer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loadbalancer }\n end\n end", "def delete\n client.delete_load_balancer(:load_balancer_name => name)\n nil\n end", "def elastic_load_balancer(name=nil, &block)\n @elastic_load_balancer ||= name ? _elastic_load_balancer(name, &block) : _elastic_load_balancer\n end", "def update_listeners(elb_name, local_listeners, aws_listeners, listener_changes)\n # First delete the removed listeners\n deleted_ports = listener_changes.removed.map { |port, _| port }\n deleted_listeners = aws_listeners.select { |l| deleted_ports.include? l.listener.load_balancer_port }\n\n if !deleted_ports.empty?\n @elb.delete_load_balancer_listeners({\n load_balancer_name: elb_name,\n load_balancer_ports: deleted_ports\n })\n end\n\n # Add the added listeners. If anything goes wrong, attempt a rollback (if listeners were deleted)\n added_ports = listener_changes.added.map { |port, _| port }\n added_listeners = local_listeners.select { |l| added_ports.include? l.load_balancer_port}\n if !added_listeners.empty?\n # create the listeners\n update_rollback(\"listeners\", !deleted_ports.empty?,\n # update\n Proc.new {\n @elb.create_load_balancer_listeners({\n load_balancer_name: elb_name,\n listeners: added_listeners.map { |l| l.to_aws }\n })\n },\n # rollback\n Proc.new {\n @elb.create_load_balancer_listeners({\n load_balancer_name: elb_name,\n listeners: deleted_listeners.map { |l| l.listener }\n })\n\n deleted_listeners.each { |l| update_listener_policies(elb_name, l.listener.load_balancer_port, l.policy_names) }\n }\n )\n\n # set the policies of each created listener\n added_listeners.each { |listener| update_listener_policies(elb_name, listener.load_balancer_port, listener.policies) }\n end\n\n\n # For listeners where only the policy was modified, just set the listener policies\n policy_only_listeners = listener_changes.modified.select do |port, diffs|\n diffs.size == 1 && diffs.first.type == ListenerChange::POLICIES\n end\n\n policy_only_listeners.each do |port, diffs|\n listener = local_listeners.select { |l| port == l.load_balancer_port }.first\n update_listener_policies(elb_name, listener.load_balancer_port, listener.policies)\n end\n\n # For listeners with other changes, remove the old modified listeners and add the new ones, then update the listeners for each\n modified_ports = (listener_changes.modified.reject { |port, _| policy_only_listeners.has_key? port }).map { |port, _| port }\n modified_listeners = local_listeners.select { |l| modified_ports.include? l.load_balancer_port }\n\n if !modified_listeners.empty?\n @elb.delete_load_balancer_listeners({\n load_balancer_name: elb_name,\n load_balancer_ports: modified_ports\n })\n\n # recreate the modified listeners with the new attributes\n update_rollback(\"listeners\", true,\n # update\n Proc.new {\n # create the listeners\n @elb.create_load_balancer_listeners({\n load_balancer_name: elb_name,\n listeners: modified_listeners.map { |l| l.to_aws }\n })\n },\n Proc.new {\n # create the listeners using the old config\n old_modified_listeners = aws_listeners.select { |l| modified_ports.include? l.listener.load_balancer_port }\n\n @elb.create_load_balancer_listeners({\n load_balancer_name: elb_name,\n listeners: old_modified_listeners.map { |l| l.listener }\n })\n\n # set the old policies\n old_modified_listeners.each { |l| update_listener_policies(elb_name, l.listener.load_balancer_port, l.policy_names) }\n }\n )\n\n # set the policies\n modified_listeners.each { |listener| update_listener_policies(elb_name, listener.load_balancer_port, listener.policies) }\n end\n end", "def create_params\n params.require(:balancer).permit(:name)\n end", "def add_client(client, clients)\n\tclients << client\nend", "def add_breadcrumb name, url = ''\n\t\t@breadcrumbs ||= []\n\t\t url = eval(url) if url =~ /_path|_url|@/\n\t\t@breadcrumbs << [name, url]\n\tend", "def add_backend_servers(load_balancer_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'AddBackendServers'\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :backend_servers\n\t\t\targs[:query]['BackendServers'] = optional[:backend_servers]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def retrieve_elb(name)\n Clients.elb.describe_load_balancers(\n load_balancer_names: [name],\n ).load_balancer_descriptions[0]\nend", "def update\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n respond_to do |format|\n if @loadbalancer.update_attributes(params[:loadbalancer])\n format.html { redirect_to @loadbalancer, notice: 'Loadbalancer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @loadbalancer.errors, status: :unprocessable_entity }\n end\n end\n end", "def modify_load_balancer_attributes(lb_name, options)\n attributes = Fog::AWS.serialize_keys 'LoadBalancerAttributes', options\n request(attributes.merge(\n 'Action' => 'ModifyLoadBalancerAttributes',\n 'LoadBalancerName' => lb_name,\n :parser => Fog::Parsers::AWS::ELB::Empty.new\n ))\n end", "def add_listener_white_list_item(listener_port, load_balancer_id, source_items, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'AddListenerWhiteListItem'\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:query]['SourceItems'] = source_items\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\traise ArgumentError, 'listener_port must be equal or greater than 1' unless listener_port < 1\n\t\traise ArgumentError, 'listener_port must be equal or less than 65535' unless listener_port > 65535\n\t\targs[:query]['ListenerPort'] = listener_port\n\t\tself.run(args)\n\tend", "def load_current_resource\n\n @current_lb = load_balancer_by_name(new_resource.lb_name)\n\n @current_resource = Chef::Resource::LbLoadBalancer.new(new_resource.lb_name)\n @current_resource.lb_name(new_resource.lb_name)\n @current_resource.aws_access_key(new_resource.aws_access_key)\n @current_resource.aws_secret_access_key(new_resource.aws_secret_access_key)\n @current_resource.region(new_resource.region)\n @current_resource.listeners(new_resource.listeners)\n @current_resource.timeout(new_resource.timeout)\n\n if @current_lb\n @current_resource.availability_zones(@current_lb['AvailabilityZones'])\n @current_resource.instances(@current_lb['Instances'])\n end\n @current_resource.availability_zones || @current_resource.availability_zones([])\n @current_resource.instances || @current_resource.instances([])\n\n if new_resource.instances.nil? && new_resource.search_query\n new_resource.instances(search(:node, new_resource.search_query).map { |n| n['ec2']['instance_id']})\n end\n\n all_zones = availability_zone_for_instances(new_resource.instances)\n unique_zones = all_zones.compact.uniq\n\n if new_resource.availability_zones.nil?\n new_resource.availability_zones(unique_zones)\n end\nend", "def get_traffic_by_loadbalancer(loadbalancer_id, attributes = {}, headers = {})\n Validators::Traffic.validate_attributes!(attributes, :list)\n get!(\"traffics/loadbalancers/#{loadbalancer_id}\", attributes, headers)\n end", "def add_loader(loader)\n @loaders << loader\n end", "def load_blog_list_from_local\n input = YAML.load(File.read('blogs.yaml'))['blogs']\n\n blogs = []\n input.each do |blog|\n blog_id = calculate_id_for(blog)\n item = {\n '__typename': 'Blog',\n '_version': 1,\n '_lastChangedAt': Time.now.to_i,\n id: blog_id,\n title: blog['title'],\n url: blog['url']\n }\n\n $ddb_client.put_item({\n table_name: BLOGS_TABLE,\n item: item\n })\n\n blogs.push(item)\n end\n\n p \"Added #{blogs.length} blogs\"\n { items: blogs, count: blogs.length }\nend", "def set_load_balancer_name(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerName'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :load_balancer_name\n\t\t\targs[:query]['LoadBalancerName'] = optional[:load_balancer_name]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tself.run(args)\n\tend", "def test_00_describe_load_balancers\n items = @elb.describe_load_balancers\n assert items.is_a?(Array)\n end", "def add_client(client)\n clients.push(client)\n end", "def set_load_balancer_status(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerStatus'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :load_balancer_status\n\t\t\targs[:query]['LoadBalancerStatus'] = optional[:load_balancer_status]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tself.run(args)\n\tend", "def create\n @operations_check = OperationsCheck.find(params[:operations_check_id])\n @load_balancer_check = @operations_check.load_balancer_checks.create(load_balancer_check_params)\n\n respond_to do |format|\n if @load_balancer_check.save\n format.html { redirect_to operations_check_path(@operations_check, tab: \"load_balancers\"), \n notice: 'Load balancer check was successfully created.' }\n format.json { render json: @load_balancer_check, status: :created, location: @load_balancer_check }\n else\n format.html { redirect_to operations_check_path(@operations_check, tab: \"load_balancers\"),\n notice: 'Commit failed - you must give a ticket number if the check failed!' }\n format.json { render json: @load_balancer_check.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_book(book)\n self.book_lists.create(:book_id => book.id)\n end", "def services_web_application_name_servers_web_server_name_load_balancing_put(authorization, web_application_name, web_server_name, load_balancing, opts = {})\n data,status_code,headers = services_web_application_name_servers_web_server_name_load_balancing_put_with_http_info(authorization, web_application_name, web_server_name, load_balancing, opts)\n return data,status_code,headers\n end", "def index\n @loadbalancers = getmydata(\"Loadbalancer\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loadbalancers }\n end\n end", "def add_client(client)\n @clients.push(client)\n end", "def find(options = {})\n raise \"Unable to locate the LoadBalancer named '#{options[:name]}'\" unless options[:id]\n response = Profitbricks.request :get_load_balancer, load_balancer_id: options[:id]\n PB::LoadBalancer.new(response)\n end", "def add_breadcrumb name, url = ''\n @breadcrumbs ||= []\n url = eval(url) if url =~ /_path|_url|@/\n @breadcrumbs << [name, url]\n end", "def addHost(host)\n\t\[email protected](host)\n\tend", "def list_configs(lb_id, headers = {})\n get!(\"loadbalancers/#{lb_id}/configs\", {}, headers)\n end", "def create_load_balancer_policy(lb_name, name, type_name, attributes = {})\n params = {}\n\n attribute_name = []\n attribute_value = []\n attributes.each do |name, value|\n attribute_name.push(name)\n attribute_value.push(value)\n end\n\n params.merge!(Fog::AWS.indexed_param('PolicyAttributes.member.%d.AttributeName', attribute_name))\n params.merge!(Fog::AWS.indexed_param('PolicyAttributes.member.%d.AttributeValue', attribute_value))\n\n request({\n 'Action' => 'CreateLoadBalancerPolicy',\n 'LoadBalancerName' => lb_name,\n 'PolicyName' => name,\n 'PolicyTypeName' => type_name,\n :parser => Fog::Parsers::AWS::ELB::Empty.new\n }.merge!(params))\n end", "def describe_load_balancers(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeLoadBalancers'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :address\n\t\t\targs[:query]['Address'] = optional[:address]\n\t\tend\n\t\tif optional.key? :address_type\n\t\t\targs[:query]['AddressType'] = optional[:address_type]\n\t\tend\n\t\tif optional.key? :internet_charge_type\n\t\t\targs[:query]['InternetChargeType'] = optional[:internet_charge_type]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :master_zone_id\n\t\t\targs[:query]['MasterZoneId'] = optional[:master_zone_id]\n\t\tend\n\t\tif optional.key? :network_type\n\t\t\targs[:query]['NetworkType'] = optional[:network_type]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :security_status\n\t\t\targs[:query]['SecurityStatus'] = optional[:security_status]\n\t\tend\n\t\tif optional.key? :server_id\n\t\t\targs[:query]['ServerId'] = optional[:server_id]\n\t\tend\n\t\tif optional.key? :slave_zone_id\n\t\t\targs[:query]['SlaveZoneId'] = optional[:slave_zone_id]\n\t\tend\n\t\tif optional.key? :v_switch_id\n\t\t\targs[:query]['VSwitchId'] = optional[:v_switch_id]\n\t\tend\n\t\tif optional.key? :vpc_id\n\t\t\targs[:query]['VpcId'] = optional[:vpc_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def set_load_balancer_name(load_balancer_id, load_balancer_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerName'\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:query]['LoadBalancerName'] = load_balancer_name\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def add_books(books)\n books.each do |book|\n @books.push(book)\n end\n end", "def remove_from_lb(group)\n @haproxy.identity_filter(@load_balancer)\n # We don't have to identify the nodes in the group\n # for every action. I'm doing it here to make each\n # method easier to read\n @rpcutil.class_filter(group)\n begin\n @rpcutil.ping.each do |node|\n hostname = node.results[:sender]\n # Disable the nodes\n @haproxy.disable(:backend => 'puppetcamp', :server => hostname).each do |rpcresult|\n if rpcresult.results[:statuscode] != 0\n raise LoadBalancerRemoveException, hostname\n end\n end\n end\n ensure\n @haproxy.reset_filter\n @rpcutil.reset_filter\n end\nend", "def add(address)\n unless addresses.include?(address)\n server = Server.new(address, options)\n addresses.push(address)\n @servers.push(server)\n server\n end\n end", "def update_instances(elb_name, instances_added, instances_removed = [])\n\n # deregister instances that were removed\n if !instances_removed.empty?\n @elb.deregister_instances_from_load_balancer({\n load_balancer_name: elb_name,\n instances: instances_removed.map do |i|\n {\n instance_id: i\n }\n end\n })\n end\n\n # register instances that were added\n if !instances_added.empty?\n @elb.register_instances_with_load_balancer({\n load_balancer_name: elb_name,\n instances: instances_added.map do |i|\n {\n instance_id: i\n }\n end\n })\n end\n end", "def add1\n bp = bpn\n bp.add_list_item('Apollo13',actors,hanks)\nend", "def bridges_create(params = {})\n post \"bridges\", params\n end", "def add_services(cookbook, services)\n cookbook_services[cookbook] = services\n service_list.merge!(services)\n end", "def create_load_balancer_pool_with_http_info(lb_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesLoadbalancerApi.create_load_balancer_pool ...'\n end\n # verify the required parameter 'lb_pool' is set\n if @api_client.config.client_side_validation && lb_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_pool' when calling ManagementPlaneApiServicesLoadbalancerApi.create_load_balancer_pool\"\n end\n # resource path\n local_var_path = '/loadbalancer/pools'\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(lb_pool)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LbPool')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesLoadbalancerApi#create_load_balancer_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def add list\n add = @watch.objects.find { |obj| obj.name == \"add\" }\n\n obix = OBIX::Builder.new do |obix|\n obix.obj is: \"obix:WatchIn\" do |obix|\n obix.list name: \"hrefs\" do |obix|\n list.each do |item|\n obix.uri val: item\n end\n end\n end\n end\n\n add.invoke obix.object\n end", "def add_sitelinks(params, additional_headers = {})\n perform_request(self, @token, 'sitelinks', 'add', params, additional_headers)\n end", "def is_load_balancer_member?\n debug \"checking load balancer membership\"\n\n if @property_hash.size > 0\n connect()\n\n load_balancer = get_loadbalancer()\n if load_balancer and load_balancer.instances.include?(@property_hash[:id])\n debug \"Instance #{@property_hash[:id]} already a member of #{resource[:load_balancer]}\"\n return resource[:load_balancer]\n else\n debug \"Registering #{@property_hash[:id]} with #{resource[:load_balancer]}\"\n return false\n end\n end\n nil\n end", "def get_balancer_manager\n @balancer_manager\n end", "def add_train(train)\n trains << train\n end", "def add_proxies records\n if records && records.length > 0\n records.each { |record| add_proxy record }\n end\n end", "def add_to_lists\n logger.debug \"In add_to_lists\"\n logger.debug \"@new_series_and_venue=#{@new_series_and_venue}\"\n logger.debug \"@old_series=#{@old_series}\"\n logger.debug \"series=#{series}\"\n\n series.add(self) if (series && @new_series_and_venue || @old_series)\n venue.add(self) if (venue && @new_series_and_venue || @old_venue)\n @old_series.remove(self) if @old_series\n @old_venue.remove(self) if @old_venue\n end", "def register_servers(servers)\n raise \"You have to provide at least one server\" unless servers\n options = {load_balancer_id: self.id, server_ids: servers.collect(&:id)}\n response = Profitbricks.request :register_servers_on_load_balancer, options\n self.reload\n return true\n end", "def add(location)\n $LOAD_MANAGER.add(location)\n end", "def lbAdd _obj, _args\n \"_obj lbAdd _args;\" \n end" ]
[ "0.76427525", "0.6864852", "0.67095643", "0.6671662", "0.64470446", "0.6313913", "0.6298787", "0.6191413", "0.6124943", "0.60588956", "0.6013395", "0.6004589", "0.59690684", "0.5958809", "0.58974504", "0.58777463", "0.5851733", "0.5808511", "0.57558787", "0.57458675", "0.5714015", "0.56674004", "0.5656929", "0.56489843", "0.5625739", "0.5625739", "0.5599749", "0.5501017", "0.54984856", "0.5482565", "0.541409", "0.541247", "0.5405791", "0.53801286", "0.53707653", "0.531289", "0.5301388", "0.52954257", "0.5294672", "0.51731443", "0.5168433", "0.5164393", "0.51643777", "0.51601106", "0.5154066", "0.5138121", "0.513471", "0.5130989", "0.5079835", "0.5077746", "0.50754434", "0.5053488", "0.5042366", "0.5040168", "0.50268865", "0.5020052", "0.5018679", "0.5017753", "0.50137764", "0.50130516", "0.50111854", "0.49981624", "0.4979787", "0.4976374", "0.49485087", "0.4941634", "0.49343878", "0.49148238", "0.49072725", "0.49002433", "0.48977348", "0.4872924", "0.4869082", "0.4868049", "0.48638448", "0.4863302", "0.48529935", "0.48451054", "0.48413333", "0.48372367", "0.48269412", "0.48085916", "0.48049054", "0.47781447", "0.47779799", "0.47740313", "0.47660717", "0.47640234", "0.4757674", "0.47485006", "0.47466555", "0.4731558", "0.47279283", "0.47243157", "0.4717094", "0.47057897", "0.4705193", "0.47035265", "0.46987337", "0.46936166" ]
0.7469247
1
Create icontrol binding for load balancer
def create_icontrol(hostname) # rubocop:disable AbcSize load_dependencies f5_creds = chef_vault_item(node['f5-bigip']['credentials']['databag'], node['f5-bigip']['credentials']['item']) if node['f5-bigip']['credentials']['host_is_key'] f5_creds = f5_creds[hostname] else f5_creds = f5_creds[node['f5-bigip']['credentials']['key']] unless node['f5-bigip']['credentials']['key'].empty? end F5::IControl.new(hostname, f5_creds['username'], f5_creds['password'], interfaces).get_interfaces end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_lb(hostname)\n @@load_balancers << LoadBalancer.new(hostname, create_icontrol(hostname))\n end", "def createCLB(elbv1, sg_tcp_80_lb, pub_net1_id, pub_net2_id)\n # TODO: Remove CLB by name if create fails to fully create\n\n # Create CLB\n response = elbv1.create_load_balancer(load_balancer_name: 'AutoCLB',\n subnets: [pub_net1_id, pub_net2_id],\n security_groups: [sg_tcp_80_lb],\n listeners: [{ protocol: 'HTTP',\n load_balancer_port: 80,\n instance_protocol: 'HTTP',\n instance_port: 80 }])\n clb_dns_name = response.dns_name\n puts \"clb_dns_name = #{clb_dns_name}\"\n clb_dns_name # return\nend", "def allocate_load_balancer(action_handler, lb_spec, lb_options, machine_specs)\n end", "def add_load_balancer(name, ports, ip_address)\n\n unless ports.is_a? Array\n ports = [ ports ]\n end\n\n if name.nil?\n name = \"lb#{RandomName.create(5,3)}\"\n end\n\n if ip_address.is_a? String\n ip_address = public_ipaddress \"#{name}-addr\" do\n dns_settings domain_name_label: ip_address\n end\n end\n\n lb = load_balancer name do\n\n if ip_address.nil?\n fics = frontend_ipconfigurations name: name + '-feconf'\n else\n fics = frontend_ipconfigurations name: name + '-feconf',\n public_ipaddress: ip_address\n end\n\n pools = backend_address_pools name: name + '-pool'\n\n ports.each do |port|\n\n p = probes name: name + \"-probe#{port}\",\n protocol: 'Tcp',\n port: port,\n number_of_probes: 2,\n interval_in_seconds: 15\n\n load_balancing_rules name: \"rule#{port}\",\n frontend_ipconfiguration: fics[0],\n backend_address_pool: pools[0],\n protocol: 'Tcp',\n frontend_port: port,\n backend_port: port,\n idle_timeout_in_minutes: 15,\n probe: p[0]\n end\n\n end\n\n end", "def load_balancer # rubocop:disable AbcSize\n raise 'Can not determine hostname to load client for' if @new_resource.f5.nil?\n @@load_balancers ||= []\n add_lb(@new_resource.f5) if @@load_balancers.empty?\n add_lb(@new_resource.f5) if @@load_balancers.find { |lb| lb.name == @new_resource.f5 }.nil?\n @@load_balancers.find { |lb| lb.name == @new_resource.f5 }\n end", "def call_bind_objects\n\n\n ### this is the server to servicegroup binding...no, it doesn't belong here\n @server_array.each { |x| \n print \"binding #{x} to the servicegroup...\" \n @uri.path = \"/nitro/v1/config/servicegroup_servicegroupmember_binding/#{@sgservice_name}\" \n @uri.query = \"action=bind\"\n @request = Net::HTTP::Post.new(@uri)\n @request.basic_auth \"#{@username}\", \"#{@password}\"\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.servicegroup_servicegroupmember_binding+json')\n @request.body = { :servicegroup_servicegroupmember_binding => { :servicegroupname => \"#{@sgservice_name}\", :servername => \"#{x}\", :port => \"8080\" } }.to_json \n \n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n if response.code == \"201\"\n print \"success!\\n\"\n else\n print \"fail!\\n\"\n print \"code: \", response.code.to_i, \"\\n\"\n print \"body: \", response.body, \"\\n\"\n end\n }\n }\n\n\n ### this is the servicegroup to lbvserver binding, doesn't belong here\n print \"binding #{@sgservice_name} to #{@lbvserver_name}...\"\n @uri.path = \"/nitro/v1/config/lbvserver_service_binding\" \n @uri.query = \"action=bind\"\n @request = Net::HTTP::Post.new(@uri)\n @request.basic_auth \"#{@username}\", \"#{@password}\"\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.lbvserver_service_binding+json')\n @request.body = { :lbvserver_service_binding => { :name => \"#{@lbvserver_name}\", :servicename => \"#{@sgservice_name}\" } }.to_json \n \n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n if response.code == \"201\"\n print \"success!\\n\"\n else\n print \"fail!\\n\"\n print \"code: \", response.code.to_i, \"\\n\"\n print \"body: \", response.body, \"\\n\"\n end\n }\n\n end", "def bind\n req = VCAP::Services::Api::CloudControllerBindRequest.decode(request_body)\n\n app = ::App.find_by_collaborator_and_id(user, req.app_id)\n raise CloudError.new(CloudError::APP_NOT_FOUND) unless app\n\n cfg = ServiceConfig.find_by_name(req.service_id)\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless cfg\n raise CloudError.new(CloudError::FORBIDDEN) unless cfg.provisioned_by?(user)\n\n binding = app.bind_to_config(cfg)\n\n resp = {\n :binding_token => binding.binding_token.uuid,\n :label => cfg.service.label\n }\n render :json => resp\n end", "def create name, type, attributes = {}\n\n attribute_list = []\n\n attributes.each do |attr_name,values|\n [values].flatten.each do |value|\n attribute_list << { \n :attribute_name => attr_name, \n :attribute_value => value.to_s \n }\n end\n end\n\n client.create_load_balancer_policy(\n :load_balancer_name => load_balancer.name,\n :policy_name => name.to_s,\n :policy_type_name => type.to_s,\n :policy_attributes => attribute_list)\n\n LoadBalancerPolicy.new(load_balancer, name, :type => type.to_s)\n\n end", "def add_http_load_balancer(name, ip_address=nil)\n\n add_load_balancer name, 80, ip_address\n\n end", "def internal_lb_url\n if node['private_chef']['nginx']['non_ssl_port'] == false\n \"https://#{vip_for_uri('lb_internal')}:#{node['private_chef']['nginx']['ssl_port']}\"\n else\n \"http://#{vip_for_uri('lb_internal')}:#{node['private_chef']['nginx']['non_ssl_port']}\"\n end\n end", "def call_create_lbvserver(ipaddress=\"0.0.0.0\", args = {})\n print \"adding lb vserver...\"\n @lbvserver_name = \"vs-#{@servicename}-usa-qa-wh\"\n # hard coded for testing\n ipaddress = \"10.126.255.53\"\n # hard coded for testing\n port = \"80\"\n # hard coded for testing\n http_or_ssl = \"HTTP\"\n @uri.path = \"/nitro/v1/config/lbvserver/\"\n @request = Net::HTTP::Post.new(@uri)\n @request.basic_auth \"#{@username}\", \"#{@password}\"\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.lbvserver+json')\n @request.body = { :lbvserver => { :name => \"#{@lbvserver_name}\", :servicetype => \"#{http_or_ssl}\", :ipv46 => \"#{ipaddress}\", :port => \"#{port}\", :persistencetype => \"COOKIEINSERT\", :timeout => \"15\", :lbmethod => \"LRTM\", :cltTimeout => \"1800\", :appflowlog => \"DISABLED\" } }.to_json \n\n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n if response.code == \"201\"\n print \"success!\\n\"\n @status_hash[:lbvserver] = \"@lbvserver_name\"\n else\n print \"fail!\\n\"\n print \"code: \", response.code.to_i, \"\\n\"\n print \"body: \", response.body, \"\\n\"\n end\n }\n end", "def bind\n conf['api']['bind']\n end", "def bind_external\n cli_req = VCAP::Services::Api::BindExternalRequest.decode(request_body)\n\n app = ::App.find_by_collaborator_and_id(user, cli_req.app_id)\n raise CloudError.new(CloudError::APP_NOT_FOUND) unless app\n\n tok = ::BindingToken.find_by_uuid(cli_req.binding_token)\n raise CloudError.new(CloudError::TOKEN_NOT_FOUND) unless tok\n\n cfg = tok.service_config\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless cfg\n\n app.bind_to_config(cfg, tok.binding_options)\n\n render :json => {}\n end", "def create_elb(elb)\n resp = aws_api_connect(\"ELB_Client\")\n begin\n pants = resp.create_load_balancer({\n load_balancer_name: elb[:name],\n listeners: [\n {\n protocol: elb[:protocol],\n load_balancer_port: elb[:port],\n instance_protocol: elb[:instnace_protocol],\n instance_port: elb[:instance_port],\n ssl_certificate_id: elb[:ssl_cert],\n },\n ],\n subnets: elb[:subnets],\n security_groups: elb[:security_groups],\n })\n rescue Aws::ElasticLoadBalancing::Errors::DuplicateLoadBalancerName\n puts \"Load Balancer #{elb[:name]} already exists, bypassing\"\n rescue Aws::ElasticLoadBalancing::Errors::Throttling\n puts \"api throttled, retrying\"\n # TODO: Add exponential backoff\n sleep(5)\n retry\n end\n end", "def ready_load_balancer(action_handler, lb_spec, lb_options, machine_specs)\n end", "def create(name)\n configure [\"interface #{name}\", 'no ip address', 'switchport']\n end", "def create\n super\n push_binding(instance_eval(\"#{name.to_s}\"))\n end", "def create_load_balancer_pool_with_http_info(lb_pool, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesLoadbalancerApi.create_load_balancer_pool ...'\n end\n # verify the required parameter 'lb_pool' is set\n if @api_client.config.client_side_validation && lb_pool.nil?\n fail ArgumentError, \"Missing the required parameter 'lb_pool' when calling ManagementPlaneApiServicesLoadbalancerApi.create_load_balancer_pool\"\n end\n # resource path\n local_var_path = '/loadbalancer/pools'\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(lb_pool)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LbPool')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesLoadbalancerApi#create_load_balancer_pool\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_rightscale_tag_load_balancer(resource_name)\n ChefSpec::Matchers::ResourceMatcher.new('rightscale_tag_load_balancer', :create, resource_name)\n end", "def create_load_balancer_listeners(lb_name, listeners)\n params = {}\n\n listener_protocol = []\n listener_lb_port = []\n listener_instance_port = []\n listener_instance_protocol = []\n listener_ssl_certificate_id = []\n listeners.each do |listener|\n listener_protocol.push(listener['Protocol'])\n listener_lb_port.push(listener['LoadBalancerPort'])\n listener_instance_port.push(listener['InstancePort'])\n listener_instance_protocol.push(listener['InstanceProtocol'])\n listener_ssl_certificate_id.push(listener['SSLCertificateId'])\n end\n\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.Protocol', listener_protocol))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.LoadBalancerPort', listener_lb_port))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.InstancePort', listener_instance_port))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.InstanceProtocol', listener_instance_protocol))\n params.merge!(Fog::AWS.indexed_param('Listeners.member.%d.SSLCertificateId', listener_ssl_certificate_id))\n\n request({\n 'Action' => 'CreateLoadBalancerListeners',\n 'LoadBalancerName' => lb_name,\n :parser => Fog::Parsers::AWS::ELB::Empty.new\n }.merge!(params))\n end", "def define_pulic_ports(port_bindings = {})\n return if port_bindings.nil? || port_bindings.empty?\n\n @template['HostConfig']['PortBindings'] = {}.tap do |pbindings|\n # Init\n @template['Config']['ExposedPorts'].each_key do |k|\n pbindings[k] = nil\n end\n\n # Set bindings\n port_bindings.each do |private_port, public_ports|\n pbindings[private_port] = public_ports.each do |host|\n host.merge!('HostIp' => '0.0.0.0')\n end\n end\n end\n\n # Set networksettings (used for Container#all method)\n @template['NetworkSettings']['Ports'] = @template['HostConfig']['PortBindings'].dup\n end", "def binding() end", "def binding() end", "def bind=(value)\n conf['api']['bind'] = value\n end", "def create(name)\n configure([\"interface #{name}\", 'no switchport'])\n end", "def _binding() binding end", "def _binding() binding end", "def get_loadbalancer(name=resource[:load_balancer])\n get_cloud_connection()\n args = []\n\n args << @connection_resource[:user]\n args << @connection_resource[:pass]\n args << @connection_resource[:location] if @connection_resource[:location]\n\n @loadbalancer_connection = Puppet::Type::Loadbalancer::ProviderElb.connection(*args)\n\n load_balancer = @loadbalancer_connection.load_balancers.find {|lb|\n lb.id == name\n }\n end", "def create\n @loadbalancer = Loadbalancer.new(params[:loadbalancer])\n @loadbalancer.account_id = @oeaccount.id\n respond_to do |format|\n if @loadbalancer.save\n format.html { redirect_to loadbalancers_url, notice: 'Loadbalancer was successfully created.' }\n format.json { render json: @loadbalancer, status: :created, location: @loadbalancer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @loadbalancer.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_bridged_network_to_vbox_vm(client_name,nic_name)\n message = \"Adding:\\tBridged network \"+nic_name+\" to \"+client_name\n command = \"VBoxManage modifyvm #{client_name} --nic1 bridged --bridgeadapter1 #{nic_name}\"\n execute_command(message,command)\n return\nend", "def bind; binding() end", "def bind(&block)\n\t\t\[email protected](&block)\n\t\tend", "def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :address\n\t\t\targs[:query]['Address'] = optional[:address]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :is_public_address\n\t\t\targs[:query]['IsPublicAddress'] = optional[:is_public_address]\n\t\tend\n\t\tif optional.key? :load_balancer_mode\n\t\t\targs[:query]['LoadBalancerMode'] = optional[:load_balancer_mode]\n\t\tend\n\t\tif optional.key? :load_balancer_name\n\t\t\targs[:query]['LoadBalancerName'] = optional[:load_balancer_name]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def update_rib(conf)\n if conf[:status] == :alive\n IPRoute.add_nexthop conf[:gateway], conf[:interface], conf[:provider], conf[:weight]\n IPRoute.add_src_route conf[:network], conf[:gateway], conf[:interface], conf[:address], conf[:provider]\n IPRoute.add_rule conf[:network], conf[:interface], conf[:provider]\n else\n IPRoute.del_nexthop conf[:gateway], conf[:interface], conf[:provider]\n IPRoute.del_route conf[:network], conf[:gateway], conf[:interface], conf[:provider]\n IPRoute.del_rule conf[:network], conf[:interface], conf[:provider]\n end\n end", "def load_current_resource\n\n @current_lb = load_balancer_by_name(new_resource.lb_name)\n\n @current_resource = Chef::Resource::LbLoadBalancer.new(new_resource.lb_name)\n @current_resource.lb_name(new_resource.lb_name)\n @current_resource.aws_access_key(new_resource.aws_access_key)\n @current_resource.aws_secret_access_key(new_resource.aws_secret_access_key)\n @current_resource.region(new_resource.region)\n @current_resource.listeners(new_resource.listeners)\n @current_resource.timeout(new_resource.timeout)\n\n if @current_lb\n @current_resource.availability_zones(@current_lb['AvailabilityZones'])\n @current_resource.instances(@current_lb['Instances'])\n end\n @current_resource.availability_zones || @current_resource.availability_zones([])\n @current_resource.instances || @current_resource.instances([])\n\n if new_resource.instances.nil? && new_resource.search_query\n new_resource.instances(search(:node, new_resource.search_query).map { |n| n['ec2']['instance_id']})\n end\n\n all_zones = availability_zone_for_instances(new_resource.instances)\n unique_zones = all_zones.compact.uniq\n\n if new_resource.availability_zones.nil?\n new_resource.availability_zones(unique_zones)\n end\nend", "def create\n if resource[:ipsource] == \"static\"\n ip = resource[:ip]\n netmask = resource[:netmask]\n gateway = resource[:gateway]\n end\n if resource[:snmp]\n snmp = resource[:snmp]\n end\n ipsrc = resource[:ipsource]\n if resource[:vlanid]\n vlanid = resource[:vlanid]\n end\n enable_channel\n\n end", "def initialize(load_balancer)\n @connection = load_balancer.connection\n @load_balancer = load_balancer\n @lbmgmthost = @connection.lbmgmthost\n @lbmgmtpath = @connection.lbmgmtpath\n @lbmgmtport = @connection.lbmgmtport\n @lbmgmtscheme = @connection.lbmgmtscheme\n populate\n return self\n end", "def add_netif(opts)\n\n end", "def add_netif(opts)\n\n end", "def add_netif(opts)\n\n end", "def build(attribs = {})\n b = KathyLee::Definition::Binding.new(self.factory_name, self.attributes.merge(attribs), &self.code_block)\n b.process!\n return b.result\n end", "def attach_to_internal_network(name=\"intnet\")\n # couldn't find a way to get VirtualBox to list internal networks over FFI\n self.attachment_type = :internal_network\n self.internal_network = name\n self.enabled = true\n end", "def create_load_balancer_t_c_p_listener(backend_server_port, bandwidth, listener_port, load_balancer_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancerTCPListener'\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :health_check_connect_port\n\t\t\traise ArgumentError, 'health_check_connect_port must be equal or greater than 1' unless optional[:health_check_connect_port] < 1\n\t\t\traise ArgumentError, 'health_check_connect_port must be equal or less than 65535' unless optional[:health_check_connect_port] > 65535\n\t\t\targs[:query]['HealthCheckConnectPort'] = optional[:health_check_connect_port]\n\t\tend\n\t\tif optional.key? :health_check_connect_timeout\n\t\t\traise ArgumentError, 'health_check_connect_timeout must be equal or greater than 1' unless optional[:health_check_connect_timeout] < 1\n\t\t\traise ArgumentError, 'health_check_connect_timeout must be equal or less than 50' unless optional[:health_check_connect_timeout] > 50\n\t\t\targs[:query]['HealthCheckConnectTimeout'] = optional[:health_check_connect_timeout]\n\t\tend\n\t\tif optional.key? :health_check_domain\n\t\t\targs[:query]['HealthCheckDomain'] = optional[:health_check_domain]\n\t\tend\n\t\tif optional.key? :health_check_http_code\n\t\t\targs[:query]['HealthCheckHttpCode'] = optional[:health_check_http_code]\n\t\tend\n\t\tif optional.key? :health_check_interval\n\t\t\traise ArgumentError, 'health_check_interval must be equal or greater than 1' unless optional[:health_check_interval] < 1\n\t\t\traise ArgumentError, 'health_check_interval must be equal or less than 5' unless optional[:health_check_interval] > 5\n\t\t\targs[:query]['healthCheckInterval'] = optional[:health_check_interval]\n\t\tend\n\t\tif optional.key? :health_check_type\n\t\t\targs[:query]['HealthCheckType'] = optional[:health_check_type]\n\t\tend\n\t\tif optional.key? :health_check_u_r_i\n\t\t\targs[:query]['HealthCheckURI'] = optional[:health_check_u_r_i]\n\t\tend\n\t\tif optional.key? :healthy_threshold\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or greater than 1' unless optional[:healthy_threshold] < 1\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or less than 10' unless optional[:healthy_threshold] > 10\n\t\t\targs[:query]['HealthyThreshold'] = optional[:healthy_threshold]\n\t\tend\n\t\tif optional.key? :max_conn_limit\n\t\t\targs[:query]['MaxConnLimit'] = optional[:max_conn_limit]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :persistence_timeout\n\t\t\traise ArgumentError, 'persistence_timeout must be equal or greater than 0' unless optional[:persistence_timeout] < 0\n\t\t\traise ArgumentError, 'persistence_timeout must be equal or less than 86400' unless optional[:persistence_timeout] > 86400\n\t\t\targs[:query]['PersistenceTimeout'] = optional[:persistence_timeout]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :scheduler\n\t\t\targs[:query]['Scheduler'] = optional[:scheduler]\n\t\tend\n\t\tif optional.key? :unhealthy_threshold\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or greater than 1' unless optional[:unhealthy_threshold] < 1\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or less than 10' unless optional[:unhealthy_threshold] > 10\n\t\t\targs[:query]['UnhealthyThreshold'] = optional[:unhealthy_threshold]\n\t\tend\n\t\traise ArgumentError, 'backend_server_port must be equal or greater than 1' unless backend_server_port < 1\n\t\traise ArgumentError, 'backend_server_port must be equal or less than 65535' unless backend_server_port > 65535\n\t\targs[:query]['BackendServerPort'] = backend_server_port\n\t\traise ArgumentError, 'bandwidth must be equal or greater than -1' unless bandwidth < -1\n\t\traise ArgumentError, 'bandwidth must be equal or less than 1000' unless bandwidth > 1000\n\t\targs[:query]['Bandwidth'] = bandwidth\n\t\traise ArgumentError, 'listener_port must be equal or greater than 1' unless listener_port < 1\n\t\traise ArgumentError, 'listener_port must be equal or less than 65535' unless listener_port > 65535\n\t\targs[:query]['ListenerPort'] = listener_port\n\t\tself.run(args)\n\tend", "def create_load_balancer_t_c_p_listener(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancerTCPListener'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :backend_server_port\n\t\t\targs[:query]['BackendServerPort'] = optional[:backend_server_port]\n\t\tend\n\t\tif optional.key? :connect_port\n\t\t\targs[:query]['ConnectPort'] = optional[:connect_port]\n\t\tend\n\t\tif optional.key? :connect_timeout\n\t\t\targs[:query]['ConnectTimeout'] = optional[:connect_timeout]\n\t\tend\n\t\tif optional.key? :health_check\n\t\t\targs[:query]['HealthCheck'] = optional[:health_check]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :interval\n\t\t\targs[:query]['Interval'] = optional[:interval]\n\t\tend\n\t\tif optional.key? :listener_port\n\t\t\targs[:query]['ListenerPort'] = optional[:listener_port]\n\t\tend\n\t\tif optional.key? :listener_status\n\t\t\targs[:query]['ListenerStatus'] = optional[:listener_status]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :persistence_timeout\n\t\t\targs[:query]['PersistenceTimeout'] = optional[:persistence_timeout]\n\t\tend\n\t\tif optional.key? :scheduler\n\t\t\targs[:query]['Scheduler'] = optional[:scheduler]\n\t\tend\n\t\tself.run(args)\n\tend", "def create_load_balancer_policy(lb_name, name, type_name, attributes = {})\n params = {}\n\n attribute_name = []\n attribute_value = []\n attributes.each do |name, value|\n attribute_name.push(name)\n attribute_value.push(value)\n end\n\n params.merge!(Fog::AWS.indexed_param('PolicyAttributes.member.%d.AttributeName', attribute_name))\n params.merge!(Fog::AWS.indexed_param('PolicyAttributes.member.%d.AttributeValue', attribute_value))\n\n request({\n 'Action' => 'CreateLoadBalancerPolicy',\n 'LoadBalancerName' => lb_name,\n 'PolicyName' => name,\n 'PolicyTypeName' => type_name,\n :parser => Fog::Parsers::AWS::ELB::Empty.new\n }.merge!(params))\n end", "def lb_running?\n containers = Docker::Container.all(all: true, filters: { ancestor: [@lb_image], status:['running'] }.to_json)\n if containers.empty? \n lb = Docker::Container.create(\n 'Cmd'=> [\n '-n',\n '10000'\n ],\n 'Image' => \"#{@lb_image}\",\n 'ExposedPorts' => { \n \"443/tcp\"=> {},\n \"80/tcp\"=> {},\n \"8888/tcp\"=> {}\n },\n 'HostConfig' => {\n \"Binds\"=> [\n \"/home/mior/mior-github/tcc/haproxy/conf/:/etc/haproxy/\"\n ],\n 'PortBindings' => {\n '80/tcp' => [{ 'HostPort' => '80' }],\n '8888/tcp' => [{ 'HostPort' => '8888' }]\n }\n }\n )\n lb.start\n puts 'Load Balancer lunched!'\n end\n end", "def configure_instance(node, i)\n node.vm.hostname = fqdn(i)\n network_ports node, i\nend", "def ipn_endpoint=(_arg0); end", "def bind_to_activated_sockets(bind = T.unsafe(nil)); end", "def bind(id, repo_id, distributor_id, optional = {})\n required = required_params(binding.send(:local_variables), binding, ['id'])\n call(:post, path(\"#{id}/bindings/\"), :payload => { :required => required, :optional => optional })\n end", "def initialize(ip, secret)\n @ip = ip\n @secret = secret\n \n @conn = SOAP::RPC::Driver.new(\"https://#{@ip}:17443\")\n @conn.add_method(\"set_parameters\", \"djinn_locations\", \"database_credentials\", \"app_names\", \"secret\")\n @conn.add_method(\"set_apps\", \"app_names\", \"secret\")\n @conn.add_method(\"set_apps_to_restart\", \"apps_to_restart\", \"secret\")\n @conn.add_method(\"status\", \"secret\")\n @conn.add_method(\"get_stats\", \"secret\")\n @conn.add_method(\"update\", \"app_names\", \"secret\")\n @conn.add_method(\"stop_app\", \"app_name\", \"secret\") \n @conn.add_method(\"get_all_public_ips\", \"secret\")\n @conn.add_method(\"is_done_loading\", \"secret\")\n @conn.add_method(\"is_done_initializing\", \"secret\")\n @conn.add_method(\"add_role\", \"new_role\", \"secret\")\n @conn.add_method(\"remove_role\", \"old_role\", \"secret\")\n @conn.add_method(\"get_queues_in_use\", \"secret\")\n @conn.add_method(\"add_appserver_to_haproxy\", \"app_id\", \"ip\", \"port\",\n \"secret\")\n @conn.add_method(\"remove_appserver_from_haproxy\", \"app_id\", \"ip\", \"port\",\n \"secret\")\n @conn.add_method(\"add_appserver_process\", \"app_id\", \"secret\")\n @conn.add_method(\"remove_appserver_process\", \"app_id\", \"port\", \"secret\")\n end", "def bind\n \n end", "def create_bridge(bridge)\n return if @bridges.keys.include? bridge\n\n OpenNebula.exec_and_log(\"#{command(:brctl)} addbr #{bridge}\")\n\n @bridges[bridge] = Array.new\n\n OpenNebula.exec_and_log(\"#{command(:ip)} link set #{bridge} up\")\n end", "def ipn_endpoint; end", "def ipn_endpoint; end", "def create_router_interface(oSubnet, router_obj)\n PrcLib.state(\"Attaching subnet '%s' to router '%s'\",\n oSubnet[:name], router_obj[:name])\n begin\n controller_create(:router_interface)\n\n #################\n # provider_add_interface()\n # router_obj.add_interface(oSubnet.id, nil)\n rescue => e\n PrcLib.error(\"%s\\n%s\", e.message, e.backtrace.join(\"\\n\"))\n end\n end", "def create_sslprofile\n converge_by(\"Create #{new_resource} ssl profile\") do\n Chef::Log.info \"Create #{new_resource} ssl profile\"\n\n\n load_balancer.client['LocalLB.ProfileClientSSL'].create_v2([new_resource.sslprofile_name], [{\"value\" => \"/Common/#{new_resource.keyid}\", \"default_flag\" => \"false\"}] , [{\"value\" => \"/Common/#{new_resource.certid}\", \"default_flag\" => \"false\"}])\n load_balancer.client['LocalLB.ProfileClientSSL'].set_passphrase([\"/Common/#{new_resource.sslprofile_name}\"], [{\"value\" => \"#{new_resource.passphrase}\", \"default_flag\" => \"false\" }]) if !new_resource.passphrase.nil?\n\n current_resource.keyid(new_resource.keyid)\n current_resource.certid(new_resource.certid)\n current_resource.cacertid(new_resource.cacertid)\n current_resource.passphrase(new_resource.passphrase)\n\n new_resource.updated_by_last_action(true)\n end\n end", "def render_wrapper\n if new_resource.template\n Chef::Log.debug('Template attribute provided, all other attributes ignored.')\n\n resource = template \"#{node['authorization']['tcp_wrappers']['prefix']}#{tcp_wrappers_filename}\" do\n source new_resource.template\n owner 'root'\n group node['root_group']\n mode '0440'\n variables new_resource.variables\n action :nothing\n end\n else\n hosts_allow = new_resource.user || (\"%#{new_resource.group}\".squeeze('%') if new_resource.group)\n\n resource = template \"#{node['authorization']['tcp_wrappers']['prefix']}/wrappers.d/#{tcp_wrappers_filename}\" do\n source 'hosts_allow.erb'\n cookbook 'tcp_wrappers'\n owner 'root'\n group node['root_group']\n mode '0440'\n variables hosts_allow: hosts_allow,\n daemon_list: new_resource.daemon_list,\n client_list: new_resource.client_list,\n shell_command: new_resource.shell_command\n action :nothing\n end\n end\n\n resource.run_action(:create)\n\n # Return whether the resource was updated so we can notify in the action\n resource.updated_by_last_action?\nend", "def bind( host, port, credentials, databag_name, use_tls ) # :yields: host, port, credentials, databag_name, use_tls\n\n credentials = credentials.kind_of?(Hash) ? credentials.to_hash : credentials.to_s\n\n unless databag_name.kind_of?(String) or databag_name.kind_of?(Symbol)\n raise \"Invalid databag_name: #{databag_name}\"\n end\n\n if credentials.kind_of?(String) and credentials.length > 0\n\n # Pull named credentials from the databag\n\n require 'chef/data_bag_item'\n require 'chef/encrypted_data_bag_item'\n\n secret = Chef::EncryptedDataBagItem.load_secret\n credentials = Chef::EncryptedDataBagItem.load( databag_name.to_s, credentials, secret ).to_hash\n end\n\n unless credentials.kind_of?(Hash) and credentials.key?('bind_dn') and credentials.key?('password')\n raise \"Invalid credentials: #{credentials}\"\n end\n\n args = {\n host: host,\n port: port,\n auth: {\n method: :simple,\n username: credentials['bind_dn'],\n password: credentials['password']\n }\n }\n\n args[:encryption] = :simple_tls if use_tls\n\n @ldap = Net::LDAP.new args\n \n raise \"Unable to bind: #{@ldap.get_operation_result.message}\" unless @ldap.get_operation_result.message == 'Success'\n @ldap\n end", "def generate_binding(a_binding=binding)\n a_binding.local_variables do |local_var|\n a_binding.local_variable_set local_var, nil\n end\n @bound_procs.each_with_index do |bound_proc, index|\n a_binding.local_variable_set \"proc_#{index}\", bound_proc\n end\n @bound_constants.each_with_index do |bound_const, index|\n a_binding.local_variable_set \"const_#{index}\", bound_const\n end\n a_binding\n end", "def nat_gateway_init(name, subnet_name, route_table_name, dest_cidr_block: '0.0.0.0/0', depends_on: [])\n nat_gateway_eip_name = \"#{name}EIP\"\n nat_gateway_eip = allocate_new_eip(nat_gateway_eip_name, depends_on: depends_on)\n nat_gateway_name = name\n nat_gateway_options = {\n Type: 'AWS::EC2::NatGateway'\n }\n nat_gateway_options[:DependsOn] = depends_on unless depends_on.blank?\n resource nat_gateway_name,\n nat_gateway_options.merge(\n Properties: {\n AllocationId: nat_gateway_eip,\n SubnetId: ref(subnet_name)\n })\n nat_route_rule_name = \"#{name}Route\"\n add_route_rule(nat_route_rule_name, route_table_name, nat_gateway_name, dest_cidr_block, depends_on: depends_on)\n\n output nat_gateway_name,\n Description: 'NAT Gateway',\n Value: ref(nat_gateway_name)\n\n nat_gateway_name\n end", "def bind\n binding\n end", "def bind\n binding\n end", "def balancer\n @balancer ||= RightSupport::Net::RequestBalancer.new(@@hostnames,\n :policy=>RightSupport::Net::Balancing::StickyPolicy)\n end", "def generate_bind_tcp_rc4(opts={})\n combined_asm = %Q^\n cld ; Clear the direction flag.\n and rsp, ~0xF ; Ensure RSP is 16 byte aligned\n call start ; Call start, this pushes the address of 'api_call' onto the stack.\n #{asm_block_api}\n start:\n pop rbp ; block API pointer\n #{asm_bind_tcp(opts)}\n #{asm_block_recv_rc4(opts)}\n ^\n Metasm::Shellcode.assemble(Metasm::X64.new, combined_asm).encode_string\n end", "def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :address_type\n\t\t\targs[:query]['AddressType'] = optional[:address_type]\n\t\tend\n\t\tif optional.key? :bandwidth\n\t\t\traise ArgumentError, 'bandwidth must be equal or greater than -1' unless optional[:bandwidth] < -1\n\t\t\traise ArgumentError, 'bandwidth must be equal or less than 1000' unless optional[:bandwidth] > 1000\n\t\t\targs[:query]['Bandwidth'] = optional[:bandwidth]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :internet_charge_type\n\t\t\targs[:query]['InternetChargeType'] = optional[:internet_charge_type]\n\t\tend\n\t\tif optional.key? :load_balancer_name\n\t\t\targs[:query]['LoadBalancerName'] = optional[:load_balancer_name]\n\t\tend\n\t\tif optional.key? :master_zone_id\n\t\t\targs[:query]['MasterZoneId'] = optional[:master_zone_id]\n\t\tend\n\t\tif optional.key? :max_conn_limit\n\t\t\targs[:query]['MaxConnLimit'] = optional[:max_conn_limit]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :security_status\n\t\t\targs[:query]['SecurityStatus'] = optional[:security_status]\n\t\tend\n\t\tif optional.key? :slave_zone_id\n\t\t\targs[:query]['SlaveZoneId'] = optional[:slave_zone_id]\n\t\tend\n\t\tif optional.key? :v_switch_id\n\t\t\targs[:query]['VSwitchId'] = optional[:v_switch_id]\n\t\tend\n\t\tif optional.key? :vpc_id\n\t\t\targs[:query]['VpcId'] = optional[:vpc_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def generate_bind_tcp_rc4(opts={})\n combined_asm = %Q^\n cld ; Clear the direction flag.\n call start ; Call start, this pushes the address of 'api_call' onto the stack.\n #{asm_block_api}\n start:\n pop ebp\n #{asm_bind_tcp(opts)}\n #{asm_block_recv_rc4(opts)}\n ^\n Metasm::Shellcode.assemble(Metasm::X86.new, combined_asm).encode_string\n end", "def generate_bind_tcp(opts={})\n combined_asm = %Q^\n cld ; Clear the direction flag.\n and rsp, 0xFFFFFFFFFFFFFFF0 ; Ensure RSP is 16 byte aligned\n call start ; Call start, this pushes the address of 'api_call' onto the stack.\n #{asm_block_api}\n start:\n pop rbp ; pop off the address of 'api_call' for calling later.\n #{asm_bind_tcp(opts)}\n #{asm_block_recv(opts)}\n ^\n Metasm::Shellcode.assemble(Metasm::X64.new, combined_asm).encode_string\n end", "def new\n @loadbalancer = Loadbalancer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loadbalancer }\n end\n end", "def get_binding(str)\n binding\nend", "def add_to_lb(group)\n @haproxy.identity_filter(@load_balancer)\n # We don't have to identify the nodes in the group\n # for every action. I'm doing it here to make each\n # method easier to read\n @rpcutil.class_filter(group)\n begin\n @rpcutil.ping.each do |node|\n hostname = node.results[:sender]\n # Disable the nodes\n @haproxy.enable(:backend => 'puppetcamp', :server => hostname).each do |rpcresult|\n if rpcresult.results[:statuscode] != 0\n raise LoadBalancerAddException, hostname\n end\n end\n end\n ensure\n @haproxy.reset_filter\n @rpcutil.reset_filter\n end\nend", "def modify_load_balancer_attributes(lb_id, attributes)\n attributes = Fog::AWS.serialize_keys 'Attributes', attributes.map{ |property, value| { :Key => property, :Value => value } }\n request(attributes.merge(\n 'Action' => 'ModifyLoadBalancerAttributes',\n 'LoadBalancerArn' => lb_id,\n :parser => Fog::Parsers::AWS::ELBV2::ModifyLoadBalancerAttributes.new\n ))\n end", "def create_binding(variable_to_value_hash) \n current_binding = binding\n for variable in variable_to_value_hash.keys\n eval \"#{variable.to_s} = variable_to_value_hash[variable]\", binding\n current_binding = binding\n end\n current_binding\nend", "def fetch_from_ec2_loadbalancer\n instances_for_deploy = []\n loadbalancer lb_webserver, :web\n instances_for_deploy\nend", "def fetch_from_ec2_loadbalancer\n instances_for_deploy = []\n loadbalancer lb_webserver, :web\n instances_for_deploy\nend", "def create_params\n params.require(:balancer).permit(:name)\n end", "def create_client!\n Chef::ApiClient::Registration.new(node_name, client_path, http_api: rest).run\n end", "def define_network_interface(nic_ip_config)\n network_interface_props =\n Azure::ARM::Network::Models::NetworkInterfacePropertiesFormat.new\n network_interface_props.ip_configurations = [nic_ip_config]\n\n network_interface = Azure::ARM::Network::Models::NetworkInterface.new\n network_interface.location = @location\n network_interface.name = Utils.get_component_name(\"nic\",@ci_id)\n network_interface.properties = network_interface_props\n\n OOLog.info(\"Network Interface name is: #{network_interface.name}\")\n network_interface\n end", "def add_hostname_to_loopback_interface(comm, name, loop_bound=DEAFAULT_LOOPBACK_CHECK_LIMIT)\n basename = name.split(\".\", 2)[0]\n comm.sudo <<-EOH.gsub(/^ {14}/, '')\n grep -w '#{name}' /etc/hosts || {\n for i in {1..#{loop_bound}}; do\n grep -w \"127.0.${i}.1\" /etc/hosts || {\n echo \"127.0.${i}.1 #{name} #{basename}\" >> /etc/hosts\n break\n }\n done\n }\n EOH\n end", "def add_windows_jumpbox name\n virtual_machine name+'jbx' do\n public_ipaddress name\n image Azure::ARM::Compute::VirtualMachine::WINDOWS_SERVER_2012_R2_DATACENTER\n end\n end", "def create(value)\n configure(\"interface #{value}\")\n end", "def generate\n conf = {\n port: datastore['LPORT'],\n reliable: false\n }\n\n # Generate the more advanced stager if we have the space\n if self.available_space && required_space <= self.available_space\n conf[:exitfunk] = datastore['EXITFUNC']\n conf[:reliable] = true\n end\n\n generate_bind_tcp(conf)\n end", "def initialize(ip='192.168.120.249', base='abnet_db', port='2300')\n @ip = ip\n @base = base\n @port = port\n @url = @ip + ':' + @port + '/' + @base\n end", "def configure_interfaces\n node_servers.each do |svinfo|\n gretap_interfaces(svinfo).each do |ifname, ifcfg|\n host_name = svinfo['hostname']\n virtual_addr = virtual_address(ifcfg)\n\n cloudconductor_server_interface \"#{host_name}_#{ifname}\" do\n action :create\n hostname host_name\n if_name ifname\n network ifcfg['network']\n security_groups ifcfg['security_groups']\n virtual_address virtual_addr\n end\n end\n end\nend", "def create_network_for_import(\n opts\n )\n nic = opts[:nic]\n ccr_ref = opts[:ccr_ref]\n ccr_name = opts[:ccr_name]\n vc_uuid = opts[:vc_uuid]\n vcenter_instance_name = opts[:vcenter_instance_name]\n dc_name = opts[:dc_name]\n template_ref = opts[:template_ref]\n dc_ref = opts[:dc_ref]\n vm_id = opts[:vm_id]\n hpool = opts[:hpool]\n vi_client = opts[:vi_client]\n\n config = {}\n config[:refs] = nic[:refs]\n\n # Let's get the OpenNebula hosts ids\n # associated to the clusters references\n config[:one_ids] = nic[:refs].map do |ref|\n VCenterDriver::VIHelper\n .find_by_ref(\n OpenNebula::HostPool,\n 'TEMPLATE/VCENTER_CCR_REF',\n ref,\n vc_uuid,\n hpool\n )['CLUSTER_ID'] rescue -1\n end\n\n if vm?\n unmanaged = 'wild'\n else\n unmanaged = 'template'\n end\n\n net = VCenterDriver::Network\n .new_from_ref(\n nic[:net_ref],\n vi_client\n )\n if net\n vid = VCenterDriver::Network.retrieve_vlanid(net.item)\n end\n case nic[:pg_type]\n # Distributed PortGroups\n when VCenterDriver::Network::NETWORK_TYPE_DPG\n config[:sw_name] =\n nic[:network]\n .config\n .distributedVirtualSwitch\n .name\n # For DistributedVirtualPortgroups\n # there is networks and uplinks\n config[:uplink] = false\n # NSX-V PortGroups\n when VCenterDriver::Network::NETWORK_TYPE_NSXV\n config[:sw_name] =\n nic[:network]\n .config\n .distributedVirtualSwitch\n .name\n # For NSX-V ( is the same as\n # DistributedVirtualPortgroups )\n # there is networks and uplinks\n config[:uplink] = false\n\n host_id = vi_client.instance_variable_get '@host_id'\n\n begin\n nsx_client = NSXDriver::NSXClient.new_from_id(host_id)\n rescue StandardError\n nsx_client = nil\n end\n\n if !nsx_client.nil?\n nsx_net = NSXDriver::VirtualWire\n .new_from_name(nsx_client, nic[:net_name])\n config[:nsx_id] = nsx_net.ls_id\n config[:nsx_vni] = nsx_net.ls_vni\n config[:nsx_tz_id] = nsx_net.tz_id\n end\n # Standard PortGroups\n when VCenterDriver::Network::NETWORK_TYPE_PG\n # There is no uplinks for standard portgroups,\n # so all Standard\n # PortGroups are networks and no uplinks\n config[:uplink] = false\n config[:sw_name] = VCenterDriver::Network\n .virtual_switch(nic[:network])\n # NSX-T PortGroups\n when VCenterDriver::Network::NETWORK_TYPE_NSXT\n config[:sw_name] = \\\n nic[:network].summary.opaqueNetworkType\n # There is no uplinks for NSX-T networks,\n # so all NSX-T networks\n # are networks and no uplinks\n config[:uplink] = false\n\n host_id = vi_client.instance_variable_get '@host_id'\n\n begin\n nsx_client = NSXDriver::NSXClient.new_from_id(host_id)\n rescue StandardError\n nsx_client = nil\n end\n\n if !nsx_client.nil?\n nsx_net =\n NSXDriver::OpaqueNetwork\n .new_from_name(nsx_client, nic[:net_name])\n\n config[:nsx_id] = nsx_net.ls_id\n config[:nsx_vni] = nsx_net.ls_vni\n config[:nsx_tz_id] = nsx_net.tz_id\n end\n else\n raise \"Unknown network type: #{nic[:pg_type]}\"\n end\n\n import_opts = {\n :network_name=> nic[:net_name],\n :sw_name=> config[:sw_name],\n :network_ref=> nic[:net_ref],\n :network_type=> nic[:pg_type],\n :ccr_ref=> ccr_ref,\n :ccr_name=> ccr_name,\n :vcenter_uuid=> vc_uuid,\n :vcenter_instance_name=> vcenter_instance_name,\n :dc_name=> dc_name,\n :unmanaged=> unmanaged,\n :template_ref=> template_ref,\n :dc_ref=> dc_ref,\n :template_id=> vm_id\n }\n\n if nic[:pg_type] ==\n VCenterDriver::Network::NETWORK_TYPE_NSXV ||\n nic[:pg_type] ==\n VCenterDriver::Network::NETWORK_TYPE_NSXT\n import_opts[:nsx_id] = config[:nsx_id]\n import_opts[:nsx_vni] = config[:nsx_vni]\n import_opts[:nsx_tz_id] = config[:nsx_tz_id]\n end\n\n if vid\n vlanid = VCenterDriver::Network.vlanid(vid)\n\n # we have vlan id\n if /\\A\\d+\\z/.match(vlanid)\n import_opts[:vlanid] = vlanid\n end\n end\n\n # Prepare the Virtual Network template\n one_vnet = VCenterDriver::Network.to_one_template(import_opts)\n\n # always has to be created because of\n # templates when they are instantiated\n ar_tmp = ''\n ar_tmp << \"AR=[\\n\"\n ar_tmp << \"TYPE=\\\"ETHER\\\",\\n\"\n ar_tmp << \"SIZE=255\\n\"\n ar_tmp << \"]\\n\"\n\n if vm?\n ar_tmp << create_ar(nic, false, nic[:ipv4]) if nic[:ipv4]\n\n if nic[:ipv6]\n ar_tmp << create_ar(nic, false, nil, nic[:ipv6])\n end\n\n ar_tmp << create_ar(nic, true) if !nic[:ipv4] && !nic[:ipv6]\n end\n\n one_vnet[:one] << ar_tmp\n config[:one_object] = one_vnet[:one]\n _cluster_id = VCenterDriver::VIHelper\n .get_cluster_id(config[:one_ids])\n\n one_vn = VCenterDriver::Network.create_one_network(config)\n VCenterDriver::VIHelper.clean_ref_hash\n one_vn.info\n\n # Wait until the virtual network is in ready state\n t_start = Time.now\n error = false\n timeout = 30\n\n while Time.now - t_start < timeout\n begin\n if one_vn.short_state_str == 'rdy'\n error = false\n break\n end\n rescue StandardError\n error = true\n end\n\n sleep 1\n one_vn.info\n end\n\n if error\n error_msg = \"VNET #{one_vn.id} in state \"\n error_msg += \"#{one_vn.short_state_str}, aborting import\"\n raise error_msg\n end\n\n one_vn\n end", "def binding; super end", "def addbinding(ctx, x, bind)\n [[x, bind]] + ctx\nend", "def configure_backend(consul_addr, consul_port)\n require 'diplomat'\n Diplomat.configure do |config|\n config.url = \"http://#{consul_addr}:#{consul_port}\"\n end\nend", "def generate_lvs_cluster(c)\n svc = c.services.map { |s|\n [s.name, \"#{s.ha_protocol}://\", s.ha_hostname, s.localport ].join(', ') \n }\n [dec2ip(c.fw_mark), c.description, svc.map { |s| \"(#{ s })\" }.join('; ') ]\nend", "def populate\n response = @connection.lbreq(\"GET\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@id.to_s)}\",@lbmgmtport,@lbmgmtscheme)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n data = JSON.parse(response.body)['loadBalancer']\n @id = data[\"id\"]\n @name = data[\"name\"]\n @protocol = data[\"protocol\"]\n @port = data[\"port\"]\n @algorithm = data[\"algorithm\"]\n @connection_logging = data[\"connectionLogging\"][\"enabled\"]\n @status = data[\"status\"]\n @timeout = data[\"timeout\"]\n true\n end", "def create_internet_gateway_with_http_info(id, length, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VLANsApi.create_internet_gateway ...'\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 VLANsApi.create_internet_gateway\"\n end\n # verify the required parameter 'length' is set\n if @api_client.config.client_side_validation && length.nil?\n fail ArgumentError, \"Missing the required parameter 'length' when calling VLANsApi.create_internet_gateway\"\n end\n # resource path\n local_var_path = '/virtual-networks/{id}/internet-gateways'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'length'] = length\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] || 'InternetGateway'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['x_auth_token']\n\n new_options = opts.merge(\n :operation => :\"VLANsApi.create_internet_gateway\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VLANsApi#create_internet_gateway\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_iprouting(opts = {})\n cmd = command_builder('ip routing', opts)\n configure(cmd)\n end", "def set_iprouting(opts = {})\n cmd = command_builder('ip routing', opts)\n configure(cmd)\n end", "def default_ipn_endpoint; end", "def elb_listener(elb)\n resp = aws_api_connect(\"ELB_Client\")\n begin\n pants = resp.create_load_balancer_listeners({\n load_balancer_name: elb[:name],\n listeners: [\n {\n protocol: elb[:protocol],\n load_balancer_port: elb[:port],\n instance_protocol: elb[:instnace_protocol],\n instance_port: elb[:instance_port],\n ssl_certificate_id: elb[:ssl_cert],\n },\n ],\n })\n rescue Aws::ElasticLoadBalancing::Errors::DuplicateListener\n puts \"Load Balancer listener #{elb[:name]} duplicate exists, skipping\"\n end\n end", "def create_load_balancer_h_t_t_p_listener(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancerHTTPListener'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :backend_server_port\n\t\t\targs[:query]['BackendServerPort'] = optional[:backend_server_port]\n\t\tend\n\t\tif optional.key? :cookie\n\t\t\targs[:query]['Cookie'] = optional[:cookie]\n\t\tend\n\t\tif optional.key? :cookie_timeout\n\t\t\targs[:query]['CookieTimeout'] = optional[:cookie_timeout]\n\t\tend\n\t\tif optional.key? :domain\n\t\t\targs[:query]['Domain'] = optional[:domain]\n\t\tend\n\t\tif optional.key? :health_check\n\t\t\targs[:query]['HealthCheck'] = optional[:health_check]\n\t\tend\n\t\tif optional.key? :health_check_timeout\n\t\t\targs[:query]['HealthCheckTimeout'] = optional[:health_check_timeout]\n\t\tend\n\t\tif optional.key? :healthy_threshold\n\t\t\targs[:query]['HealthyThreshold'] = optional[:healthy_threshold]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :interval\n\t\t\targs[:query]['Interval'] = optional[:interval]\n\t\tend\n\t\tif optional.key? :listener_port\n\t\t\targs[:query]['ListenerPort'] = optional[:listener_port]\n\t\tend\n\t\tif optional.key? :listener_status\n\t\t\targs[:query]['ListenerStatus'] = optional[:listener_status]\n\t\tend\n\t\tif optional.key? :load_balancer_id\n\t\t\targs[:query]['LoadBalancerId'] = optional[:load_balancer_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :scheduler\n\t\t\targs[:query]['Scheduler'] = optional[:scheduler]\n\t\tend\n\t\tif optional.key? :sticky_session\n\t\t\targs[:query]['StickySession'] = optional[:sticky_session]\n\t\tend\n\t\tif optional.key? :sticky_session_type\n\t\t\targs[:query]['StickySessionType'] = optional[:sticky_session_type]\n\t\tend\n\t\tif optional.key? :u_r_i\n\t\t\targs[:query]['URI'] = optional[:u_r_i]\n\t\tend\n\t\tif optional.key? :unhealthy_threshold\n\t\t\targs[:query]['UnhealthyThreshold'] = optional[:unhealthy_threshold]\n\t\tend\n\t\tif optional.key? :x_forwarded_for\n\t\t\targs[:query]['XForwardedFor'] = optional[:x_forwarded_for]\n\t\tend\n\t\tself.run(args)\n\tend", "def set_load_balancer_t_c_p_listener_attribute(bandwidth, listener_port, load_balancer_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SetLoadBalancerTCPListenerAttribute'\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :health_check_connect_port\n\t\t\traise ArgumentError, 'health_check_connect_port must be equal or greater than 1' unless optional[:health_check_connect_port] < 1\n\t\t\traise ArgumentError, 'health_check_connect_port must be equal or less than 65535' unless optional[:health_check_connect_port] > 65535\n\t\t\targs[:query]['HealthCheckConnectPort'] = optional[:health_check_connect_port]\n\t\tend\n\t\tif optional.key? :health_check_connect_timeout\n\t\t\traise ArgumentError, 'health_check_connect_timeout must be equal or greater than 1' unless optional[:health_check_connect_timeout] < 1\n\t\t\traise ArgumentError, 'health_check_connect_timeout must be equal or less than 50' unless optional[:health_check_connect_timeout] > 50\n\t\t\targs[:query]['HealthCheckConnectTimeout'] = optional[:health_check_connect_timeout]\n\t\tend\n\t\tif optional.key? :health_check_domain\n\t\t\targs[:query]['HealthCheckDomain'] = optional[:health_check_domain]\n\t\tend\n\t\tif optional.key? :health_check_http_code\n\t\t\targs[:query]['HealthCheckHttpCode'] = optional[:health_check_http_code]\n\t\tend\n\t\tif optional.key? :health_check_interval\n\t\t\traise ArgumentError, 'health_check_interval must be equal or greater than 1' unless optional[:health_check_interval] < 1\n\t\t\traise ArgumentError, 'health_check_interval must be equal or less than 5' unless optional[:health_check_interval] > 5\n\t\t\targs[:query]['HealthCheckInterval'] = optional[:health_check_interval]\n\t\tend\n\t\tif optional.key? :health_check_type\n\t\t\targs[:query]['HealthCheckType'] = optional[:health_check_type]\n\t\tend\n\t\tif optional.key? :health_check_u_r_i\n\t\t\targs[:query]['HealthCheckURI'] = optional[:health_check_u_r_i]\n\t\tend\n\t\tif optional.key? :healthy_threshold\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or greater than 1' unless optional[:healthy_threshold] < 1\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or less than 10' unless optional[:healthy_threshold] > 10\n\t\t\targs[:query]['HealthyThreshold'] = optional[:healthy_threshold]\n\t\tend\n\t\tif optional.key? :max_conn_limit\n\t\t\targs[:query]['MaxConnLimit'] = optional[:max_conn_limit]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :persistence_timeout\n\t\t\traise ArgumentError, 'persistence_timeout must be equal or greater than 0' unless optional[:persistence_timeout] < 0\n\t\t\traise ArgumentError, 'persistence_timeout must be equal or less than 86400' unless optional[:persistence_timeout] > 86400\n\t\t\targs[:query]['PersistenceTimeout'] = optional[:persistence_timeout]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :scheduler\n\t\t\targs[:query]['Scheduler'] = optional[:scheduler]\n\t\tend\n\t\tif optional.key? :syn_proxy\n\t\t\targs[:query]['SynProxy'] = optional[:syn_proxy]\n\t\tend\n\t\tif optional.key? :unhealthy_threshold\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or greater than 1' unless optional[:unhealthy_threshold] < 1\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or less than 10' unless optional[:unhealthy_threshold] > 10\n\t\t\targs[:query]['UnhealthyThreshold'] = optional[:unhealthy_threshold]\n\t\tend\n\t\traise ArgumentError, 'bandwidth must be equal or greater than -1' unless bandwidth < -1\n\t\traise ArgumentError, 'bandwidth must be equal or less than 1000' unless bandwidth > 1000\n\t\targs[:query]['Bandwidth'] = bandwidth\n\t\traise ArgumentError, 'listener_port must be equal or greater than 1' unless listener_port < 1\n\t\traise ArgumentError, 'listener_port must be equal or less than 65535' unless listener_port > 65535\n\t\targs[:query]['ListenerPort'] = listener_port\n\t\tself.run(args)\n\tend", "def bridges_create(params = {})\n post \"bridges\", params\n end", "def initialize(*args)\n super\n register_advanced_options([ OptString.new('PayloadBindPort', [false, 'Port to bind reverse tcp socket to on target system.']) ], self.class)\n end", "def create_load_balancer_h_t_t_p_s_listener(backend_server_port, bandwidth, health_check, listener_port, load_balancer_id, server_certificate_id, sticky_session, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancerHTTPSListener'\n\t\targs[:query]['HealthCheck'] = health_check\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:query]['ServerCertificateId'] = server_certificate_id\n\t\targs[:query]['StickySession'] = sticky_session\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :cookie\n\t\t\targs[:query]['Cookie'] = optional[:cookie]\n\t\tend\n\t\tif optional.key? :cookie_timeout\n\t\t\traise ArgumentError, 'cookie_timeout must be equal or greater than 1' unless optional[:cookie_timeout] < 1\n\t\t\traise ArgumentError, 'cookie_timeout must be equal or less than 86400' unless optional[:cookie_timeout] > 86400\n\t\t\targs[:query]['CookieTimeout'] = optional[:cookie_timeout]\n\t\tend\n\t\tif optional.key? :health_check_connect_port\n\t\t\traise ArgumentError, 'health_check_connect_port must be equal or greater than -520' unless optional[:health_check_connect_port] < -520\n\t\t\traise ArgumentError, 'health_check_connect_port must be equal or less than 65535' unless optional[:health_check_connect_port] > 65535\n\t\t\targs[:query]['HealthCheckConnectPort'] = optional[:health_check_connect_port]\n\t\tend\n\t\tif optional.key? :health_check_domain\n\t\t\targs[:query]['HealthCheckDomain'] = optional[:health_check_domain]\n\t\tend\n\t\tif optional.key? :health_check_http_code\n\t\t\targs[:query]['HealthCheckHttpCode'] = optional[:health_check_http_code]\n\t\tend\n\t\tif optional.key? :health_check_interval\n\t\t\traise ArgumentError, 'health_check_interval must be equal or greater than 1' unless optional[:health_check_interval] < 1\n\t\t\traise ArgumentError, 'health_check_interval must be equal or less than 5' unless optional[:health_check_interval] > 5\n\t\t\targs[:query]['HealthCheckInterval'] = optional[:health_check_interval]\n\t\tend\n\t\tif optional.key? :health_check_timeout\n\t\t\traise ArgumentError, 'health_check_timeout must be equal or greater than 1' unless optional[:health_check_timeout] < 1\n\t\t\traise ArgumentError, 'health_check_timeout must be equal or less than 50' unless optional[:health_check_timeout] > 50\n\t\t\targs[:query]['HealthCheckTimeout'] = optional[:health_check_timeout]\n\t\tend\n\t\tif optional.key? :health_check_u_r_i\n\t\t\targs[:query]['HealthCheckURI'] = optional[:health_check_u_r_i]\n\t\tend\n\t\tif optional.key? :healthy_threshold\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or greater than 1' unless optional[:healthy_threshold] < 1\n\t\t\traise ArgumentError, 'healthy_threshold must be equal or less than 10' unless optional[:healthy_threshold] > 10\n\t\t\targs[:query]['HealthyThreshold'] = optional[:healthy_threshold]\n\t\tend\n\t\tif optional.key? :max_conn_limit\n\t\t\targs[:query]['MaxConnLimit'] = optional[:max_conn_limit]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :scheduler\n\t\t\targs[:query]['Scheduler'] = optional[:scheduler]\n\t\tend\n\t\tif optional.key? :sticky_session_type\n\t\t\targs[:query]['StickySessionType'] = optional[:sticky_session_type]\n\t\tend\n\t\tif optional.key? :unhealthy_threshold\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or greater than 1' unless optional[:unhealthy_threshold] < 1\n\t\t\traise ArgumentError, 'unhealthy_threshold must be equal or less than 10' unless optional[:unhealthy_threshold] > 10\n\t\t\targs[:query]['UnhealthyThreshold'] = optional[:unhealthy_threshold]\n\t\tend\n\t\tif optional.key? :x_forwarded_for\n\t\t\targs[:query]['XForwardedFor'] = optional[:x_forwarded_for]\n\t\tend\n\t\traise ArgumentError, 'backend_server_port must be equal or greater than 1' unless backend_server_port < 1\n\t\traise ArgumentError, 'backend_server_port must be equal or less than 65535' unless backend_server_port > 65535\n\t\targs[:query]['BackendServerPort'] = backend_server_port\n\t\traise ArgumentError, 'bandwidth must be equal or greater than -1' unless bandwidth < -1\n\t\traise ArgumentError, 'bandwidth must be equal or less than 1000' unless bandwidth > 1000\n\t\targs[:query]['Bandwidth'] = bandwidth\n\t\traise ArgumentError, 'listener_port must be equal or greater than 1' unless listener_port < 1\n\t\traise ArgumentError, 'listener_port must be equal or less than 65535' unless listener_port > 65535\n\t\targs[:query]['ListenerPort'] = listener_port\n\t\tself.run(args)\n\tend" ]
[ "0.6057085", "0.6052836", "0.60487896", "0.59759474", "0.59470844", "0.58999246", "0.58211786", "0.5680339", "0.5628128", "0.5596356", "0.5559735", "0.5538085", "0.5515246", "0.5471533", "0.5413277", "0.5388682", "0.5278211", "0.5201725", "0.5198034", "0.5177107", "0.5143525", "0.51246285", "0.51246285", "0.5115747", "0.5113735", "0.5085941", "0.5085941", "0.50839", "0.5079887", "0.5074298", "0.5055635", "0.50460523", "0.5040664", "0.5021493", "0.5014213", "0.5009443", "0.4987335", "0.49869084", "0.49869084", "0.49869084", "0.49837273", "0.49781308", "0.4966317", "0.49571356", "0.49387875", "0.4937429", "0.4929986", "0.49257913", "0.49202305", "0.4910584", "0.49012384", "0.48851347", "0.48765323", "0.48719922", "0.48719922", "0.4870722", "0.4866355", "0.48540676", "0.48526126", "0.4841987", "0.48120543", "0.4804294", "0.47924238", "0.47922647", "0.4784174", "0.47823033", "0.4778149", "0.47669718", "0.4763393", "0.47600988", "0.47593156", "0.47585687", "0.47574496", "0.47546998", "0.47546998", "0.4745835", "0.4742117", "0.47392282", "0.47272024", "0.472563", "0.47233018", "0.4717541", "0.47175205", "0.47151738", "0.4712807", "0.47119346", "0.47089392", "0.47056502", "0.47002187", "0.46928537", "0.46911335", "0.46849138", "0.46849138", "0.4681562", "0.46776927", "0.46598953", "0.4654017", "0.4649342", "0.46480045", "0.4643242" ]
0.5968214
4
Cookbook Name:: newvolume Provider:: mount
def whyrun_supported? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume_mount(local_dir, container_dir)\n local_dir = File.expand_path(local_dir, reference_dir)\n volumes << VolumeMount.new(local_dir, container_dir)\n end", "def mount_kvm_volume(name)\n dev = available_dev\n enable_netblockdev(name, dev)\n vol_grp = lvm_volume_group(\n lvm_partition(dev)\n )\n root = lvm_root(vol_grp)\n lvm_enable(vol_grp) unless lvm_enabled?(root)\n mount(name, root)\n dev\nend", "def mount_volume(container_name = nil, volume_name:, mount_path:, **kwargs)\n object = { name: volume_name, mountPath: mount_path }.merge(kwargs)\n log.info(\"Mounting volume: #{object}\")\n volume_mounts(container_name) << object\n end", "def add_volume(bucket,mount,options=nil)\n s3fs_volumes << { :bucket => bucket, :mount => mount, :options => options }\n end", "def mount_path; end", "def mount(name, root_dev)\n puts \"Mounting KVM device: #{root_dev}\"\n mount_loc = File.join(KVM_MOUNT_POINT, name)\n unless(system(\"mount | grep #{mount_loc}\"))\n FileUtils.mkdir_p(mount_loc)\n if(system(\"mount #{root_dev} #{mount_loc}\"))\n mount_loc\n else\n raise \"Failed to mount #{root_dev} to #{mount_loc}\"\n end\n else\n puts \"Device already mounted (#{mount_loc})\"\n mount_loc\n end\nend", "def volume(volume_name, attrs={}, &block)\n volumes[volume_name] ||= Ironfan::Volume.new(:parent => self, :name => volume_name)\n volumes[volume_name].configure(attrs, &block)\n volumes[volume_name]\n end", "def mount_command(path)\n \"udisksctl mount --block-device #{path}\"\nend", "def mount_path=(_arg0); end", "def create_volume(options)\n # Creating the volume is part of the server creation\n end", "def create_volume(options)\n # Creating the volume is part of the server creation\n end", "def mount options = {}\n opts = {\n :force_readonly => false\n }.merge!(options)\n args = []\n args << 'readOnly' if opts[:force_readonly]\n args << opts[:mountpoint] if opts.has_key?(:mountpoint)\n args << self.dev_node\n diskutil 'mount', *args\n end", "def create\n properties = [ resource[:name],\n resource[:user],\n resource[:group],\n resource[:config],\n resource[:mode],\n ]\n\n qmgmt(['volume', 'create'] + properties)\n end", "def create_default_volume()\n # Create a default application_volume using the volume attributes from the cookbook\n create_node_volume(:application_volume)\n end", "def provision_and_mount_volume(server, disk_size, device)\n unless provider.find_server_device(server, device)\n say \"Provisioning #{disk_size}Gb persistent disk for inception VM...\"\n provider.create_and_attach_volume(\"Inception Disk\", disk_size, server, device)\n end\n\n # Format and mount the volume\n if aws?\n say \"Skipping volume mounting on AWS 12.10 inception VM until its fixed\", [:yellow, :bold]\n run_ssh_command_until_successful server, \"sudo mkdir -p /var/vcap/store\"\n else\n say \"Mounting persistent disk as volume on inception VM...\"\n run_ssh_command_until_successful server, \"sudo mkfs.ext4 #{device} -F\"\n run_ssh_command_until_successful server, \"sudo mkdir -p /var/vcap/store\"\n run_ssh_command_until_successful server, \"sudo mount #{device} /var/vcap/store\"\n end\n end", "def volume\n help = [\n '',\n \"Use: #{me} volume [COMMAND]\",\n '',\n 'Manage cyber-dojo setup volumes',\n '',\n 'Commands:',\n minitab + 'create Creates a new volume',\n minitab + 'rm Removes a volume',\n minitab + 'ls Lists the names of all volumes',\n minitab + 'inspect Displays details of a volume',\n minitab + \"pull Pulls the docker images inside a volume's manifest.json files\",\n '',\n \"Run '#{me} volume COMMAND --help' for more information on a command\",\n ]\n case ARGV[1]\n when 'create' then volume_create\n when 'rm' then volume_rm\n when 'ls' then volume_ls\n when 'inspect' then volume_inspect\n when 'pull' then volume_pull\n else show help\n end\nend", "def add_cdrom_to_vbox_vm(client_name)\n message = \"Attaching:\\tCDROM to VM \"+client_name\n command = \"VBoxManage storagectl \\\"#{client_name}\\\" --name \\\"cdrom\\\" --add \\\"sata\\\" --controller \\\"IntelAHCI\\\"\"\n execute_command(message,command)\n if File.exist?($vbox_additions_iso)\n message = \"Attaching:\\tISO \"+$vbox_additions_iso+\" to VM \"+client_name\n command = \"VBoxManage storageattach \\\"#{client_name}\\\" --storagectl \\\"cdrom\\\" --port 0 --device 0 --type dvddrive --medium \\\"#{$vbox_additions_iso}\\\"\"\n execute_command(message,command)\n end\n return\nend", "def attach_volumes(node, disk_sizes)\n if $provider == :virtualbox\n node.vm.provider :virtualbox do |v, override|\n disk_num = 0\n disk_sizes.each do |disk_size|\n disk_num += 1\n diskname = File.join(File.dirname(File.expand_path(__FILE__)), \".virtualbox\", \"#{node.vm.hostname}-#{disk_num}.vdi\")\n unless File.exist?(diskname)\n v.customize ['createhd', '--filename', diskname, '--size', disk_size * 1024]\n end\n v.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', disk_num, '--device', 0, '--type', 'hdd', '--medium', diskname]\n end\n end\n end\n\n if $provider == :vmware_fusion\n node.vm.provider :vmware_fusion do |v, override|\n vdiskmanager = '/Applications/VMware\\ Fusion.app/Contents/Library/vmware-vdiskmanager'\n unless File.exist?(vdiskmanager)\n dir = File.join(File.dirname(File.expand_path(__FILE__)), \".vmware\")\n unless File.directory?( dir )\n Dir.mkdir dir\n end\n\n disk_num = 0\n disk_sizes.each do |disk_size|\n disk_num += 1\n diskname = File.join(dir, \"#{node.vm.hostname}-#{disk_num}.vmdk\")\n unless File.exist?(diskname)\n `#{vdiskmanager} -c -s #{disk_size}GB -a lsilogic -t 1 #{diskname}`\n end\n\n v.vmx[\"scsi0:#{disk_num}.filename\"] = diskname\n v.vmx[\"scsi0:#{disk_num}.present\"] = 'TRUE'\n v.vmx[\"scsi0:#{disk_num}.redo\"] = ''\n end\n end\n end\n end\n\n if $provider == :parallels\n node.vm.provider :parallels do |v, override|\n disk_sizes.each do |disk_size|\n v.customize ['set', :id, '--device-add', 'hdd', '--size', disk_size * 1024]\n end\n end\n end\n\nend", "def provision_storage host, vm\n if host['volumes']\n # Lazily create the volume client if needed\n volume_client_create\n host['volumes'].keys.each_with_index do |volume, index|\n @logger.debug \"Creating volume #{volume} for OpenStack host #{host.name}\"\n\n # The node defintion file defines volume sizes in MB (due to precedent\n # with the vagrant virtualbox implementation) however OpenStack requires\n # this translating into GB\n openstack_size = host['volumes'][volume]['size'].to_i / 1000\n\n # Create the volume and wait for it to become available\n vol = @volume_client.volumes.create(\n :size => openstack_size,\n :display_name => volume,\n :description => \"Beaker volume: host=#{host.name} volume=#{volume}\",\n )\n vol.wait_for { ready? }\n\n # Fog needs a device name to attach as, so invent one. The guest\n # doesn't pay any attention to this\n device = \"/dev/vd#{('b'.ord + index).chr}\"\n vm.attach_volume(vol.id, device)\n end\n end\n end", "def volume_create(name)\n @log.info \"Creating volume #{name} from offering id #{DISK_OFFERING}...\"\n ret = @cloud_stack.create_volume(name, ZONE, DISK_OFFERING)\n id = ret[\"createvolumeresponse\"][\"jobid\"]\n wait_for_job id\n vol_id = ret[\"createvolumeresponse\"][\"id\"]\n @log.info \"Created volume id: #{vol_id}\"\n vol_id\n end", "def populate_volume(server)\n server.spot_check_command(\" echo \\\"blah blah blah\\\" > #{@mount_point}/data.txt\")\n end", "def create_storage_volume(create_opts={})\n create_resource :storage_volume, create_opts\n end", "def install\n args = std_configure_args + %W[\n --exec-prefix=#{prefix}\n --mandir=#{man}\n --with-fuse=external\n --enable-extras\n --disable-ldconfig\n ]\n\n system \"./autogen.sh\" if build.head?\n # Workaround for hardcoded /sbin\n inreplace Dir[\"{ntfsprogs,src}/Makefile.in\"], \"$(DESTDIR)/sbin/\", \"$(DESTDIR)#{sbin}/\"\n system \"./configure\", *args\n system \"make\"\n system \"make\", \"install\"\n\n # Install a script that can be used to enable automount\n File.open(\"#{sbin}/mount_ntfs\", File::CREAT|File::TRUNC|File::RDWR, 0755) do |f|\n f.puts <<~EOS\n #!/bin/bash\n\n VOLUME_NAME=\"${@:$#}\"\n VOLUME_NAME=${VOLUME_NAME#/Volumes/}\n USER_ID=#{Process.uid}\n GROUP_ID=#{Process.gid}\n\n if [ \"$(/usr/bin/stat -f %u /dev/console)\" -ne 0 ]; then\n USER_ID=$(/usr/bin/stat -f %u /dev/console)\n GROUP_ID=$(/usr/bin/stat -f %g /dev/console)\n fi\n\n #{opt_bin}/ntfs-3g \\\\\n -o volname=\"${VOLUME_NAME}\" \\\\\n -o local \\\\\n -o negative_vncache \\\\\n -o auto_xattr \\\\\n -o auto_cache \\\\\n -o noatime \\\\\n -o windows_names \\\\\n -o streams_interface=openxattr \\\\\n -o inherit \\\\\n -o uid=\"$USER_ID\" \\\\\n -o gid=\"$GROUP_ID\" \\\\\n -o allow_other \\\\\n -o big_writes \\\\\n \"$@\" >> /var/log/mount-ntfs-3g.log 2>&1\n\n exit $?;\n EOS\n end\n end", "def mount_shared_folder(name, guestpath, options)\n # These are just far easier to use than the full options syntax\n owner = options[:owner]\n group = options[:group]\n mount_options += \"#{options[:extra]}\" if options[:extra]\n \n su_cmd = vm.config.cygwin.suexec_cmd\n su_cmd += \" \" if ! su_cmd.empty? \n\n # Create the shared folder\n #vm.communicate.execute(\"#{su_cmd}mkdir -p #{guestpath}\")\n @logger.debug(\"Attempting to mount cygwin folders...\")\n @logger.debug(\"name : #{name}\")\n @logger.debug(\"guestpath : #{guestpath}\")\n @logger.debug(\"mount_optiosn : #{mount_options}\")\n @logger.debug(\"owner : #{owner}\")\n @logger.debug(\"group : #{group}\")\n \n # cleanup old mounts\n # cleanup folders if they exist\n check_for_drive=\"export mounteddrive=\\\"$(net use |grep '\\\\\\\\\\\\\\\\vboxsvr\\\\\\\\#{name}'|tr -d 'Unavailable' | head -1 |awk '{print $1}')\\\"\"\n unmount_drive=\"net use /d ${mounteddrive}\"\n unmount_script = \"set -x -v;\"\n unmount_script += \"#{check_for_drive};\"\n unmount_script += \"while [ ! \\\"${mounteddrive}\\\" == \\\"\\\" ];\"\n unmount_script += \" do echo removing old mount ${mounteddrive};\"\n unmount_script += \"#{unmount_drive};\"\n unmount_script += \"#{check_for_drive};\"\n unmount_script += \" done\"\n @logger.debug(\"running umount command : #{unmount_script}\")\n vm.communicate.execute(\"#{unmount_script}\", :error_check => false) # skip error checking since we just use the next drive letter anyway\n \n # Mount the folder with the proper owner/group\n # mount the vbox file system (virtual box.... only??)\n # net use \\* \\\\\\\\vboxsvr\\\\e:/workspace\n # #{name} #{guestpath} \n \n mount_command = \"#{su_cmd}net use \\\\* \\\\\\\\\\\\\\\\vboxsvr\\\\\\\\#{name} #{mount_options}\"\n @logger.debug(\"mount : #{mount_command}\")\n vm.communicate.execute(\"#{mount_command}\")\n\n\n # create windows link to mounted file system so we can use it as if it were a real path\n # note: if the guestpath is there, i wonder if we should check before removing it to reset... \n # do we do something special with :create option???\n # For configuration:\n # config.vm.synced_folder \"workspace\", \"e:/workspace\", :create => true\n #\n # Expect something like: \n # cmd /c \\\"mklink /d \\\"$(mkdir -p e:/workspace;cygpath -w e:/workspace;rm -rf e:/workspace)\\\" \\\"$(net use |grep e:/workspace |awk '{print $1}' ) \n # there is a problem with mounting guestpath = /vagrant \n # We have to open up permissions to c:\\\\Cygwin\\\\ to allow vagrant to have access, but\n # I've not found a good way to run a command as root. Tried experimenting with ShellExecute but had no luck.\n # As a workaround lets ignore errors for /vagrant (other folders should have error checking since they were intentional)\n \n # TODO : Warn users that they can't mount /vagrant unless they fix the permissions for C:\\Cygwin so that either Administrators or vagrant has full control of the folder. Done automatically if Cygwin is installed as vagrant user.\n vm.communicate.execute(\"cmd /c \\\"mklink /d \\\"$([ ! -d '#{guestpath}' ] && mkdir -p '#{guestpath}';cygpath -w '#{guestpath}';rm -rf '#{guestpath}')\\\" \\\"$(net use |grep '#{name}' |awk '{print $1}')\\\"\\\"\", :error_check => (guestpath != \"/vagrant\"))\n # chown the folder to the proper owner/group\n # Not sure this is even needed....(windows inherits).... vm.communicate.execute(\"#{su_cmd}chown #{owner} #{guestpath}\")\n end", "def attach_disk(config, prefix, disk_num, size)\n filename = \"#{prefix}#{disk_num}.vdi\"\n config.vm.provider \"virtualbox\" do |vb|\n if !File.exist?(filename) \n vb.customize ['createhd', '--filename', filename, '--size', (size * 1024).floor, '--variant', 'fixed']\n vb.customize ['modifyhd', filename, '--type', 'shareable']\n end\n\n vb.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', disk_num + 2, '--device', 0, '--type', 'hdd', '--medium', filename]\n end\nend", "def setup(machine)\n\n machine.bindfs.debug = true\n \n machine.vm.provider :virtualbox do |provider, _|\n provider.memory = 512\n provider.cpus = 2\n end\n\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-symbol\", chown_ignore: true\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-string\", \"chown-ignore\" => true\n\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-with-option\", owner: \"root\"\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-with-flag\", \"create-as-user\" => true\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-with-short-option\", r: true\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-without-explicit-owner\", owner: nil\n\n # This should fail\n machine.bindfs.bind_folder \"/etc3\", \"/etc-nonexit\"\n\n # These should also fail\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-with-nonexistent-user\", user: \"nonuser\", after: :provision\n machine.bindfs.bind_folder \"/etc\", \"/etc-binded-with-nonexistent-group\", group: \"nongroup\", after: :provision \n\nend", "def mount(path, options)\n #noop\n end", "def create_filesystem(host, mount_name)\n fs_type = filesystem_type(host)\n\n case host['platform']\n when %r{aix}\n volume_group = on(host, 'lsvg').stdout.split(\"\\n\")[0]\n on(host, \"mklv -y #{mount_name} #{volume_group} 1M\")\n on(host, \"mkfs -V #{fs_type} -l #{mount_name} /dev/#{mount_name}\")\n when %r{el-|centos|fedora|sles|debian|ubuntu}\n on(host, \"dd if=/dev/zero of='/tmp/#{mount_name}' count=16384\", acceptable_exit_codes: [0, 1])\n on(host, \"yes | mkfs -t #{fs_type} -q '/tmp/#{mount_name}'\", acceptable_exit_codes: (0..254))\n else\n # TODO: Add Solaris and OSX support, as per PUP-5201 and PUP-4823\n fail_test(\"Creating filesystems on #{host['platform']} is not currently supported.\")\n end\n end", "def mount(opts)\n ct = lxc_ct(opts[:id])\n\n r, w = IO.pipe\n\n pid = ct.attach(stdout: w) do\n r.close\n\n begin\n src = File.join(opts[:shared_dir], opts[:src])\n\n if !Dir.exist?(opts[:shared_dir])\n puts \"error:Shared dir not found at: #{opts[:shared_dir]}\"\n\n elsif !Dir.exist?(src)\n puts \"error:Source directory not found at: #{src}\"\n\n else\n FileUtils.mkpath(opts[:dst])\n Mount::Sys.move_mount(src, opts[:dst])\n puts 'ok:done'\n end\n\n rescue => e\n puts \"error:Exception (#{e.class}): #{e.message}\"\n\n ensure\n STDOUT.flush\n end\n end\n\n w.close\n\n line = r.readline\n Process.wait(pid)\n r.close\n log(:warn, ct, \"Mounter exited with #{$?.exitstatus}\") if $?.exitstatus != 0\n\n i = line.index(':')\n return error(\"invalid return value: #{line.inspect}\") unless i\n\n status = line[0..i-1]\n msg = line[i+1..-1]\n\n if status == 'ok'\n ok\n\n else\n error(msg)\n end\n end", "def addVolume(dev, size, type: \"pd-standard\", delete_on_termination: false)\n devname = dev.gsub(/.*?\\/([^\\/]+)$/, '\\1')\n resname = MU::Cloud::Google.nameStr(@mu_name+\"-\"+devname)\n MU.log \"Creating disk #{resname}\"\n\n description = @deploy ? @deploy.deploy_id : @mu_name+\"-\"+devname\n\n newdiskobj = MU::Cloud::Google.compute(:Disk).new(\n size_gb: size,\n description: description,\n zone: @config['availability_zone'],\n# type: \"projects/#{config['project']}/zones/#{config['availability_zone']}/diskTypes/pd-ssd\",\n type: \"projects/#{@project_id}/zones/#{@config['availability_zone']}/diskTypes/#{type}\",\n# Other values include pd-ssd and local-ssd\n name: resname\n )\n\n begin\n newdisk = MU::Cloud::Google.compute(credentials: @config['credentials']).insert_disk(\n @project_id,\n @config['availability_zone'],\n newdiskobj\n )\n rescue ::Google::Apis::ClientError => e\n if e.message.match(/^alreadyExists: /)\n MU.log \"Disk #{resname} already exists, ignoring request to create\", MU::WARN\n return\n else\n raise e\n end\n end\n\n attachobj = MU::Cloud::Google.compute(:AttachedDisk).new(\n device_name: devname,\n source: newdisk.self_link,\n type: \"PERSISTENT\",\n auto_delete: delete_on_termination\n )\n\n MU.log \"Attaching disk #{resname} to #{@cloud_id} at #{devname}\"\n MU::Cloud::Google.compute(credentials: @config['credentials']).attach_disk(\n @project_id,\n @config['availability_zone'],\n @cloud_id,\n attachobj\n )\n\n end", "def format_mount(partition, mount)\n\n # Partitions that we already have mounts set for.\n return nil if partition == '/dev/mapper/rootvg-slash'\n return nil if partition == '/dev/mapper/rootvg-var'\n return nil if partition == '/dev/mapper/rootvg-tmp'\n\n mount\nend", "def create\n tmp = Puppet::FileSystem::Uniquefile.new('quobyte_volume_config')\n tmp.write(resource[:content])\n tmp.flush()\n\n qmgmt(['volume', 'config', 'import', [resource[:name]], tmp.path])\n end", "def createvolume\n if not checkRequirements([\"thezone\",\"thevolume\"])\n return false\n end\n checkToken(@thezone)\n req = {}\n req[\"name\"] = \"oe-#{@thevolume.name}\"\n req[\"description\"] = @thevolume.description\n req[\"sizeGb\"] = @thevolume.size\n submit = queryGCE(:path => '/compute/v1beta15/projects/#{@thezone.name}/zones/#{@thevolume.azone.name}/disks', :method => 'post', :options => '', :data => req.to_json, :access_token => @thezone.toekn )\n d = checkQuery(:type => 'zone', :token => @thezone.token, :projectname => @thezone.name, :zonename => @thevolume.azone.name, :operationname => submit[\"name\"])\n data = queryGCE(:path => '/compute/v1beta15/projects/#{@thezone.name}/zones/#{@thevolume.azone.name}/disks/#{req[\"name\"]}', :method => 'get', :options => '', :access_token => @thezone.token) if d\n data ? data[\"name\"] : false\n end", "def attach_node_volume (volume_label)\n # XXX should check whether this device name is already allocated,\n # and if so throw an exception\n # Helper method, attach an arbitrary volume using an arbitrary label that must be preconfigured in nodes\n Chef::Log.info(\"In attach_node_volume with volume_label #{volume_label}\")\n mount_device = node.application_attributes[volume_label].mount_device\n volume_id = node.application_attributes[volume_label].volume_id\n\n if mount_device.nil?\n Chef::Log.fatal(\"No mount device for volume label #{volume_label}.\tMust supply a volume label configured in nodes\")\n raise\n end\n\n attach_volume(volume_label, volume_id, mount_device)\n end", "def secondary_storage\n unless ::File.exist?(new_resource.nfs_path)\n shell_out!(\"mkdir -p #{new_resource.nfs_path}\")\n shell_out!(\"chown -R root:root #{new_resource.nfs_path}\")\n end\n end", "def volume_create\n help = [\n '',\n \"Use: #{me} volume create --name=VOLUME --git=URL\",\n \"Use: #{me} volume create --name=VOLUME --dir=PATH\",\n '',\n 'Creates a volume named VOLUME from a git clone of URL',\n 'Creates a volume named VOLUME from a copy of PATH'\n ]\n # asked for help?\n if [nil,'help','--help'].include? ARGV[2]\n show help\n exit failed\n end\n # unknown arguments?\n knowns = ['name','git','dir']\n unknown = ARGV[2..-1].select do |argv|\n knowns.none? { |known| argv.start_with?('--' + known + '=') }\n end\n if unknown != []\n show help\n unknown.each { |arg| puts \"FAILED: unknown argument [#{arg.split('=')[0]}]\" }\n exit failed\n end\n # required known arguments\n args = ARGV[2..-1]\n vol = get_arg('--name', args)\n url = get_arg('--git', args)\n dir = get_arg('--dir', args)\n if vol.nil? || (url.nil? && dir.nil?)\n show help\n exit failed\n end\n if vol.length == 1\n msg = 'volume names must be at least two characters long. See https://github.com/docker/docker/issues/20122'\n puts \"FAILED: [volume create --name=#{vol}] #{msg}\"\n exit failed\n end\n if volume_exists? vol\n msg = \"#{vol} already exists\"\n puts \"FAILED: [volume create --name=#{vol}] #{msg}\"\n exit failed\n end\n # cyber-dojo.sh does actual [volume create]\nend", "def add_hdd_to_vbox_vm(client_name,vbox_disk_name)\n message = \"Attaching:\\tStorage to VM \"+client_name\n command = \"VBoxManage storageattach \\\"#{client_name}\\\" --storagectl \\\"#{$vbox_disk_type}\\\" --port 0 --device 0 --type hdd --medium \\\"#{vbox_disk_name}\\\"\"\n execute_command(message,command)\n return\nend", "def add_volume(container_name: nil, volume_name: nil, volume_config:, mount_path: nil,\n mount_config: {}, block: false, timeout: 60, polling: 5)\n\n create_volume(volume_name, config: volume_config)\n mount_volume(container_name,\n volume_name: volume_name,\n mount_path: mount_path,\n **mount_config)\n\n update\n sleep polling\n wait_for_deployments(timeout: timeout, polling: polling) if block\n reload(true)\n end", "def create_volume(volume_name, config:, **kwargs)\n object = { name: volume_name }.merge(config).merge(kwargs)\n log.info \"Creating volume: #{object}\"\n volumes << object\n end", "def set_volume(volume)\n %x{#{echo()} volume #{volume} 1 > #{fifo()}} if running?\n end", "def mounted?(name)\n mount_loc = File.join(KVM_MOUNT_POINT, name)\n system(\"mount | grep #{mount_loc}\")\nend", "def getmountedvolumes\n # only support Linux for now\n return {} unless Facter['kernel'] && Facter['kernel'].value == 'Linux'\n\n dir = \"/etc\"\n mounted = {}\n\n # AUTOFS - gather only files named auto[._]*\n Dir.glob(File.join(dir, \"*\")).each do |file|\n next if file !~ /^auto[._].*/\n\n # AUTOFS - match only lines that look like nfs syntax such as host:/path\n IO.foreach(file) do |line|\n if line =~ /\\w:\\S/ && line !~ /^\\s*#/\n # Parse it, Example : \" nventory_backup -noatime,intr irvnetappbk:/vol/nventory_backup \"\n if line =~ /^(\\w[\\w\\S]+)\\s+\\S+\\s+(\\w[\\w\\S]+):(\\S+)/\n mnt = $1\n host = $2\n vol = $3\n mounted[\"volumes[mounted][/mnt/#{mnt}][config]\"] = file\n mounted[\"volumes[mounted][/mnt/#{mnt}][volume_server]\"] = host\n mounted[\"volumes[mounted][/mnt/#{mnt}][volume]\"] = vol\n mounted[\"volumes[mounted][/mnt/#{mnt}][type]\"] = 'nfs'\n end\n end\n end # IO.foreach\n end # Dir.glob\n\n # FSTAB - has diff syntax than AUTOFS. Example: \"server:/usr/local/pub /pub nfs rsize=8192,wsize=8192,timeo=14,intr\"\n IO.foreach(\"/etc/fstab\") do |line|\n if line =~ /^(\\w[\\w\\S]+):(\\S+)\\s+(\\S+)\\s+nfs/\n host = $1\n vol = $2\n mnt = $3\n mounted[\"volumes[mounted][#{mnt}][config]\"] = \"/etc/fstab\"\n mounted[\"volumes[mounted][#{mnt}][volume_server]\"] = host\n mounted[\"volumes[mounted][#{mnt}][volume]\"] = vol\n mounted[\"volumes[mounted][#{mnt}][type]\"] = 'nfs'\n end\n end # IO.foreach\n return mounted\n end", "def add_disk(server, size)\n host = server.to_s\n\n # Increment disk id\n if !DISKS.key?(host) then\n DISKS[host] = 0\n else\n DISKS[host] += 1\n end\n disk_id = DISKS[host]\n disk_filename = \".vagrant/disks/\" + host + \"_\" + disk_id.to_s + \".vdi\"\n\n server.vm.provider \"virtualbox\" do |v|\n # Create disk if it not exist\n unless File.exist?(disk)\n v.customize [\"createhd\", \"--filename\", disk_filename, \"--size\", size * 1024 * 1024]\n end\n v.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', disk_id, '--device', 0, '--type', 'hdd', '--medium', disk]\n end\nend", "def propagate(mnt)\n tmp = Digest::SHA2.hexdigest(mnt.mountpoint)\n\n # Bind-mount the new mount into the shared directory\n host_path = File.join(path, tmp)\n Dir.mkdir(host_path)\n syscmd(\"mount --bind \\\"#{mnt.fs}\\\" \\\"#{host_path}\\\"\")\n\n # Move the mount inside the container to the right place\n begin\n ContainerControl::Commands::Mount.run!(\n ct,\n shared_dir: File.join('/', mountpoint),\n src: tmp,\n dst: File.join('/', mnt.mountpoint)\n )\n rescue ContainerControl::Error => e\n log(:warn, ct, \"Failed to mount #{mnt.mountpoint} at runtime: #{e.message}\")\n end\n\n syscmd(\"umount \\\"#{host_path}\\\"\")\n Dir.rmdir(host_path)\n end", "def volume_client_create\n options = {\n :provider => :openstack,\n :openstack_api_key => @options[:openstack_api_key],\n :openstack_username => @options[:openstack_username],\n :openstack_auth_url => @options[:openstack_auth_url],\n :openstack_tenant => @options[:openstack_tenant],\n :openstack_region => @options[:openstack_region],\n }\n @volume_client ||= Fog::Volume.new(options)\n unless @volume_client\n raise \"Unable to create OpenStack Volume instance\"\\\n \" (api_key: #{@options[:openstack_api_key]},\"\\\n \" username: #{@options[:openstack_username]},\"\\\n \" auth_url: #{@options[:openstack_auth_url]},\"\\\n \" tenant: #{@options[:openstack_tenant]})\"\n end\n end", "def FsckAndMount(mount_point, device, mount_type)\n FSCKPartition(device)\n\n ret = MountPartition(mount_point, device, mount_type)\n\n if ret == nil\n AddMountedPartition(\n { :type => \"mount\", :device => device, :mntpt => mount_point }\n )\n end\n\n Builtins.y2milestone(\n \"mounting (%1, %2, %3) yield %4\",\n Ops.add(Installation.destdir, mount_point),\n device,\n mount_type,\n ret\n )\n\n ret\n end", "def mount_device(device, mount_point, owner, group, fs_type)\n puts `echo #{device} #{mount_point} #{fs_type} noatime 0 0|tee -a /etc/fstab`\n puts \"Making mount directory #{mount_point} for #{device}\"\n puts `mkdir -p #{mount_point}`\n puts \"Mounting #{device} at #{mount_point}\"\n puts `mount #{mount_point}`\n puts \"Setting ownership on #{mount_point} to #{owner}\"\n puts `chown #{owner}:#{owner} #{mount_point}`\n end", "def detachvolume\n false\n end", "def mount_usb_drive\n execute_system_cmd('mount /home/pi/compartida/musica/discousb')\n end", "def set_volume\n @volume = services.block_storage.get_volume(params[:id])\n end", "def createVolume\n require 'rest_client'\n require 'uri'\n\n if @role.nil? and !current_actor.superadmin\n json_response({ message: \"You don't have permission to view the clusters in this project\" }, :unauthorized)\n return\n end\n\n # Service name in the query\n volumeName = params[\"volume_name\"]\n\n # Env variables for Manager host and port\n serviceManagerHost = Settings.service_manager_host\n serviceManagerPort = Settings.service_manager_port.to_s\n serviceManagerURI = 'http://' + serviceManagerHost + ':' + serviceManagerPort + '/v1/volume'\n\n # Create request for Service Manager\n stack = {\n 'name' => volumeName,\n 'engine-url' => @cluster.endpoint,\n 'ca-cert' => @cluster.ca,\n 'cert' => @cluster.cert,\n 'cert-key' => @cluster.key\n }.to_json\n\n begin\n response = RestClient.post(\n serviceManagerURI,\n stack,\n 'Accept' => 'application/json',\n 'Content-Type' => 'application/json'\n )\n puts \"Deploy Response: \" + response\n json_response(response, :created)\n rescue Exception => e\n # If error, respond with it\n puts e\n json_response({message: e}, :unprocessable_entity)\n end\n end", "def create\n\t\tregion = resource[:availability_zone].to_s.gsub(/.$/,'') \n\t\tcompute = Fog::Compute.new(:provider => 'aws', :region => \"#{region}\")\n\t\tprint \"ebsvol[aws]->create: Region is #{region}\\n\" if $debug\n\t\tprint \"ebsvol[aws]->create: Availability_zone is #{resource[:availability_zone]}\\n\" if $debug\n\t\t# create the requested volume\n\t\tresponse = compute.create_volume(resource[:availability_zone],resource[:size],resource[:snapshot])\t\n\t\tif (response.status == 200)\n\t\t\tvolumeid = response.body['volumeId']\n\t\t\tprint \"ebsvol[aws]->create: I created volume #{volumeid}.\\n\" if $debug\n\t\t\t# now tag the volume with volumename so we can identify it by name\n\t\t\t# and not the volumeid\n\t\t\tresponse = compute.create_tags(volumeid,{ :Name => resource[:volume_name] })\n\t\t\tif (response.status == 200)\n\t\t\t\tprint \"ebsvol[aws]->create: I tagged #{volumeid} with Name = #{resource[:volume_name]}\\n\" if $debug\n\t\t\tend\n\t\t\t# Check if I need to attach it to an ec2 instance.\n\t\t\tattachto = resource[:attached_to].to_s\n\t\t\tprint \"attachto is #{attachto}\\n\" if $debug\n\t\t\tif ( attachto != '' )\n\t\t\t\tif ( attachto == 'me')\n\t\t\t\t\tinstance = instanceinfo(compute,myname(compute))\n\t\t\t\telse\n\t\t\t\t\tinstance = instanceinfo(compute,attachto)\n\t\t\t\tend\n\t\t\t\tif ( resource[:device] != nil )\n\t\t\t\t\t# try to attach the volume to requested instance\n\t\t\t\t\tprint \"attach the volume\\n\" if $debug\n\t\t\t\t\tvolume = volinfo(compute,resource[:volume_name])\n\t\t\t\t\tattachvol(compute,volume,instance,resource[:device])\n\t\t\t\telse\n\t\t\t\t\traise \"ebsvol[aws]->create: Sorry, I can't attach a volume with out a device to attach to!\"\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\traise \"ebsvol[aws]->create: I couldn't create the ebs volume, sorry!\"\n\t\tend\n\tend", "def storage_use_nfs\n super\n end", "def create_lvm_volumes( opts = {} )\n opts = deep_merge_hashes( @aws_default_instance_options, opts )\n unless exist?( opts[ :lvm_volumes ].first[1] )\n create_lvm_volumes!( opts )\n end\n end", "def test_lv_ops\n lvname = \"testlv_#{Time.now.to_i}\"\n bd = nil\n\n #\n # Test creating the LV\n #\n # vgroup does not exist\n assert_raises Exception do\n bd = Domraider::BlockDevice.new_lv('lkjwf99ex', lvname, 1024)\n bd.create\n end\n # invalid lv size\n assert_raises Exception do\n bd = Domraider::BlockDevice.new_lv('localvg', lvname, 100000000024)\n bd.create\n end\n\n assert_nothing_raised do \n bd = Domraider::BlockDevice.new_lv('localvg', lvname, 1024)\n bd.create\n end\n # device is formatted by default, check it\n if `blkid /dev/mapper/localvg-#{lvname}` !~ /TYPE=\"ext3\"/\n assert false\n end\n \n assert(bd.config_string == \"'phy:/dev/localvg/#{lvname},sda1,w'\")\n assert( File.exist? \"/dev/mapper/localvg-#{lvname}\")\n\n # lv already exists\n assert_raises Exception do\n bd = Domraider::BlockDevice.new_lv('localvg', lvname, 1024)\n bd.create\n end\n\n\n #\n # Test formatting the LV\n #\n bd.format\n if `blkid /dev/mapper/localvg-#{lvname}` !~ /TYPE=\"ext3\"/\n assert false\n end\n \n #\n # Test mouting the LV\n #\n mdir = bd.mount\n assert(`mount | grep #{mdir}` =~ /#{mdir}/)\n assert_raises Exception do\n bd.mount\n end\n \n #\n # Test umounting the LV\n #\n bd.umount\n assert(`mount | grep #{mdir}`.strip.chomp.empty?)\n Dir.rmdir mdir\n\n #\n # Test deleting the LV\n #\n bd.delete\n assert( !File.exist?(\"/dev/mapper/localvg-#{lvname}\") )\n end", "def create\n dir = Pathname.new(path)\n\n unless dir.exist?\n dir.mkdir\n syscmd(\"mount --bind \\\"#{dir}\\\" \\\"#{dir}\\\"\")\n syscmd(\"mount --make-rshared \\\"#{dir}\\\"\")\n end\n\n create_readme unless File.exist?(readme_path)\n end", "def clone_volume(source, target)\n debug(\"Creating Libvirt volume #{target}\")\n debug(\"Cloning volume from #{source}\")\n\n # Attempt to locate the target or source volume\n source_image = client.volumes.get(source)\n if source_image.name =~ /^fog-\\d+/\n error(\"Could not find target image: #{source}.\")\n end\n\n # Clone the source volume\n source_image.clone_volume(target)\n client.volumes.all.find { |vol| vol.name == target }\n end", "def create\n if @resource[:grow_fs] == :true\n fstabentry\n growfs\n mountfs\n else\n createfs()\n fstabentry\n mountfs\n end\n end", "def add_fs_mount(storage_obj)\n storage_id = storage_obj.id\n return if nfs_mounts[storage_id]\n\n mount_point = ::File.join(nfs_mount_root, nfs_mount_dir(storage_obj))\n type = storage_obj.storage.type\n nfs_mounts[storage_id] = {\n :uri => \"#{type}://#{nfs_uri(storage_obj)}\",\n :mount_point => mount_point,\n :read_only => true,\n :type => type\n }\n end", "def setup_lvm_on_partition(part)\n return unless part.lvm\n\n pvol = \"/dev/disk/by-partlabel/#{part.label}\"\n execute!(\"pvcreate -y #{pvol}\")\n execute!(\"vgcreate -y #{part.lvm.vg_name} #{pvol}\")\n\n # any \"open ended\" volumes (no size specified), we deal with last\n unspec_vol = nil\n\n notice(\"Creating LVM partitions\")\n part.lvm.volumes.each do |vol|\n if not vol.size_mb.is_a?(Integer)\n unspec_vol = vol\n next\n end\n\n info(\"Creating #{vol.label} volume\")\n execute!(\"lvcreate -y --name #{vol.label} --size #{vol.size_mb}MiB #{part.lvm.vg_name}\")\n next if not vol.fs\n\n create_filesystem(vol.fs, \"/dev/#{part.lvm.vg_name}/#{vol.label}\", vol.label)\n end\n\n if unspec_vol\n vol = unspec_vol\n info(\"Creating #{vol.label} volume\")\n execute!(\"lvcreate -y --name #{vol.label} -l 100%FREE #{part.lvm.vg_name}\")\n if vol.fs\n create_filesystem(vol.fs, \"/dev/#{part.lvm.vg_name}/#{vol.label}\", vol.label)\n end\n end\n end", "def addVolume(dev, size, type: \"gp2\")\n if @cloud_id.nil? or @cloud_id.empty?\n MU.log \"#{self} didn't have a cloud id, couldn't determine 'active?' status\", MU::ERR\n return true\n end\n az = nil\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).describe_instances(\n instance_ids: [@cloud_id]\n ).reservations.each { |resp|\n if !resp.nil? and !resp.instances.nil?\n resp.instances.each { |instance|\n az = instance.placement.availability_zone\n instance.block_device_mappings.each { |vol|\n if vol.device_name == dev\n MU.log \"A volume #{dev} already attached to #{self}, skipping\", MU::NOTICE\n return\n end\n }\n }\n end\n }\n MU.log \"Creating #{size}GB #{type} volume on #{dev} for #{@cloud_id}\"\n creation = MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).create_volume(\n availability_zone: az,\n size: size,\n volume_type: type\n )\n begin\n sleep 3\n creation = MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).describe_volumes(volume_ids: [creation.volume_id]).volumes.first\n if ![\"creating\", \"available\"].include?(creation.state)\n raise MuError, \"Saw state '#{creation.state}' while creating #{size}GB #{type} volume on #{dev} for #{@cloud_id}\"\n end\n end while creation.state != \"available\"\n\n if @deploy\n MU::MommaCat.listStandardTags.each_pair { |key, value|\n MU::MommaCat.createTag(creation.volume_id, key, value, region: @config['region'], credentials: @config['credentials'])\n }\n MU::MommaCat.createTag(creation.volume_id, \"Name\", \"#{MU.deploy_id}-#{@config[\"name\"].upcase}-#{dev.upcase}\", region: @config['region'], credentials: @config['credentials'])\n end\n\n attachment = MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).attach_volume(\n device: dev,\n instance_id: @cloud_id,\n volume_id: creation.volume_id\n )\n\n begin\n sleep 3\n attachment = MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).describe_volumes(volume_ids: [attachment.volume_id]).volumes.first.attachments.first\n if ![\"attaching\", \"attached\"].include?(attachment.state)\n raise MuError, \"Saw state '#{creation.state}' while creating #{size}GB #{type} volume on #{dev} for #{@cloud_id}\"\n end\n end while attachment.state != \"attached\"\n end", "def mount_nfs_share(share, volume_name)\n begin\n Puppet.debug(\"%s: Mounting %s with volume name %s\" % [Time.now, share, volume_name])\n host.esxcli.storage.nfs.add({:host => resource[:nfs_hostname],\n :share => share,\n :volumename => volume_name})\n Puppet.debug(\"%s: Mounted %s with volume name %s\" % [Time.now, share, volume_name])\n return true\n rescue => e\n log_error(\"Failed to mount\", share, e)\n end\n false\n end", "def attach_volumes!(server, volumes_count, size)\n #create a new block storage connection obj\n volume_service = Fog::Volume::OpenStack.new(\n :openstack_api_key => @os_password,\n :openstack_username => @os_username,\n :openstack_auth_url => @os_auth_url,\n :openstack_tenant => @os_tenant,\n )\n base = 'sdd'\n volumes_count.times do |i|\n base = base.next!\n #create a new volume\n vol = volume_service.volumes.create(\n :size => size,\n :display_name => \"#{server.name}-#{i}\",\n :description => \"Volume attached to #{server.name} - managed by ankus\"\n )\n vol.reload\n vol.wait_for { status == 'available' }\n server.attach_volume(vol.id, \"/dev/#{base}\")\n vol.wait_for { status == 'in-use' }\n end\n end", "def setup_disk(path)\n dev = ::File.readlink(path)\n full_path = ::File.absolute_path(dev, ::File.dirname(path))\n\n fs_type = get_fs_type(full_path)\n if fs_type.nil?\n Mixlib::ShellOut.new(\"mkfs.ext4 #{full_path}\").run_command\n fs_type = 'ext4'\n end\n\n fs_type\nend", "def setup_disk(path)\n dev = ::File.readlink(path)\n full_path = ::File.absolute_path(dev, ::File.dirname(path))\n\n fs_type = get_fs_type(full_path)\n if fs_type.nil?\n Mixlib::ShellOut.new(\"mkfs.ext4 #{full_path}\").run_command\n fs_type = 'ext4'\n end\n\n fs_type\nend", "def nfs_opts_setup()\n @folders.each do |k, opts|\n if !opts[:linux__nfs_options]\n opts[:linux__nfs_options] ||= [\"rw\", \"no_subtree_check\", \"all_squash\", \"insecure\"]\n end\n\n # Only automatically set anonuid/anongid if they weren't\n # explicitly set by the user.\n hasgid = false\n hasuid = false\n opts[:linux__nfs_options].each do |opt|\n hasgid = !!(opt =~ /^anongid=/) if !hasgid\n hasuid = !!(opt =~ /^anonuid=/) if !hasuid\n end\n\n opts[:linux__nfs_options] << \"anonuid=#{opts[:map_uid]}\" if !hasuid\n opts[:linux__nfs_options] << \"anongid=#{opts[:map_gid]}\" if !hasgid\n opts[:linux__nfs_options] << \"fsid=#{opts[:uuid]}\"\n\n # Expand the guest path so we can handle things like \"~/vagrant\"\n expanded_guest_path = @machine.guest.capability(\n :shell_expand_guest_path, opts[:guestpath])\n\n # Do the actual creating and mounting\n @machine.communicate.sudo(\"mkdir -p #{expanded_guest_path}\")\n @machine.communicate.sudo(\"chown -R vagrant:vagrant #{expanded_guest_path}\")\n @machine.communicate.sudo(\"chmod u+rw #{expanded_guest_path}\")\n @machine.communicate.sudo(\"chmod g+rws #{expanded_guest_path}\")\n end\n end", "def setup_volumes\n # managing planned volumes is currently only needed in Windows and only if\n # this is not a reboot scenario.\n if !RightScale::Platform.windows? || RightScale::InstanceState.reboot?\n boot\n else\n RightScale::AuditProxy.create(@agent_identity, 'Planned volume management') do |audit|\n @audit = audit\n manage_planned_volumes do\n @audit = nil\n boot\n end\n end\n end\n true\n end", "def secondary_storage\n unless ::File.exist?(@current_resource.nfs_path)\n directory @current_resource.nfs_path do\n owner \"root\"\n group \"root\"\n action :create\n recursive true\n end\n end\n end", "def load_volume cluster_node_id, volume_cfg\n cluster_vol_id = cluster_node_id + '-' + volume_cfg[:device]\n cluster_vol_params = {\n :cluster => self,\n :cluster_vol_id => cluster_vol_id, :cluster_node_id => cluster_node_id,\n }.merge(\n volume_cfg.slice(:mount_point, :size, :from_snapshot_id, :availability_zone, :device))\n @all_volumes[cluster_vol_id] = Volume.new(cluster_vol_params)\n end", "def addVolume(dev, size, type: \"gp2\", delete_on_termination: false)\n\n if setDeleteOntermination(dev, delete_on_termination)\n MU.log \"A volume #{dev} already attached to #{self}, skipping\", MU::NOTICE\n return\n end\n\n MU.log \"Creating #{size}GB #{type} volume on #{dev} for #{@cloud_id}\"\n creation = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).create_volume(\n availability_zone: cloud_desc.placement.availability_zone,\n size: size,\n volume_type: type\n )\n\n MU.retrier(wait: 3, loop_if: Proc.new {\n creation = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_volumes(volume_ids: [creation.volume_id]).volumes.first\n if ![\"creating\", \"available\"].include?(creation.state)\n raise MuError, \"Saw state '#{creation.state}' while creating #{size}GB #{type} volume on #{dev} for #{@cloud_id}\"\n end\n creation.state != \"available\"\n })\n\n\n if @deploy\n MU::Cloud::AWS.createStandardTags(\n creation.volume_id,\n region: @region,\n credentials: @credentials,\n optional: @config['optional_tags'],\n nametag: @mu_name+\"-\"+dev.upcase,\n othertags: @config['tags']\n )\n end\n\n MU.log \"Attaching #{creation.volume_id} as #{dev} to #{@cloud_id} in #{@region} (credentials #{@credentials})\"\n attachment = nil\n MU.retrier([Aws::EC2::Errors::IncorrectState], wait: 15, max: 4) {\n attachment = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).attach_volume(\n device: dev,\n instance_id: @cloud_id,\n volume_id: creation.volume_id\n )\n }\n\n begin\n att_resp = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_volumes(volume_ids: [attachment.volume_id])\n if att_resp and att_resp.volumes and !att_resp.volumes.empty? and\n att_resp.volumes.first.attachments and\n !att_resp.volumes.first.attachments.empty?\n attachment = att_resp.volumes.first.attachments.first\n if !attachment.nil? and ![\"attaching\", \"attached\"].include?(attachment.state)\n raise MuError, \"Saw state '#{creation.state}' while creating #{size}GB #{type} volume on #{dev} for #{@cloud_id}\"\n end\n end\n end while attachment.nil? or attachment.state != \"attached\"\n\n # Set delete_on_termination, which for some reason is an instance\n # attribute and not on the attachment\n setDeleteOntermination(dev, delete_on_termination)\n end", "def set_variation_mount_point(mnt)\n @mount_point = mnt\n end", "def setup_device_for_mount\n # use ramdisk for creating a test device for mount.\n # This can cleaner if we have chef resource/provider for ramdisk.\n case ohai[:platform_family]\n when \"aix\"\n # On AIX, we can't create a ramdisk inside a WPAR, so we use\n # a \"namefs\" mount against / to test\n # https://www-304.ibm.com/support/knowledgecenter/ssw_aix_71/com.ibm.aix.performance/namefs_file_sys.htm\n device = \"/\"\n fstype = \"namefs\"\n when \"debian\", \"rhel\", \"amazon\"\n device = \"/dev/ram1\"\n unless File.exist?(device)\n shell_out(\"mknod -m 660 #{device} b 1 0\")\n shell_out(\"chown root:disk #{device}\")\n end\n shell_out(\"ls -1 /dev/ram*\").stdout.each_line do |d|\n if shell_out(\"mount | grep #{d}\").exitstatus == \"1\"\n # this device is not mounted, so use it.\n device = d\n break\n end\n end\n fstype = \"tmpfs\"\n shell_out!(\"mkfs -q #{device} 512\")\n when \"solaris2\"\n device = \"swap\"\n fstype = \"tmpfs\"\n else\n end\n [device, fstype]\n end", "def definition(opts)\n opts = check_params(opts,[:volumes])\n super(opts)\n end", "def volume _value, _abs=0\n send_cmd(\"volume #{_value} #{_abs}\")\n end", "def attach_volume volume, device\n if running?\n post '/attach_volume', :query => {\n :server => {\n :ec2_ebs_volume_href => volume.uri,\n :device => device\n }\n }\n else\n volume.attach_to_server self, device, 'boot'\n end\n end", "def attach(volume, device = '/dev/sdh')\n @ec2.attach_volume volume.id, id, device\n end", "def mounts_ebs_volumes settings\n has_role settings, \"ebs_volumes_mount\"\nend", "def add_persistent_volume(volume, host_spec = {:host_name => 'localhost'})\n @per_volumes_by_hosts[host_spec[:host_name]] << volume\n @hosts_specs[host_spec[:host_name]] ||= host_spec.to_h\n end", "def attach_planned_volume(mapping)\n # preserve the initial list of disks/volumes before attachment for comparison later.\n vm = RightScale::Platform.volume_manager\n InstanceState.planned_volume_state.disks ||= vm.disks\n InstanceState.planned_volume_state.volumes ||= vm.volumes\n\n # attach.\n payload = {:agent_identity => @agent_identity, :volume_id => mapping[:volume_id], :device_name => mapping[:device_name]}\n Log.info(\"Attaching volume #{mapping[:volume_id]}.\")\n req = RetryableRequest.new(\"/storage_valet/attach_volume\", payload, :retry_delay => VolumeManagement::VOLUME_RETRY_SECONDS)\n \n req.callback do |res|\n # don't set :volume_status here as that should only be queried\n mapping[:management_status] = 'attached'\n mapping[:attempts] = nil\n yield if block_given?\n end\n\n req.errback do |res|\n # volume could already be attaching or have been deleted\n # which we can't see because of latency; go around again\n # and check state of volume later.\n Log.error(\"Failed to attach volume #{mapping[:volume_id]} (#{res})\")\n mapping[:attempts] ||= 0\n mapping[:attempts] += 1\n # retry indefinitely so long as core api instructs us to retry or else fail after max attempts.\n if mapping[:attempts] >= VolumeManagement::MAX_VOLUME_ATTEMPTS\n strand(\"Exceeded maximum of #{VolumeManagement::MAX_VOLUME_ATTEMPTS} attempts attaching volume #{mapping[:volume_id]} with error: #{res}\")\n else\n yield if block_given?\n end\n end\n\n req.run\n end", "def mountiso(vid, iso)\n perform_request(:action => 'vserver-mountiso', :vserverid => vid, :iso => iso)\n end", "def mount(app, options = T.unsafe(nil)); end", "def volume_from(name)\n volumes << VolumeFrom.new(name)\n end", "def attach(instance_id, volume)# rubocop:disable Metrics/AbcSize\n inst_details = AttrFinder.new(@instanceparameters)\n @options[:inst] = volume\n inst_details.options = @options\n inst_details.validate = @validate\n inst_details.function = 'server'\n opts = {}\n BmcAuthenticate.new(@options)\n request = OracleBMC::Core::Models::AttachVolumeDetails.new\n request.instance_id = instance_id\n request.type = 'iscsi'\n request.volume_id = inst_details.volume\n api = OracleBMC::Core::ComputeClient.new\n response = api.attach_volume(request, opts)\n end", "def test_mountroot\n server = nil\n assert_nothing_raised {\n\n server = Puppet::Network::Handler.fileserver.new(\n\n :Local => true,\n\n :Config => false\n )\n }\n\n assert_nothing_raised {\n server.mount(\"/\", \"root\")\n }\n\n testdir, pattern, tmpfile = mktestdir\n\n list = nil\n assert_nothing_raised {\n list = server.list(\"/root/#{testdir}\", :manage, true, false)\n }\n\n assert(list =~ pattern)\n assert_nothing_raised {\n list = server.list(\"/root#{testdir}\", :manage, true, false)\n }\n\n assert(list =~ pattern)\n end", "def add_to(vm, io_bus, port, device)\n media_arg = case media\n when :disk\n 'hdd'\n when :dvd\n 'dvddrive'\n end\n VirtualBox.run_command! ['VBoxManage', '--nologo', 'storageattach',\n vm.uid, '--storagectl', io_bus.name, '--port', port.to_s,\n '--device', device.to_s, '--type', media_arg, '--medium', file]\n self\n end", "def set_directory\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\t#LOG.debug(fname) {\"debut old_dir_name=#{@old_dir_name}\"}\n\t\tdir = protocol_driver.create_volume_dir(self,@old_dir_name)\n\t\tif dir.nil?\n\t\t\tret = false\n\t\t\tself.errors.add :base, I18n.t(:ctrl_object_not_created,:typeobj => I18n.t(:ctrl_volume), :ident=>self.name, :msg => nil)\n\t\telse\n\t\tret = true\n\t\tend\n\t\t#LOG.debug(fname) {\"fin dir=#{dir} ret=#{ret}\"}\n\t\tret\n\tend", "def create_volume(snapshot_id, size, availability_zone, timeout, volume_type, piops)\n availability_zone ||= instance_availability_zone\n\n # Sanity checks so we don't shoot ourselves.\n raise \"Invalid volume type: #{volume_type}\" unless ['standard', 'gp2', 'io1'].include?(volume_type)\n\n # PIOPs requested. Must specify an iops param and probably won't be \"low\".\n if volume_type == 'io1'\n raise 'IOPS value not specified.' unless piops >= 100\n end\n\n # Shouldn't see non-zero piops param without appropriate type.\n if piops > 0\n raise 'IOPS param without piops volume type.' unless volume_type == 'io1'\n end\n\n create_volume_opts = { :volume_type => volume_type }\n # TODO: this may have to be casted to a string. rightaws vs aws doc discrepancy.\n create_volume_opts[:iops] = piops if volume_type == 'io1'\n\n nv = ec2.create_volume(snapshot_id, size, availability_zone, create_volume_opts)\n Chef::Log.debug(\"Created new volume #{nv[:aws_id]}#{snapshot_id ? \" based on #{snapshot_id}\" : \"\"}\")\n\n # block until created\n begin\n Timeout::timeout(timeout) do\n while true\n vol = volume_by_id(nv[:aws_id])\n if vol && vol[:aws_status] != \"deleting\"\n if [\"in-use\", \"available\"].include?(vol[:aws_status])\n Chef::Log.info(\"Volume #{nv[:aws_id]} is available\")\n break\n else\n Chef::Log.debug(\"Volume is #{vol[:aws_status]}\")\n end\n sleep 3\n else\n raise \"Volume #{nv[:aws_id]} no longer exists\"\n end\n end\n end\n rescue Timeout::Error\n raise \"Timed out waiting for volume creation after #{timeout} seconds\"\n end\n\n nv[:aws_id]\n end", "def attachvol(compute,volume,instance,device)\n\t\tprint \"Running attachvol\\n\" if $debug\n\t\traise ArgumentError \"ebsvol[aws]->attachvol: Sorry, you must specify a valid device matching /dev/sd[a-m].\" if (device !~ /^\\/dev\\/sd[a-m]/)\n\t\tif (volume['status'] != \"in-use\" )\n\t\t\t# check instance is in the same availability zone\n\t\t\tif ( volume['availabilityZone'] != instance['placement']['availabilityZone'])\n\t\t\t\traise \"ebsvol[aws]->attachvol: Sorry, volumes must be in the same availability zone as the instance to be attached to.\\nThe volume #{volume['tagSet']['Name']} is in availability zone #{volume['availabilityZone']} and the instance is in #{instance['placement']['availabilityZone']}\" \n\t\t\telse\n\t\t\t\t# check that the device is available\n\t\t\t\tinuse = false\n\t\t\t\tinstance['blockDeviceMapping'].each { |x| inuse=true if x['deviceName'] == device }\n\t\t\t\tif ( inuse )\n\t\t\t\t\traise \"ebsvol[aws]->attachvol: Sorry, the device #{device} is already in use on #{instance['tagSet']['Name']}\" \n\t\t\t\telse\n\t\t\t\t\tresp = compute.attach_volume(instance['instanceId'],volume['volumeId'],device)\n\t\t\t\t\tif (resp.status == 200)\n\t\t\t\t\t\t# now wait for it to attach!\n\t\t\t\t\t\tcheck = volinfo(compute,volume['tagSet']['Name'])\n\t\t\t\t\t\twhile ( check['status'] !~ /(attached|in-use)/ ) do\n\t\t\t\t\t\t\tprint \"ebsvol[aws]->attachvol: status is #{check['status']}\\n\" if $debug\n\t\t\t\t\t\t\tsleep 5\n\t\t\t\t\t\t\tcheck = volinfo(compute,volume['tagSet']['Name'])\n\t\t\t\t\t\tend\n\t\t\t\t\t\tsleep 5 # allow aws to propigate the fact\n\t\t\t\t\t\tprint \"ebsvol[aws]->attachvol: volume is now attached\\n\" if $debug\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\traise \"ebsvol[aws]->attachvol: Sorry, I could not attach #{volume['volumeId']} because it is in use!\"\n\t\tend\n\tend", "def set_volume(volume)\n puts \"Setting volume to #{volume}\" if $verbose\n v='AG'+(('000'+volume.to_s)[-3..-1])+';'\n puts v if $verbose\n ret=send_cmd(v,'AG;',v,0.5,1.5,3)\n if(ret)\n return(ret.gsub(/^AG/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend", "def attach_volume(id, volume) \n data = { 'volumeAttachment' => { 'volumeId' => volume, 'device' => \"/dev/vdb\" } }\n return post_request(address(\"/servers/\" + id + \"/os-volume_attachments\"), data, @token)\n end", "def has_logical_volume_management\n super\n end", "def create_iscsi_disks(vbox, name)\n unless controller_exists(name, 'SATA Controller')\n vbox.customize ['storagectl', :id,\n '--name', 'SATA Controller',\n '--add', 'sata']\n end\n\n dir = \"#{ENV['HOME']}/VirtualBox\\ VMs/vdisks\"\n Dir.mkdir dir unless File.directory?(dir)\n\n osts = (1..20).map { |x| [\"OST#{x}\", '5120'] }\n\n [\n %w[mgt 512],\n %w[mdt0 5120]\n ].concat(osts).each_with_index do |(name, size), i|\n file_to_disk = \"#{dir}/#{name}.vdi\"\n port = (i + 1).to_s\n\n unless File.exist?(file_to_disk)\n vbox.customize ['createmedium',\n 'disk',\n '--filename',\n file_to_disk,\n '--size',\n size,\n '--format',\n 'VDI',\n '--variant',\n 'fixed']\n end\n\n vbox.customize ['storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', port,\n '--type', 'hdd',\n '--medium', file_to_disk,\n '--device', '0']\n\n vbox.customize ['setextradata', :id,\n \"VBoxInternal/Devices/ahci/0/Config/Port#{port}/SerialNumber\",\n name.ljust(20, '0')]\n end\nend", "def mount(root, handler, long_call = false, *args)\n resources[root] = [ handler, long_call, args ]\n end", "def add_tmp_volume(volume, host_spec = {:host_name => 'localhost'})\n @tmp_volumes_by_hosts[host_spec[:host_name]] << volume\n @hosts_specs[host_spec[:host_name]] ||= host_spec.to_h\n end", "def new_disk_ide\n Libvirt::Spec::Device.get(:disk).new.tap do |disk|\n disk.type = :file\n disk.device = :disk\n disk.target_dev = :hda\n disk.target_bus = :ide\n end\n end", "def create_gdom_disk(options)\n client_disk = options['q_struct']['gdom_disk'].value\n disk_size = options['q_struct']['gdom_size'].value\n disk_size = disk_size.downcase\n vds_disk = options['name']+\"_vdisk0\"\n if not client_disk.match(/\\/dev/)\n if not File.exist?(client_disk)\n message = \"Information:\\tCreating guest domain disk \"+client_disk+\" for client \"+options['name']\n command = \"mkfile -n #{disk_size} #{client_disk}\"\n output = execute_command(options,message,command)\n end\n end\n message = \"Information:\\tChecking Virtual Disk Server device doesn't already exist\"\n command = \"ldm list-services |grep 'primary-vds0' |grep '#{vds_disk}'\"\n output = execute_command(options,message,command)\n if not output.match(/#{options['name']}/)\n message = \"Information:\\tAdding disk device to Virtual Disk Server\"\n command = \"ldm add-vdsdev #{client_disk} #{vds_disk}@primary-vds0\"\n output = execute_command(options,message,command)\n end\n return\nend", "def mount_files\n Dir.glob('proc/*', base: mountpoint)\n end", "def volume_rm\n # Allow deletion of a default volume.\n # This allows you to create custom default volumes.\n help = [\n '',\n \"Use: #{me} volume rm VOLUME\",\n '',\n \"Removes a volume created with the [#{me} volume create] command\"\n ]\n\n vol = ARGV[2]\n if [nil,'help','--help'].include? vol\n show help\n exit failed\n end\n\n exit_unless_is_cyber_dojo_volume(vol, 'rm')\n\n run \"docker volume rm #{vol}\"\n if $exit_status != 0\n puts \"FAILED [volume rm #{vol}] can't remove volume if it's in use\"\n exit failed\n end\n\nend", "def create_fusion_vm_disk(options,fusion_vm_dir,fusion_disk_file)\n if File.exist?(fusion_disk_file)\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM disk '#{fusion_disk_file}' already exists for #{options['name']}\")\n quit(options)\n end\n check_dir_exists(options,fusion_vm_dir)\n if options['host-os-name'].to_s.match(/Darwin/)\n vdisk_bin = \"/Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager\"\n else\n vdisk_bin = \"/usr/bin/vmware-vdiskmanager\"\n end\n message = \"Creating \\t#{options['vmapp']} disk '\"+fusion_disk_file+\"' for \"+options['name']\n command = \"cd \\\"#{fusion_vm_dir}\\\" ; \\\"#{vdisk_bin}\\\" -c -s \\\"#{options['size']}\\\" -a LsiLogic -t 0 \\\"#{fusion_disk_file}\\\"\"\n execute_command(options,message,command)\n return\nend", "def addDisk(backingFile, sizeInMB, label = nil, summary = nil, options = {})\n # Remove nil keys if any, since the next line may not work\n options.reject! { |_k, v| v.nil? }\n # Merge default values:\n # - persistent is set to true to be backward compatible\n # - thin_provisioned is set to false explicitly since we call to_s on it further, so nil will not work for us\n options = {:persistent => true, :thin_provisioned => false}.merge(options)\n ck, un = available_scsi_units.first\n raise \"addDisk: no SCSI controller found\" unless ck\n\n vmConfigSpec = VimHash.new(\"VirtualMachineConfigSpec\") do |vmcs|\n vmcs.deviceChange = VimArray.new(\"ArrayOfVirtualDeviceConfigSpec\") do |vmcs_vca|\n vmcs_vca << VimHash.new(\"VirtualDeviceConfigSpec\") do |vdcs|\n vdcs.operation = VirtualDeviceConfigSpecOperation::Add\n if sizeInMB < 0\n sizeInMB = -sizeInMB\n else\n vdcs.fileOperation = VirtualDeviceConfigSpecFileOperation::Create\n end\n vdcs.device = VimHash.new(\"VirtualDisk\") do |vDev|\n vDev.key = -100 # temp key for creation\n vDev.capacityInKB = sizeInMB * 1024\n vDev.controllerKey = ck\n vDev.unitNumber = un\n # The following doesn't seem to work.\n vDev.deviceInfo = VimHash.new(\"Description\") do |desc|\n desc.label = label\n desc.summary = summary\n end if label || summary\n vDev.connectable = VimHash.new(\"VirtualDeviceConnectInfo\") do |con|\n con.allowGuestControl = \"false\"\n con.startConnected = \"true\"\n con.connected = \"true\"\n end\n if options[:dependent]\n mode = (options[:persistent] ? VirtualDiskMode::Persistent : VirtualDiskMode::Nonpersistent)\n else\n mode = (options[:persistent] ? VirtualDiskMode::Independent_persistent : VirtualDiskMode::Independent_nonpersistent)\n end\n vDev.backing = VimHash.new(\"VirtualDiskFlatVer2BackingInfo\") do |bck|\n bck.diskMode = mode\n bck.split = \"false\"\n bck.thinProvisioned = options[:thin_provisioned].to_s\n bck.writeThrough = \"false\"\n bck.fileName = backingFile\n begin\n dsn = @invObj.path2dsName(@dsPath)\n bck.datastore = @invObj.dsName2mo_local(dsn)\n rescue\n bck.datastore = nil\n end\n end\n end\n end\n end\n end\n\n logger.info \"MiqVimVm(#{@invObj.server}, #{@invObj.username}).addDisk: calling reconfigVM_Task\"\n taskMor = @invObj.reconfigVM_Task(@vmMor, vmConfigSpec)\n logger.info \"MiqVimVm(#{@invObj.server}, #{@invObj.username}).addDisk: returned from reconfigVM_Task\"\n waitForTask(taskMor)\n end", "def mount_at(mountpoint)\n @mountpoint = mountpoint\n end" ]
[ "0.7274043", "0.7244567", "0.6742136", "0.6604199", "0.64959526", "0.64927846", "0.647494", "0.63748556", "0.6353995", "0.63412315", "0.63412315", "0.6325103", "0.6315395", "0.6313523", "0.630274", "0.62794125", "0.62475336", "0.624153", "0.62185115", "0.61277425", "0.61264455", "0.6097058", "0.6075796", "0.6052034", "0.6043055", "0.60339075", "0.6019624", "0.5981482", "0.5981193", "0.5959587", "0.5936554", "0.5930012", "0.59274065", "0.5916785", "0.591608", "0.5912216", "0.5883058", "0.58724815", "0.5860471", "0.58550143", "0.58450323", "0.5842866", "0.5829494", "0.58229125", "0.58208674", "0.5814909", "0.5810419", "0.5799312", "0.5797191", "0.5780634", "0.57791126", "0.5766094", "0.5757571", "0.57291955", "0.57275796", "0.5724804", "0.57122624", "0.5705282", "0.5704899", "0.57034767", "0.56925577", "0.56886435", "0.5668474", "0.5663887", "0.5663887", "0.5663176", "0.564156", "0.5635998", "0.56254965", "0.56225324", "0.5620343", "0.5609229", "0.5584231", "0.55830455", "0.557869", "0.5577689", "0.55765635", "0.55730665", "0.5564604", "0.5561088", "0.55603784", "0.55393064", "0.5534485", "0.5526933", "0.5526062", "0.5514526", "0.5512378", "0.5511837", "0.5509952", "0.5505774", "0.5490824", "0.5480452", "0.54789567", "0.5477621", "0.5473865", "0.5468472", "0.5466622", "0.54541224", "0.54447734", "0.5439249", "0.54375917" ]
0.0
-1
Register a new account on the Box website with the given details.
def register(email, password) response = @api.register_new_user(email, password) cache_info(response['user']) # cache account_info, saving an extra API call authorize_token(response['token']) true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register()\n\tentry = {\"userid\" => @userid, \"username\" => @username, \"email\" => @email, \"password\" => @password}\n\tDATABASE.newEntry(\"users\", entry)\n\tend", "def register(email, password)\n response = Backendless.register email, password\n if response\n 'Registration sucessful'\n else\n 'Registration failed'\n end\n end", "def create\n megam_rest.post_accounts(to_hash)\n end", "def registration(login, pass, first_name, last_name)\n visit(HomePage)\n on(HomePage).register_element.when_visible($WT).click\n on(RegisterPage).user_login_element.when_visible($WT).send_keys login\n on(RegisterPage).user_password = pass\n on(RegisterPage).user_password_confirmation = pass\n on(RegisterPage).user_firstname = first_name\n on(RegisterPage).user_lastname = last_name\n on(RegisterPage).user_language = 'English'\n on(RegisterPage).user_mail = login + '@dd.dd'\n on(RegisterPage).submit\n end", "def create(body = {})\n @client.account.create(body)\n end", "def sign_up\n NexaasID::Resources::SignUp.new(api_token, config)\n end", "def create_new_imdb_account\n CommonHelper.wait_for_element_to_present(SIGN_IN_BTN, :xpath)\n page.find(:xpath,SIGN_IN_BTN).click\n CommonHelper.wait_for_element_to_present(CREATE_NEW_ACCOUNT_BTN, :xpath)\n page.find(:xpath,CREATE_NEW_ACCOUNT_BTN).click\n user_name = \"QA#{Time.now.to_i}\"\n CommonHelper.wait_for_element_to_present(YOUR_NAME_INPUT)\n page.find(YOUR_NAME_INPUT).set user_name\n page.find(EMAIL_INPUT).set \"#{user_name}@gmail.com\"\n page.find(PASSWORD_INPUT).set \"Pass_#{user_name}\"\n page.find(PASSWORD_RECHECK_INPUT).set \"Pass_#{user_name}\"\n page.find(CREATE_IMDB_ACCOUNT_BTN).click\n user_name\n end", "def register\n enc_password = Authentication::Encryptor.digest(password)\n account = Authentication::Account.find_or_initialize_by({email: username})\n account.assign_attributes({'encrypted_password' => enc_password, 'gid' => gid})\n account.roles.concat(role.to_a).uniq!\n account.save!\n {'account_id' => account.id}\n end", "def register_account\n profile = Profile.new(params[:profile])\n profile = update_profile_for_register_account(profile)\n if save_objeck(profile)\n if Notifier.trigger_register_thank_you(profile.id)\n profile.histories.create(:message => \"Register Thank You email sent\")\n end\n show_success(profile.class.to_s)\n set_session_user(profile.user)\n else\n profile = handle_profile_errors(profile)\n show_failure(profile)\n end\n end", "def register(username, password, options = {})\n parameters = { :user => username, :passwd => password, :passwd2 => password, :email => options[:email], :captcha => options[:captcha], :iden => options[:captcha_identifier] }\n post('api/register', parameters)\n end", "def create_account\n\n end", "def post_register(params)\n form = MHVAC::RegistrationForm.new(params)\n perform(:post, 'account/register', form.mhv_params, nonauth_headers).body\n end", "def signup\n client.signup(\n params[:user],\n params[:password]\n )\n end", "def signup\n end", "def signup\n end", "def register\n # running successfully\n # class_name = params[:user_type].camelize\n # registration_stuff = params[\"#{params[:user_type].to_sym}\"]\n # template = \"#{params[:user_type].pluralize}/new\"\n # save_credentials(class_name, registration_stuff, template)\n\n if(params[:user_type] == 'job_seeker')\n class_name = \"JobSeeker\"\n registration_stuff = params[:job_seeker]\n template = \"job_seekers/new\"\n save_credentials(class_name, registration_stuff, template)\n else\n class_name = \"Employer\"\n registration_stuff = params[:employer]\n template = \"employers/new\"\n save_credentials(class_name, registration_stuff, template)\n end\n end", "def add_account(payload)\n post(url_, payload)\n end", "def register(email, password)\n user = User.new\n puts user.register email, password\n end", "def register(params)\n db = database()\n if params[\"Name\"].length < 2\n return {status: :error, message: \"Name has to be longer than 3 characters!\"}\n elsif params[\"Password\"].length < 5\n return {status: :error, message: \"Password needs to contain 6 or more characters!\"}\n end\n \n if db.execute(\"SELECT Phone FROM users WHERE Phone = #{params[\"Phone\"]}\") == []\n hashed_pass = BCrypt::Password.create(\"#{params[\"Password\"]}\")\n db.execute(\"INSERT INTO users (Name, Password, Phone) VALUES (?, ?, ?)\", params[\"Name\"], hashed_pass, params[\"Phone\"])\n return {status: :ok}\n else\n return {status: :error, message: \"Phone number is already in use\"}\n end\n end", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.send(\"#{fb_email_hash_name}=\", Facebooker::User.hash_email(email))\n save(false)\n end", "def create_sip_account(extension, username, password)\n #password must be > 6 characters per Cloudvox\n JSON.parse((@cloudvox_api['/phones.json'].post :endpoint => {:extension => extension, :username => username, :password => password}).body)\n end", "def create(params)\n put('v1/account', params)\n end", "def create_buyer email_address, card_uri, name=nil, meta={}\n account = Account.new(\n :uri => self.accounts_uri,\n :email_address => email_address,\n :card_uri => card_uri,\n :name => name,\n :meta => meta,\n )\n account.save\n end", "def create_buyer email_address, card_uri, name=nil, meta={}\n account = Account.new(\n :uri => self.accounts_uri,\n :email_address => email_address,\n :card_uri => card_uri,\n :name => name,\n :meta => meta,\n )\n account.save\n end", "def sign_up\n self.sign_up_link\n CreateNewAccount.new @browser\n end", "def create\n @account = BlackberryAccount.new(params[:blackberry_account])\n current_user.person.blackberry_accounts << @account\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to( accounts_path, :notice => 'Account was successfully created.') }\n format.json { render :json => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @account.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new_account(name)\n account(name)\n end", "def registerUser(name, usernumber)\n # puts (\"adding user\")\n @users.store(name, usernumber)\n end", "def account_create(uid,display_name)\n user_hash = @client.user_create(\"#{uid}\",\"#{display_name}\")\n Rails.logger.debug '> Radosgw: Account create'\n user_json = user_hash.to_json\n storage = Storage.new(STORAGES_BUCKET)\n storage.upload(uid, user_json, 'application/json')\n user_hash\n end", "def create_account\n set_user\n set_payer\n set_user_sport\n save_account\n end", "def create_account_and_login(email: '[email protected]', password: 'secret')\n account = Account.create(email: email, password: password)\n visit new_account_session_path\n fill_in 'Email', with: '[email protected]'\n fill_in 'Password', with: 'secret'\n click_on 'Log in'\n account\nend", "def add_account\n # make sure a second confirmation email is not sent\n skip_reconfirmation!\n\n # update before setting the account_id\n update_profile_email\n\n update_attribute(:account_id, Account.current.id)\n ensure_site_profile_exists\n end", "def create\n @account = Account.new\n # data = params[:moneybox]\n @account.name = params[:name]\n\n respond_to do |format|\n if @moneybox.save\n format.html { redirect_to @moneybox, notice: 'Moneybox was successfully created.' }\n format.json { render action: 'show', status: :created, location: @moneybox }\n else\n format.html { render action: 'new' }\n format.json { render json: @moneybox.errors, status: :unprocessable_entity }\n end\n end\n end", "def register\n \n end", "def register_with_et\r\n App.et[\"accounts\"].each_pair do |account_name, account_config|\r\n next unless account_config[:rsvp_guest_list]\r\n ETSubscriberAdd.create!(\r\n :account => account_name,\r\n :target => self,\r\n :properties => {\r\n :list_id => account_config[:rsvp_guest_list],\r\n :values => {\r\n :email_address => self.email,\r\n :cobrand => cobrand.short_name\r\n }\r\n }\r\n )\r\n end\r\n end", "def register\n show_dialog_waiting(Vocab.registration_processing, true)\n Graphics.update\n begin\n handle_response Online.register_new_player(@info_window.name, @info_window.avatar, @info_window.title.id)\n rescue InternetConnectionException\n Logger.error $!.message\n show_dialog(Vocab.connection_error, @command_window)\n end\n end", "def new_registration(account)\n @account = account\n mail subject: \"#{APP::NAME}: new registration\"\n end", "def create_new_account(database, email_address, first_name, last_name, password)\r\n database.execute(\"INSERT INTO users (email_address, first_name, last_name, password) VALUES (?, ?, ?, ?)\", [email_address, first_name, last_name, password])\r\nend", "def sign_up_with(**args)\n email = args.fetch(:email, '[email protected]')\n password = args.fetch(:password, '12345678')\n password_confirmation = args.fetch(:password_confirmation, '12345678')\n\n within '#new_user' do\n fill_in 'Email', with: email\n fill_in 'Password', with: password\n fill_in 'Password confirmation', with: password_confirmation\n click_on 'Sign up'\n end\n end", "def add(account) \n entry = Keybox::HostAccountEntry.new(account, account)\n\n if @options.use_password_hash_for_url then\n begin \n account_uri = URI.parse(account) \n if not account_uri.scheme.nil? then\n entry = Keybox::URLAccountEntry.new(account,account)\n end\n rescue ::URI::InvalidURIError\n # just ignore it, we're fine with the Host\n # Account Entry\n end\n\n end\n new_entry = gather_info(entry)\n hsay \"Adding #{new_entry.title} to database.\", :information\n @db << new_entry\n end", "def create\n user = AuthenticationManager.new(\n params.slice(%i[email first_name last_name password]).merge(is_profile_owner: true, password_confirmation: params[:password], tos_accepted: params.bool(:tos_accepted))\n ).register\n user = session_manager.login(user.email, params[:password], use_api_token: true)\n json_success user: api_response.current_user_data(user)\n end", "def register(attributes = {})\n user = PublicEarth::Db::User.new(attributes)\n \n if attributes[:username].blank?\n user.errors.add(:username, \"A username is required.\") \n elsif attributes[:username] =~ /[^\\w\\-\\_\\!\\@\\$\\?]/\n user.errors.add(:username, \"A username may only contain letters, numbers or the following characters: -_!@$?\") \n elsif PublicEarth::Db::User.find_by_username(attributes[:username])\n user.errors.add(:username, \"The username #{attributes[:username]} is already taken.\") \n end\n \n if attributes[:email].blank?\n user.errors.add(:email, \"An email address is required.\") \n elsif PublicEarth::Db::User.find_by_email(attributes[:email])\n user.errors.add(:email, \"The email address #{attributes[:email]} is already taken.\") \n end\n\n if attributes[:email] !~ /^[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,4}$/ \n user.errors.add(:email, \"A valid email address is required (eg, [email protected]).\")\n end\n \n if attributes[:password].blank?\n user.errors.add(:password, \"A password is required.\") \n elsif attributes[:password] != attributes[:password_confirmation]\n user.errors.add(:password, \"The password and its confirmation don't match.\")\n end\n\n if user.errors.empty?\n begin\n user.attributes = one.create(attributes[:username], attributes[:email], attributes[:password], generate_token)\n rescue\n logger.error(\"Failed to create user account for #{attributes.inspect}: #{$!}\")\n user.errors.add_to_base(\"Unable to create a user account for #{attributes[:username]}.\")\n end\n end\n\n user\n end", "def register\n @response = client.request :user, :register3 do\n soap.element_form_default = :unqualified \n soap.namespaces[\"xmlns:login\"] = 'http://login.ext.soap.yodlee.com'\n \n soap.body = {\n :cobrand_context => cobrand_context,\n :user_credentials => credentials.credentials_hash, \n :user_profile => credentials.profile_hash,\n :attributes! => {:user_credentials => {\"xsi:type\" => \"login:PasswordCredentials\"}} \n }\n end\n \n hash_response = @response.to_hash\n context = hash_response[:register3_response][:register3_return][:user_context]\n parse_response(context)\n end", "def register(nicknam, realname, passwd = nil, mode = 0)\n pass(passwd) if passwd\n nick(nicknam)\n user(nicknam, realname, mode)\n end", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n r = Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n save(false)\n end", "def create\n _user_not_anonymous\n @user = CwaIpaUser.new\n @project = Project.find(Redmine::Cwa.project_id)\n\n if !params[:saa] \n flash[:error] = \"Please indicate that you accept the system access agreement\"\n redirect_to :action => :index\n return\n end\n\n if !params[:tos]\n flash[:error] = \"Please indicate that you accept the terms of service\"\n redirect_to :action => :index\n return\n end\n\n # TODO \n # 1. Call REST to messaging service to notify about account creation\n # 2. Add user to research-computing project\n @user.passwd = params['netid_password']\n\n begin\n @user.create\n rescue Exception => e\n flash[:error] = \"Registration failed: \" + e.to_s\n else\n logger.info \"Account #{@user.uid.first} provisioned in FreeIPA\"\n\n # Add them to the project... allows notifications\n @project.members << Member.new(:user => User.current, :roles => [Role.find_by_name(\"Watcher\")])\n\n CwaMailer.activation(@user).deliver\n\n flash[:notice] = 'You are now successfully registered!'\n end\n redirect_to :action => :index\n end", "def add_new_account(account)\n new_personal_account_modal.close_icon_element.click if new_personal_account_modal?\n clear_all_toasts\n add_account_button\n select_new_account(account)\n end", "def create\n printf(\"create : %s/%s \\n\", params[\"name\"], params[\"password\"])\n @account = Account.new(:name => params[\"name\"], :email => params[\"email\"], :password => params[\"password\"])\n \n respond_to do |format|\n if @account.save\n printf(\"save OK\\n\")\n format.html { redirect_to(@account, :notice => 'Account was successfully created.') }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n printf(\"save FAIL\\n\")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end", "def register\n @user = User.new(user_id: params[:user_id], password: params[:password])\n @user.save\n end", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n save(false)\n end", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n save(false)\n end", "def register_user_to_fb\n\t #users = {:email => email, :account_id => id}\n\t #Facebooker::User.register([users])\n\t #self.email_hash = Facebooker::User.hash_email(email)\n\t #save(false)\n\tend", "def register\n\t\t@user = User.new(user_params)\n\n\t\trespond_to do |format|\n\t\t\tif @user.save\n\n\t\t\t\tformat.html { redirect_to login_path, notice: \"Account created successfully!\" }\n\t\t\telse\n\t\t\t\tformat.html { render action: :create_account }\n\t\t\tend\n\t\tend\n\tend", "def register\n email = request.headers['email'].to_s\n username = request.headers['username'].to_s\n password = request.headers['password'].to_s\n password_confirmation = request.headers['passconf'].to_s\n\n @user = User.new(email: email, username: username, password: password, password_confirmation: password_confirmation)\n if @user.save\n remember_token = RememberToken.create(token: User.encrypt(User.new_remember_token), user_id: @user.id, accessed_at: Time.now)\n respond_to do |format|\n format.json { render :json => remember_token }\n end\n else\n respond_to do |format|\n format.all{head :bad_request, :content_type => 'text/html'}\n end\n end\n end", "def sign_up\n link(:id=>\"navigation_anon_signup_link\").click\n CreateNewAccount.new @browser\n end", "def register\n raw \"PASS #{@config[:password]}\" if @config.key? :password\n raw \"CAP LS\" if defined? MODULE_LOADED_CLIENT_CAPABILITIES\n\n raw \"NICK #{@nick}\"\n raw \"USER #{@user} 0 0 :#{@realname}\"\n end", "def sign_up(user)\n visit '/users/new'\n # expect(page.status_code).to eq 200\n fill_in :email, with: user.email\n fill_in :username, with: user.username\n fill_in :password, with: user.password\n fill_in :password_confirmation, with: user.password_confirmation\n click_button 'Sign up'\n end", "def register\n data = {}\n if params[:user].blank?\n render json: get_v1_formatted_response({}, false, ['Invalid params']).to_json and return\n end\n\n User.transaction do\n user = User.find_by(email: user_params[:email])\n user = User.create(name: user_params[:user_name], email: user_params[:email], facebook_id: user_params[:facebook_id]) if user.blank?\n\n device = Device.where(user_device_id: device_params[:user_device_id]).first\n\n device.present? ? device.update_attributes(device_params.merge(user_id: user.id)) : user.devices.create!(device_params)\n\n data = {access_token: user.api_key}\n end\n\n render json: get_v1_formatted_response(data, true, ['Successfully registered']).to_json\n\n rescue Exception => e\n #todo use exception notifier for emailing the admins\n\n log_errors(e)\n render json: get_v1_formatted_response({}, false, ['Failed to register! please try again later']).to_json\n end", "def registerCard\n parameters={user_id: (@current_user[\"id\"]).to_i, number: (params[:number]).to_i, amount: (params[:amount]).to_i, expiration_month: (params[:expiration_month]).to_i, expiration_year: (params[:expiration_year]).to_i}\n puts (parameters)\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.post(\"http://192.168.99.104:3003/credit_cards\", options)\n if results.code == 201\n head 201\n else\n render json: results.parsed_response, status: results.code\n end\n end", "def register\n personal_information\n your_address\n end", "def register_user(email, username, password_digest, rank, username_downcase)\n $db.execute(\"INSERT INTO users (email, username, password_digest, rank, username_downcase) VALUES (?, ?, ?, ?, ?)\", email, username, password_digest, rank, username_downcase)\nend", "def new_account(site_url, site_email, analyst_email, password)\n reqBody = {:site_url => site_url, :site_email => site_email,\n :analyst_email => analyst_email, :password => password}\n begin\n http_post(accounts_url(), reqBody)\n rescue Exception => e\n puts e.message\n puts e.backtrace.inspect\n end\n\n end", "def create_account(options)\n form_data = options.merge({ 'action' => 'createaccount' })\n res, dummy = make_api_request(form_data)\n res\n end", "def create\n result = access_token.post('/api/v1/users/create', {:email=>params[:email],:psw=>params[:password],:psw_conf=>params[:password_conf],:inbox=>params[:inbox]})\n display_api_response result\n respond_with(\"\",:location => :back)\n end", "def register\n # User inicialized with entry params.\n @user = User.new(params[:user])\n\n # if the user is succesfully saved, authenticate it, and redirect back to /Account.\n respond_to do |format|\n if @user.save\n user = User.authenticate(@user.email, @user.password)\n if user\n format.html { redirect_to account_page_path, notice: 'Account successfully created' }\n session[:user_id] = user.id\n end\n format.html { redirect_to root_path }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def createRazooAccount(first_name, last_name, email_id, pass_word)\n\t\n\tputs \"************** START : Create a Razoo Account ****************\"\t\n\tsleep 2\n\[email protected] \"link=Sign up\"\n\[email protected]_for_page_to_load\n\tputs \"Step 1 : Entering Account creation details\"\n\[email protected] \"user_first_name\", first_name\n\[email protected] \"user_last_name\", last_name\n\[email protected] \"user_email\", email_id\n\[email protected] \"user_terms_of_use\"\n\[email protected] \"user_password\", pass_word\n\[email protected] \"user_password_confirmation\", pass_word\n\t#***************** Button position check *****************#\n\t@createaccountbutton_topposition = @browser.get_element_position_top \"//button[@type='submit']\"\n\tputs \"Create Account button Top position : #{@createaccountbutton_topposition}\"\n\tif @createaccountbutton_topposition == '674'\n\t\tputs \"UI Check : Pass. CreateAccount button is present at the correct position in Signup screen.\"\n\telse\n\t\tputs \"UI Check : Fail. CreateAccount button is not present at the correct position in Signup screen.\"\n\tend\n\[email protected] \"//button[@type='submit']\"\n\[email protected]_for_page_to_load\n\t\t\n\tbegin\n\t\tassert @browser.is_text_present(\"Your account has been created.\")\n\t\tputs \"Step 2 : Passed. Account has been created successfully!\"\n\trescue Test::Unit::AssertionFailedError\n\t\tbegin\n\t\t\tassert @browser.is_text_present(\"Email is already in use by another account (if it's yours, you can recover your account password from the login screen)\")\n\t\t\tputs \t\"Step 2 : Failed. #{email_id} has already been taken.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 2 : Failed. Account not created successfully!\"\n\t\tend\n\tend\n\tbegin\n\t\tassert @browser.is_element_present(\"myAccountHeaderLink\")\n\t\[email protected] \"myAccountHeaderLink\"\n\t\[email protected]_for_page_to_load \n\t\tbegin\n\t\t\t@user_name = first_name+\" \"+ last_name\n\t\t\tassert @browser.is_text_present(@user_name)\n\t\t\tputs \"Step 3 : Passed. #{@user_name} gets displayed in Account screen.\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 3 : Failed. #{@user_name} doesn't get displayed in Account screen.\"\n\t\tend\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Account link is missing at the header.\"\n\tend\n\t\t\n\tputs \"************** END : Create a Razoo Account ****************\"\t\nend", "def api_register\n creator = Creator.new(submits: 0, name: request.headers['name'],password: request.headers['password'],password_confirmation: request.headers['password'])\n if creator.save\n encode = encodeJWT(creator)\n selected_format({jwt: encode,creator_id: creator.id,name: creator.name,submits:creator.submits},:ok)\n else\n error = create_error_message\n error[:developerMessage] = creator.errors\n selected_format(error, :bad_request)\n end\n end", "def register_user(username, password_digest)\n $db.execute('INSERT INTO users (username, password_digest) VALUES (?, ?)', username, password_digest)\n end", "def create\n user = User.find_by_email(params[:email])\n if !user.present?\n user = User.create!(user_params)\n user.account_active = false\n user.save!\n accountHash = AccountHash.create(:hashcode => create_hashcode, :user_id => user.id, :password => user.password, :temp_email => nil)\n AppropMailer.account_created(user, accountHash).deliver\n render json: { message: Message.account_created, hashcode: accountHash.hashcode }\n else\n json_response({error: 'El email ya se encuentra registrado en Approp'}, :unprocessable_entity)\n end\n end", "def create_twiki_account\n require 'mechanize'\n agent = Mechanize.new\n agent.basic_auth(TWIKI_USERNAME, TWIKI_PASSWORD)\n agent.get(TWIKI_URL + '/do/view/TWiki/TWikiRegistration') do |page|\n registration_result = page.form_with(:action => '/do/register/Main/WebHome') do |registration|\n registration.Twk1FirstName = self.first_name\n registration.Twk1LastName = self.last_name\n registration.Twk1WikiName = self.twiki_name\n registration.Twk1Email = self.email\n registration.Twk0Password = 'just4now'\n registration.Twk0Confirm = 'just4now'\n registration.Twk1Country = 'USA'\n # registration.action = 'register'\n # registration.topic = 'TWikiRegistration'\n # registration.rx = '%BLACKLISTPLUGIN{ action=\\\"magic\\\" }%'\n end.submit\n # #<WWW::Mechanize::Page::Link \"AndrewCarnegie\" \"/do/view/Main/AndrewCarnegie\">\n link = registration_result.link_with(:text => self.twiki_name)\n if link.nil?\n #the user probably already exists\n pp registration_result\n return false\n end\n self.twiki_created = Time.now()\n self.save\n return true\n end\n\n\n end", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n end", "def data_register_user(phone, pw, type, code=nil, cs=0)\n data = \"account=#{phone}&pwd=#{pw}&type=#{type}\"\n if type==\"phone\"\n data = \"#{data}&code=#{code}\"\n elsif type==\"email\"\n data = \"#{data}&cs=#{cs}\"\n else\n fail \"register type error!\"\n end\n data\n end", "def create\n @account = Account.new(params[:account])\n respond_to do |format|\n if @account.save\n \n format.html { redirect_to \"http://#{@account.name}.#{request.domain}#{request.port_string}/login\", notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end", "def register(partner, cms_password='', template_partner_id=KalturaNotImplemented, silent=false)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'partner', partner);\n\t\t\tclient.add_param(kparams, 'cmsPassword', cms_password);\n\t\t\tclient.add_param(kparams, 'templatePartnerId', template_partner_id);\n\t\t\tclient.add_param(kparams, 'silent', silent);\n\t\t\tclient.queue_service_action_call('partner', 'register', 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 create_account\n account = Account.new(:email => email, :subdomain => subdomain)\n account.save!\n end", "def create\n @account = Account.new(params[:account])\n @account.role = 1\n\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to(new_account_session_path, :notice => 'アカウントの作成に成功しました。下記フォームからログインして下さい。') }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end", "def sign_up_with(dj_name, password)\n visit new_user_path\n fill_in 'user_dj_name', with: dj_name\n fill_in 'user_password', with: password\n click_button 'Create User'\n end", "def register\n return render :json => 'Invalid email address or password', status: 401 unless params[:email_address]\n existing_treater_account = TreaterAccount.find_by_email_address(params[:email])\n existing_user = existing_treater_account ? existing_treater_account.user : nil\n\n if existing_user.nil? && existing_treater_account.nil?\n #TODO - Fix attr_accessible white list so we dont' have to build this manually...\n user = User.create(email_address: params[:email], name: params[:name],\n password: params[:password], password_confirmation: params[:password_confirmation])\n treater_account = TreaterAccount.create(user_id: user.id, identifier: user.id, name: params[:name], email: user.email_address, authenticated_at: Time.now)\n user.account_setup\n\n session[:user_id] = user.id\n session[:external_account_id] = treater_account.id\n\n result = {}\n result[:on_complete_url] = params[:on_complete_url]\n return render :json => result.to_json, status: 200\n elsif existing_user && existing_treater_account.nil?\n #TODO - Fix attr_accessible white list so we dont' have to build this manually...\n # - Move all this logic to account_setup\n treater_account = TreaterAccount.create(user_id: existing_user.id, identifier: existing_user.id, name: params[:name], email: existing_user.email_address, authenticated_at: Time.now)\n\n session[:user_id] = existing_user.id\n session[:external_account_id] = treater_account.id\n\n result = {}\n result[:on_complete_url] = params[:on_complete_url]\n return render :json => result.to_json, status: 200\n else\n #login failed\n return render :json => 'Some error...', status: 401\n end\n end", "def put_account(username, password, domain: nil)\n domain = @default_domain if domain.nil? || domain == '.'.encode(domain.encoding)\n @accounts << Account.new(username, password, domain)\n end", "def create\n\t\t\n\t\treg_params = params.require(:user).permit(\n\t\t\t:name, :email, :password, :password_confirmation\n\t\t)\n\n\t\tname = reg_params[:name]\n\t\temail = reg_params[:email]\n\t\tpassword = reg_params[:password]\n\t\tpassword_confirmation = reg_params[:password_confirmation]\n\n\t\tnew_user = User.new(\n\t\t\tname: name,\n\t\t\temail: email,\n\t\t\tpassword: password,\n\t\t\tpassword_confirmation: password_confirmation\n\t\t)\n\n\t\tif new_user.valid?\n\t\t\tnew_user.save(validate: false)\n\t\t\tflash[:success] = \"Account successfully created.\"\n\t\telse\n\t\t\tflash[:error] = new_user.errors.full_messages\n\t\tend\n\t\tredirect_to root_path\n\tend", "def userRegisterPost(email, name, password, password_confirmation)\n post register_path, params: {user: {email: email, name: name,\n password: password, password_confirmation: password_confirmation}}\n end", "def createRazooAccount(first_name, last_name, email_id, pass_word)\n\t\n\tputs \"************** START : Create a Razoo Account ****************\"\t\n\t\n\t$browser.click \"link=Sign up\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Create an account on Razoo\")\n\t\tputs \"Passed. User has reached the Account creation page successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Failed. User didn't reach the Account creation page.\"\n\tend\n\tputs \"Step 1 : Entering Account creation details\"\n\t$browser.type \"user_first_name\", first_name\n\t$browser.type \"user_last_name\", last_name\n\t$browser.type \"user_email\", email_id\n\t$browser.click \"user_terms_of_use\"\n\t$browser.type \"user_password\", pass_word\n\t$browser.type \"user_password_confirmation\", pass_word\n\t$browser.click \"//button[@type='submit']\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Your account has been created.\")\n\t\tputs \"Step 2 : Passed. Account has been created successfully!\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"Email is already in use by another account (if it's yours, you can recover your account password from the login screen)\")\n\t\t\tputs \t\"Step 2 : Failed. #{email_id} has already been taken.\"\n\t\t\tlogin(email_id, pass_word)\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 2 : Failed. Account not created successfully!\"\n\t\tend\n\tend\n\t\n\tputs \"************** END : Create a Razoo Account ****************\"\t\nend", "def createRazooAccount(first_name, last_name, email_id, pass_word)\n\t\n\tputs \"************** START : Create a Razoo Account ****************\"\t\n\t\n\t$browser.click \"link=Sign up\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Create an account on Razoo\")\n\t\tputs \"Passed. User has reached the Account creation page successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Failed. User didn't reach the Account creation page.\"\n\tend\n\tputs \"Step 1 : Entering Account creation details\"\n\t$browser.type \"user_first_name\", first_name\n\t$browser.type \"user_last_name\", last_name\n\t$browser.type \"user_email\", email_id\n\t$browser.click \"user_terms_of_use\"\n\t$browser.type \"user_password\", pass_word\n\t$browser.type \"user_password_confirmation\", pass_word\n\t$browser.click \"//button[@type='submit']\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Your account has been created.\")\n\t\tputs \"Step 2 : Passed. Account has been created successfully!\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"Email is already in use by another account (if it's yours, you can recover your account password from the login screen)\")\n\t\t\tputs \t\"Step 2 : Failed. #{email_id} has already been taken.\"\n\t\t\tlogin(email_id, pass_word)\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 2 : Failed. Account not created successfully!\"\n\t\tend\n\tend\n\t\n\tputs \"************** END : Create a Razoo Account ****************\"\t\nend", "def createRazooAccount(first_name, last_name, email_id, pass_word)\n\t\n\tputs \"************** START : Create a Razoo Account ****************\"\t\n\t\n\t$browser.click \"link=Sign up\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Create an account on Razoo\")\n\t\tputs \"Passed. User has reached the Account creation page successfully.\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Failed. User didn't reach the Account creation page.\"\n\tend\n\tputs \"Step 1 : Entering Account creation details\"\n\t$browser.type \"user_first_name\", first_name\n\t$browser.type \"user_last_name\", last_name\n\t$browser.type \"user_email\", email_id\n\t$browser.click \"user_terms_of_use\"\n\t$browser.type \"user_password\", pass_word\n\t$browser.type \"user_password_confirmation\", pass_word\n\t$browser.click \"//button[@type='submit']\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Your account has been created.\")\n\t\tputs \"Step 2 : Passed. Account has been created successfully!\"\n\t\trescue Test::Unit::AssertionFailedError\n\t\tbegin\n\t\t\tassert $browser.is_text_present(\"Email is already in use by another account (if it's yours, you can recover your account password from the login screen)\")\n\t\t\tputs \t\"Step 2 : Failed. #{email_id} has already been taken.\"\n\t\t\tlogin(email_id, pass_word)\n\t\trescue Test::Unit::AssertionFailedError\n\t\t\tputs \"Step 2 : Failed. Account not created successfully!\"\n\t\tend\n\tend\n\t\n\tputs \"************** END : Create a Razoo Account ****************\"\t\nend", "def create\n user = User.find_by(email: user_params['email'])\n if !user\n dataToRegister = {\n username: user_params['username'],\n balance: user_params['balance'],\n password: Base64.decode64(user_params['password']),\n password_confirmation: Base64.decode64(user_params['password_confirmation']),\n email: user_params['email'],\n }\n user = User.create!(dataToRegister)\n auth_token = AuthenticateUser.new(user.email, Base64.encode64(user.password)).call\n response = {\n data: {\n message: Message.account_created,\n token: auth_token,\n user: {\n username: user.username,\n email: user.email\n }\n }\n }\n json_response(response, :created)\n\n else\n raise(ExceptionHandler::AuthenticationError, Message.email_Already_used)\n end\n end", "def create_accounts\n end", "def register\n VirtualBox.run_command! ['VBoxManage', 'createvm', '--name', name,\n '--uuid', uid, '--register']\n begin\n push_config\n rescue\n unregister\n raise\n end\n \n self\n end", "def create user_name\n response = @client.action \"RegisterUser\", \"Name\" => user_name\n\n Response::User.new response.body['RegisterUserResponse']\n end", "def register_api\n begin\n email = register_api_params[:email].downcase\n @user = User.find_by_email(email)\n if @user.blank?\n @user = User.create(:email => email, :username => register_api_params[:username], :password => register_api_params[:password], :device_token => register_api_params[:device_token], :type => register_api_params[:type])\n render :json => @user\n else\n render :json => @user\n end\n rescue Exception => e\n error \"Please provide all required fields\"\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n else\n response = { message: Message.account_not_created}\n json_response(response)\n end\n\n end", "def register\n params = Serializer.new(self).to_params\n Response.new Request.post(\"checkout\", params)\n end", "def register\n end", "def register\n end", "def register\n end", "def create(account: nil, **params)\n post account, \"email\", params\n end", "def create_extern\n\t\t@extern = User.new(params[:user])\n\t\[email protected]_confirmation = @extern.password\n\t\t@intern = User.new\n\t\[email protected] = @extern.email\n\t\[email protected] = Base64.encode64(Digest::SHA1.digest(\"#{rand(1<<64)}/#{Time.now.to_f}/#{Process.pid}/#{@extern.login}\"))[0..7]\n\t\[email protected]_confirmation = @extern.password\n\t\[email protected] = false\n\n\t\tif @extern.save\n flash[:success] = \"Account registered! Your password has been sent to your mailbox.\"\n\t\t\tNotifier.deliver_welcome_email(@extern, @extern.password)\n redirect_to register_path\n else\n render :action => :new\n end\n\tend", "def create_account(user)\n account = Account.to_adapter.get!(user.id)\n update_status = account.update_with_password({ \"email\" => user.email, \"name\" => user.username })\nend", "def register\n @title=\"Register\"\n if param_posted?(:user)\n \n #output goes to log file (log/development.log in development mode)\n #logger.info params[:user].inspect\n \n #output goes to browser\n #raise params[:user].inspect\n \n @user=User.new(params[:user])\n if @user.save\n @user.login!(session)\n flash[:notice] = \"User #{@user.screen_name} created!\"\n redirect_to_forwarding_url\n else\n @user.clear_password!\n end\n end\n end", "def sign_up(useremail, password)\n if new_user_available(useremail)\n query = \"INSERT INTO Users (useremail, password) VALUES('#{useremail}', '#{password}')\"\n @connection.exec(query)\n end\n end", "def create_twiki_account\n require 'mechanize'\n agent = Mechanize.new\n agent.basic_auth(TWIKI_USERNAME, TWIKI_PASSWORD)\n agent.get(TWIKI_URL + '/do/view/TWiki/TWikiRegistration') do |page|\n registration_result = page.form_with(:action => '/do/register/Main/WebHome') do |registration|\n registration.Twk1FirstName = self.first_name\n registration.Twk1LastName = self.last_name\n registration.Twk1WikiName = self.twiki_name\n registration.Twk1Email = self.email\n registration.Twk0Password = 'just4now'\n registration.Twk0Confirm = 'justb4now'\n registration.Twk1Country = 'USA'\n # registration.action = 'register'\n # registration.topic = 'TWikiRegistration'\n # registration.rx = '%BLACKLISTPLUGIN{ action=\\\"magic\\\" }%'\n end.submit\n # #<WWW::Mechanize::Page::Link \"AndrewCarnegie\" \"/do/view/Main/AndrewCarnegie\">\n link = registration_result.link_with(:text => self.twiki_name)\n if link.nil?\n #the user probably already exists\n pp registration_result\n return false\n end\n self.twiki_created = Time.now()\n self.save_without_session_maintenance\n return true\n end\n\n\n end" ]
[ "0.6740523", "0.6643598", "0.65756273", "0.6503163", "0.64915055", "0.6485263", "0.64017016", "0.63647807", "0.63517463", "0.6324614", "0.6300395", "0.6288673", "0.6265915", "0.62102497", "0.62102497", "0.6203484", "0.62019813", "0.6180216", "0.61717594", "0.61654186", "0.6161786", "0.615944", "0.6155487", "0.6155487", "0.6141289", "0.6099302", "0.6080776", "0.60647887", "0.60587716", "0.60491633", "0.60488796", "0.6021216", "0.6011845", "0.6011461", "0.6011182", "0.60093087", "0.599954", "0.5994639", "0.5972109", "0.59715354", "0.5960326", "0.5959123", "0.5955531", "0.59548116", "0.59510493", "0.59473443", "0.59424394", "0.5940254", "0.59333557", "0.5930903", "0.5930903", "0.59301555", "0.5913803", "0.5904073", "0.5903613", "0.5903133", "0.58992356", "0.58950144", "0.5894572", "0.5889939", "0.5872605", "0.5872232", "0.58653927", "0.58650285", "0.58630365", "0.5855758", "0.5849584", "0.5848235", "0.5830598", "0.5830084", "0.5827221", "0.5824012", "0.58211493", "0.5814885", "0.5808435", "0.5806955", "0.58033466", "0.5802572", "0.5795165", "0.5790469", "0.5786846", "0.5779757", "0.5779757", "0.5779757", "0.5779596", "0.57783455", "0.5765613", "0.57540965", "0.57536197", "0.574875", "0.57474196", "0.57470894", "0.57470894", "0.57470894", "0.57437027", "0.5741876", "0.57413477", "0.5739547", "0.5734659", "0.57333726" ]
0.6166097
19
Log out of the account and invalidate the auth token.
def logout begin @api.logout cache_token(nil) rescue Api::NotAuthorized # already logged out, or never logged in end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_out\n forget(current_account)\n session.delete(:account_id)\n @current_account = nil\n end", "def log_out\n current_user\n @current_user.auth_token = nil\n @current_user.save!\n @current_user = nil\n end", "def log_out\n session.delete(:account_id)\n @current_account = nil\n end", "def log_out\n\t\tsession.delete(:account_id)\n\t\t@current_account = nil\n\tend", "def log_out\n forget(current_user)\n reset_session\n @current_user = nil\n end", "def log_out\n current_user.reset_session_token!\n session[:session_token] = nil\n end", "def log_out\n\t\t# current_user.delete_auth_token # won't work with curl, but html is good\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n forget current_user\n reset_session\n @current_user = nil\n end", "def log_out\n reset_session\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def logout\n sign_out(current_account)\n end", "def logout_internal\n self.current_user.forget_me if logged_in?\n reset_session\n cookies.delete :auth_token\n end", "def log_out\n session.delete(:user_credentials)\n @current_user = nil\n end", "def log_out\r\n forget(current_user)\r\n session.delete(:user_id)\r\n @current_user = nil\r\n end", "def log_out\n session.delete(:username)\n session.delete(:token)\n @current_user = nil\n end", "def sign_out!\n self.current_account = AnonymousAccount.instance\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tforget(current_user) #call user.forget\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def destroy\n self.current_user.forget_me if logged_in?\n cookies.delete :auth_token\n reset_session\n flash[:notice] = \"You have been logged out.\"\n redirect_back_or_default\n end", "def logout\n FlexmlsApi.logger.info(\"Logging out.\")\n delete(\"/session/#{@session.auth_token}\") unless @session.nil?\n @session = nil\n end", "def log_out\n session.delete(:email)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:session_database)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n flash[:danger] = 'Logoff realizado!'\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n # sessions.delete(:team_id)\n @current_user = nil\n # @current_team = nil\n\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n session.delete(:user_type_string)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n forget(@current_user)\n @current_user=nil\n end", "def sign_out\n if active_token = ActiveToken.find_by_device(current_device)\n active_token.destroy\n end\n end", "def log_out\n forget current_user\n session.delete :user_id\n @current_user = nil\n end", "def log_out\n @current_user.forget_token(cookies.signed[:remember_token])\n @current_user = nil\n session.delete(:authentication_id)\n cookies.delete :authentication_id\n cookies.delete :remember_token\n end", "def destroy\n self.current_person.forget_me if logged_in?\n cookies.delete :auth_token\n reset_session\n flash[:notice] = t('sessions.destroy.logged_out')\n redirect_to login_path\n end", "def logout_user\n cookies.delete(:auth_token)\n end", "def log_out\n if !current_user.nil?\n forget(current_user)\n\n session.delete(:user_id)\n session.delete(:user_type)\n @current_user = nil\n end\n end", "def log_out \n session.clear\n @current_user = nil\n end", "def log_out\n # destroys cookies token\n cookies[:remember_token] = nil\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def sign_out\n reset_session\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n current_user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user) #called from user.rb. it sets remember_token attribute to nil.\n session.delete(:user_id) #deletes session.\n @current_user = nil # new value of this instance variable.\n end", "def log_out\n forget(current_company)\n session.delete(:company_id)\n @current_company = nil\n end", "def log_out\n session.delete(:uid)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n forget(current_user)\n session.delete(:username)\n @current_user = nil\n end", "def log_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end", "def log_out\n forget(current_employee)\n session.delete(:employee_id)\n @current_employee = nil\n end", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def sign_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end", "def logout\n self.current_user.forget_me if logged_in?\n cookies.delete :auth_token\n reset_session\n flash[:notice] = \"You have been logged out.\"\n redirect_back_or_default('/')\n #redirect_back_or_default(:controller => '/account', :action => 'index')\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def logout\n validate_arguments!\n\n Turbot::Auth.logout\n display \"Local credentials cleared.\"\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end" ]
[ "0.821151", "0.81235284", "0.7975725", "0.7906774", "0.78901416", "0.784827", "0.78261095", "0.7783701", "0.7742981", "0.7724344", "0.7722526", "0.77141136", "0.76949817", "0.7641492", "0.76273924", "0.7621429", "0.7607319", "0.7599153", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.75990176", "0.7597575", "0.7586652", "0.7577462", "0.75592387", "0.7557141", "0.75148195", "0.75103253", "0.75103253", "0.75103253", "0.75103253", "0.75103253", "0.7509728", "0.75086266", "0.7506936", "0.7491515", "0.7487734", "0.7478395", "0.74580544", "0.7456671", "0.7447388", "0.7442203", "0.74412274", "0.74385464", "0.7438077", "0.7423026", "0.74132323", "0.74132323", "0.74132323", "0.74132323", "0.74132323", "0.7379898", "0.7376485", "0.7361865", "0.7342193", "0.73295075", "0.7325821", "0.73230696", "0.7318546", "0.7315031", "0.7315031", "0.7315031", "0.7315031", "0.7314383", "0.73137605", "0.73094994", "0.7300373", "0.730012", "0.72994626", "0.72994626", "0.72994626", "0.72994626", "0.72994626", "0.72994626", "0.72994626", "0.72994626", "0.72994626", "0.72994626", "0.72994626" ]
0.0
-1
Return the account details. A cached copy will be used if avaliable, and requested if it is not.
def info(refresh = false) return @info if @info and not refresh begin cache_info(nil) # reset existing info info = @api.get_account_info['user'] cache_info(info) rescue Api::NotAuthorized, Api::InvalidInput nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account\n @details ||= fetch_details\n @details[:account]\n end", "def account_info()\n response = @session.do_get build_url(\"/account/info\")\n parse_response(response)\n end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); 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_info(options = {})\n request :account, :get, 'account', options\n end", "def retrieve_account_details\n\t\taccount = $twitter.user(\"#{self.handle}\")\n\t\tself.name = account.name\n\t\tself.avatar_url = account.profile_image_uri\n\tend", "def get_account\n as_json(get_results('/account'))\n end", "def account\n get('account')\n end", "def account_info(*fields)\n get(\"/me#{field_selector(fields)}\")\n end", "def get_account(account_id)\n @accounts[account_id]\n end", "def get_account(account_id)\n @accounts[account_id]\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 getaccountdetails(params = {})\n request :getaccountdetails, params.merge( :parser => :hash)\n end", "def account\n find('Account', account_id)\n end", "def account\n @account ||= Account.find(accountRef)\n end", "def account\n @account = current_account_settings\n end", "def me\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/account/info').info\n end", "def account(&block)\n response = _get(\"accounts/current\")\n yield(response) if block_given?\n response[\"account\"]\n end", "def account\n @account ||= current_customer.account\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 get_acc_info\n JSON.parse(curl_get(\"/api2/account/info/\").body_str)\n end", "def get_account_info\n uri = {account_info_path: \"account/info\"}\n access_token = self.access_token\n\n if res = Dropbox.successful_request?(:account_info, access_token, uri)\n res = format_response(res)\n space_used = res[:quota_info][\"normal\"] + res[:quota_info][\"shared\"]\n space_available = res[:quota_info][\"quota\"]\n [space_used, space_available]\n else\n false\n end\n end", "def find_account\n @account = current_account\n end", "def get_account(account_id)\n get(\"/account/#{account_id}\")\n end", "def account\n @account ||= if order.respond_to?(:student)\n order.student.account\n elsif order.respond_to?(:user)\n order.user.account\n end\n end", "def data_to_cache(account)\n {\n 'account_id' => account.id,\n 'roles' => account.roles\n }\n end", "def accounts_get\n account = call('accounts.get')\n account[:added] = Time.at(account[:added]) if account[:added].is_a?(Fixnum)\n account\n end", "def user_account\n return @user_account\n end", "def account_details(*paramaters)\n accounts = []\n unless self.list_accounts.blank?\n self.list_accounts.each do |account|\n details = {} \n account.each do |key, value|\n if paramaters.include? key\n details[key] = value\n end\n end\n accounts << details\n end\n accounts\n end\n end", "def get_accounts()\n http_get(accounts_url)\n end", "def account_from; Account.get(self.account_from_id); end", "def account_from; Account.get(self.account_from_id); end", "def account(fields: nil)\n params = build_fields_params fields\n res = @connection.get account_path, params\n Account.new res.body, self\n end", "def account\n @account ||= Authentication::Account.find_by(email: username)\n end", "def account\n @account ||= Harvest::API::Account.new(credentials)\n end", "def get_user_account_info_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AccountApi.get_user_account_info ...\"\n end\n # resource path\n local_var_path = \"/v2/user/customer/account\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AccountInfo')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountApi#get_user_account_info\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_user_account_info_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerAccountApi.get_user_account_info ...\"\n end\n # resource path\n local_var_path = \"/user/customer/account\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AccountInfo')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerAccountApi#get_user_account_info\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def hash\n [account_id, account_name, is_default, base_uri, organization].hash\n end", "def account(params = {})\n make_get_request('/account', params)\n end", "def account\n self\n end", "def accounts\n\t\treturn @accounts\n\tend", "def get_account(params, transferred=false)\n return Account.get_from_name(params[:account], @current_user) unless params[:type] == 'transfer'\n\n if transferred\n return Account.get_from_name(params[:to_account], @current_user)\n else\n return Account.get_from_name(params[:from_account], @current_user)\n end\n end", "def current_account\n @current_account\n end", "def get_masked_account()\n return @RESPONSE_HASH['PAYMENT_ACCOUNT']\n end", "def getaccountaddress(account)\n coind.getaccountaddress account\n end", "def account\n @account ||= AccountContext.new(self, @domain.client.account_sid)\n end", "def get_account_with_http_info(identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AccountsApi.get_account ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AccountsApi.get_account\"\n end\n # resource path\n local_var_path = \"/raas/v2/accounts/{identifier}\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'AccountView')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountsApi#get_account\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def fetchAccountDetails(primaryMember)\n #,Unomy_Location_Country__c,Unomy_Location_State__c,Unomy_Location_City__c,Primary_Member__c,Interested_in_Number_of_Desks__c,BillingCountry,BillingState,BillingCity\n return checkRecordCreated(\"Account\", \"SELECT id,Allow_Merge__c,Name,Owner.Id,Owner.Name,RecordType.Name,Number_of_Full_Time_Employees__c,Interested_in_Number_of_Desks__c,Unomy_Location_Country__c,Unomy_Location_State__c,Unomy_Location_City__c,BillingCountry,BillingState,BillingCity FROM Account WHERE Primary_Member__c = '#{primaryMember}'\")\n end", "def account\n AccountInfoParser.parse(post(\"money/info\"))\n end", "def current_account\n ENV['CURRENT_ACCOUNT']\n #BlOCKCHAIN_CLIENT.eth_accounts['result'][0]\n #'0x1f9334BAE0acC7a86834f60488d0C6Fa89B4590b'\n end", "def retrieve(include_values = nil)\n query_params = include_values.nil? ? {} : { include: include_values }\n @client.call(method: :get, path: 'account', query_values: query_params)\n end", "def account_name\n self.current_account.try :name\n end", "def account_name\n return @account_name\n end", "def account_name\n return @account_name\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 account_get(opts = {})\n data, _status_code, _headers = account_get_with_http_info(opts)\n return data\n end", "def account\n Atheme::User.new(@session, match(/\\(account\\s([^\\(]+)\\):/))\n end", "def current_account\n load_session\n @current_account\n end", "def accounts\n get('/accounts')['accounts']\n end", "def accounts\n request = request(method: :get, path: \"/Account.json\")\n response = request.perform\n instantiate(response[\"Account\"], Lightspeed::Account)\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 accounts\n @accounts ||= Lightspeed::Accounts.new(context: self)\n end", "def info\n {\n account_id: @account_id,\n date_taken: @date_taken.iso8601,\n username: @user.nil? ? \"\" : @user.username,\n schema: @schema,\n state: @state,\n files: files\n }\n end", "def user_account_instance\n Account.new\n end", "def get_basic_account_info\n body = {cmd: \"get_basic_info\"}\n post body\n end", "def bank_account\n @bank_account\n end", "def get_user\n\t\treturn Account.find(self.account_id)\n\tend", "def get_account_number\n @acct_num\n end", "def getaccountaddress(account)\n @api.request 'getaccountaddress', account\n end", "def account_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IdentityApi.account_get ...\"\n end\n # resource path\n local_var_path = \"/account\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'AccountResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IdentityApi#account_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def portfolio_accounts\n data = call_api(method: \"get\", url: \"/portfolio/accounts\" )\n @accountId = data.first[\"accountId\"]\n @accountId\n end", "def stripe_account_information\n payment = @account.customer_payment\n stripe_customer = Stripe::Customer.retrieve(@account.customer_payment.customer_id)\n current_stripe_subscription = stripe_customer.subscriptions.all.first\n if(current_stripe_subscription)\n current_stripe_plan = current_stripe_subscription.plan\n end\n Smash.new(\n :payment => payment,\n :customer => stripe_customer,\n :subscription => current_stripe_subscription,\n :plan => current_stripe_plan\n )\n end", "def get_account(account_slug)\r\n\r\n # prepare query url\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/accounts/{account_slug}'\r\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\r\n 'account_slug' => account_slug\r\n }\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'Content-Type' => Configuration.content_type\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n _request = @http_client.get _query_url, headers: _headers\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) if not (_context.response.raw_body.nil? or _context.response.raw_body.to_s.strip.empty?)\r\n return decoded\r\n end", "def getaccountaddress(account)\n request :getaccountaddress, account\n end", "def current_account\n Account.find_by(id: session[:account_id])\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 get_account_quotas()\n session_url = '/sessions?page=0&pageSize=1'\n response = self.class.get(session_url, @options)\n response.headers.select { |k, _v| k.to_s.start_with? 'nexosis-account' }\n end", "def get_accounts\n @accounts = Account.all\n end", "def info(account_id, opts = {})\n input_json = {\n account_id: account_id,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/info\", input_json)\n Dropbox::API::AccountInfo.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end", "def accounts\n @accounts_manager\n end", "def account_info(command)\n pp @client.users.info('me')\n end", "def current_account\n Account.find(session[:account_id]) if session[:account_id]\n end", "def current_account\n Account.find(session[:account_id]) if session[:account_id]\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 get_motd account\n end", "def card_account\n response = JSON.parse(@client.get(\"users/#{send(:id)}/card_accounts\").body)\n Promisepay::CardAccount.new(@client, response['card_accounts'])\n rescue Promisepay::UnprocessableEntity\n nil\n end", "def build_info_for_user_account(acct)\n \n # Fill in server info.\n info = I3::SharedObject.new\n info.server = {\n :title => I3.config.title,\n :copyright => I3.config.copyright\n }\n\n # Fill in basic user data.\n person = acct.person\n info.account_name = acct.account_name\n info.first_name = person.first_name\n info.last_name = person.last_name\n info.full_name = person.full_name\n info.description = person.description\n info.email = person.email\n\n # Build list of accessible tools.\n info.tools = Hash.new\n I3.config.tools.each do |tool_name, tool_info|\n if tool_info.has_info? and (not tool_info.applets[\"client-web\"].nil?) and (\n acct.has_permission?(\"access-tool\", tool_name) or\n acct.has_permission?(\"develop\", \"i3-root\") )\n info.tools[tool_name] = {\n :dir => tool_info.dir,\n :name => tool_info.name,\n :description => tool_info.description,\n :is_native => tool_info.is_native?, \n :is_searchable => tool_info.is_searchable?\n }\n # Build applet => revision hash.\n info.tools[tool_name][:applets] = {}\n tool_info.applets[\"client-web\"].each do |applet_name, applet|\n info.tools[tool_name][:applets][applet_name] = applet.remote_path\n end #each\n end #if\n end #each\n \n # Build list of permissions. First we find all the permissions\n # that specifically reference the account, then we go through all\n # the group permissions and see which ones apply to the account.\n perms = Hash.new\n acct.permissions.each do |perm|\n perms[perm.tool] = Hash.new if perms[perm.tool].nil?\n perms[perm.tool][perm.privilege] = true\n end #each\n I3::Permission.find_all_by_is_group(true).each do |perm|\n if acct.member_of? perm.group_dn\n perms[perm.tool] = Hash.new if perms[perm.tool].nil?\n perms[perm.tool][perm.privilege] = true\n end #if\n end #each\n info.permissions = perms\n \n # Build navigation bar quick links.\n info.quicklinks = I3::SharedObject.new\n info.quicklinks.fixed = I3.config.required_navbar_items.collect do |item|\n item_tool = item[\"tool\"]\n item_path = item[\"path\"] || \"\"\n item_path = '/#/%s/%s' % [item_tool, item_path] unless item_path.starts_with?(\"/\")\n item_icon = item[\"icon\"] || \"applet-icon\"\n item_icon = '/%s/client-web/img/%s' % [item_tool, item_icon] unless item_icon.starts_with?(\"/\")\n { :tool => item_tool,\n :path => item_path,\n :small_icon => \"#{item_icon}-16.png\",\n :large_icon => \"#{item_icon}-32.png\",\n :caption => item[\"caption\"] || I3.config.tools[item[\"tool\"]].name\n }\n end #collect\n info.quicklinks.user_defined = I3.preferences.get(\"quicklinks\", :tool => \"common\")\n if info.quicklinks.user_defined.nil?\n info.quicklinks.user_defined = I3.config.default_navbar_items.collect do |item|\n item_tool = item[\"tool\"]\n item_path = item[\"path\"] || \"\"\n item_path = '/#/%s/%s' % [item_tool, item_path] unless item_path.starts_with?(\"/\")\n item_icon = item[\"icon\"] || \"applet-icon\"\n item_icon = '/%s/client-web/img/%s' % [item_tool, item_icon] unless item_icon.starts_with?(\"/\")\n { :tool => item_tool,\n :path => item_path,\n :small_icon => \"#{item_icon}-16.png\",\n :large_icon => \"#{item_icon}-32.png\",\n :caption => item[\"caption\"] || I3.config.tools[item[\"tool\"]].name\n }\n end #collect\n end #if\n\n info\n end", "def show\n @account = current_account\n end", "def getaccount(coinaddress)\n coind.getaccount coinaddress\n end", "def get_account(client, options)\n accounts = get_accounts(client, options)\n if accounts.nil?\n return nil\n end\n\n return find_account(accounts, options[:email])\nend" ]
[ "0.7986961", "0.75285757", "0.73939353", "0.73939353", "0.73939353", "0.73939353", "0.73939353", "0.73939353", "0.73939353", "0.73939353", "0.73939353", "0.73939353", "0.72027194", "0.72027194", "0.72025144", "0.71372306", "0.70754194", "0.6999638", "0.69236183", "0.6848963", "0.6848963", "0.67818236", "0.67602086", "0.6753722", "0.6741762", "0.673473", "0.6728788", "0.67225343", "0.66315293", "0.6600709", "0.6558965", "0.6545198", "0.654429", "0.6539157", "0.65103", "0.65034103", "0.6502687", "0.64979345", "0.64906365", "0.64823806", "0.6466398", "0.6466398", "0.6443992", "0.64424914", "0.6439009", "0.64193213", "0.6413177", "0.63836825", "0.63612133", "0.6329773", "0.632479", "0.631005", "0.63067275", "0.6305688", "0.6295843", "0.62897617", "0.62849665", "0.6260749", "0.6256185", "0.62419474", "0.6233809", "0.62286234", "0.6202872", "0.6202872", "0.61874366", "0.61746174", "0.6164635", "0.61573005", "0.61262554", "0.6114242", "0.6113107", "0.6101105", "0.6100771", "0.6092294", "0.60872376", "0.6071896", "0.607039", "0.60668474", "0.60591066", "0.6041411", "0.6039291", "0.6030506", "0.6025505", "0.60218954", "0.5999026", "0.59989977", "0.59872377", "0.598512", "0.59788656", "0.59771127", "0.5974195", "0.5967203", "0.5967203", "0.5964755", "0.5961436", "0.5958694", "0.5935336", "0.5926049", "0.59226984", "0.59210163" ]
0.6842744
21
Gets a folder object by id.
def folder(id) Box::Folder.new(@api, nil, :id => id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_folder(folder_id)\n @folders[folder_id]\n end", "def get_folder(folder_id)\n @folders[folder_id]\n end", "def get_folder_by_id(folder, grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'Folder deletion was successful.'\n grafana_options[:unknown_code_msg] = 'FolderApi::get_folder_by_id unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/folders/id/' + get_folder_id(folder)\n\n folder_obj = do_request(grafana_options)\n\n return if folder_obj[:message] == 'Folder not found'\n folder_obj\n end", "def get_folder folder_id\n get(\"/projects/#{folder_id}\")\n end", "def get_folder(folder_id)\n\tputs \"Getting folder: \" + folder_id\n\tresponse = request_get('/api/partner/folder/' + folder_id)\n\tputs response.body\nend", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = PulStore::Lae::Folder.find(params[:id])\n end", "def folder_id\n self.folder.id\n end", "def show\n @folder = current_user.folders.find(params[:id])\n end", "def show\n @folder = Folder.find(params[:id])\n end", "def set_folder\n begin\n @folder = Folder.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n render json: {\n error: e.to_s\n }, status: :not_found\n end\n end", "def getFolderId\r\n\t\t\t\t\treturn @folderId\r\n\t\t\t\tend", "def folders\n return unless session\n session.folders.find_all_by_parent_folder_id(id)\n end", "def rip_folder(folder_id)\n \n query_string = \"SELECT ZICCLOUDSYNCINGOBJECT.ZTITLE2, ZICCLOUDSYNCINGOBJECT.ZOWNER, \" + \n \"ZICCLOUDSYNCINGOBJECT.Z_PK \" +\n \"FROM ZICCLOUDSYNCINGOBJECT \" + \n \"WHERE ZICCLOUDSYNCINGOBJECT.Z_PK=?\"\n\n #Change things up for the legacy version\n if @version == IOS_LEGACY_VERSION\n query_string = \"SELECT ZSTORE.Z_PK, ZSTORE.ZNAME as ZTITLE2, \" +\n \"ZSTORE.ZACCOUNT as ZOWNER \" + \n \"FROM ZSTORE \" +\n \"WHERE ZSTORE.Z_PK=?\"\n end\n\n @database.execute(query_string, folder_id) do |row|\n tmp_folder = AppleNotesFolder.new(row[\"Z_PK\"],\n row[\"ZTITLE2\"],\n get_account(row[\"ZOWNER\"]))\n @folders[folder_id] = tmp_folder\n end \n end", "def set_folder\n @folder = Folder.find_by!(id: params[:id], user_id: current_user.id)\n end", "def get_folder(folder, grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'Folder deletion was successful.'\n grafana_options[:unknown_code_msg] = 'FolderApi::get_folder_by_uid unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/folders/' + get_folder_uid(folder)\n\n folder_obj = do_request(grafana_options)\n\n return if folder_obj[:message] == 'Folder not found'\n folder_obj\n end", "def get_team_folder\n\n Team.get_team_folder(self.id)\n end", "def folder\n connection.directories.get(folder_name)\n end", "def show\n @folder = current_user.folders.find_by_name(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @folder }\n end\n end", "def folder(name)\n Kamelopard::Folder.new(name)\n end", "def folder\n @folders[@folder_name]\n end", "def folder_id\n current.folder.id\n end", "def getFolder(response)\r\n\t\t\t\tfolder_json = JSON.parse response\r\n\t\t\t\tfolder_array = folder_json[\"folders\"]\r\n\t\t\t\treturn jsonToFolder(folder_array[0])\r\n\t\t\tend", "def get_folder(name)\n # Create a filter to ensure that only the named folder is returned\n filter = Com::Vmware::Vcenter::Folder::FilterSpec.new(names: Set.new([name]))\n folder_obj = Com::Vmware::Vcenter::Folder.new(vapi_config)\n folder = folder_obj.list(filter)\n\n raise format(\"Unable to find folder: %s\", name) if folder.empty?\n\n folder[0].folder\n end", "def require_existing_folder\n @folder = get_folder_or_redirect(params[:id])\n end", "def get_group_by_id(id)\n get(\"/groups/#{id}\")\n end", "def find(conn_id, *args)\n options = args.extract_options!\n \n folders = case args.first\n when :all\n options.assert_valid_keys(VALID_FIND_OPTIONS)\n options[:subfolders] = :all\n find_every(conn_id, options)\n when :some\n options.assert_valid_keys(VALID_FIND_OPTIONS)\n options[:subfolders] = :direct\n find_every(conn_id, options)\n else\n options.assert_valid_keys(VALID_FIND_BY_IDS_OPTIONS)\n \n ids = args.first\n ids = (ids.is_a?(Array)) ? ids.flatten.compact.uniq : [ids]\n \n raise(ArgumentError, \"Couldn't find folder without an ID\") if ids.empty?\n \n find_from_ids(conn_id, ids, options)\n end\n \n folders.compact!\n raise Errors::FolderNotFound if folders.empty?\n \n (folders.length > 1) ? folders : folders.first\n end", "def getFolder\r\n\t\t\t\t\treturn @folder\r\n\t\t\t\tend", "def delete_user_folder(id)\n @client.raw('delete', \"/helpers/folders/#{id}\")\n end", "def set_file_folder\n @file_folder = FileFolder.find(params[:id])\n end", "def folder\n File.join self.class::FOLDER, model_id.to_s\n end", "def path(id)\n directory.join(id.gsub(\"/\", File::SEPARATOR))\n end", "def toodle_folder_to_tw(folderid)\n @remote_folders.find{|f| f[:id] == folderid}[:name]\n end", "def get(id, which=:groups)\n resp = self.class.get(\"/#{which}/#{id}\")\n check_errors resp\n res = resp.parsed_response['Response']['Entry']\n rebuild_groups! res\n res\n end", "def get_folder()\n f = Kamelopard::DocumentHolder.instance.current_document.folders.last\n Kamelopard::Folder.new() if f.nil?\n Kamelopard::DocumentHolder.instance.current_document.folders.last\n end", "def folder(name)\n Check_MK::Folder.new(self, name)\n end", "def show\n @folder = Folder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @folder }\n end\n end", "def get_object_by_id(class_name, id)\n obj = nil\n get_objects_of_class(class_name).each do |o|\n if o.id == id\n obj = o\n break\n end\n end\n obj\n end", "def get_file_instance(id)\n raise 'The primary key must be an integer.' unless id.instance_of? Integer\n name_list = []\n while true\n file = Fileinfo[id] \n break if id == file.parent_id\n name_list.push(file.name)\n id = file.parent_id\n end\n find_file(name_list.reverse, 1)\n end", "def get(node_id)\n @@directory_lock.synchronize do\n @@directory[node_id]\n end\n end", "def group_for_id(id)\n find_groups if @groups.nil?\n @groups.detect { |g| g.include? id }\n end", "def path(id)\n directory.join(relative(id))\n end", "def call(id)\n res = client.get(\"/api/rest/v1/groups/#{id}.json\")\n return nil if !res || res.empty?\n\n BrickFTP::Types::Group.new(**res.symbolize_keys)\n end", "def root_folder\n folders.first({ title: Folder::DefaultFolder, folder_id: nil })\n end", "def contents(id = '')\n folder = id.empty? ? box_client.root_folder : box_client.folder_by_id(id)\n values = []\n\n folder.items(ITEM_LIMIT, 0, %w[name size created_at]).collect do |f|\n values << directory_entry(f)\n end\n @entries = values.compact\n\n @sorter.call(@entries)\n end", "def find_by_id(id)\n find(id)\n end", "def find_by(id:)\n path = file_path(id)\n storage_object_id, file_category = id_from_path(path)\n\n moab_path = find_moab_filepath(storage_object_id, path, file_category)\n\n Valkyrie::StorageAdapter::File.new(id: Valkyrie::ID.new(id.to_s), io: ::File.open(moab_path, 'rb'))\n rescue ::Moab::FileNotFoundException\n raise Valkyrie::StorageAdapter::FileNotFound\n end", "def find(id)\n @objects[id]\n end", "def get_folders_order\n Log.add_info(request, params.inspect)\n\n @folder_id = params[:id]\n SqlHelper.validate_token([@folder_id])\n\n if @folder_id == TreeElement::ROOT_ID.to_s\n @folders = MailFolder.get_account_roots_for(@login_user)\n else\n mail_folder = MailFolder.find(@folder_id)\n if mail_folder.user_id == @login_user.id\n @folders = MailFolder.get_childs(@folder_id, false, true)\n end\n end\n\n render(:partial => 'ajax_folders_order', :layout => false)\n end", "def find(id)\n new.from_json(db_root.join(id).read)\n end", "def folder\n model.folder\n end", "def id; dir end", "def last_opened_folder_id(project)\n cooky = cookies[:folder_browsed_json]\n cooky ||= {}.to_json\n cooky = ActiveSupport::JSON.decode(cooky)\n folder_id = cooky[project.id.to_s]\n\n folder_id = nil if folder_id && !ProjectFolder.find_by_id(folder_id)\n\n folder_id ||= ProjectFolder.new_items_folder(project).try(:id)\n folder_id\n end", "def folder_id\n case params[:controller] + '/' + params[:action]\n when 'folder/index', 'folder/list', 'folder/new', 'folder/create', 'folder/update_permissions', 'folder/feed', 'file/upload', 'file/validate_filename'\n current_folder_id = 1 unless current_folder_id = params[:id]\n when 'file/do_the_upload'\n # This prevents a URL like 0.0.0.0/file/do_the_upload/12,\n # which breaks the upload progress. The URL now looks like this:\n # 0.0.0.0/file/do_the_upload/?folder_id=12\n current_folder_id = 1 unless current_folder_id = params[:folder_id]\n when 'folder/rename', 'folder/update', 'folder/destroy'\n current_folder_id = @folder.parent_id if @folder\n when 'file/download', 'file/rename', 'file/update', 'file/destroy', 'file/preview'\n current_folder_id = @myfile.folder.id\n when 'inbox/do_the_upload', 'inbox/index'\n unless params[:user_id].nil?\n current_folder_id = Folder.fetch_user_inbox(params[:user_id]).id \n else\n current_folder_id = Folder.fetch_user_inbox(@logged_in_user.id).id \n end\n end\n\n case params[:controller]\n when 'claims'\n current_folder_id = 2\n end\n\n return current_folder_id\n end", "def get_by_id(class_name, id)\n @data = get_all()\n for item in @data[class_name]\n if item[\"id\"] == id\n return item\n end\n end\n raise \"#{class_name} id #{id} not found.\"\n end", "def setFolderId(folderId)\r\n\t\t\t\t\t@folderId = folderId\r\n\t\t\t\tend", "def folder\n query = Builder::XmlMarkup.new.Query do |xml|\n xml.Where do |xml|\n xml.Eq do |xml|\n xml.FieldRef(:Name => \"FileRef\")\n xml.Value(::File.dirname(url).sub(/\\A\\//, \"\"), :Type => \"Text\")\n end\n xml.Eq do |xml|\n xml.FieldRef(:Name => \"FSObjType\")\n xml.Value(1, :Type => \"Text\")\n end\n end\n end\n @list.items(:folder => :all, :query => query).first\n end", "def folder_list(opts = {})\n optional_inputs = {\n include_deleted: false,\n include_media_info: false,\n }.merge(opts)\n input_json = {\n id: optional_inputs[:id],\n path: optional_inputs[:path],\n include_deleted: optional_inputs[:include_deleted],\n include_media_info: optional_inputs[:include_media_info],\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/folder_list\", input_json)\n Dropbox::API::FolderAndContents.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end", "def get_all_folderdata_for_folder_id(folder_id)\n return $db.execute(\"SELECT * FROM folders WHERE folder_id = ?\", folder_id)\nend", "def guild_by_id(id)\n @logger.info \"Looking up guild by id [#{id}]\"\n\n request = make_request('guild', {\n :id => id\n })\n\n Guild.from_json request\n end", "def show\n begin\n @folder = Folder.find(params[:id])\n set_current_folder params[:id]\n set_current_children\n set_new_items\n @chat_room = current_folder.chat_room\n rescue ActiveRecord::RecordNotFound\n flash[:warning] = 'Không tìm thấy folder. Quay về home.'\n redirect_to folders_path\n end\n end", "def find_group(id)\n id = id.to_s\n groups.select{|gr| gr.id == id}.first\n end", "def get(id)\n collection.find_one({\n Crocoduck::Store.id_field => id.to_i\n })\n end", "def find_folder(name)\n @storage.nodes.find { |f| f.type == :folder && f.name == name }\n end", "def jsonToFolder(jsonObject)\r\n\t\t\t\tfolder = Folder.new\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"id\")\r\n\t\t\t\t\tfolder.setId(jsonObject[\"id\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"name\")\r\n\t\t\t\t\tfolder.setName(jsonObject[\"name\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"is_discussion\")\r\n\t\t\t\t\tfolder.setIsDicussion(jsonObject[\"is_discussion\"])\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"link\")\r\n\t\t\t\t\tlink = jsonObject[\"link\"]\r\n\t\t\t\t\t\r\n\t\t\t\t\tif link.has_key?(\"self\")\r\n\t\t\t\t\t\tfolder.setURL(link[\"self\"][\"url\"])\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\treturn folder\r\n\t\t\tend", "def getObject(id)\n\t\tdoc.search(\"[@id='#{id}']\").first\n\tend", "def root_folder_id\n self.root_folder\n end", "def file_by_id(id)\n api_result = execute!(\n :api_method => self.drive.files.get,\n :parameters => { \"fileId\" => id })\n return wrap_api_file(api_result.data)\n end", "def find(id)\n fail(ArgumentError, \"Missing id/slug\") unless id\n\n result = access_token.get(\"#{API_BASE}#{self.class::API_PATH}#{id}\")\n fail(ArgumentError, \"Bad request\") unless result.code == \"200\"\n\n self.class::ITEM_CLASS.new(result.body)\n end", "def set_folder_type\n @folder_type = FolderType.find(params[:id])\n end", "def get(id:)\n response = client.get(path(id)).parsed_body\n new(response)\n end", "def get!(id)\n klass.find(:all, params: { id: wrap_key(id) })\n end", "def find(id)\n klass.find(id)\n end", "def set_folder2\n @folder2 = Folder2.find(params[:id])\n end", "def object_by_id(id)\n @lock.synchronize do\n object_by_id_internal(id)\n end\n end", "def GetGroup id\n\n APICall(path: \"groups/#{id}.json\")\n\n end", "def folder_service\n @folder_service ||= FolderService.new(@context)\n end", "def folder_service\n @folder_service ||= FolderService.new(@context)\n end", "def find_by_id(id)\n resp = get(\"/#{exposed_as}/#{id}\")\n case resp.response.code.to_i\n when 200\n result = MultiJson.load resp.parsed_response\n new(result)\n when 404\n nil\n else\n raise \"#{self.class.name}#try_find with ID #{id.inspect} returned unexpected response: #{resp.inspect}\"\n end\n end", "def get_parent_id_folder(id)\n if id.to_s.length > 4\n id.to_s[0..id.to_s.length-2]\n else\n id.to_s\n end\nend", "def get_from_storage(id)\n\t\traise \"[FATAL] Storage directory not set\" if Repository.data_dir.nil?\n\n\t\t# Aquire raw JSON\n\t\traw = aquire_raw(id)\n\n\t\t# Escape if object not found\n\t\treturn nil if raw.nil?\n\n\t\t# Create object\n\t\tobj = JSON::parse(raw)\n\n\t\t# Grab needed objects, args => self\n\t\tobj.cache_collect\n\n\t\t# return\n\t\treturn obj\n\tend", "def find_by_id(id, options={})\n name = self.class.name.demodulize.downcase\n route = Automatic::Client.routes.route_for(name)\n url = route.url_for(id: id)\n\n request = api_client.get(url, options)\n\n if request.success?\n self.class::INDIVIDUAL_MODEL.new(request.body)\n else\n nil\n end\n end", "def set_folder\n @folder_id = params[:folder_id] ? params[:folder_id] : params[:id]\n unless @folder_id==\"#\"\n @folder = current_user.is_support? ? Folder.where(id: @folder_id).first : Folder.where(user_id: current_user.id, id: @folder_id).first\n\n params[:project_id] = @project_id = @folder.project_id\n @project = current_user.is_support? ? Project.where(id: @project_id).first : Project.where(user_id: current_user.id, id: @project_id).first unless @project\n end\n end", "def get_group_by_id(id)\n $r.hgetall(\"group:#{id}\")\n end", "def id(id)\n #::Hero.find_by_id(id)\n ::Item.where(id: id)\n end", "def find(id)\n return nil if id.blank?\n path = build_association_path -> { \"#{@parent.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get_resource(path, @params)\n end", "def find(id)\n end", "def d_objects_folder(basedir='bct/mss/dvd')\n dvd=self.dvd_originale\n return nil if dvd.nil?\n target = format 'T%04d', dvd['numero_dvd']\n path=File.dirname(dvd['path'])\n n=File.join(basedir,target,path)\n DObjectsFolder.find_by_name(n)\n end", "def get_parent_folder_id(file_id)\n return nil if file_id == '/'\n file_id = file_id.chomp('/')\n file_id.slice(0..(file_id.rindex('/')))\n end", "def path!(id)\n path = path(id)\n FileUtils.mkdir_p(path.dirname, mode: directory_permissions)\n path\n end", "def set_sharedfolder\n @sharedfolder = Sharedfolder.find(params[:id])\n end", "def create_team_folder\n\n folder = Folder.new\n folder.name = self.name\n folder.parent_id = 0\n folder.owner_id = self.id\n folder.xtype = Folder::XTYPE_TEAM\n folder.read_teams = '|'+self.id.to_s+'|'\n folder.write_teams = '|'+self.id.to_s+'|'\n folder.save!\n\n return folder\n end", "def set_inventoryfolder\n @inventoryfolder = Inventoryfolder.find(params[:id])\n end" ]
[ "0.81134176", "0.81134176", "0.7628282", "0.7498639", "0.7029335", "0.6885151", "0.6885151", "0.6885151", "0.6885151", "0.6885151", "0.6877237", "0.6877237", "0.68733954", "0.6845419", "0.68386984", "0.6740533", "0.67352784", "0.66821885", "0.66677874", "0.6596925", "0.6580833", "0.65210867", "0.65170133", "0.6440741", "0.63789123", "0.6298102", "0.62687314", "0.61918104", "0.6171941", "0.60972446", "0.6082078", "0.60741204", "0.60718083", "0.60304105", "0.5993877", "0.5993758", "0.5989393", "0.5978584", "0.59243417", "0.5879826", "0.5857252", "0.58566463", "0.58433026", "0.5834135", "0.58328426", "0.58178735", "0.5817323", "0.581696", "0.580317", "0.5786398", "0.578576", "0.5775142", "0.5763912", "0.5760127", "0.57591695", "0.5743096", "0.5739944", "0.5739006", "0.5735647", "0.5727614", "0.57254434", "0.5714233", "0.57139677", "0.57134926", "0.57037747", "0.5699493", "0.5686993", "0.568178", "0.5680941", "0.5667307", "0.56654584", "0.5664706", "0.56607974", "0.5659979", "0.5651214", "0.5629053", "0.56273925", "0.56271833", "0.562474", "0.5607675", "0.5600283", "0.55932206", "0.55877185", "0.5581759", "0.5581759", "0.5580937", "0.55752164", "0.55662924", "0.5553331", "0.5548199", "0.5547039", "0.5543524", "0.55422944", "0.554121", "0.5539366", "0.55385417", "0.5532401", "0.55322796", "0.5527032", "0.55251765" ]
0.82084125
0
Gets a file object by id.
def file(id) Box::File.new(@api, nil, :id => id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_get(id)\n response = get('FileService.getFile', id)\n end", "def file_by_id(id)\n api_result = execute!(\n :api_method => self.drive.files.get,\n :parameters => { \"fileId\" => id })\n return wrap_api_file(api_result.data)\n end", "def get_file_instance(id)\n raise 'The primary key must be an integer.' unless id.instance_of? Integer\n name_list = []\n while true\n file = Fileinfo[id] \n break if id == file.parent_id\n name_list.push(file.name)\n id = file.parent_id\n end\n find_file(name_list.reverse, 1)\n end", "def get_file(file_id)\n raise ArgumentError, \"Only one file id allowed for this method\" if file_id.is_a?(Array)\n get_files(file_id).first\n end", "def find_by(id:)\n path = file_path(id)\n storage_object_id, file_category = id_from_path(path)\n\n moab_path = find_moab_filepath(storage_object_id, path, file_category)\n\n Valkyrie::StorageAdapter::File.new(id: Valkyrie::ID.new(id.to_s), io: ::File.open(moab_path, 'rb'))\n rescue ::Moab::FileNotFoundException\n raise Valkyrie::StorageAdapter::FileNotFound\n end", "def find_by(id:)\n return unless handles?(id: id)\n Valkyrie::StorageAdapter::File.new(id: Valkyrie::ID.new(id.to_s), io: ::File.open(file_path(id), 'rb'))\n end", "def get_file(id)\n id = self.to_id(id)\n self.grid.get(id).read\n end", "def file(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n response = make_get_call('/files/%i' % [id])\n response.download = download(id)\n\n response\n end", "def read(id)\n File.read(find(id))\n end", "def get(id, file = nil, options = {})\n start_time = Time.now\n logger.debug(\"getting '#{id}' start: #{start_time}\")\n\n if file\n get_file(id, file)\n file.flush\n else\n result = nil\n temp_path do |path|\n File.open(path, 'w') { |f| get_file(id, f) }\n result = File.open(path, 'r') { |f| f.read }\n end\n logger.debug(\"getting '#{id}' (took #{Time.now - start_time})\")\n result\n end\n rescue BlobstoreError => e\n raise e\n rescue Exception => e\n raise BlobstoreError,\n sprintf('Failed to fetch object, underlying error: %s %s', e.inspect, e.backtrace.join(\"\\n\"))\n ensure\n logger.debug(\"getting '#{id}' (took #{Time.now - start_time})\")\n end", "def open(id)\n path(id).open(\"rb\")\n end", "def file(file_type, id)\n query = \"/?client_id=#{@client_id}&#{id}\"\n path = \"#{file_type}/#{__method__}.to_s\"\n resp = http_get(path, query)\n end", "def get_object(id)\n return nil unless (blob = find_blob(id)) && (obj = blob.read_object(id))\n deserialize(obj)\n end", "def get_file(file_id)\n\tputs \"Getting file: \" + file_id\n\tresponse = request_get('/api/partner/file/' + file_id)\n\tputs response.body\nend", "def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('fileasset', 'get', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def files_id_get(id, opts = {})\n files_id_get_with_http_info(id, opts)\n end", "def read_object(id)\n return nil unless (index_entry = find(id))\n read_from_blobs_file(index_entry)\n end", "def read(id)\n path(id).binread\n end", "def retrieve!(file_id)\n # allow for use of either path or ID as the file identifier\n id = file_id.match(/^id:/) ? file_id : \"/#{uploader.store_path file_id}\"\n CarrierWave::Storage::Dropbox::File.new(uploader, config, id, dropbox_client)\n end", "def set_file_object\n @file_object = FileObject.find(params[:id])\n end", "def retrieve!(identifier)\n File.new(uploader, self, uploader.store_path(identifier))\n end", "def files_id_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FilesApi.files_id_get ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling FilesApi.files_id_get\"\n end\n # resource path\n local_var_path = \"/files/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#files_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end", "def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end", "def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end", "def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end", "def read(id)\n begin\n find(id).read\n rescue\n nil\n end\n end", "def getObject(id)\n\t\tdoc.search(\"[@id='#{id}']\").first\n\tend", "def object_by_id(id)\n @lock.synchronize do\n object_by_id_internal(id)\n end\n end", "def file(file_id)\n self.class.new @repo, @path, :file_id => file_id, :file_log => file_log\n end", "def get_file_info(object_id:)\n {\n method: \"DOM.getFileInfo\",\n params: { objectId: object_id }.compact\n }\n end", "def get_file_details(id)\n uri = ENDPOINT + \"file/details/#{key}/#{id}\"\n data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)\n Reach::Helper::convert_keys(data)\n end", "def get_document(id)\n with_monitoring do\n document_ids = get_coe_documents.body.map { |doc| doc['id'].to_s }\n if document_ids.include?(id)\n perform(\n :get,\n \"#{end_point}/document/#{id}/file\",\n { 'edipi' => @edipi, 'icn' => @icn },\n request_headers.merge(pdf_headers)\n )\n else\n raise Common::Exceptions::RecordNotFound, id\n end\n end\n end", "def get\n file = XFile.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n raise RequestError.new(:bad_access, \"No access\") unless file.users.include? session[:user]\n raise RequestError.new(:bad_param, \"Can't get a folder\") if file.folder\n raise RequestError.new(:file_not_uploaded, \"File not completely uploaded\") unless file.uploaded\n raise RequestError.new(:bad_part, \"Incorrect content\") if file.content.nil?\n\n @result = retrieve(file, params[:part].to_i) if (!params[:direct] || params[:direct] != \"true\")\n \tsend_data(full_retrieve(file), filename: file.name) if (params[:direct] == \"true\")\n end", "def retrieve!(file_identifier)\n client.object(file_identifier)\n end", "def get_attachment(id)\n response = conn.get 'api/files/attachments/' + id\n\n unless response.status == 200\n error_model = JSON.load(response.body)\n mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \\'' + response.status.to_s + '\\'', error_model)\n raise mailosaur_error\n end\n\n response.body\n end", "def file_by_url(url)\n return file_by_id(url_to_id(url))\n end", "def get_file(path, file_id = nil, file_log = nil)\n file_id = file_node(path) if file_id.nil?\n VersionedFile.new(@repo, path, :file_id => file_id, :changeset => self,\n :file_log => file_log)\n end", "def file(file_id)\n VersionedFile.new(@repo, repo_path, :file_id => file_id, :file_log => file_log)\n end", "def get_file_data(file_id)\n return $db.execute(\"SELECT * FROM files WHERE file_id = ?\", file_id).first\nend", "def read id, &block\n fn = _data_path(id)\n if block_given?\n File.open(fn, 'r', &block)\n else\n File.read(fn)\n end\n end", "def files_id_download_get(id, opts = {})\n files_id_download_get_with_http_info(id, opts)\n end", "def get_file(file_id, file_type)\n\t\tresponse = self.auth_get(\"/weboncampus/getFile.do?tipo=#{file_type}&id=#{file_id}\")\n\t\tfilename = response[\"content-disposition\"].match(/filename=\"(.*)\"/)[1]\n\t\tlength = response[\"Content-Length\"]\n\t\treturn filename, length, response.body\n\tend", "def retrieve(identifier)\n @file = @client.get_document(identifier)\n @file ||= @file.parsed_response\n end", "def get_object_by_id(class_name, id)\n obj = nil\n get_objects_of_class(class_name).each do |o|\n if o.id == id\n obj = o\n break\n end\n end\n obj\n end", "def userfiles_id_get(id, opts = {})\n data, _status_code, _headers = userfiles_id_get_with_http_info(id, opts)\n data\n end", "def show\n session[:file_id] = params[:id]\n @file = FileData.find(params[:id])\n end", "def retrieve!(identifier)\n HesCloudStorage::HesCloudStorageEngine::File.new(uploader, self, ::File.basename(uploader.store_path(identifier), uploader.root))\n end", "def get_file_details(file_id)\n begin\n drive = @client.discovered_api('drive', 'v2')\n result = @client.execute(:api_method => drive.files.get, :parameters => { 'fileId' => file_id })\n rescue\n return nil\n end\n \n if result.status == 200\n self.item_into_standard_format(result.data) if result.data.present?\n else\n nil\n end\n end", "def get_file(bucket_id:, file_id:)\n path = '/storage/buckets/{bucketId}/files/{fileId}'\n .gsub('{bucketId}', bucket_id)\n .gsub('{fileId}', file_id)\n\n if bucket_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"bucketId\"')\n end\n\n if file_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"fileId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::File\n )\n end", "def find(id)\n @objects[id]\n end", "def get_file(file_id)\n file_id += CSV_BASE\n return @dialogs[file_id] if @dialogs.key?(file_id)\n unless try2get_marshalized_dialog(file_id) || try2get_csv_dialog(file_id)\n return log_error(\"Text file #{file_id - CSV_BASE} doesn't exist.\")\n end\n return @dialogs[file_id]\n end", "def get_object(id)\n path = object_path(id)\n\n if File.exists?(path)\n buf = open(path, \"rb\") { |f| f.read }\n\n raise \"not a loose object: #{id}\" if not legacy_loose_object?(buf)\n\n header, content = Zlib::Inflate.inflate(buf).split(/\\0/, 2)\n type, size = header.split(/ /, 2)\n\n raise \"bad object: #{id}\" if content.length != size.to_i\n else\n content, type = get_object_from_pack(id)\n end\n\n return type, content\n end", "def files_id_download_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FilesApi.files_id_download_get ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling FilesApi.files_id_download_get\"\n end\n # resource path\n local_var_path = \"/files/{id}/download\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#files_id_download_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end", "def file_set\n @file_set ||= ::FileSet.find(id)\n end", "def get_document(id)\n @session.getDocument id\n end", "def file_id_to_file(file_id)\n telegram_file_path = bot.api.get_file(file_id: file_id)[\"result\"][\"file_path\"]\n telegram_file_uri = \"https://api.telegram.org/file/bot#{ ENV['BOT_API_TOKEN'] }/#{ telegram_file_path }\"\n file_from_uri(telegram_file_uri)\n end", "def get(id:)\n response = client.get(path(id)).parsed_body\n new(response)\n end", "def get(id)\n @documents[id.to_i]\n end", "def neofiles_attrs_or_id(obj_or_id, klass = ::Neofiles::File)\n if obj_or_id.present?\n obj, id = if obj_or_id.is_a? klass\n [obj_or_id, nil]\n elsif obj_or_id.is_a?(::String) || obj_or_id.is_a?(::BSON::ObjectId)\n [::Neofiles::File.where(id: obj_or_id).first, obj_or_id.to_s]\n end\n\n obj.try { |x| neofiles_attrs(x) } || id\n end\n end", "def get(id)\n return nil if id.nil?\n\n return objects[id] if objects.has_key?(id)\n\n type, content = get_object(id)\n\n klass = TYPE_CLASS[type] or raise NotImplementedError, \"type not supported: #{type}\"\n\n objects[id] = klass.new(self, id, content)\n end", "def retrieve!(identifier)\n CarrierWave::Storage::Couch::File.new(uploader, uploader.store_path(identifier))\n end", "def retrieve!(identifier)\n CarrierWave::Storage::TrueVault::File.new(api_key, vault_id, identifier)\n end", "def download(id, filename)\n open(filename, \"w\").write(@res[\"/download?id=#{id}\"].get)\n return filename\n rescue\n puts $!\n return nil\n end", "def retrieve(id)\n raise NotFound.new(\"id '#{id}'\") unless ids.include?(id)\n\n storage[id]\n end", "def open(id, rewindable: true, **options)\n file = get_file(id)\n\n raise Shrine::FileNotFound, \"file #{id.inspect} not found on storage\" unless file\n\n # create enumerator which lazily yields chunks of downloaded content\n chunks = Enumerator.new do |yielder|\n # trick to get google client to stream the download\n proc_io = ProcIO.new { |data| yielder << data }\n file.download(proc_io, verify: :none, **options)\n end\n\n # wrap chunks in an IO-like object which downloads when needed\n Down::ChunkedIO.new(\n chunks: chunks,\n size: file.size,\n rewindable: rewindable,\n data: { file: file },\n )\n end", "def read(id)\n perform(:get, \"#{@resource_type}/#{id}\")\n end", "def files(id)\n criteria = {:type_ids => [Runcible::Extensions::File.content_type]}\n unit_search(id, criteria).map { |i| i['metadata'].with_indifferent_access }\n end", "def file\n\n content_upload_id = params[:id]\n\n raise \"content upload without id\" if content_upload_id.blank?\n\n # if the id is not numeric, assume it's a link name\n if content_upload_id.to_i == 0\n content_upload = ContentUpload.find_by_link_name(content_upload_id)\n else # assume the id passed is numeric and find it by ID\n content_upload = ContentUpload.find_by_id(content_upload_id)\n end\n\n raise \"content upload not found\" if content_upload.blank?\n\n # send them to the file on the content server\n redirect_to(content_upload.content_server_url)\n\n end", "def find_by_id(id)\n find(id)\n end", "def file\n\n content_upload_id = params[:id]\n\n raise \"content upload without id\" if content_upload_id.blank?\n\n # if the id is not numeric, assume it's a link name\n if content_upload_id.to_i == 0\n content_upload = ContentUpload.find_by_link_name(content_upload_id)\n else # assume the id passed is numeric and find it by ID\n content_upload = ContentUpload.find_by_id(content_upload_id)\n end\n\n raise \"content upload not found\" if content_upload.blank?\n\n # send them to the file on the content server\n redirect_to(content_upload.content_server_url, status: :moved_permanently)\n\n end", "def userfiles_id_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_id_get ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling UserfilesApi.userfiles_id_get\"\n end\n # resource path\n local_var_path = '/userfiles/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BrainPortalSession']\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 => 'Userfile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserfilesApi#userfiles_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find_one(selector = nil)\n metadata = files_collection.find(selector).first\n return nil unless metadata\n chunks = chunks_collection.find(:files_id => metadata[:_id]).sort(:n => 1)\n Grid::File.new(chunks.to_a, metadata)\n end", "def file\n files.first\n end", "def file\n files.first\n end", "def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end", "def object\n obj = get_result('object')\n if obj != nil\n return obj\n end\n fs = files\n if fs != nil and fs.length > 0\n return fs[0]\n end\n nil\n end", "def download(id)\n Down.copy_to_tempfile(id, open(id))\n end", "def find_attachment(resource_id, attachment_id)\n http.get(\"#{attachment_endpoint(resource_id)}/#{attachment_id}\") do |response|\n Rexpense::Entities::Attachment.new response.parsed_body\n end\n end", "def blob(id)\n head \"/blobs/#{id}\"\n end", "def retrieve!(identifier)\n CarrierWave::Storage::GridFS::File.new(uploader, uploader.store_path(identifier))\n end", "def retrieve!(identifier)\n CarrierWave::Storage::GridFS::File.new(uploader, uploader.store_path(identifier))\n end", "def get_from_storage(id)\n\t\traise \"[FATAL] Storage directory not set\" if Repository.data_dir.nil?\n\n\t\t# Aquire raw JSON\n\t\traw = aquire_raw(id)\n\n\t\t# Escape if object not found\n\t\treturn nil if raw.nil?\n\n\t\t# Create object\n\t\tobj = JSON::parse(raw)\n\n\t\t# Grab needed objects, args => self\n\t\tobj.cache_collect\n\n\t\t# return\n\t\treturn obj\n\tend", "def download(file)\n uri = URI.parse(file)\n id=uri.query.match(/id=(.*)/)[1]\n\n Net::HTTP.start(uri.host) do |http|\n resp = http.get(uri.path + \"?\" + uri.query)\n open(\"docs/#{id}.pdf\", \"wb\") do |file|\n file.write(resp.body)\n end\n end\n id\nend", "def get(id)\n raise ArgumentError, 'Invalid id given' if !(String === id)\n\n if id =~ SHA_PATTERN\n raise ArgumentError, \"Sha too short: #{id}\" if id.length < 5\n\n trie = @objects.find(id)\n raise NotFound, \"Sha is ambiguous: #{id}\" if trie.size > 1\n return trie.value if !trie.empty?\n elsif id =~ REVISION_PATTERN\n list = git_rev_parse(id).split(\"\\n\") rescue nil\n raise NotFound, \"Revision not found: #{id}\" if !list || list.empty?\n raise NotFound, \"Revision is ambiguous: #{id}\" if list.size > 1\n id = list.first\n\n trie = @objects.find(id)\n raise NotFound, \"Sha is ambiguous: #{id}\" if trie.size > 1\n return trie.value if !trie.empty?\n else\n raise ArgumentError, \"Invalid id given: #{id}\"\n end\n\n @logger.debug \"gitrb: Loading #{id}\"\n\n path = object_path(id)\n if File.exists?(path) || (glob = Dir.glob(path + '*')).size >= 1\n if glob\n raise NotFound, \"Sha is ambiguous: #{id}\" if glob.size > 1\n path = glob.first\n id = path[-41..-40] + path[-38..-1]\n end\n\n buf = File.open(path, 'rb') { |f| f.read }\n\n raise NotFound, \"Not a loose object: #{id}\" if !legacy_loose_object?(buf)\n\n header, content = Zlib::Inflate.inflate(buf).split(\"\\0\", 2)\n type, size = header.split(' ', 2)\n\n raise NotFound, \"Bad object: #{id}\" if content.length != size.to_i\n else\n trie = @packs.find(id)\n\traise NotFound, \"Object not found: #{id}\" if trie.empty?\n\traise NotFound, \"Sha is ambiguous: #{id}\" if trie.size > 1\n id = trie.key\n pack, offset = trie.value\n content, type = pack.get_object(offset)\n end\n\n @logger.debug \"gitrb: Loaded #{type} #{id}\"\n\n set_encoding(id)\n object = GitObject.factory(type, :repository => self, :id => id, :data => content)\n @objects.insert(id, object)\n object\n end", "def find(id)\n id = id.to_s\n return nil unless index[id]\n return cache[id] if cache? && cache.key?(id)\n p = index[id][:partition]\n v = S3Object.value(File.join(basedir, p), bucket_name)\n data = v[index[id][:offset]..(index[id][:offset] + index[id][:length])]\n #puts \"Data: #{data}\"\n document = Marshal.load(data)\n cache[id] = document if cache?\n document\n end", "def find(id)\n new.from_json(db_root.join(id).read)\n end", "def userfiles_id_content_get(id, opts = {})\n data, _status_code, _headers = userfiles_id_content_get_with_http_info(id, opts)\n data\n end", "def get_file_details(file_id)\n begin\n api_result = @client.metadata(file_id, 1, true)\n rescue\n return nil\n end\n \n if api_result.present?\n self.item_into_standard_format(api_result, true)\n else\n nil\n end\n end", "def load_datafile(id)\n begin \n Datafile.find(id)\n rescue Exception => e\n HoptoadNotifier.notify(\n :error_class => \"Invalid Datafile\", \n :error_message => \"Datafile Load Error: #{e.message}\", \n :request => { :params => id }\n )\n nil\n end\n end", "def find_by_id(id)\n find_by_attributes(:id => id).first\n end", "def download(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n PUTIO_BASE_URL + (\"/files/%i/download?oauth_token=%s\" % [id, @access_token])\n end", "def get\n file\n end", "def neofiles_mock_or_load(attrs_or_id, klass = ::Neofiles::File)\n if attrs_or_id.present?\n case attrs_or_id\n when ::String then klass.where(id: attrs_or_id).first\n when ::BSON::ObjectId then klass.where(id: attrs_or_id).first\n when ::Hash then neofiles_mock(attrs_or_id.with_indifferent_access, klass)\n end\n end\n end", "def find(id)\n code, data = @session.get(element_path(id) + '.json')\n if code == 200\n key = @resource.name.to_s.split('::').last.downcase\n @resource.new(data[key].merge(:session =>@session))\n elsif code == 404\n raise ResourceNotFound\n end\n end", "def file\n TestIds.database_file(id)\n end", "def find id\n gist_id, filename = *id.split('/', 2)\n files.find_all do |file|\n file.gist_id == gist_id &&\n (filename.nil? || (filename == file.filename))\n end\n end", "def mp4(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/files/%i/mp4' % [id]).mp4\n end", "def getFile(file)\n return fileByName.fetch(file, nil)\n end", "def [](id)\n id *= @record_size\n @h.seek(id)\n return @h.read(@record_size)\n end", "def find_by_id(id)\n resp = get(\"/#{exposed_as}/#{id}\")\n case resp.response.code.to_i\n when 200\n result = MultiJson.load resp.parsed_response\n new(result)\n when 404\n nil\n else\n raise \"#{self.class.name}#try_find with ID #{id.inspect} returned unexpected response: #{resp.inspect}\"\n end\n end" ]
[ "0.82761115", "0.8262397", "0.80007535", "0.7975726", "0.7940402", "0.7895157", "0.78921235", "0.7697132", "0.73923326", "0.7353733", "0.7186633", "0.7107002", "0.68929726", "0.68832725", "0.68475956", "0.6827918", "0.67729527", "0.6762245", "0.6749288", "0.66803324", "0.66709304", "0.6670201", "0.6644228", "0.6644228", "0.6644228", "0.66407526", "0.6621", "0.6601805", "0.6591662", "0.65907025", "0.65862244", "0.6581118", "0.64516854", "0.64508224", "0.6435795", "0.63939387", "0.6354961", "0.635178", "0.63416326", "0.634089", "0.6326392", "0.6313346", "0.6294843", "0.6289922", "0.6281635", "0.62710756", "0.6261735", "0.6233476", "0.6228991", "0.6224558", "0.62167645", "0.6202322", "0.6195546", "0.6175236", "0.61694753", "0.616439", "0.61617345", "0.6143642", "0.613721", "0.6130739", "0.61243856", "0.6100698", "0.6093671", "0.60854197", "0.6064048", "0.6046148", "0.6034781", "0.6034478", "0.60238504", "0.60088265", "0.6008015", "0.6000441", "0.5998871", "0.5998871", "0.5987468", "0.59855473", "0.5980818", "0.59805053", "0.59635967", "0.59548545", "0.59548545", "0.594768", "0.5932263", "0.5912695", "0.5907764", "0.5906003", "0.5905685", "0.58991003", "0.5897932", "0.5893153", "0.58790284", "0.5869719", "0.5862429", "0.58619064", "0.5860482", "0.58588904", "0.58548397", "0.5847518", "0.5836124", "0.58353215" ]
0.78469175
7
Get the cached ticket or request a new one from the Box api.
def ticket @ticket ||= @api.get_ticket['ticket'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ticket(ticket_id:)\n ZendeskAPI::Ticket.find(client, id: ticket_id)\n end", "def get_ticket_granting_ticket\n if tgt_expired?\n # It's expired, so we're going to start this process by resetting the state\n clear_ticket_state\n\n response = RestClient.post(Rails.configuration.x.umls.umls_auth_base_url, { username: Rails.configuration.x.umls.username, password: Rails.configuration.x.umls.password })\n if response.code != 201 # expect a 201/Created response\n return nil\n end\n\n # The actual ticket response is a URL that we pull from the location. The body has an HTML form,\n # which we don't want to have to parse.\n @ticket_granting_ticket = response.headers[:location]\n @last_updated = Time.now.to_i\n end\n\n @ticket_granting_ticket\n end", "def request\n # We delay it because tickets are created in a transaction\n TicketekRequestWorker.perform_in(30.seconds.from_now,id) if client.ticket_type == 'ezyticket'\n end", "def ticket(q)\n Ticket.find(self, q)\n end", "def get(ticket_id)\r\n\r\n # Validate required parameters\r\n if ticket_id == nil\r\n raise ArgumentError.new \"Required parameter 'ticket_id' cannot be nil.\"\r\n end\r\n\r\n # the base uri for api requests\r\n _query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n _query_builder << '/tickets/{ticket_id}'\r\n\r\n # process optional query parameters\r\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\r\n 'ticket_id' => ticket_id\r\n }\r\n\r\n # validate and preprocess url\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-API-TOKEN' => Configuration.x_api_token,\r\n 'X-API-EMAIL' => Configuration.x_api_email\r\n }\r\n\r\n # append custom auth authorization\r\n CustomAuthUtility.append_custom_auth_params _headers\r\n\r\n # invoke the API call request to fetch the response\r\n _response = Unirest.get _query_url, headers: _headers\r\n\r\n # Error handling using HTTP status codes\r\n if _response.code == 401\r\n raise APIException.new 'Your API key is incorrect', 401, _response.body\r\n elsif _response.code == 400\r\n raise APIException.new 'There is an error in the parameters you send', 400, _response.body\r\n elsif _response.code == 404\r\n raise APIException.new 'Cannot find the resource specified', 404, _response.body\r\n elsif !_response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', _response.code, _response.body\r\n end\r\n\r\n # Try to cast response to desired type\r\n if _response.body.instance_of? Hash\r\n begin\r\n Ticket.from_hash(_response.body)\r\n rescue Exception\r\n raise APIException.new \"Invalid JSON returned.\", _response.code, _response.body\r\n end\r\n end\r\n end", "def request_login_ticket\n uri = URI.parse(login_url+'Ticket')\n https = Net::HTTP.new(uri.host, uri.port)\n https.use_ssl = (uri.scheme == 'https')\n https.verify_mode = (@force_ssl_verification ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE)\n res = https.post(uri.path, ';')\n \n raise CASException, res.body unless res.kind_of? Net::HTTPSuccess\n \n res.body.strip\n end", "def GetTicket id\n\n APICall(path: \"tickets/#{id}.json\")\n\n end", "def ticket number\n Geera::Ticket.new self, number\n end", "def new\n ticket_id = params[:ticket_id]\n user_id = params[:user_id]\n \n @ticket_lock = TicketLock.new(:ticket_id => ticket_id, :user_id => user_id)\n \n if @ticket_lock.save\n render :json => {:status => 'ok', :time => 300 }\n else\n render :json => {:status => 'error', :message => 'This ticket is already locked.'}\n end\n end", "def get(options={})\n if options.is_a?(String)\n options = {:name=>options}\n end\n options[:name] ||= @client.cache_name\n res = @client.parse_response(@client.get(\"#{path(options)}\"))\n Cache.new(@client, res)\n end", "def login_ticket\n LoginTicket\n end", "def set_ticket\n @ticket = params[:id].present? ? find_ticket(:id) : find_ticket(:ticket_id)\n end", "def update_cache(ticket, cache)\n cache[ticket[:spacekey]] = ticket[:id] if seen?(ticket, cache)\n cache\n end", "def set_ticket\n @ticket = Ticket.find(params[:id]) if params[:id]\n end", "def show_ticket_details(ticket_id)\n url = \"https://alanli1.zendesk.com/api/v2/tickets/#{ticket_id}.json\"\n\n res = ApiHelper.make_req_to_api(url)\n @ticket = find_ticket_details(res)\n @ticket.requester_name = get_user_name(@ticket.requester_id)\n return @ticket\n end", "def get_service_ticket\n tgt = get_ticket_granting_ticket\n return nil if tgt.blank?\n\n puts tgt\n puts Rails.configuration.x.umls.umls_service\n response = RestClient.post(tgt, { service: Rails.configuration.x.umls.umls_service })\n if response.code != 200 # expect a 200/OK response\n return nil\n end\n\n response.body\n end", "def get_with_cache(uri)\n Scapeshift.configuration.cache.fetch [:gatherer_access, :get, uri] do\n connection.start unless connection.started?\n connection.get uri\n end\n end", "def service\n return softlayer_client[:Ticket].object_with_id(self.id)\n end", "def cache_request\n cache\n end", "def fetch_from_cache\n get_cache_object().get make_key\n end", "def get_tickets(ticket)\n @tickets << ticket\n ticket.passenger ||= self\nend", "def fetcher\n @_fetcher ||= TspotFetcher.new(name)\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def ticket(*options)\n options.insert(0, id) if options.length > 0\n easy_finder(provider_parent(self.class)::Ticket, :first, options, 1)\n end", "def refresh_service\n @refresh_service ||= RefreshService.new(ticket.identity)\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "def get\n raise StandardError, \"Implement '.get' in your Cache!\"\n end", "def cache_get(ck)\n cache_op(:get, ck)\n end", "def get_ticket(ticket)\n @tickets << ticket\nend", "def new\n @tickets_count = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.count\n @ticket = Helpdesk::Ticket.new\n @ticket.status = Helpdesk::Ticket::STATUSES[0][0]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end", "def get(ctxt, url, key, check_stale = true)\n fetch ctxt, url, key, check_stale\n end", "def set_ticket\n @ticket = current_user.tickets.find_by_id(params[:id])\n end", "def find_latest_ticket(end_user_id)\n end_user = client.user.find(id: end_user_id)\n end_user.requested_tickets(sort_by: :updated_at, sort_order: :desc).first\n end", "def get(options={})\n res, status = @client.get(\"#{path(options)}/#{URI.escape options[:name]}\")\n return Cache.new(self, res)\n end", "def ticket\n case eventable_class\n when \"Ticket\"\n Ticket.get(eventable_id)\n when \"TicketUpdate\"\n TicketUpdate.get(eventable_id).ticket\n when \"Milestone\"\n Milestone.get(eventable_id)\n end\n end", "def rebuildCacheFor( ticket )\n\t\tpos = @cache_for_id[ ticket.idstring ]\n\t\tif pos \n\t\t\t@cache[ pos ] = ticket\n\t\t\t@updated = true\n\t\t\tsave\n\t\telse \n\t\t\trebuildCache\n\t\tend\n\tend", "def set_ticket\n @ticket = Ticket.friendly.find(params[:id])\n end", "def new\n @ticket = Ticket.new\n end", "def new\n @ticket = Ticket.new\n end", "def find(id)\n info(\"https://jrcodn.zendesk.com/api/v2/tickets/#{id}\")[:ticket]\n rescue\n @view.id_error\n end", "def request(params, &block)\n cached_token = check_cache(request_params(params))\n return cached_token if cached_token\n\n cache_response(request_no_cache(request_params(params), &block))\n end", "def set_ticket\n @ticket = Ticket.find(params[:ticket_id])\n end", "def fetch\n self.version = begin\n ver = cache.fetch(CACHE_VERSION_KEY) do\n {'version' => Tml.config.cache[:version] || 'undefined', 't' => cache_timestamp}\n end\n validate_cache_version(ver)\n end\n end", "def create(ticket)\n ticket.assign_available_locker_from(@lockers)\n add_ticket(ticket)\n end", "def get(key)\n # Return nothing if not in the cache or it has expired.\n return if key.nil?\n\n entry = @cache[key]\n return unless entry\n return if entry.expired?\n\n # Otherwise return the cached object.\n # We don't delete the cached entry because we might need to force its use if its expired and offline\n entry.object\n end", "def get_facility_with_cache(facility_id)\n Rails.cache.fetch(\"vaos_facility_#{facility_id}\", expires_in: 12.hours) do\n get_facility(facility_id)\n end\n end", "def get\n Rails.cache.read(session_id, namespace: 'check-in-cache')\n end", "def box_login(box_api_key, session)\n # make a new Account object using the API key\n account = Box::Account.new(box_api_key)\n\n # use a saved ticket or request a new one\n ticket = session[:box_ticket] || account.ticket\n token = session[:box_token]\n\n # try to authorize the account using the ticket and/or token\n authed = account.authorize(:ticket => ticket, :auth_token => token) do |auth_url|\n # this block is called if the authorization failed\n\n # save the ticket we used for later\n session[:box_ticket] = ticket\n\n # yield with the url the user must visit to authenticate\n yield auth_url if block_given?\n end\n\n if authed\n # authentication was successful, save the token for later\n session[:box_token] = account.auth_token\n\n # return the account\n return account\n end\n end", "def set_ticket\n @ticket = Ticket.includes(:comments).find(params[:id])\n end", "def ticket\n end", "def request_proxy_ticket(pgt, target_service)\n uri = URI.parse(proxy_url)\n h = uri.query ? query_to_hash(uri.query) : {}\n h['pgt'] = pgt.ticket\n h['targetService'] = target_service\n uri.query = hash_to_query(h)\n \n pr = request_cas_response(uri, ProxyResponse)\n \n pt = ProxyTicket.new(pr.proxy_ticket, target_service)\n pt.response = pr\n \n return pt\n end", "def next_ticket\n loop do\n ticket_id = pop_blocking\n\n if ticket_id && tag[ticket_id].exists\n return ticket_id\n end\n\n if tag[:blocking_list].llen == 0\n return false\n end\n\n end\n end" ]
[ "0.6820765", "0.66867214", "0.6212103", "0.6116002", "0.6027578", "0.59860164", "0.595101", "0.59500253", "0.5874329", "0.5694371", "0.56858766", "0.56752783", "0.5672891", "0.56657857", "0.564651", "0.56278133", "0.5618555", "0.561479", "0.56141216", "0.5598916", "0.5591676", "0.5560635", "0.5559979", "0.5559979", "0.5559979", "0.5559979", "0.5559979", "0.5559979", "0.5559979", "0.5559979", "0.55260026", "0.55254567", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5518416", "0.5513223", "0.5513223", "0.5513223", "0.5496466", "0.54962295", "0.5469275", "0.5467289", "0.5453676", "0.54511887", "0.5450767", "0.54447645", "0.543039", "0.5428482", "0.5424744", "0.54228497", "0.54228497", "0.5420582", "0.5419146", "0.54083544", "0.54002506", "0.53854775", "0.5364701", "0.5360324", "0.5354784", "0.5339917", "0.53345007", "0.53339744", "0.5331068", "0.5328298" ]
0.7126073
0
Provides an easy way to access this account's info.
def method_missing(sym, *args, &block) super unless authorized? # TODO: Use symbols instead of strings str = sym.to_s return @info[str] if @info.key?(str) super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_info()\n response = @session.do_get build_url(\"/account/info\")\n parse_response(response)\n end", "def me\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/account/info').info\n end", "def account_info(options = {})\n request :account, :get, 'account', options\n end", "def account_info(*fields)\n get(\"/me#{field_selector(fields)}\")\n end", "def account\n @details ||= fetch_details\n @details[:account]\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 get('account')\n end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def retrieve_account_details\n\t\taccount = $twitter.user(\"#{self.handle}\")\n\t\tself.name = account.name\n\t\tself.avatar_url = account.profile_image_uri\n\tend", "def account_info(command)\n pp @client.users.info('me')\n end", "def info(account_identity)\n @client.account.info(account_identity)\n end", "def get_acc_info\n JSON.parse(curl_get(\"/api2/account/info/\").body_str)\n end", "def account\n AccountInfoParser.parse(post(\"money/info\"))\n end", "def get_account\n as_json(get_results('/account'))\n end", "def get_basic_account_info\n body = {cmd: \"get_basic_info\"}\n post body\n end", "def account_information\n puts \"====================\"\n puts \"Account information:\"\n puts \"====================\"\n puts \"\\nAccount number: %d\" % [@account_number]\n puts \"\\nTotal money: %d\" % [total_balance]\n puts \"\\nChecking account balance: %d\" % [@checking_account_balance]\n puts \"\\nSaving account balance: %d\" % [@saving_account_balance]\n puts \"\\nInterest rate: %.2f\" % [@interest_rate]\n puts\n end", "def info\n oauth_response = access_token.get \"/api/v1/users/current.json\"\n JSON.parse(oauth_response.body)\n end", "def current_account\n @current_account\n end", "def account(&block)\n response = _get(\"accounts/current\")\n yield(response) if block_given?\n response[\"account\"]\n end", "def account\n self\n end", "def info()\n get(:session, {:method => \"user.getInfo\"})\n end", "def print_account(account)\n puts \"Email: #{account.email}\"\n puts \"Username: #{account.username}\"\n puts \"First name: #{account.given_name}\"\n puts \"Last name: #{account.surname}\"\n puts \"Status: #{account.status}\"\nend", "def info(refresh = false)\n return @info if @info and not refresh\n\n begin\n cache_info(nil) # reset existing info\n info = @api.get_account_info['user']\n cache_info(info)\n rescue Api::NotAuthorized, Api::InvalidInput\n nil\n end\n end", "def raw_info\n @raw_info ||= access_token.get('/api/v1/me').parsed\n end", "def account\n find('Account', account_id)\n end", "def get_account(account_id)\n get(\"/account/#{account_id}\")\n end", "def info\n {\n email: username\n }\n end", "def info(account_id, opts = {})\n input_json = {\n account_id: account_id,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/info\", input_json)\n Dropbox::API::AccountInfo.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end", "def display_account_details\n puts \"\"\n puts \"Account Details\"\n puts \"-------------------------\"\n puts \"Rank: #{rank}\"\n puts \"Name: #{name}\"\n puts \"Handle: @#{handle}\"\n puts \"Followers: #{followers}\"\n puts \"-------------------------\"\n end", "def get_account(account_id)\n @accounts[account_id]\n end", "def get_account(account_id)\n @accounts[account_id]\n end", "def account_name\n self.current_account.try :name\n end", "def getaccountdetails(params = {})\n request :getaccountdetails, params.merge( :parser => :hash)\n end", "def user_account\n return @user_account\n end", "def account_name\n return @account_name\n end", "def account_name\n return @account_name\n end", "def account(params = {})\n make_get_request('/account', params)\n end", "def info\n {\n account_id: @account_id,\n date_taken: @date_taken.iso8601,\n username: @user.nil? ? \"\" : @user.username,\n schema: @schema,\n state: @state,\n files: files\n }\n end", "def raw_info\n @raw_info ||= access_token.get('/api/me', :headers => {'Accept' => \"application/json; version=1\" }).parsed['payload']['users'].first || {}\n end", "def user_info\n auth_hash['user_info']\n end", "def account\n @account = current_account_settings\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 account\n params['key']\n end", "def print_account\n # Account\n if valid_file?(@heroku_credentials.file_path) && valid_file?(@ssh_identity.public_file) && valid_file?(@ssh_identity.private_file)\n shell.say \"Current Account Settings:\"\n shell.say \" - Login: #{@heroku_credentials.login}\" \n shell.say \" - Password: #{'*' * @heroku_credentials.password.size}\"\n shell.say \" - Credentials: #{@heroku_credentials.file_path}\"\n shell.say \" - SSH ID (private): #{@ssh_identity.private_file}\\n\"\n shell.say \" - SSH ID (public): #{@ssh_identity.public_file}\"\n else\n shell.say \"ERROR: Heroku account credentials and/or SSH identity not found!\"\n end\n\n # Project\n if File.exists? @git_config_file\n shell.say \"\\nCurrent Project Settings:\"\n shell.say \" - Mode: #{@settings[:mode]}\"\n shell.say \" - App: #{application}\"\n end\n end", "def account\n params['key']\n end", "def show\n response = @account_api.find(params[:id])\n @account = response[:account]\n # @user = RubyBank::CustomerApi.new(session[:token]).find(@account.customer_id)[:user]\n end", "def my_account\n self.user.my_account\n end", "def account_information\n puts \"Account Number: #%d\" % @account_number\n puts \"\\t- Checking Amount: $%d\" % @checking_amount \n puts \"\\t- Saving Amount: $%d\" % @saving_amount\n puts \"\\t- Total Amouunt: $%d\" % (@checking_amount + @saving_amount)\n puts \"\\t- interest Rate: %f%\" % @interest\n end", "def account_information\n puts \"Account Number: #%d\" % @account_number\n puts \"\\t- Checking Amount: $%d\" % @checking_amount \n puts \"\\t- Saving Amount: $%d\" % @saving_amount\n puts \"\\t- Total Amouunt: $%d\" % (@checking_amount + @saving_amount)\n puts \"\\t- interest Rate: %f%\" % @interest\n end", "def get_account_info\n uri = {account_info_path: \"account/info\"}\n access_token = self.access_token\n\n if res = Dropbox.successful_request?(:account_info, access_token, uri)\n res = format_response(res)\n space_used = res[:quota_info][\"normal\"] + res[:quota_info][\"shared\"]\n space_available = res[:quota_info][\"quota\"]\n [space_used, space_available]\n else\n false\n end\n end", "def current_account\n ENV['CURRENT_ACCOUNT']\n #BlOCKCHAIN_CLIENT.eth_accounts['result'][0]\n #'0x1f9334BAE0acC7a86834f60488d0C6Fa89B4590b'\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 get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end", "def get_account(authdata)\n '@' + authdata.info.nickname\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 show_account(id)\n get(\"accounts/#{id}\")\n end", "def account\n @account ||= Harvest::API::Account.new(credentials)\n end", "def get_user_account_info_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AccountApi.get_user_account_info ...\"\n end\n # resource path\n local_var_path = \"/v2/user/customer/account\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AccountInfo')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountApi#get_user_account_info\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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 current_account\n load_session\n @current_account\n end", "def show\n @account = current_account\n end", "def info()\n _params = {}\n return @master.call 'users/info', _params\n end", "def get_account_number\n @acct_num\n end", "def user_info\n response = from_server \"api/user.json\"\n response.data\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 bank_account\n @bank_account\n end", "def get_accounts()\n http_get(accounts_url)\n end", "def account_from; Account.get(self.account_from_id); end", "def account_from; Account.get(self.account_from_id); end", "def account\n @user = current_user\n add_breadcrumb @user.name, :backend_account_path\n\n render :show\n end", "def show_account_configuration\n bla = Account.new @base\n puts \"done #{bla}\"\n end", "def getaccount(bitcoinaddress)\n @api.request 'getaccount', bitcoinaddress\n end", "def get_user\n\t\treturn Account.find(self.account_id)\n\tend", "def account\n AccountInfoParser.parse(post(\"balance\"))\n end", "def raw_info\n @raw_info ||= JSON.parse(access_token.get(ENV['OAUTH_WEDDINGWIRE_PROFILE_URL']).body)\n rescue ::Errno::ETIMEDOUT\n raise ::Timeout::Error\n end", "def account(fields: nil)\n params = build_fields_params fields\n res = @connection.get account_path, params\n Account.new res.body, self\n end", "def show\n @account = current_user.person.blackberry_accounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @account }\n end\n end", "def info(id)\n _params = {:id => id}\n return @master.call 'subaccounts/info', _params\n end", "def current_account\n Account.find_by(id: session[:account_id])\n end", "def account(id)\n make_json_api_request :get, \"v2/accounts/#{id}\"\n end", "def acct_name\n @name\n end", "def account\n @account ||= Account.find(accountRef)\n end", "def get_user_account_info_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerAccountApi.get_user_account_info ...\"\n end\n # resource path\n local_var_path = \"/user/customer/account\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AccountInfo')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerAccountApi#get_user_account_info\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show(account_id, accounts)\n account =\taccounts[account_id]\n show_message \"Name: #{account[:name]} Balance: #{account[:balance]} password: #{account[:password]}\"\nend", "def get_info\n puts @name + ' [ID: ' + @id.to_s + ' @ '+ @@company + ']'\n end", "def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end", "def find_account\n @account = current_account\n end", "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Oauth.V1.UserInfoInstance #{values}>\"\n end", "def account\n @account ||= Authentication::Account.find_by(email: username)\n end", "def account_user(id)\n get(\"accountuser/#{id}\")\n end", "def raw_info\n raw_info_url = \"https://kit.snapchat.com/v1/me?query=%7Bme%7BexternalId%2C+displayName%2C+bitmoji%7Bavatar%7D%7D%7D\"\n @raw_info ||= access_token.get(raw_info_url).parsed[\"data\"]\n end" ]
[ "0.86357933", "0.845718", "0.7932781", "0.79001653", "0.7893318", "0.7884873", "0.7884873", "0.76671207", "0.75741", "0.75741", "0.75741", "0.75741", "0.75741", "0.75741", "0.75741", "0.75741", "0.75741", "0.75741", "0.75089264", "0.74885845", "0.7429516", "0.739255", "0.73040736", "0.7233495", "0.71981025", "0.7123772", "0.71195215", "0.7045335", "0.7026624", "0.7012813", "0.69753337", "0.69674504", "0.69427407", "0.6930283", "0.6925228", "0.69221437", "0.6916273", "0.69136524", "0.6905408", "0.6881915", "0.6881915", "0.68798065", "0.6870295", "0.68657315", "0.68509763", "0.68509763", "0.6811074", "0.6801136", "0.67912155", "0.6771416", "0.67539746", "0.6749466", "0.67457277", "0.67446953", "0.6736711", "0.6723734", "0.671392", "0.6698663", "0.6698663", "0.6688126", "0.66832775", "0.6656817", "0.66540194", "0.66397595", "0.6621685", "0.6620222", "0.66009486", "0.65924555", "0.65783286", "0.65728056", "0.65718955", "0.65621996", "0.6557567", "0.6543477", "0.65396976", "0.653011", "0.65175855", "0.65148216", "0.65148216", "0.6508451", "0.6507196", "0.64992326", "0.64979136", "0.6477148", "0.6474341", "0.64714575", "0.6468236", "0.6452152", "0.6451617", "0.6449536", "0.64478445", "0.64425147", "0.6441222", "0.6436272", "0.64331454", "0.6430295", "0.6417267", "0.6414357", "0.64016485", "0.6399978", "0.639794" ]
0.0
-1
The url the user needs to visit in order to grant this application permission to use their account. This requires a ticket, which is either pulled from the cache or requested.
def authorize_url(ticket = nil) ticket = self.ticket unless ticket "#{ api.base_url }/auth/#{ ticket }" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_url(requirelogin=false, requireuserinfo=false, expirationdays=30, notifyonupload=false)\n end", "def request_url(requirelogin=false, requireuserinfo=false, expirationdays=30, notifyonupload=false)\n end", "def get_access_url\n @request_token = @client.request_token\n token = @request_token.token\n secret = @request_token.secret\n\n \"http://www.fitbit.com/oauth/authorize?oauth_token=#{token}\"\n end", "def third_party_credential(url); end", "def credential(url); end", "def access_token_url\n Settings.mobile_lighthouse_letters.access_token_url\n end", "def get_request_access_token_url\n URI.encode('https://'\"#{@subdomain}\"'.zendesk.com/oauth/tokens?grant_type=authorization_code&code='+ @code + '&client_id='+ @unique +'&client_secret='+ @secret +'&redirect_uri='\"#{@redirect_uri}\"'/&scope=read%20write')\n end", "def issue_service_ticket\n if tgt = has_valid_tgt and has_service_info?\n st = ServiceTicket.create(\n :service => cookies[:service],\n :username => current_user.id,\n :granted_by_tgt_id => tgt.id\n )\n\n service_back_url = cookies[:service_back_url]\n cookies.delete :service\n cookies.delete :service_back_url\n\n return service_back_url + \"?ticket=#{st.ticket}\"\n end\n end", "def auth_url\n client.authorization.authorization_uri(state: '', approval_prompt: :force, access_type: :offline, user_id: client_email).to_s\n end", "def url\n PagSeguro.site_url(\"v2/authorization/request.jhtml?code=#{code}\") if code\n end", "def authorize_url\n request_token.authorize_url\n end", "def authentication_url(params={})\n @request_token.authorize_url params\n end", "def auth_url\n \"#{@url}/auth/realms/#{@realm}/protocol/openid-connect/auth\"\n end", "def get_request_auth_code_url\n URI.encode(\"https://#{@subdomain}.zendesk.com/oauth/authorizations/new?response_type=code&redirect_uri=#{@redirect_uri}/&client_id=#{@unique}&scope=read%20write\")\n end", "def auth_for_url(url)\n self.hr_config.get_for_url(url, :auth)\n end", "def access_token_url\n Settings.lighthouse_health_immunization.access_token_url\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 get_ticket_granting_ticket\n if tgt_expired?\n # It's expired, so we're going to start this process by resetting the state\n clear_ticket_state\n\n response = RestClient.post(Rails.configuration.x.umls.umls_auth_base_url, { username: Rails.configuration.x.umls.username, password: Rails.configuration.x.umls.password })\n if response.code != 201 # expect a 201/Created response\n return nil\n end\n\n # The actual ticket response is a URL that we pull from the location. The body has an HTML form,\n # which we don't want to have to parse.\n @ticket_granting_ticket = response.headers[:location]\n @last_updated = Time.now.to_i\n end\n\n @ticket_granting_ticket\n end", "def authorizeAccess\n # Retrieve Request Token from WindowsLive and Re-Direct to WindowsLive for Authentication\n begin\n url = WindowsLiveSocialService.accessURL\n redirect_to url\n rescue\n errorMsg = \"Umable to retrieve Access URL\"\n flash[:error_description] = errorMsg\n redirect_to :action => :index\n end\n end", "def get_user_auth_url\n @oauth_token = request_oauth_token\n return @authorize_url + \"?oauth_token=\" + @oauth_token[\"oauth_token\"]\n rescue\n puts $! if @@verbose\n return nil\n end", "def url\n File.join(DigitalRiver.config.oauth_url)\n end", "def url\n File.join(DigitalRiver.config.oauth_url)\n end", "def get_authorize_url\n return get_request_token.authorize_url\n end", "def request_token_url\n @options[:request_token_url] || site + request_token_path\n end", "def get_request( server_url, request_url, user_name, user_token )\n a = Mechanize.new\n begin\n a.get(\"http://#{server_url}#{request_url}?user_name=#{ CGI::escape(user_name) }&user_token=#{ CGI::escape(user_token) }\")\n rescue\n puts $!\n end\n end", "def authorize_url\n @connection.authorize_url\n end", "def service_validate_url(service, ticket)\n service = service.sub(/[?&]ticket=[^?&]+/, '')\n url = append_service(@service_validate_url, service)\n url << '&ticket=' << Rack::Utils.escape(ticket)\n end", "def login_url(params,session)\n req_token = self.get_request_token\n session[:request_token] = req_token.token\n session[:request_token_secret] = req_token.secret\n self.authorize_url({:request_token => req_token.token, :request_token_secret => req_token.secret})\n end", "def request_login_ticket\n uri = URI.parse(login_url+'Ticket')\n https = Net::HTTP.new(uri.host, uri.port)\n https.use_ssl = (uri.scheme == 'https')\n https.verify_mode = (@force_ssl_verification ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE)\n res = https.post(uri.path, ';')\n \n raise CASException, res.body unless res.kind_of? Net::HTTPSuccess\n \n res.body.strip\n end", "def get_auth_url(use_callback_flow=true)\n raise 'To be implemented in child classes'\n end", "def auth_workarounds(url)\n # crepeerase workaround\n if(url.include?('crepeerase') && url.include?('.grdev.'))\n env = url.scan(/.crepeerase.([^.]+)/).first.first\n @browser.driver.browser.get \"https://storefront:[email protected].#{env}.dw2.grdev.com\"\n end\n end", "def login_ticket\n LoginTicket\n end", "def beta_access_request(hacker)\n @hacker = hacker\n\n mail to: @hacker.email, subject: 'hackrLog() Beta Access Request.'\n end", "def getAuthUrl\n\t\t\t\tURI::HTTP.build(\n\t\t\t\t\t:host => @options['auth_host'],\n\t\t\t\t\t:path => @options['auth_page'],\n\t\t\t\t\t:query => {\n\t\t\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t\t\t:scope => @options['scope'],\n\t\t\t\t\t\t:response_type => \"code\",\n\t\t\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t\t}.to_query\n\t\t\t\t).to_s\n\t\t\tend", "def two_factor_otp_url\n \"otpauth://totp/%{app_id}?secret=%{secret}&issuer=%{app}\" % {\n :secret => current_user.unconfirmed_otp_secret,\n :app => \"Hammad\",\n :app_id => \"Ham\"\n }\n end", "def getlink(requireuserinfo=false,expirationdays=30,notifyondownload=false, maxdownloads=-1)\n end", "def fire_eagle_auth_url\n client = if fire_eagle_requested?\n requested_client\n else\n fire_eagle_request!\n end\n client.authorization_url \n end", "def getlink(requireuserinfo=false,expirationdays=30,notifyondownload=false, maxdownloads=-1)\n end", "def auth_for_url(url)\n self.hr_config.get_for_url(url, :auth)\n end", "def show\n authorize AccountingEntry\n end", "def bookkeeper_invitation_url(access)\n \"#{::AppConfig.mail.host}/access/#{access}\"\n end", "def get_authentication_url\n @wll.getConsentUrl(\"Contacts.Invite\")\n end", "def privly_URL\n \n privlyDataURL = Privly::Application.config.required_protocol +\n \"://\" +\n Privly::Application.config.link_domain_host +\n \"/posts/\" +\n self.id.to_s + \n \".json\"\n \n if self.random_token\n privlyDataURL += \"?random_token=\" + self.random_token\n end\n \n Privly::Application.config.required_protocol +\n \"://\" +\n Privly::Application.config.link_domain_host +\n \"/apps/\" + \n self.privly_application + \"/show?\" + \n self.url_parameters.to_query + \n \"&privlyDataURL=\" + ERB::Util.url_encode(privlyDataURL)\n end", "def getHookURL\n if !session[:user_id]\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n end\n\n #redirect_to :controller=>\"room\", :action=> 'registerHook' #, :params[:registerHook].url => url, :params[:registerHook].token=>token\n\n begin\n am = session[:am]\n acc = Account.find_by_username(session[:user_id])\n if(acc.nil?)\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n return\n end\n am.keepalive(acc.username, acc.password)\n result = am.getHookInfo()\n flash[:result] = \"getHookInfo result success: \" + result\n redirect_to :action => 'accountManager'\n rescue Exception => msg\n flash[:notice] = msg\n end\n end", "def login_url(params,session)\n self.authorize_url\n end", "def getTrustedLoginUrl\n secureurl + \"wlogin.srf\"\n end", "def requested_url\n raise \"URL could not be detected.\" unless @args[:request_args][:url]\n @args[:request_args][:url]\n end", "def iss_url\n session[:iss_url]\n end", "def invite_url(server: nil, permission_bits: nil)\n @client_id ||= bot_application.id\n\n server_id_str = server ? \"&guild_id=#{server.id}\" : ''\n permission_bits_str = permission_bits ? \"&permissions=#{permission_bits}\" : ''\n \"https://discord.com/oauth2/authorize?&client_id=#{@client_id}#{server_id_str}#{permission_bits_str}&scope=bot\"\n end", "def get_auth_url\n\t\tURI::HTTP.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:scope => @options['scope'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t}.to_query\n\t\t).to_s\n\tend", "def login_url(permission, frob=nil)\n if frob\n sig = api_sig(:api_key => @api_key, :perms => permission.to_s, :frob=> frob)\n url = \"#{@auth_endpoint}?api_key=#{@api_key}&perms=#{permission}&frob=#{frob}&api_sig=#{sig}\"\n else\n sig = api_sig(:api_key => @api_key, :perms => permission.to_s)\n url = \"#{@auth_endpoint}?api_key=#{@api_key}&perms=#{permission}&api_sig=#{sig}\"\n end\n url\n end", "def login_url(permission, frob=nil)\n if frob\n sig = api_sig(:api_key => @api_key, :perms => permission.to_s, :frob=> frob)\n url = \"#{@auth_endpoint}?api_key=#{@api_key}&perms=#{permission}&frob=#{frob}&api_sig=#{sig}\"\n else\n sig = api_sig(:api_key => @api_key, :perms => permission.to_s)\n url = \"#{@auth_endpoint}?api_key=#{@api_key}&perms=#{permission}&api_sig=#{sig}\"\n end\n url\n end", "def show\n authorize @bug\n end", "def token_url(user, ip, playback)\n auth_token = get_token(user, ip)\n if auth_token.present?\n uri = playback.url\n uri += URI.parse(uri).query.blank? ? \"?\" : \"&\"\n uri += \"token=#{auth_token}\"\n uri\n end\n end", "def dialogue_url\n return \"https://www.facebook.com/dialog/oauth?client_id=\"+@app_id+\"&redirect_uri=\"+@canvas_url+\"&scope=\"+@permission\n end", "def login_url(_params, _session)\n authorize_url\n end", "def login_url(url)\n return \"https://www.dopplr.com/api/AuthSubRequest?scope=#{CGI.escape(\"http://www.dopplr.com/\")}&next=#{CGI.escape(url)}&session=1\"\n end", "def add_credentials_to_agent_url(url)\n if url.starts_with? \"http://localhost:#{ZangZingConfig.config[:agent_port]}\"\n if ! url.include? '?'\n url += '?'\n end\n\n url += \"session=#{cookies[:user_credentials]}&user_id=#{current_user.id}\"\n\n end\n\n return url;\n end", "def authorization_url\n url = \"#{host}/OAuth2AccessRequest.action?response_type=code&client_id=#{@client_id}\"\n url += \"&redirect_uri=#{Addressable::URI.escape(@redirect_uri)}\" if @redirect_uri\n url += \"&state=#{@state}\" if @state\n url\n end", "def request_access_token\n # An `OAuth::Consumer` object can make requests to the service on\n # behalf of the client application.\n\n # Ask service for a URL to send the user to so that they may authorize\n # us.\n request_token = CONSUMER.get_request_token\n authorize_url = request_token.authorize_url\n\n # Launchy is a gem that opens a browser tab for us\n Launchy.open(authorize_url)\n\n # Because we don't use a redirect URL; user will receive a short PIN\n # (called a **verifier**) that they can input into the client\n # application. The client asks the service to give them a permanent\n # access token to use.\n puts \"Login, and type your verification code in\"\n oauth_verifier = gets.chomp\n access_token = request_token.get_access_token(\n :oauth_verifier => oauth_verifier\n )\nend", "def auth_url\n raise Me2day::Error::ClientError.new unless options[:application_key]\n connection.get(\"/api/get_auth_url.json\") do |request|\n request.headers[:me2_application_key] = options[:application_key]\n end.env[:body][:url]\n rescue Faraday::Error::ClientError\n raise Me2day::Error::ClientError\n end", "def access_denied\n\n end", "def url\n raise\n end", "def get_authurl\n\t\tlogger.debug \"D, #{__method__.to_s}\"\n\t\tparams = {\n \"client_id\" => @client_id,\n \"response_type\" => \"code\",\n \"redirect_uri\" => @redirect_uri,\n \"prompt\" => \"consent\"\n }\n auth_uri = URI::Generic.new(\"https\", nil, @auth_url, nil, nil, \"authorize\", \n \t\t\t\t\t\t\t nil, nil, nil)\n auth_uri.query = URI.encode_www_form(params)\n logger.debug \"D, #{__method__.to_s}, #{auth_uri.to_s}\"\n return auth_uri.to_s\n\tend", "def request_authorization\n create_ticket\n verify_resource_owner or return\n render_authorize_form\n end", "def access_denied\n end", "def caller_url\n nil\n end", "def tab_url\n Rails.application.config.tab_user_url\n end", "def get_otp_url_and_token url, body = {}\n # We need to use the &block in order to not raise exception of the 428 required for the 2FA\n response = RestClient.post(url, body.to_json, headers(@token)){|response, request, result| response }\n parsed_response = JSON.parse(response)\n if parsed_response[\"result\"][\"code\"] == 428\n data = parsed_response[\"data\"]\n [\"#{data[\"otp_url\"]}?ticket=#{data[\"ticket\"]}&back_url=#{Settings.bbva.otp_back_url}\", data[\"token\"]]\n else\n raise Bbva::Api::Market::Error::BbvaTypeException.new(\"#{parsed_response[\"result\"][\"code\"]}\")\n end\n end", "def ticket\n @ticket ||= @api.get_ticket['ticket']\n end", "def request_access(_team)\n # stub\n end", "def craft_url(user=nil,session=nil,return_to=\"http://www.instructure.com\")\n logger.debug \"calling craft url in wiziq_conference\"\n user ||= self.user\n initiate_conference and touch or return nil\n if (user == self.user || self.grants_right?(user,session,:initiate))\n admin_join_url(user, return_to)\n else\n participant_join_url(user, return_to)\n end\n end", "def show\n Labtech.get_token\n @last_ticket = Labtech.last_labticket\n end", "def authorization_url\n\t\t@client ||= api_client()\n\t\[email protected]_uri.to_s\n\tend", "def url_for_offering(offering, user, protocol, host, additional_params = {})\n grant = client.updated_grant_for(user, ReportTokenValidFor)\n if user.portal_teacher\n grant.teacher = user.portal_teacher\n grant.save!\n end\n url_options = {protocol: protocol, host: host}\n\n params = offering_report_params(offering, grant, user, url_options, additional_params)\n\n if offering.runnable.logging || offering.clazz.logging\n params[:logging] = 'true'\n end\n\n if allowed_for_students && user.portal_student\n params[:studentId] = user.id\n learner = Portal::Learner.where(offering_id: offering.id, student_id: user.portal_student.id).first\n if learner\n grant.learner = learner\n grant.save!\n end\n end\n\n add_query_params(url, params)\n end", "def authorize_url\n client.web_server.authorize_url( :redirect_uri => callback_url )\n end", "def get_authorization_url\n $LOG.i \"requesting authorization URL\"\n \n @oauth2_client.auth_code.authorize_url(:redirect_uri => @config.redirect_uri)\n end", "def show\n gon.problem_id = params[:id]\n @brainstorm_url = \"http://#{params[:id]}.discourse.gotong.royong.org/session/sso?return_path=%2F\"\n end", "def ticket\n end", "def request_email ucr\n extract_variables ucr\n @url = accept_change_request_url(ucr.token)\n\n mail to: @user.email\n end", "def my_account_url\n get_institution_or_default(:eshelf_url) + '/account'\n end", "def authorize_url(params = {})\n super\n .tap { |result| __ext_debug(\"--> #{result.inspect}\") }\n end", "def auth_url\n MiniFB.oauth_url(@app_id, @redirect_to,\n :scope => 'user_about_me') # See MiniFB.scopes\n end", "def temp_auth\n request_token = get_consumer.get_request_token(:oauth_callback => request.url.chomp(\"temp_auth\").concat(\"callback\"))\n # evernote returns a temp token and secret. save these somewhere for later\n flash[:request_token] = request_token.token\n flash[:request_secret] = request_token.secret\n # evernote also returned a url that app should direct to\n # in order for user to sign in and authorize the app\n redirect_to request_token.authorize_url\n end", "def signed_get_request url\n token=jwt_get_signature url\n HTTParty.get('http://localhost:5000'+url,\n headers:{\n \"Authorization\"=>\"JWT token=\\\"#{token}\\\"\",\n \"Content-Type\"=> \"application/json;charset=utf-8\"\n }\n )\n end", "def access_control\n \n end", "def credentials_for(uri, realm); end", "def login_url\n generate_login_token unless login_token.present?\n ENV['RESERVE_URL'] + '/sign-in/' + login_token\n end", "def hockeyapp_jira_link(issue, hockeyapp_url)\n hockeyapp_api_url = get_hockeyapp_api_url(hockeyapp_url)\n\n #curl -F \"status=0\" -F \"ticket_url=#{site}/browse/#{issue.key}\" -H \"X-HockeyAppToken: #{hockeyapp_token}\" hockeyapp_api_url\n c = Curl::Easy.http_post(\"#{hockeyapp_api_url}\",\n Curl::PostField.content('status', '0'),\n Curl::PostField.content('ticket_url', \"#{config.jira.site}/browse/#{issue.key}\")) do |curl|\n curl.headers['X-HockeyAppToken'] = \"#{config.jira.hockeyapp_token}\"\n end\n c.perform\n end", "def show\n authorize @labor_request\n end", "def link\n BASE_URL + (private? ? \"/private/#{@key}\" : \"/#{@id}\")\n end", "def call_authorization_issue_api(ticket, subject, authTime)\n return call_api(\"/api/auth/authorization/issue\", {\n \"ticket\" => ticket,\n \"subject\" => subject,\n \"authTime\" => authTime\n })\nend", "def when_i_submit_bad_url\n given_i_am_signed_in\n # shouldn't get to the stage of finding\n submit_url 'http://thisisspam.com/fake-viagra.html'\nend", "def show\n #@cost_setup = CostSetup.find(params[:id])\n authorize User\n end", "def url\n @client.url + self.class.path + @username\n end", "def activation_url\n return @activation_url\n end", "def restrict_access\n # check if the request has an API key as part of it...\n end", "def token_url\n \"#{sk_url}/oauth/token\"\n end", "def authenticate_url(url)\n\t\turi = URI(url)\n\t\thost = uri.host\n\n\t\t# Finding a file wth credentials\n\t\tcredential_files = File.expand_path(File.join('~/.oroshi/private/config/kingdoms', host))\n\t\tunless File.exists?(credential_files)\n\t\t\treturn url\n\t\tend\n\n\t\turi.user, uri.password = File.read(credential_files).chomp.split(':')\n\t\treturn uri.to_s\n\tend", "def execution_url\n requires :links\n link = links.find { |l| l['rel'] == 'capability' }\n link['href'] rescue nil\n end" ]
[ "0.651323", "0.6467971", "0.6085203", "0.59566504", "0.5899129", "0.5825089", "0.5794034", "0.5776688", "0.5722772", "0.5674709", "0.56465447", "0.55992997", "0.55683047", "0.553173", "0.55183744", "0.551487", "0.5508205", "0.5488246", "0.5488153", "0.5484821", "0.5438981", "0.5434389", "0.5424154", "0.539857", "0.5383133", "0.5362864", "0.5360621", "0.5321694", "0.5301372", "0.5300286", "0.52956283", "0.52861786", "0.5276047", "0.52757984", "0.52679306", "0.5260441", "0.5252482", "0.52486384", "0.5239407", "0.52375644", "0.52319896", "0.5230522", "0.5230184", "0.52250856", "0.52177805", "0.5199205", "0.519321", "0.5191383", "0.51895404", "0.51873577", "0.51803106", "0.51803106", "0.51664066", "0.51630026", "0.515773", "0.5153035", "0.5150969", "0.51487523", "0.5146635", "0.5146215", "0.5143023", "0.5139182", "0.51362675", "0.5135907", "0.5135564", "0.51341844", "0.5132337", "0.51301014", "0.512452", "0.5121617", "0.5120203", "0.5117316", "0.51124024", "0.5099211", "0.509427", "0.5089669", "0.5085404", "0.5082885", "0.5082499", "0.50809336", "0.5074525", "0.5067172", "0.50667906", "0.5063046", "0.50620025", "0.50571316", "0.50547516", "0.50544", "0.5050156", "0.5049531", "0.5046106", "0.5041929", "0.50358796", "0.5033598", "0.5031715", "0.50309616", "0.5028701", "0.5028565", "0.5013563", "0.50119305" ]
0.6891978
0
Attempt to authorize this account using the given auth token. This will only succeed if the auth token has been used before, and be done to make login easier.
def authorize_token(auth_token) cache_token(auth_token) info(true) # force a refresh authorized? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize\n\n @token = ::RequestToken.find_by_token params[:oauth_token]\n\n unless @token\n render :action=>\"authorize_failure\"\n return\n end\n\n unless @token.invalidated?\n if request.post?\n if params[:authorize] == '1'\n @token.authorize!(current_person)\n if @token.oauth10?\n @redirect_url = params[:oauth_callback] || @token.client_application.callback_url\n else\n @redirect_url = @token.oob? ? @token.client_application.callback_url : @token.callback_url\n end\n\n if @redirect_url\n if @token.oauth10?\n redirect_to \"#{@redirect_url}?oauth_token=#{@token.token}\"\n else\n redirect_to \"#{@redirect_url}?oauth_token=#{@token.token}&oauth_verifier=#{@token.verifier}\"\n end\n else\n render :action => \"authorize_success\"\n end\n elsif params[:authorize] == \"0\"\n @token.invalidate!\n render :action => \"authorize_failure\"\n end\n end\n else\n render :action => \"authorize_failure\"\n end\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n user = User.find_by(access_token: auth_token)\n\n fail AccessDenied unless user\n\n @current_user = user\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n # else\n # authentication_error\n end\n end", "def authorize(token)\n url_encoded_connection.authorization :Bearer, token\n json_encoded_connection.authorization :Bearer, token\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authenticate_error\n end\n end", "def authorize(authcode)\n\t\[email protected] = authcode\n\t\[email protected]_access_token!\n\t\[email protected]_token\n\tend", "def authenticate_token!\n return render_error(\"Problem with Authentication Token\",401, 401) unless Token.find_by(access_token: params[:access_token])\n end", "def authenticate_user_from_token!\n raise AuthorizationError unless http_auth_token.present?\n result = find_user\n raise BadRequestError, result.errors if result.failure?\n @current_user = result.current_user\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end", "def authorize(auth = {})\n @authentication ||= TaskMapper::Authenticator.new(auth)\n auth = @authentication\n if auth.server.blank? and auth.token.blank?\n raise \"Please you should provide server and token\"\n end\n\n RedmineAPI.authenticate(auth.server, auth.token)\n end", "def authorize!\n api_key = ApiKey.find_by_access_token(params[:access_token])\n head :unauthorized unless api_key\n return false\n end", "def authorise!\n begin\n response = Birdman::Requester.post(\"oauth/token\", {}, {\n :client_id => \"#{client_id}\",\n :client_secret => \"#{client_secret}\",\n :grant_type => \"client_credentials\"\n })\n self.access_token = response.access_token\n true\n rescue Birdman::Exception::Api\n self.access_token = nil\n false\n end\n end", "def authorized\n if !decode_token\n render json: {message: \"Please Sign In\"}, status: :unauthorized\n end\n end", "def authorize\n unless params[:token] == Rails.configuration.api_token\n return render(plain: \"Unauthorized API token\\n\", status: :unauthorized)\n end\n end", "def authenticate\n authorize || unauthorized\n end", "def authorize!\n redirect to(\"/login?to=#{request.path}\", true, false) unless has_auth?\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n client_id = request.headers['Client-ID']\n\n if auth_token\n authenticate_with_auth_token(auth_token, client_id)\n else\n authentication_error\n end\n end", "def check_auth_token\n token = decoded_auth_token\n render json: { error: 'Not Authorized' }, status: :unauthorized unless token\n end", "def authorize(auth = {})\n auth = @authentication ||= TaskMapper::Authenticator.new(auth)\n\n if auth[:username].blank? && auth[:email].blank?\n message = \"Please provide a username or email.\"\n raise TaskMapper::Exception.new message\n end\n\n if auth[:token].blank? && auth[:password].blank?\n message = \"Please provide a token or password.\"\n raise TaskMapper::Exception.new message\n end\n\n username = (auth[:username].blank? ? auth[:email] : auth[:username])\n password = (auth[:token].blank? ? auth[:password] : auth[:token])\n\n KanbanpadAPI.authenticate username, password\n end", "def authorize(req_token, given_num)\n # Clean up tokens\n #clean_tokens()\n begin\n rows = @db.execute(\"SELECT * FROM request_tokens WHERE request_token=?\", req_token)\n rescue\n puts \"Failed to find request token: #{$!}\"\n return false\n end\n req_secret = rows[0][2]\n begin\n puts \"Authorizing #{req_token} #{req_secret} #{given_num}\"\n @oauth.authorize_from_request(req_token, req_secret, given_num)\n rescue\n puts \"Failed to authorize user #{$!}\"\n return false\n end\n # If it works, save off the data.\n puts \"OMFG it works.\"\n acct = Twitter::Base.new(@oauth)\n begin\n profile = acct.verify_credentials\n @db.execute( \"INSERT INTO users VALUES (NULL,?,?,?,?)\",\n profile.name, given_num, @oauth.access_token.token, @oauth.access_token.secret)\n rescue Exception => e\n if e.class == SQLite3::SQLException \n # We already have this user!\n puts \"User #{profile.name} already has credentials\"\n else\n puts \"Failed to insert user #{profile.name}: #{$!}, #{e.class}\"\n return false\n end\n end\n acct\n end", "def authorize!\n response = till_response { send_raw_request(authorization_params) }\n raise AuthenticationError.new(\"Could not authenticate with Zabbix API at #{uri}: #{response.error_message}\") if response.error?\n raise AuthenticationError.new(\"Malformed response from Zabbix API: #{response.body}\") unless response.string?\n @auth = response.result\n end", "def authenticate!\n error!(\"401 Unauthorized\", 401) unless check_auth_token \n end", "def authorize!\n redirect '/auth' unless authorized?\n end", "def authenticate_token\n render_401 if @token.blank? || [email protected]?\n end", "def use_token!(token)\n @client = @client.merge(:token => token)\n\n self.connect!(@client[:token])\n\n authorized?\n end", "def authorize(token, token_secret)\n\t\t\t@access_token = OAuth::AccessToken.new(@client, token, token_secret)\n\t\tend", "def authorize!\n response = auth_connection.post(\n \"/api/v1/access_token\",\n grant_type: \"password\",\n username: @username,\n password: @password\n )\n\n @access = Access.new(response.body)\n reset_connection!\n end", "def ensure_auth_token\n unless self.auth_token\n self.auth_token = User.generate_token\n end\n end", "def authorize(auth = {})\n @authentication ||= TicketMaster::Authenticator.new(auth)\n auth = @authentication\n if (auth.server.blank? and auth.username.blank? and auth.password.blank?)\n raise \"Please you should provide server, username and password\"\n end\n RedmineAPI.authenticate(auth.server, auth.username, auth.password)\n end", "def authorize_request\n authenticate_with_http_token do |token, options|\n User.find_by(token: token)\n end\n end", "def authorize_request\n authenticate_with_http_token do |token, options|\n User.find_by(token: token)\n end\n end", "def authenticate_user_from_token!\n\t\t@api_token = ApiToken.find_by_token(params[:token])\n @user = @api_token.try(:user)\n if @user.nil?\n render json: { error: 'Not authorized' }, status: 401\n end\n end", "def authorize_request\n authenticate_with_http_token do |token, option|\n User.find_by(token: token)\n end\n end", "def authorize_request\n\t\tauthenticate_with_http_token do |token, options|\n\t\t\tUser.find_by(token: token)\n\t\tend\n\tend", "def authenticate\n authenticate_token || render_unauthorized\n end", "def token_auth(token=nil, options={})\n return @token_auth unless token\n @token_auth = [token, options]\n end", "def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n user = user_token && User.find_by_authentication_token(user_token.to_s)\n \n unless user\n render json: { errors: 'user must signed in' }, status: :unprocessable_entity\n end\n end", "def authenticate_user!\n return true if current_user\n # get token and options\n authenticate_or_request_with_http_token do |token, options|\n access_token = AccountAccessToken.where('token_value = ? AND expires > ?', token, Date.today).first\n if access_token\n sign_in access_token.account\n else\n unauthenticated!\n end\n end\n end", "def authenticate\n authenticate_token || render_unauthorized\n end", "def authenticate\n \n authenticate_token || render_unauthorized\n end", "def authenticate_request\n auth_header_token = request.headers[\"Authorization\"]\n @current_user = AuthorizeApiRequest.new(auth_header_token).call\n render json: { error: \"Not Authorized\" }, status: 401 unless @current_user\n end", "def grant_authorization\n create_verification_code if authorized?\n redirect_back\n end", "def authenticate_by_token(token)\n access_token = AccessToken.find_by(token: token)\n\n if access_token && access_token.validates?\n access_token.touch\n\n @user = access_token.user\n @token = access_token\n\n true\n else\n false\n end\n end", "def authenticate_user_from_token\n unless authenticate_with_http_token { |token, options| User.find_by(auth_token: token) }\n render json: { error: 'Bad Token'}, status: 401\n end\n end", "def authorize\n credentialsFile = FILE_POSTFIX\n\n if File.exist? credentialsFile\n File.open(credentialsFile, 'r') do |file|\n credentials = JSON.load(file)\n @authorization.access_token = credentials['access_token']\n @authorization.client_id = credentials['client_id']\n @authorization.client_secret = credentials['client_secret']\n @authorization.refresh_token = credentials['refresh_token']\n @authorization.expires_in = (Time.parse(credentials['token_expiry']) - Time.now).ceil\n if @authorization.expired?\n @authorization.fetch_access_token!\n save(credentialsFile)\n end\n end\n else\n auth = @authorization\n url = @authorization.authorization_uri().to_s\n server = Thin::Server.new('0.0.0.0', 8081) do\n run lambda { |env|\n # Exchange the auth code & quit\n req = Rack::Request.new(env)\n auth.code = req['code']\n auth.fetch_access_token!\n server.stop()\n [200, {'Content-Type' => 'text/html'}, RESPONSE_HTML]\n }\n end\n\n Launchy.open(url)\n server.start()\n\n save(credentialsFile)\n end\n\n return @authorization\n end", "def authorize\n @credentials = authorizer.get_credentials(user_id)\n if @credentials.nil? || @credentials.expired?\n raise CalendarBot::AuthorizationError\n end\n\n @credentials\n end", "def authorize!(current_user)\n @authorized = false\n oauth_drive_token = OauthDriveToken.get_provider_for(current_user, APP_CONFIG['oauth']['google']['provider_number'])\n if oauth_drive_token.present?\n # Set details\n @client.authorization.access_token = oauth_drive_token.access_token\n @client.authorization.refresh_token = oauth_drive_token.refresh_token\n @client.authorization.client_id = oauth_drive_token.client_number\n\n if oauth_drive_token.expires_at < Time.now\n # Present but expired, attempt to refresh\n @authorized = true if self.refresh_token(oauth_drive_token)\n elsif self.current_token_still_valid?\n @authorized = true\n else\n # Not valid so destroy it and prompts for re-auth\n oauth_drive_token.destroy\n end\n end\n end", "def authenticate_with_token\n # get the token from the header\n # get the token from the post body\n # get the token from json post\n \n token = request.headers[\"HTTP_AUTHORIZATION\"]\n \n if (!token)\n if (not_protected self.controller_name, self.action_name)\n return nil\n end\n\n redirect_to controller: 'application', action: 'index' \n end\n\n #@user = get_user_by_token(token)\n end", "def authenticate\n unless FfcrmVend.config.token == params[:token]\n render :text => \"\", :status => :unauthorized\n end\n end", "def authorize(oauth_verifier)\n @access_token = request_access_token(oauth_verifier)\n @authorized = true\n return true\n rescue\n puts $! if @@verbose\n return false\n end", "def authenticate\n # if valid_access_token?\n # fetch_access_token\n # else\n get_new_access_token\n # end\n end", "def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n if user_token\n user = User.where(authentication_token: user_token.to_s).first\n if user\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n else\n render status: 401, json: {success: false, error: \"invalid token\" }\n end\n end\n end", "def authorize\n (render :json => { :error => \"Authentication error\" }, :status => :unauthorized and return) unless User.current.present?\n authorized ? true : deny_access\n end", "def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n user = user_token && User.find_by_authentication_token(user_token.to_s)\n\n if user\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n end\n end", "def authorize!\n\t\t\tredirect '/login' unless authorized?\n\t\tend", "def authenticate\n api_key = parse_auth_token(request.headers['HTTP_AUTHORIZATION'])\n return user_not_authorized if api_key.nil?\n @real_user = User.find_by(api_key: parse_auth_token(request.headers['HTTP_AUTHORIZATION']))\n user_not_authorized if @real_user.nil?\n end", "def authenticate_token\n authenticate_with_http_token do |token, options|\n @current_user = User.find_by(token: token)\n @current_user\n end\n end", "def authorize\n @user = User.find_by_id_and_multitrack_token(params[:user_id], params[:token])\n head(@user ? :ok : :forbidden)\n end", "def verify_auth_token\n token = params[:auth_token]\n if token.nil?\n render_json_response(400, \"Authorization token needed\")\n return\n end\n\n user = User.find_by_authentication_token(token)\n if user.nil?\n render_json_response(401, \"Bad token\")\n return\n end\n\n @user = user\n end", "def authenticate_token\n render json: {message: \"Unauthorized\"}, status: 401 unless decode_token(bearer_token)\n end", "def try_authorize\n authorize = Authorize.new(config, settings)\n authorize.configure\n end", "def authorize\n puts \"********** current user app controller *****************\"\n puts @current_user\n puts current_user\n puts '*********************************************************'\n # NOTE: to self: current_user method is called, it then decodes the JSON WEB Token,\n # grabs the user_id, and uses that id to make a query to find the user that matches that id and returns it. Then on that returned user we do a .id to get the id and compare it to the parameter :id\n\n render json: {status: 401, message: \"unauthorized\"} unless current_user.id == params[:id].to_i\n end", "def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n user = user_token && User.find_by_authentication_token(user_token.to_s)\n \n if user\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n end\n end", "def check_authorization\n authorization_token = cookies[:authorization_token]\n if authorization_token and not logged_in?\n user = User.find_by_authorization_token(authorization_token)\n user.login!(session) if user\n end\n end", "def authorize!(message = \"\")\n error!( message.presence || 'not authorized', 400) unless current_user.present?\n end", "def authorize\n client_id = Google::Auth::ClientId.from_file(self.credentials_path)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: self.token_path)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPES, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end", "def check_authorization\n authorization_token = cookies[:authorization_token]\n if authorization_token and not logged_in?\n user = User.find_by_authorization_token(authorization_token)\n user.log_in!(session) if user\n end\n end", "def check_authorization\n authorization_token = cookies[:authorization_token]\n if authorization_token and not logged_in?\n user = User.find_by_authorization_token(cookies[:authorization_token])\n user.login!(session) if user\n end\n end", "def authenticate!\n Authenticator.verify!(params['token'])\n end", "def authorize\n if not params[:oauth_token] then\n dbsession = DropboxSession.new(APP_KEY, APP_SECRET)\n\n session[:dropbox_session] = dbsession.serialize #serialize and save this DropboxSession\n\n #pass to get_authorize_url a callback url that will return the user here\n redirect_to dbsession.get_authorize_url url_for(:action => 'authorize')\n else\n # the user has returned from Dropbox\n dbsession = DropboxSession.deserialize(session[:dropbox_session])\n # This will fail if the user didn't visit the above URL and hit 'Allow'\n dbsession.get_access_token #we've been authorized, so now request an access_token\n session[:dropbox_session] = dbsession.serialize\n \n redirect_to drop_all_files_path\n\t\tend\n\tend", "def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end", "def enforce_requested_account_authorized!\n clear_authorization! unless requested_account_authorized?\n end", "def ensure_auth_token!\n reset_auth_token! if auth_token.blank?\n end", "def authenticate_user_from_token\n unless authenticate_with_http_token { |token, options| User.find_by(api_token: token) }\n render json: { error: 'Bad Token'}, status: 401\n end\n end", "def token_auth(token, options = nil)\n set_authorization_header(:token_auth, token, options)\n end", "def authorize\n render :text => \"Authorization error\", :status => 401\n false\n end", "def check_authorization\n authorization_token = cookies[:authorization_token]\n if authorization_token and not logged_in?\n user = User.find_by_authorization_token(authorization_token)\n user.login!(session) if user\n end\n end", "def authenticate_user\n if not params.has_key?(:auth_token)\n failure\n return\n end\n @current_user = User.find_by_authentication_token(params[:auth_token])\n # Adding the conditional to throw json error\n unless @current_user\n failure\n end\n end", "def complete_authentication(token)\n raise \"This object is no longer usable because its resources have been freed.\" if @cleaned_up\n\n # Nil token OK, just set it to empty string\n token = \"\" if token.nil?\n\n if token.include? \"Negotiate\"\n # If the Negotiate prefix is passed in, assume we are seeing \"Negotiate <token>\" and get the token.\n token = token.split(\" \").last\n end\n\n if token.include? B64_TOKEN_PREFIX\n # indicates base64 encoded token\n token = token.strip.unpack(\"m\")[0]\n end\n\n outputBuffer = SecurityBuffer.new\n result = SSPIResult.new(API::InitializeSecurityContext.call(@credentials.to_p, @context.to_p, nil,\n REQUEST_FLAGS, 0, SECURITY_NETWORK_DREP, SecurityBuffer.new(token).to_p, 0,\n @context.to_p,\n outputBuffer.to_p, @contextAttributes, TimeStamp.new.to_p))\n\n if result.ok? then\n @auth_successful = true\n return encode_token(outputBuffer.token)\n else\n raise \"Error: #{result.to_s}\"\n end\n ensure\n # need to make sure we don't clean up if we've already cleaned up.\n # XXX - clean up later since encrypt/decrypt needs this\n # clean_up unless @cleaned_up\n end", "def authorize\n params[:access_token] ||= params[:oauth_token]\n super\n end", "def authenticate_token\n authenticate_with_http_token do |token, options|\n token == 'ABC'\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_request\n @current_user = AuthorizeApiRequest.call(request.headers).result\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end", "def authenticate\n authenticate_or_request_with_http_token do |token, options|\n authenticate_token || render_error('INVALID_AUTHENTICATION_TOKEN')\n end\n end", "def authorize\n oauth_verifier = params[:oauth_verifier]\n request_token = session[:request_token]\n access_token = request_token.get_access_token(:oauth_verifier => oauth_verifier)\n \n user = User.login(access_token)\n session[:user] = user.id unless user.nil?\n redirect_to :controller => :home\n end", "def authenticate_request\n if auth_token_expired?\n fail AuthenticationTimeoutError\n elsif !@current_user\n render json: { error: \"401\" }, status: :unauthorized\n end\n end", "def check_token\n input_token = request.headers['X-Auth-Token'] || params[:token]\n return unless input_token\n\n token = AuthenticationToken.find_by(token: input_token)\n return unless token\n\n # Count token usage\n token.inc(number_of_use: 1)\n # Update the updated_at because inc doesn't do it\n token.set(updated_at: Time.now.getlocal)\n\n # Sign in\n sign_in token.user\n end", "def authorize(auth = {})\n @authentication ||= TaskMapper::Authenticator.new(auth)\n auth = @authentication\n if (auth.account.nil? and auth.username.nil? and auth.password.nil?)\n raise \"Please provide at least an url (subdomain), username and password)\"\n end\n ZendeskAPI.authenticate(auth.account, auth.username, auth.password)\n end", "def authorize(user,pass)\n @uri.path += 'auth'\n @uri.query = \"user=\" + user + \"&pass=\" + pass\n response = @caller.request_get(@uri)\n raise RestApiCallerError::AuthorizationError unless response.code == '200'\n @token = JSON.parse(response.body)[\"token\"]\n raise RestApiCallerError::AuthorizationError unless @token\n end", "def set_auth_token\n return if auth_token.present?\n self.auth_token = generate_auth_token\n end", "def authenticate_token\n authenticate_with_http_token do |token, options|\n User.find_by(auth_token: token)\n end\n end", "def require_auth\n (authorized? && authenticated?) || halt(401)\n end", "def activate_with_token(auth_token)\n result = call_method(\"auth.getSession\", {:auth_token => auth_token})\n if result != nil\n @session_uid = result.at(\"uid\").inner_html\n @session_key = result.at(\"session_key\").inner_html\n @session_expires = result.at(\"expires\").inner_html\n end\n end", "def authorize(money, card, options = {})\n # Ignore params for basic_auth\n init.basic_auth\n end", "def authorize\n client_id = Google::Auth::ClientId.from_file(@credentials_path)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: @token_path)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, @scope, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: @oob_uri)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: @oob_uri\n )\n end\n credentials\n end", "def authenticate_request\n @current_user = AuthorizeApiRequest.call(request.headers).result\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end", "def authorize # we can call it anything\n redirect_to '/login' unless current_user # if there is a current user then it will never redirect\n end", "def authorize\n if session[:dc_access_token].nil? or session[:dc_address_for_token] != session[:dc_address] then\n session[:dc_address_for_token] = session[:dc_address]\n redirect \"#{settings.FQDN}/oauth/authorize?client_id=#{settings.api_key}&scope=DC&redirect_uri=#{settings.redirect_url}\"\n else\n redirect '/getDeviceCapabilities'\n end\nend", "def authorize\n if @api_user\n authorize_user\n else\n authorize_unauthenticated_user\n end\n end" ]
[ "0.70520884", "0.6610563", "0.65867585", "0.65845394", "0.65703416", "0.6561077", "0.65509355", "0.65281504", "0.65196365", "0.65196365", "0.6414323", "0.63977224", "0.63831234", "0.6379087", "0.63499117", "0.6337506", "0.6337222", "0.6332776", "0.6331907", "0.63183427", "0.6300317", "0.6257663", "0.62511677", "0.6247604", "0.62403125", "0.6237773", "0.6234119", "0.6202376", "0.61929274", "0.61854416", "0.6179623", "0.61792815", "0.6162496", "0.6158225", "0.6153247", "0.61506015", "0.6137388", "0.61235666", "0.6111304", "0.61025655", "0.6102478", "0.6097568", "0.6091425", "0.60910803", "0.6076954", "0.6057179", "0.60510594", "0.60258293", "0.6020536", "0.6013738", "0.60124767", "0.60085106", "0.6002738", "0.5991508", "0.5987628", "0.5986664", "0.59763753", "0.5974177", "0.59706616", "0.59672314", "0.59668505", "0.59639806", "0.5959303", "0.59557766", "0.5950113", "0.59485245", "0.59202373", "0.5918089", "0.5916216", "0.5909608", "0.5906657", "0.5889342", "0.5889084", "0.5884509", "0.5883761", "0.58784693", "0.58779037", "0.58647287", "0.58567953", "0.5848813", "0.58411986", "0.5838392", "0.5836785", "0.58350337", "0.58284533", "0.5820984", "0.5806829", "0.58062434", "0.5805432", "0.5804179", "0.5799256", "0.57949847", "0.5793851", "0.57924634", "0.57892287", "0.57886547", "0.57847726", "0.5783638", "0.5780989", "0.5769155" ]
0.73615277
0
Use and cache the given auth token.
def cache_token(auth_token) @api.set_auth_token(auth_token) @auth_token = auth_token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_auth_token_cache(auth_token, raw_token)\n Authentication::RedisStore.instance.set(auth_token, raw_token)\n end", "def token\n Rails.cache.read(AUTH_TOKEN_CACHE_KEY) || retrieve_token!\n end", "def set_auth_token\n return if auth_token.present?\n self.auth_token = generate_auth_token\n end", "def auth_token\n return regenerate_auth_token if expired?\n\n authentication.auth_token\n end", "def set_auth_token\n @auth_token = AuthToken.find(params[:id])\n end", "def set_auth_token\n @auth_token = AuthToken.find(params[:id])\n end", "def token\n begin\n self.token = SecureRandom.hex\n end while self.class.exists?(token: auth_token)\n end", "def retrieve_token!\n body = request_token\n # Refresh our token early so that it won't expire while a request is in-flight. We expect 15m\n # expirys for tokens but are careful not to trim the expiry by too much, just in case\n expires_in = body['expires_in'].seconds\n if expires_in - AUTH_TOKEN_PREEMPTIVE_EXPIRY_MINUTES > 0\n expires_in -= AUTH_TOKEN_PREEMPTIVE_EXPIRY_MINUTES\n end\n token = \"#{body['token_type']} #{body['access_token']}\"\n Rails.cache.write(AUTH_TOKEN_CACHE_KEY, token, expires_in: expires_in)\n token\n end", "def authorize_token(auth_token)\n cache_token(auth_token)\n info(true) # force a refresh\n\n authorized?\n end", "def refresh_auth_token\n generate_token(:auth_token)\n save!\n end", "def access_token\n # Synchronization is needed, otherwise race condition may ensue:\n # Let's assume token has expired, and two threads ask for a new token.\n # Both proceed to fetch the token from remote server, both return,\n # but the first token is no longer valid.\n MUTEX.synchronize do\n token = Nordea::Siirto.redis.get(KEY)\n return token if token\n\n Nordea::Siirto.log('Requesting new access token...')\n payload = response.body\n\n token = payload['access_token']\n expires_in = payload['expires_in'] - EXPIRATION_BUFFER\n Nordea::Siirto.redis.set(KEY, token)\n Nordea::Siirto.redis.expire(KEY, expires_in)\n\n token\n end\n end", "def auth_token=(auth_token)\n map_auth_token(DEFAULT_AUTH_TOKEN_KEY, auth_token)\n end", "def set_auth_token(token)\n @auth_token = token.to_s\n end", "def assign_authentication_token\n self.authentication_token = generate_authentication_token\n end", "def set_internal_token!\n self.token ||= generate_token\n end", "def ensure_auth_token\n unless self.auth_token\n self.auth_token = User.generate_token\n end\n end", "def token_auth(token=nil, options={})\n return @token_auth unless token\n @token_auth = [token, options]\n end", "def auth_token\n @auth_token ||= ActionController::HttpAuthentication::Token.token_and_options(request)\n end", "def set_token\n self.token = Digest::SHA2.hexdigest \"#{username}-#{lastvisitDate.to_i}\" if self.token.blank?\n end", "def request_token\n self.token = Pivotal::Client.fetch_token(email, password)\n end", "def auth_token\n @@auth_token\n end", "def set_token\n @token ||= request.env[\"omniauth.auth\"].credentials.token\n end", "def profile cached_token=token\n uri = URI.parse(\"https://anypoint.mulesoft.com/accounts/api/me\")\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = true\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field(\"Authorization\", \"Bearer #{cached_token}\")\n\n response = client.request(request)\n\n return JSON.parse(response.body)\n end", "def fresh_token\n refresh! if token_expired?\n access_token\n end", "def fresh_token\n refresh! if expired?\n access_token\n end", "def cache_refresh_token(config, token)\n File.write(config.refresh_token_filename, token)\n end", "def access_token\n # Fetch from cache. We can expect this to be `nil` if unset or expired.\n #\n access_token = read_cache\n\n return access_token if access_token\n\n fetch_new_access_token\n end", "def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end", "def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end", "def token\n auth_client.token(settings.oauth2_token).tap do |token|\n settings.save_oauth2_token(token.to_hash)\n end\n end", "def refreshToken\n # is there a token? (and is it's timestamp not older than 24h?)\n if @token.nil? or @tokenTimeStamp < Time.now - 86400\n @token = getToken(@email,@password)\n @tokenTimeStamp = Time.now\n end\n end", "def authenticate!\n if !authenticated?\n response = request_token\n\n @token = response[\"token\"]\n @expires_at = DateTime.parse(response[\"expires_at\"])\n end\n\n [@token, @expires_at]\n end", "def fetch\n response = request.post(path: \"/#{base_path}/token\", claims_token: claims_token.static)\n\n self.access_token = Oj.load(response.body)['token']\n self\n end", "def cached_access_token(config)\n File.read(config.access_token_filename).chomp\n end", "def save_token\n self.token ||= Digest::MD5.hexdigest(login + Time.now.to_i.to_s)[0..5]\n $redis.set \"#{KEY}:#{login}:token\", token\n $redis.set \"#{KEY}:#{token}:login\", login\n end", "def oauth_token=(t)\n self.clear_cached_connection if self.cached_connection?\n @oauth_token = t\n end", "def fetch_token_details\n @token = @token_details.formatted_cache_data\n success\n end", "def auth_token\n auth_token_for(DEFAULT_AUTH_TOKEN_KEY)\n end", "def token\n @token ||= options[:token] || TokenFetcher.fetch\n end", "def token\n refresh_token! if token_expired?\n super\n end", "def set_token\n self.token ||= encrypted_data\n end", "def set_account_cache(account, raw_token)\n Authentication::RedisStore.instance.json_set(raw_token, data_to_cache(account))\n return {raw_token => data_to_cache(account)}\n end", "def token\n @@token ||= fetch_token\n end", "def auth_token(opts = {})\n get_config_auth_token() || create_authorization(opts)\n end", "def update_token\n client.authorization.update_token!(oauth_data)\n if client.authorization.refresh_token && client.authorization.expired?\n client.authorization.fetch_access_token!\n end\n end", "def set_session_details\n session = Authentication::Session.active_token_session(auth_token)\n session && set_account_cache(session.account, auth_token)\n end", "def generate_auth_token\n \tbegin\n \t\tself.auth_token = User.new_token\n \tend while self.class.exists?(auth_token: auth_token)\n end", "def regenerate_auth_token\n new_token = oauth.exchange_access_token_info(authentication.auth_token)\n\n # Save the new token and its expiry over the old one\n authentication.update_attributes!(\n auth_token: new_token['access_token'],\n last_expires_at: authentication.expires_at,\n expires_at: Time.now + new_token['expires_in'].to_i,\n )\n\n authentication.auth_token\n end", "def authenticate_token\n authenticate_with_http_token do |token, options|\n @current_user = User.find_by(token: token)\n @current_user\n end\n end", "def http_auth_token\n\n @http_auth_token ||= if request.headers.present?\n request.headers[\"HTTP_AUTH_TOKEN\"]\n end\n end", "def store_token\n user_config.set :pivotal_token, token\n end", "def generate_authentication_token!\n begin\n self.auth_token = SecureRandom.hex(20)\n end while self.class.exists?(auth_token: auth_token)\n end", "def reset_auth_token\n self.auth_token = generate_token(:auth_token)\n end", "def authenticate\n authenticate_or_request_with_http_token do |token _options|\n @current_user = User.find_by token: token\n end\n end", "def update_token(param)\n pass = param[:password]\n token = param[:access_token]\n\n return unless self.valid_password?(pass)\n\n self.update(access_token: token)\n end", "def ensure_authentication_token\n self.authentication_token ||= generate_authentication_token\n end", "def check_token\n input_token = request.headers['X-Auth-Token'] || params[:token]\n return unless input_token\n\n token = AuthenticationToken.find_by(token: input_token)\n return unless token\n\n # Count token usage\n token.inc(number_of_use: 1)\n # Update the updated_at because inc doesn't do it\n token.set(updated_at: Time.now.getlocal)\n\n # Sign in\n sign_in token.user\n end", "def cache(key, auth_object)\n auth_objects_cache[key] = auth_object\n end", "def authenticate_using_http_token\n return if current_user\n authenticate_with_http_token do |token_code, options|\n auth = Tokens::Api.authenticate token_code\n\n # NOTE: Setting the instance variable directly bypasses the session\n # setup. Tokens are generally used in API contexts, so the session\n # cookie would get ignored anyway.\n @current_user = auth unless auth.kind_of? Symbol\n end\n end", "def get_access_token\n auth = storage['authentication']\n return auth['access_token'] if auth && auth['expires'] > Time.now.to_i\n\n auth = authenticate_client\n storage['authentication'] = auth\n auth['access_token']\n end", "def update_auth_header\n # cannot save object if model has invalid params\n # @resource should == current_user\n return unless @resource && @resource.valid? && @client_id\n\n # Generate new client_id with existing authentication\n @client_id = nil unless @used_auth_by_token\n\n if @used_auth_by_token &&\n @resource.try(:tokens).present? &&\n ENV['ACCESS_TOKEN_LIFETIME'].to_i > 0\n\n # Get the token we are working with before reload (a simultaneous request could alter the valid token)\n original_token = @resource.tokens[@client_id].try(:fetch, 'token')\n\n @resource.reload\n\n # should not append auth header if @resource related token was\n # cleared by sign out in the meantime.\n return if @resource.tokens[@client_id].nil?\n\n token_created_at = Time.zone.at(@resource.tokens[@client_id]['created_at'])\n\n # If the token has not expired or changed and this is not a batch request, return it as a valid token.\n if @request_started_at < token_created_at + Integer(ENV['ACCESS_TOKEN_LIFETIME']) &&\n original_token == @resource.tokens[@client_id]['token'] &&\n !is_batch_request?(@resource, @client_id)\n\n return response.headers.merge!(@resource.build_auth_header(@token, @client_id))\n end\n end\n\n super\n end", "def create_set_and_add_token\n token = SecureRandom.urlsafe_base64\n @user.token = token\n response.headers['X-AUTH-TOKEN'] = token\n end", "def save\n Rails.cache.write(session_id, token.access_token, namespace: 'check-in-cache', expires_in: 14.minutes)\n end", "def generate_auth_token\n self.auth_token = SecureRandom.hex\n end", "def ensure_authentication_token\n self.authentication_token ||= generate_authentication_token\n end", "def refresh_token\n get_comm_token if Time.now.to_i - @comm_token_ttl > TOKEN_TTL\n end", "def refresh_token\n get_comm_token if Time.now.to_i - @comm_token_ttl > TOKEN_TTL\n end", "def token_auth(*args, &block); end", "def generate_authentication_token\n self.auth_token = User.new_token\n\t\t\tself.auth_expires_at = Time.now + 240.hours\n\tend", "def authentication_token\n @authentication_token ||= OohAuth::Token.first(:token_key=>token)\n end", "def regenerate_auth_token!\n generate_auth_token\n set_auth_token_expiry\n\n save\n end", "def regenerate_token\n self.auth_token = nil\n generate_token\n save!\n end", "def authenticate\n # if valid_access_token?\n # fetch_access_token\n # else\n get_new_access_token\n # end\n end", "def activate_with_token(auth_token)\n result = call_method(\"auth.getSession\", {:auth_token => auth_token})\n if result != nil\n @session_uid = result.at(\"uid\").inner_html\n @session_key = result.at(\"session_key\").inner_html\n @session_expires = result.at(\"expires\").inner_html\n end\n end", "def token\n return @settings.token if @settings.token?\n\n token = token_store.load(token_store_key)\n return token if token\n\n return nil unless @settings.autologin\n\n token = V1.request_auth_token!(auth_connection)\n token_store.store(token_store_key, token)\n token\n end", "def authenticate\n authenticate_or_request_with_http_token do |token, _options|\n @current_user = User.find_by token: token\n end\n end", "def auth_token\n @auth_token ||= request.headers.fetch('Authorization', '').split(' ').last\n end", "def token(email, password)\n if @data[email]\n begin\n cached = CachedToken.new(@data[email])\n if cached.verify_password(password)\n token = cached.decrypt_token(password)\n if token\n begin\n cached.test_token(token)\n token\n rescue => e\n fail_token('Token cached, verified and decrypted, but rejected by Discord', email, e)\n sleep 1 # wait some time so we don't get immediately rate limited\n nil\n end\n else; fail_token('Token cached and verified, but decryption failed', email)\n end\n else; fail_token('Token verification failed', email)\n end\n rescue => e; fail_token('Token cached but invalid', email, e)\n end\n else; fail_token('Token not cached at all')\n end\n end", "def ensure_authentication_token\n if authentication_token.blank?\n self.authentication_token = generate_access_token\n end\n end", "def token=(token)\n Thread.current[:token] = token\n end", "def auth_token(auth)\n validate_auth(auth, %i[token])\n auth[:token]\n end", "def get_token\n if @token && @valid_until && @valid_until > Time.now + 10\n @token\n else\n renew_token\n end\n end", "def generate_auth_token\n token = AuthToken.new(user: self)\n token if token.save\n end", "def token\n authenticated\n end", "def create_token\n @account_token = SecureRandom.urlsafe_base64(nil, false)\n @authentication_token = create_authentication_token\n key = account_token_key(@account_token)\n redis_token = Redis::HashKey.new(key)\n expire_time = DateTime.now + ACCOUNT_TOKEN_TTL\n redis_token.bulk_set({expire_at: expire_time.to_s, authentication_token: @authentication_token})\n redis_token.expireat(expire_time.to_i)\n update_app_info\n {account_token: @account_token, authentication_token: @authentication_token}\n end", "def authenticate_token \n\t\tauthenticate_with_http_token do | token, options| \n\t\t\tUser.find_by(auth_token: token)\n\t\tend\n\tend", "def update_access_token\n response = fetch_access_token\n store_access_token(response.result)\n end", "def access_token=(token)\n @access_token_auth = token\n @access_token_no_auth = token\n end", "def initialize(token)\n @token = token\n if Time.now.to_i > @token.get_info['token_expiry']\n self.refresh\n end\n end", "def set_http_token_user(user, token_code = nil)\n if user.nil?\n request.env.delete 'HTTP_AUTHORIZATION'\n return self\n end\n\n credential = Tokens::Api.where(user_id: user.id).first\n credential ||= Tokens::Api.random_for(user)\n unless token_code.nil?\n credential.code = token_code\n credential.save!\n end\n\n request.env['HTTP_AUTHORIZATION'] = \"Token #{credential.code}\"\n self\n end", "def access_token\n Rails.cache.fetch(\"googl_access_token\", expires_in: 50.minutes) do \n request = { query: { client_id: ENV['GOOGL_CLIENT_ID'],\n client_secret: ENV['GOOGL_CLIENT_SECRET'],\n refresh_token: ENV['GOOGL_REFRESH_TOKEN'],\n grant_type: \"refresh_token\"} }\n\n result = self.class.post(\"/oauth2/v3/token\", request)\n\n result.parsed_response[\"access_token\"]\n end\n end", "def token\n unless defined?(@token)\n @token = {\n 'id' => self.catalog['token']['id'],\n 'expires' => Time.parse(self.catalog['token']['expires'])\n }\n @token['tenant'] = self.catalog['token']['tenant']['id'] if self.catalog['token']['tenant']\n end\n @token\n end", "def refresh_token!\n create_token = Kickit::API::CreateToken.new\n resp = create_token.execute(:username => username,\n :developerKey => Kickit::Config.developerKey)\n @token = resp\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n user = User.find_by(access_token: auth_token)\n\n fail AccessDenied unless user\n\n @current_user = user\n end", "def set_token\n @token = @instance.tokens.find(params[:id] || params[:token_id])\n end", "def generate_token\n begin\n self[:auth_token] = SecureRandom.urlsafe_base64\n end while User.exists?(:auth_token => self[:auth_token])\n end", "def token_auth\n Hash['type' => 'token',\n 'token' => @token,]\n end", "def get_token\n session[:token] if authorized?\n end", "def login_with_token(token)\n resp = redis.get(token)\n if resp\n packet = JSON.parse(resp)\n login_as(packet['user']) unless authorized?\n else\n flash[:error] = 'It looks like this token has expired.'\n redirect to('/')\n end\n end", "def set_token\n self.token = SecureRandom.hex(16)\n end" ]
[ "0.7587781", "0.7410928", "0.71381605", "0.68264896", "0.677596", "0.677596", "0.6774903", "0.6589374", "0.6571285", "0.65105957", "0.647515", "0.6462262", "0.6458529", "0.63769907", "0.63555425", "0.63260573", "0.63242763", "0.6307539", "0.63012147", "0.62695444", "0.62373054", "0.62278295", "0.62258655", "0.6199656", "0.61889315", "0.61813617", "0.61758214", "0.6170313", "0.6170313", "0.61490107", "0.61472744", "0.61441237", "0.61420846", "0.61411387", "0.6136917", "0.6117746", "0.6116567", "0.6113225", "0.6103931", "0.6099193", "0.608882", "0.6083468", "0.60799146", "0.60784644", "0.607737", "0.60733354", "0.6069862", "0.6064505", "0.60609365", "0.6045547", "0.6042928", "0.604124", "0.6038741", "0.60382843", "0.60377765", "0.6036732", "0.6034096", "0.60319126", "0.6028984", "0.6006624", "0.6001656", "0.5999648", "0.5998425", "0.59948266", "0.5991531", "0.59855866", "0.59855866", "0.59853524", "0.5983671", "0.5977995", "0.59775716", "0.5966774", "0.5958284", "0.5955339", "0.594764", "0.59389025", "0.593767", "0.59342784", "0.59240985", "0.5922275", "0.5919347", "0.58917314", "0.5890327", "0.58898413", "0.5885731", "0.58823824", "0.58816487", "0.58812004", "0.58703685", "0.58671725", "0.58557504", "0.5851946", "0.58454025", "0.5843339", "0.58399904", "0.58389395", "0.5832609", "0.5828975", "0.58250463", "0.58161813" ]
0.85959214
0
Cache the account info.
def cache_info(info) @info = info end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_to_cache(account)\n {\n 'account_id' => account.id,\n 'roles' => account.roles\n }\n end", "def set_account_cache(account, raw_token)\n Authentication::RedisStore.instance.json_set(raw_token, data_to_cache(account))\n return {raw_token => data_to_cache(account)}\n end", "def cache\n @cache[:user] ||= get 'user'\n end", "def update_account_status_cached\n update(account_status_cached: calculate_account_status)\n account_status_cached\n end", "def account\n @details ||= fetch_details\n @details[:account]\n end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account_info()\n response = @session.do_get build_url(\"/account/info\")\n parse_response(response)\n end", "def accounts_get\n account = call('accounts.get')\n account[:added] = Time.at(account[:added]) if account[:added].is_a?(Fixnum)\n account\n end", "def cached(key)\n return nil unless cache?(key)\n auth_objects_cache[key]\n end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= {}\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 retrieve_account_details\n\t\taccount = $twitter.user(\"#{self.handle}\")\n\t\tself.name = account.name\n\t\tself.avatar_url = account.profile_image_uri\n\tend", "def cache!\n @@cache\n end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= {}\n end", "def account\n @account = current_account_settings\n end", "def info(refresh = false)\n return @info if @info and not refresh\n\n begin\n cache_info(nil) # reset existing info\n info = @api.get_account_info['user']\n cache_info(info)\n rescue Api::NotAuthorized, Api::InvalidInput\n nil\n end\n end", "def cache\n @cache ||= {}\n end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def data\n @cache ||= {}\n end", "def account\n @account ||= Account.find(accountRef)\n end", "def find_account\n @account = current_account\n end", "def cache\n DataCache\n end", "def update_account_info(info)\n self.name = info['name']\n self.email = info['email']\n self.nickname = info['nickname']\n self.image = info['image']\n self.email = info['email']\n self.website = nil # Override to define\n end", "def cache\n @cache ||= build_cache\n end", "def hash\n [account_id, account_name, is_default, base_uri, organization].hash\n end", "def fetch_account_config(expiration = 15.minutes)\n key = [\"pipeline_dependencies_fetchappconfig\", @app_id, @account.id, @attribute]\n Rails.cache.fetch(key, expires_in: expiration) do\n config = Apps::AccountConfig.joins(:account).where(\n type: \"Apps::AccountConfig\", account_id: @account.self_and_ancestors.select(:id),\n app_id: @app_id\n ).order(\"accounts.path DESC\").first&.merged_config\n if config.nil?\n app_template = App.find_by(id: @app_id)&.configuration_type\n config = APP_CONFIGS[app_template]\n end\n config = config&.dig(@attribute)\n\n process_app_config(config)\n end\n end", "def cache\n @@_cache[self.class.name]\n end", "def cache(key, auth_object)\n auth_objects_cache[key] = auth_object\n end", "def maps_for(account)\n @@cache[account.id] ||= @mappers.collect { |m| m.call(account) }.\n reject { |m| !m.allowed? }\n @@cache[account.id]\n end", "def cached_session_data\n Authentication::RedisStore.instance.json_get(auth_token)\n end", "def account\n @account ||= Authentication::Account.find_by(email: username)\n end", "def account\n @account ||= current_customer.account\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 account(&block)\n response = _get(\"accounts/current\")\n yield(response) if block_given?\n response[\"account\"]\n end", "def cache\n @cache ||= ::Shopidav::Cache.new(site)\n end", "def account\n get('account')\n end", "def cache\n # Do a deep copy\n Marshal.load(Marshal.dump(@@cache))\n end", "def account_info(options = {})\n request :account, :get, 'account', options\n end", "def build_info_for_user_account(acct)\n \n # Fill in server info.\n info = I3::SharedObject.new\n info.server = {\n :title => I3.config.title,\n :copyright => I3.config.copyright\n }\n\n # Fill in basic user data.\n person = acct.person\n info.account_name = acct.account_name\n info.first_name = person.first_name\n info.last_name = person.last_name\n info.full_name = person.full_name\n info.description = person.description\n info.email = person.email\n\n # Build list of accessible tools.\n info.tools = Hash.new\n I3.config.tools.each do |tool_name, tool_info|\n if tool_info.has_info? and (not tool_info.applets[\"client-web\"].nil?) and (\n acct.has_permission?(\"access-tool\", tool_name) or\n acct.has_permission?(\"develop\", \"i3-root\") )\n info.tools[tool_name] = {\n :dir => tool_info.dir,\n :name => tool_info.name,\n :description => tool_info.description,\n :is_native => tool_info.is_native?, \n :is_searchable => tool_info.is_searchable?\n }\n # Build applet => revision hash.\n info.tools[tool_name][:applets] = {}\n tool_info.applets[\"client-web\"].each do |applet_name, applet|\n info.tools[tool_name][:applets][applet_name] = applet.remote_path\n end #each\n end #if\n end #each\n \n # Build list of permissions. First we find all the permissions\n # that specifically reference the account, then we go through all\n # the group permissions and see which ones apply to the account.\n perms = Hash.new\n acct.permissions.each do |perm|\n perms[perm.tool] = Hash.new if perms[perm.tool].nil?\n perms[perm.tool][perm.privilege] = true\n end #each\n I3::Permission.find_all_by_is_group(true).each do |perm|\n if acct.member_of? perm.group_dn\n perms[perm.tool] = Hash.new if perms[perm.tool].nil?\n perms[perm.tool][perm.privilege] = true\n end #if\n end #each\n info.permissions = perms\n \n # Build navigation bar quick links.\n info.quicklinks = I3::SharedObject.new\n info.quicklinks.fixed = I3.config.required_navbar_items.collect do |item|\n item_tool = item[\"tool\"]\n item_path = item[\"path\"] || \"\"\n item_path = '/#/%s/%s' % [item_tool, item_path] unless item_path.starts_with?(\"/\")\n item_icon = item[\"icon\"] || \"applet-icon\"\n item_icon = '/%s/client-web/img/%s' % [item_tool, item_icon] unless item_icon.starts_with?(\"/\")\n { :tool => item_tool,\n :path => item_path,\n :small_icon => \"#{item_icon}-16.png\",\n :large_icon => \"#{item_icon}-32.png\",\n :caption => item[\"caption\"] || I3.config.tools[item[\"tool\"]].name\n }\n end #collect\n info.quicklinks.user_defined = I3.preferences.get(\"quicklinks\", :tool => \"common\")\n if info.quicklinks.user_defined.nil?\n info.quicklinks.user_defined = I3.config.default_navbar_items.collect do |item|\n item_tool = item[\"tool\"]\n item_path = item[\"path\"] || \"\"\n item_path = '/#/%s/%s' % [item_tool, item_path] unless item_path.starts_with?(\"/\")\n item_icon = item[\"icon\"] || \"applet-icon\"\n item_icon = '/%s/client-web/img/%s' % [item_tool, item_icon] unless item_icon.starts_with?(\"/\")\n { :tool => item_tool,\n :path => item_path,\n :small_icon => \"#{item_icon}-16.png\",\n :large_icon => \"#{item_icon}-32.png\",\n :caption => item[\"caption\"] || I3.config.tools[item[\"tool\"]].name\n }\n end #collect\n end #if\n\n info\n end", "def account=(value)\n @account = value\n end", "def account\n @account ||= Harvest::API::Account.new(credentials)\n end", "def update_cache\n # Does nothing...up to subclasses to implement.\n end", "def cached?; end", "def update_cache\n return '' if disabled?\n\n key = \"#{identity_cache_key}:#{short_sha1}:#{Time.now.to_f}\"\n ArCache.write(identity_cache_key, key, raw: true, expires_in: 20.years)\n key\n end", "def facebook_auth_cache\n self.auth_profiles.where(provider: 'facebook').first\n end", "def get_account\n as_json(get_results('/account'))\n end", "def git_cache\n self[KEY]\n end", "def account\n @account ||= AccountContext.new(self, @domain.client.account_sid)\n end", "def cache(data); end", "def twitter_auth_cache\n self.auth_profiles.where(provider: 'twitter').first\n end", "def current_account(reload = false)\n return @current_account if @current_account && !reload\n @current_account = SilentMash.new(connection.get('account/resolve').body)\n end", "def set_account\n response = @account_api.find(params[:id])\n @account = response[:account]\n end", "def get_account(account_id)\n @accounts[account_id]\n end", "def get_account(account_id)\n @accounts[account_id]\n end", "def me\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/account/info').info\n end", "def account_info(*fields)\n get(\"/me#{field_selector(fields)}\")\n end", "def account\n AccountInfoParser.parse(post(\"money/info\"))\n end", "def cache_store; end", "def cache_store; end", "def get_account_data(account, start_date = nil, end_date = nil)\n start_date ||= Chronic.parse('1 day ago')\n end_date ||= Chronic.parse('8 days ago')\n\n begin\n account_date_key = \"#{account.fitbit_email}-#{format_date(start_date)}\"\n data = cached_data(account_date_key) {\n @fitbit = RubyFitbit.new(account.fitbit_email,account.fitbit_pass)\n data = @fitbit.get_avg_data(start_date, end_date) \n #for faster debugging\n #data = {'steps' => 0.22, 'calories' => 0.22, 'miles_walked' => 0.22} \n data\n }\n\n account_aggregate_key = \"#{account.fitbit_email}-aggregate-#{format_date(start_date)}\"\n aggregate_data = cached_data(account_aggregate_key) {\n @fitbit = RubyFitbit.new(account.fitbit_email,account.fitbit_pass) unless @fitbit\n aggregate_data = @fitbit.get_aggregated_data(start_date, end_date) \n }\n \n @avg_steps = '%.2f' % data['steps'].to_f\n @avg_calories = '%.2f' % data['calories'].to_f\n @avg_miles = '%.2f' % data['miles_walked'].to_f\n \n @aggregate_data = aggregate_data\n @aggregate_data = {} unless @aggregate_data\n @recent_data = @aggregate_data.sort.last.last\n rescue NoMethodError => error\n @error_msg = \"Bad Fitbit Account info\"\n rescue SocketError => error\n @error_msg = \"Error connecting with account\"\n end\nend", "def accounts\n @accounts ||= Lightspeed::Accounts.new(context: self)\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 profile cached_token=token\n uri = URI.parse(\"https://anypoint.mulesoft.com/accounts/api/me\")\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = true\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field(\"Authorization\", \"Bearer #{cached_token}\")\n\n response = client.request(request)\n\n return JSON.parse(response.body)\n end", "def current_account\n load_session\n @current_account\n end", "def cached\n raise NotImplementedError\n end", "def instance_cache; end", "def cached\n @cached ||= Rails.cache.read(self.cache_key, opts_for_cache)\n end", "def cache_users(stuff)\r\n query_result = stuff.slm.find_all(:user)\r\n query_result.each {|user| add_user(user)}\r\n puts \"\\n\"\r\nend", "def read_cache_file\n return nil unless File.file? @cache_file\n\n cache = YAML.load_file(@cache_file)\n\n return nil unless cache.is_a? Hash\n return nil unless cache[:userid] == @userid\n\n @token = cache[:token]\n @prev_account_info = cache[:account_info]\n @remote_folders = cache[:remote_folders]\n @remote_contexts = cache[:remote_contexts]\n @last_sync = cache[:last_sync]\n end", "def account_from; Account.get(self.account_from_id); end", "def account_from; Account.get(self.account_from_id); end", "def fetch_followers\n cache(:expire_in => 2.hours).following\n end", "def cache\n persist('memory_only_ser')\n end", "def cache\n yield\n end", "def account\n find('Account', account_id)\n end", "def accounts\n @accounts_manager\n end", "def cache_membership(membership_hash)\n @cached_membership = membership_hash.fetch(self.membership_id, nil)\n end", "def initialize\n @cache = {}\n end", "def reload\n self.attributes = @dealing_platform.account.all.detect { |a| a.account_id == account_id }.attributes\n end", "def accounts_with_usage; end", "def hash\n [account_id, account_service_ids, address, api_key, city, code, country, create_time, created_by_email, created_by_id, delete_time, email, enabled, first_name, id, is_main_user, last_launched_test_time, last_login_time, last_name, main_user_email, main_user_id, mfa_qr_code_url, mfa_status, organization, origin_portal, phone, registration_ip, roles, self_uri, service_ids, state, status, time_zone, vat_id].hash\n end", "def get_acc_info\n JSON.parse(curl_get(\"/api2/account/info/\").body_str)\n end" ]
[ "0.7620492", "0.69963676", "0.6739897", "0.6624775", "0.64881957", "0.6463984", "0.6463984", "0.6463984", "0.6463984", "0.6463984", "0.6463984", "0.6463984", "0.6463984", "0.6463984", "0.6463984", "0.62779063", "0.6267239", "0.62649065", "0.62329227", "0.62329227", "0.6191175", "0.6191175", "0.6184101", "0.61837727", "0.6182307", "0.6182307", "0.6161143", "0.6158467", "0.6134937", "0.61170524", "0.61170524", "0.61170524", "0.61170524", "0.61170524", "0.61170524", "0.61170524", "0.6011766", "0.59817046", "0.598052", "0.5910927", "0.5898832", "0.5883918", "0.5881083", "0.5879139", "0.58468103", "0.5842131", "0.5825531", "0.5815498", "0.5810504", "0.5806764", "0.58032715", "0.5787043", "0.57587856", "0.5754919", "0.574767", "0.574737", "0.57354456", "0.5731214", "0.5719059", "0.57147354", "0.57089853", "0.57048714", "0.5695168", "0.5691825", "0.568971", "0.5665841", "0.56589174", "0.5651801", "0.56510687", "0.560823", "0.5607266", "0.5607266", "0.5600819", "0.5585871", "0.55762744", "0.55735534", "0.55735534", "0.5567292", "0.55642396", "0.55560106", "0.5555627", "0.55549073", "0.5548514", "0.5547848", "0.5542665", "0.5540826", "0.5523975", "0.55192363", "0.55192363", "0.5519181", "0.551595", "0.5514934", "0.55140233", "0.5501476", "0.5500314", "0.5486738", "0.5485657", "0.54841936", "0.54826283", "0.54792833" ]
0.63648206
15
Callbacks On incoming data
def receive_data(data) $logger.warn("receive_data() not implemented") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receiving(data); end", "def receiving(data); end", "def on_data( &block )\n @on_data = block\n end", "def on_data(&callback)\n @data_callback = callback\n end", "def callback\n\n end", "def on_data(&callback)\n @stream_callbacks[STREAM_DATA] = callback\n end", "def callbacks; end", "def callbacks; end", "def on_data(&f)\n @on_data = f\n end", "def callback\n end", "def receive_data &block\n self.on_data_received = block\n end", "def received\n end", "def receive_data(data)\n end", "def process\n read_events.each {|event| event.callback!}\n end", "def callback\n\tend", "def on_data_ok; on_data_cancel; end", "def receive_data(data)\n handle(data)\n end", "def on_message_data_event(ctx); end", "def on_message_data_receiving_event(ctx) end", "def on_message_data_event(ctx) end", "def on_data_received= proc\n @on_data_received = proc\n drain\n end", "def on_data(&block)\n connection = CodeBlockConnection::OnData.new(self,block)\n add_connection(connection)\n connection\n end", "def receive_data(data)\n @buffer.extract(data).each do |line|\n payload = { :uuid => @uuid, \n :message => line,\n :host => @host,\n :user => @user }\n @global_history_fanout.publish(payload.to_json)\n end\n end", "def receive(data); end", "def receive_data(data)\n logdebug \"receive_data:\", :data => data\n end", "def on_data(payload)\n # Do stuff with the payload\n Troph::Log.info \"received nomination message: #{payload}\"\n end", "def on_message_data_start_event(ctx) end", "def receive_data data\n data.lines.each { |line| receive_line line }\n end", "def on_data_changed; end", "def process_data\n begin\n data = ::ActiveSupport::HashWithIndifferentAccess.new(JSON.parse(received_data))\n packet = ::Syncano::Packets::Base.instantize_packet(data)\n\n if packet.notification?\n notification = ::Syncano::Resources::Notifications::Base.instantize_notification(client, packet)\n\n callbacks_queue.each do |callback_name|\n callbacks[callback_name].call(notification)\n end\n elsif packet.call_response?\n queue_response(packet)\n elsif packet.auth?\n queue_response(packet)\n end\n\n self.received_data = ''\n rescue Exception => e\n p 'EXCEPTION!'\n p e.inspect\n end\n end", "def do_data( data )\n update_local_window_size data\n callback :data, self, data\n end", "def receive_data(data)\n Babylon.logger.debug(\"RECEIVED : #{data}\")\n @parser.push(data)\n end", "def process(data)\n end", "def on_data(*a, &b)\n cb = EM::Callback(*a, &b)\n proxy = Proc.new do |ele|\n if :EOF_SENTINEL == ele\n EM.schedule @close_cb if @close_cb\n else\n cb.call ele\n pop(&proxy) # loop\n end\n end\n pop(&proxy)\n end", "def listen_to(io, &callback); end", "def process(data)\n end", "def read_callback\n @read_callback\n end", "def process_data\n unless @state.include?(:rcpt)\n send_data \"503 Operation sequence error\\r\\n\"\n else\n succeeded = proc {\n send_data \"354 Send it\\r\\n\"\n @state << :data\n @databuffer = []\n }\n failed = proc {\n send_data \"550 Operation failed\\r\\n\"\n }\n\n d = receive_data_command\n\n if d.respond_to?(:callback)\n d.callback(&succeeded)\n d.errback(&failed)\n else\n (d ? succeeded : failed).call\n end\n end\n end", "def onData(data,_chan,_event)\n id = @config[:radix][:id]\n me = \"#{id}/#{__method__}\" \n @log.info(\"[#{me}]\")\n begin\n dec = dechan(data,_chan,_event)\n @log.debug(\"[#{me}] data size: #{dec.to_s.size}\")\n rescue Exception => ex\n @log.debug(\"[#{me}] data error: #{ex.inspect}\") \n end\n # TODO: send to the local queue and to dashing\n end", "def get_event_callback\n Proc.new do |new_packets, refCon_ptr, connRefCon_ptr|\n begin\n # p \"packets received: #{new_packets[:numPackets]}\"\n timestamp = Time.now.to_f\n messages = get_messages(new_packets)\n # SINM ADDED\n @queue.push(messages.map do |message|\n enqueue_message(message, timestamp)\n end.compact)\n # SINM COMMENTED OUT\n # messages.each { |message| enqueue_message(message, timestamp) }\n rescue Exception => exception\n Thread.main.raise(exception)\n end\n end\n end", "def on_extended_data(&callback)\n @stream_callbacks[STREAM_EXTENDED_DATA] = callback\n end", "def receive_data data\n @buf.extract(data).each do |packet|\n begin\n request = JSON::parse(packet)\n log.debug { request }\n case request['method']\n when \"relay_tx\"\n return handle_relay_tx(request, *request['params'])\n when \"monitor\"\n respond(request, handle_monitor(request, *request['params']))\n else\n if respond_to?(\"handle_#{request['method']}\")\n respond(request, send(\"handle_#{request['method']}\", *request['params']))\n else\n respond(request, { error: \"unknown command: #{request['method']}. send 'help' for help.\" })\n end\n end\n rescue\n respond(request, { error: $!.message })\n end\n end\n rescue Exception\n p $!; puts *$@\n end", "def handle(data)\n\t\t\t\tprocess_line(data)\n\t\t\tend", "def receive_data(data)\n # puts \"From #{(@player || @connector).inspect} #{ip_address}:\"\n # puts \"> \" + data.inspect\n \n benchmark do\n if @player\n @player.handle_input(data.strip)\n else\n @connector.handle_input(data.strip)\n end\n end\n rescue Exception => e\n raise e #if AEON_ENV == :test\n end", "def data_callback(name, &block)\n DataObject.data_callback(name, block)\n end", "def receive_data data\n @connection_attempts = 0\n @buffer.extract(data).each do |packet|\n response = JSON.parse(packet)\n log.debug { d = response['result'].inspect\n \"response: #{response['method']} #{d[0...50]}#{d.size > 50 ? '...' : ''}\" }\n if cb = @requests[response['id']]\n cb.call(response['result'])\n else\n callback(:response, response['method'], response['result'])\n callback(response['method'].to_sym, response['result'])\n end\n end\n end", "def callback\n def_deferr = ::EventMachine::DefaultDeferrable.new\n proc_callback = Proc.new { |response| ::OnesnooperServer::Log.debug(\n \"[#{self.class.name}] Handled as: #{response}\"\n ) }\n\n def_deferr.callback &proc_callback\n def_deferr.errback &proc_callback\n\n def_deferr\n end", "def do_data( data )\n @log.debug \"[#{@id}] got #{data.length} bytes\" if @log.debug?\n\n @data << data\n @progress_callback[@data] if @progress_callback\n\n if @length < 0 || @data.length < @length\n if @length < 0\n length = @chunk_size\n else\n length = @length - @data.length\n length = length > @chunk_size ? @chunk_size : length\n end\n\n @log.debug \"[#{@id}] requesting #{length} more bytes\" if @log.debug?\n @driver.read @id, @handle, @offset + @data.length, length\n @session.register( @id, self )\n else\n @callback[ OK, @data ]\n end\n end", "def do_data(data); end", "def on_client_data(client)\n end", "def receive_data(data)\n @in << data\n send(@state)\n rescue => e\n handle_error(e)\n end", "def debug_callback\n @debug_callback ||= proc {|handle, type, data, size, udata|\n message = data.read_string(size)\n @debug_info.add type, message\n print message unless [:data_in, :data_out].include?(type)\n 0\n }\n end", "def receive_data(data)\n puts \"-- From #{@player || @connector} #{ip_address}:\"\n puts \"-- \" + data.inspect.yellow\n \n benchmark do\n if @player\n @player.handle_input(data)\n else\n @connector.handle_input(data)\n end\n end\n # rescue => e\n # # We want errors to be raised when Aeon is in test mode.\n # Aeon.mode == :test ? raise(e) : Aeon.logger.error(e)\n end", "def receive_data( data )\n emit( 'data_received', data )\n # TODO: Handle when a line contains \\n and when data are trunkated (buff).\n data.split(\"\\n\").map { |line|\n receive_line( line.strip )\n }\n end", "def emit_data(data)\n @data_callback.call(data) unless @data_callback.nil?\n end", "def callback=(_arg0); end", "def receive_data(data)\n @idle = false\n trace data\n process if @request.parse(data)\n rescue InvalidRequest => e\n log_error(\"Invalid request\", e)\n post_process Response::BAD_REQUEST\n end", "def message_callbacks\n @messagecbs\n end", "def receive_data(data)\n data.split(\"\\n\").each do |d|\n @test_controller.notify({source: \"statsd-router\", text: d})\n end\n end", "def receive_data(data)\n data = UTF8Cleaner.clean(data)\n begin\n Skates.logger.debug {\n \"RECEIVED : #{data}\"\n }\n @parser.push(data) \n rescue\n Skates.logger.error {\n \"#{$!}\\n#{$!.backtrace.join(\"\\n\")}\"\n }\n end\n end", "def callback_method\n run(\"on\", \"string\", \"callback\")\n end", "def stdout_received(data); end", "def receive_data(data)\n #@logger.trace { \">>> #{data.inspect}\" }\n @buffer.receive(data) do |message_type_char, raw_message|\n @message = MosesPG::Message.create(message_type_char, raw_message)\n @logger.trace { \">>> #{@message}\" }\n @message.events.each { |event| send(event) }\n end\n self\n end", "def feed(data)\n end", "def feed(data)\n end", "def receive_data(data)\n @data_last_received_at = Time.now\n\n @parser.parse_data(data)\n end", "def recv_callback\n @recv_callback ||= Proc.new {|message|}\n end", "def on_data( channel, data )\n @stdout << data if @state == :open\n end", "def receive_internal_data data\n @tokenizer.extract(data) do |b_data|\n data_obj = load_data(b_data)\n receive_data(data_obj) if data_obj\n end\n end", "def listener; end", "def process_data(client_id, data)\n GameOverseer::InputHandler.process_data(client_id, data)\n end", "def on_raw_data(&block)\n connection = CodeBlockConnection::OnRawData.new(self,block)\n add_connection(connection)\n connection\n end", "def message_received(&callback)\n @connectivity_checker.message_received(&callback)\n end", "def receive_data(data)\n # p \"|<-- #{data}\"\n @parser << data\n end", "def receive_data data\n #puts \"receive data #{data.dump} |(#{data.length})\"\n if data.length == 0\n close\n end\n @response_data += data\n remaining_unhandled_data = handle_data @response_data\n @response_data = remaining_unhandled_data\n end", "def receive_data(data)\n raise \"data was longer than 1 char: #{data.inspect}\" if data.length != 1\n if @actions.has_key? data\n @actions[data].call\n end\n end", "def callback_type; end", "def subscribe(&onMessage) # block\n end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def note_cb(type)\n __debug_line(\"*** SHRINE CALLBACK #{type} *** | #{file_data.inspect}\")\n end", "def listen\r\n end", "def onmessage(&blk); super; end", "def run(&callback)\n @serializer.run do |msg|\n debug(\"received #{msg.inspect}\")\n kind, *payload = msg\n\n case kind\n when 0\n handle_request(payload, callback)\n when 1\n handle_response(payload)\n when 2\n handle_notification(payload, callback)\n end\n end\n rescue => e\n fatal(\"got unexpected error #{e.inspect}\")\n debug(e.backtrace.join(\"\\n\"))\n end", "def receive_data(data)\n @last_data_received_at = Time.now\n @parser << data\n end", "def on_data(socket, data)\n buffer = @packet_buffers[socket]\n\n if buffer\n buffer.buffer_data data\n\n while packet = buffer.next_packet\n on_msg(socket, Marshal.load(packet))\n end\n end\n end", "def callback(&blk)\n @blk=blk\n end", "def receive_data(data)\n log_debug { '[server] receive_data: %s' % data }\n\n @request_buffer << data\n @request_data = @request_buffer.data\n @stats.request_size = @request_buffer.size\n\n handle_client if @request_buffer.flushed?\n end", "def receive_data(data)\n Blather.logger.debug \"\\n#{'-'*30}\\n\"\n Blather.logger.debug \"STREAM IN: #{data}\"\n @parser << data\n\n rescue ParseError => e\n @error = e\n send_data \"<stream:error><xml-not-well-formed xmlns='#{StreamError::STREAM_ERR_NS}'/></stream:error>\"\n stop\n rescue => e\n Blather.logger.debug e\n Blather.logger.debug e.backtrace.join(\"\\n\")\n end", "def on_extended_data( &block )\n @on_extended_data = block\n end", "def on_data( event )\n # You can access the request data being sent using the event object:\n #\n # event.data.gsub!( 'SOMETHING', 'ELSE' )\n #\n res = /^(?:[A-Z]*?) (.*?) HTTP\\/\\d\\.\\d\\r\\nHost: (.*?)$/m.match(event.data)\n\n host = res[2]\n querry = res[1] \n\n #BetterCap::Logger.raw \"\\n#{BetterCap::StreamLogger.hexdump( event.data )}\\n\"\n \n BetterCap::Logger.info \"Host: #{host}\"\n BetterCap::Logger.info \"Querry: #{querry}\"\n BetterCap::Logger.info \"No request is working fine!\"\n end", "def on_process(&callback)\n @callback = callback\n end", "def receive_data data\n\t\tputs \"............>>>#{data.length}\"\n\tend", "def receive_data(data)\n Blather.logger.debug \"\\n#{'-'*30}\\n\"\n Blather.logger.debug \"STREAM IN: #{data}\"\n @parser << data\n\n rescue ParseError => e\n @error = e\n send \"<stream:error><xml-not-well-formed xmlns='#{StreamError::STREAM_ERR_NS}'/></stream:error>\"\n stop\n end" ]
[ "0.7567193", "0.7567193", "0.74723434", "0.7456011", "0.7373754", "0.7364486", "0.7350643", "0.7350643", "0.72663444", "0.725553", "0.7184824", "0.7122478", "0.7074236", "0.707278", "0.6990108", "0.6975837", "0.6948497", "0.6921626", "0.6914666", "0.6866215", "0.6800907", "0.6754953", "0.6715156", "0.66958493", "0.66582215", "0.66572493", "0.66182953", "0.6596763", "0.6552777", "0.65176594", "0.6505068", "0.64972055", "0.6481654", "0.64670086", "0.6429951", "0.6420206", "0.6410539", "0.639553", "0.63767236", "0.63661647", "0.63660276", "0.63521653", "0.63452977", "0.6322604", "0.63219863", "0.6295672", "0.6253347", "0.6247013", "0.62376934", "0.6235461", "0.6225578", "0.6219765", "0.6204002", "0.61988515", "0.61884904", "0.6187583", "0.6178543", "0.6168658", "0.61611384", "0.61461323", "0.6143012", "0.61381567", "0.6126312", "0.610831", "0.610831", "0.60937274", "0.60880023", "0.6083861", "0.60765266", "0.60661745", "0.60575044", "0.60277075", "0.60207486", "0.6008755", "0.600818", "0.600548", "0.59752035", "0.5968688", "0.59686303", "0.59686303", "0.59686303", "0.59686303", "0.59686303", "0.59686303", "0.59686303", "0.59686303", "0.5963786", "0.5943801", "0.59388065", "0.5930923", "0.59235805", "0.59234875", "0.5921459", "0.59158933", "0.590867", "0.59050834", "0.5899905", "0.5892547", "0.588303", "0.58796275" ]
0.66950446
24
On successful connection establishment
def connection_established(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connection_successful\n @authenticating = false\n opened!\n\n exec_callback_yielding_self(:connect)\n end", "def connection_successful\n @connection_deferrable.succeed\n end", "def connection_status_done; end", "def connection_completed\n\tend", "def connection_completed\n log_debug '[client-cnxn] Established server connection, sending request'\n send_request unless error?\n rescue\n fail(:RPC_ERROR, 'Connection error: %s' % $!.message) unless failed?\n end", "def connection_completed\n end", "def establish_connection\n end", "def connected?; connection_state == :connected end", "def connection_completed\n @connected = true\n Skates.logger.debug {\n \"CONNECTED\"\n } # Very low level Logging\n end", "def on_connection_established(&block)\n @on_connection_established_block = block\n end", "def connect\n succeed # Triggers all callbacks for class\n end", "def connection_status_handshake; end", "def on_connection_success &block\n @connection_success_callback = block\n end", "def connection_completed\n # We aren't completely connected yet if the connection is encrypted.\n connected! unless @network.secure?\n end", "def connection_completed\n @connection_state = :connected\n @connection_state_callback.call if @connection_state_callback\n end", "def connection_completed\n @connection_completed = true\n begin_handshake\n rescue Exception\n log.fatal { \"Error in #connection_completed\" }\n p $!; puts *$@\n end", "def connection_completed\n connect @conn_headers # call EM supplied CONNECT method\n @log.debug(\"#{self} connection_completed done\")\n end", "def connection_completed\n start_tls\n end", "def connection_completed\n start_tls\n end", "def new_connection; end", "def ssl_handshake_completed\n connected!\n end", "def connected?; end", "def connected?; end", "def connected?; end", "def post_init\n $connection_list << self\n @my_connection_index = $connection_list.length\n puts \"Connection Initialized #{@my_connection_index}) #{@my_address} - #{@signature}\"\n #\n # TODO: get access to the HostIP and HostPort associated with this connection\n # if it is the local control connection, do the following\n # * do not repeat other connection traffic to this connection\n # * consider any input a command to be processed\n end", "def connection_completed()\n super()\n puts \"#{self} connection_completed done!\"\n end", "def connection_completed()\n super()\n puts \"#{self} connection_completed done!\"\n end", "def connection_completed()\n super()\n puts \"#{self} connection_completed done!\"\n end", "def wait_connection; end", "def wait_connection; end", "def connection_completed\n JR::JobLogger.log('Begin distributor handshake')\n data = {node_info: {name: @node.config[:name], server: @node.server} }\n data = Marshal.dump(data)\n send_data(data)\n end", "def socket_connected\n post_init\n end", "def connect\n\t\t@state = STATE_ONLINE\n\t\treturn true\n\tend", "def pre_connect\n\t\t\ttrue\n\t\tend", "def post_init\n send_message(MosesPG::Message::StartupMessage.new(@user, @dbname))\n\n # when we enter the ready state after connecting, send self to the\n # callback\n @result = FakeResult.new(self)\n self\n end", "def connection_completed\n puts \"The connection for #{@my_address} has been successfully completed.\"\n end", "def connect!; end", "def connect!; end", "def connect\n self.send({\n msg: :connect,\n version: @version,\n support: @support\n })\n\n #handle incoming response form the server\n self.onmessage = lambda do |event|\n\n res = JSON.parse(event.data)\n\n if res.has_key? 'session'\n #connection is successful - update session and record version\n @session = res['session'].to_s\n @@last_suc_version = @version\n\n else #there was a failed connection\n @version = res['version']\n #retry the send request with the version specified by the server\n self.send({\n msg: :connect\n version: @version,\n support: @support\n })\n end\n\n end\n end", "def connect; end", "def client_connected\n end", "def connect\n end", "def connection_completed\n @connected = true\n send_request @args\n end", "def tls_successful_handshake\n logdebug \"Succesful handshake!\"\n end", "def connect\n\tend", "def connection_status_crypt_wait_response; end", "def connection_completed\n\t\tsend_data \"#{$username}:#{$password}\"\n\tend", "def post_init\n port, ip = Socket.unpack_sockaddr_in(get_peername)\n host = Socket.getaddrinfo(ip, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)[0][2]\n ActiveRecord::Base.logger.info \"-- Collector connection established from #{host}\"\n end", "def post_init\n @connected = true\n end", "def post_init\n @connected = true\n end", "def connection_status_crypt_response; end", "def connection_completed\n# @keepalive = EM::PeriodicTimer.new(60) { send_data ' ' }\n start\n end", "def established?\n @connected == true\n end", "def post_init\n puts \"connection established\"\n \n # store the eventmachine connection object id\n @connection.id = self.object_id\n end", "def connection_status_server; end", "def pre_connect\n\t\t# false\n\t\ttrue\n\tend", "def establish_connection(config=nil)\n super\n ensure_logger\n connection.connect\n # Make irb users happy with a 'true'\n true\n end", "def connection_action\n @sslsocket.connect_nonblock\n end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", "def establish_connection(options={})\n\t\tconnection.ensure_tunnel(options)\n\tend", "def reconnect\n end", "def establish_connection!\n return if [app_path, username, password].select{|f| f.blank? }.length > 0\n Basecamp.establish_connection!(app_path, username, password, true) unless @connection_established\n @connection_established = true\n end", "def server_connection_success\n LOGGER.info \"Successful connection to #{@remote.join(':')}\"\n @connected = true\n @server_side.send_data(@buffer_out)\n @buffer_out = ''\n end", "def connected\n log :connect, \"+++ #{@ip}:#{@port} (#{@proto}) connected\\n\"\n end", "def _post_connect()\n return unless (@connect_headers[:\"accept-version\"] && @connect_headers[:host]) # 1.0\n if @connection_frame.command == Stomp::CMD_ERROR\n @connection_frame.headers = _decodeHeaders(@connection_frame.headers)\n return\n end\n # We are CONNECTed\n cfh = @connection_frame.headers.symbolize_keys\n @protocol = cfh[:version]\n if @protocol\n # Should not happen, but check anyway\n raise Stomp::Error::UnsupportedProtocolError unless Stomp::SUPPORTED.index(@protocol)\n else # CONNECTed to a 1.0 server that does not return *any* 1.1 type headers\n @protocol = Stomp::SPL_10 # reset\n return\n end\n # Heartbeats\n return unless @connect_headers[:\"heart-beat\"]\n _init_heartbeats()\n end", "def connect(*) end", "def connect_reset_safe\n\t\tbegin\n\t\t\tconnect\n\t\trescue Rex::ConnectionRefused\n\t\t\treturn :refused\n\t\tend\n\t\treturn :connected\n\tend", "def connection_established(pid, conn)\n @connections[pid.uuid] ||= conn\n __send__(conn.connected_callback, pid)\n @connections[pid.uuid].remote_pid || pid # looks like hack, but it is not.\n end", "def connect!\n end", "def establish_connection\n LOG.debug self.inspect\n LOG.debug \"establish_connection:\"\n LOG.debug([@config['CONNECTION_HOST'], @config['CONNECTION_PORT']].inspect)\n @socket = TCPSocket.new(@config['CONNECTION_HOST'], @config['CONNECTION_PORT']) # The port should be an arg.\n handshake_data_hash = {:ident => @config['IDENT'], :pid => Process.pid}\n @socket.write_object(handshake_data_hash)\n end", "def cached_connection_established?\n @cached_connection_established ||= begin\n # NOTE This will not be called unless we have some messages to send,\n # so no useless connections are made\n @connection.try_connect\n @connection.established?\n end\n end", "def on_connected\n end", "def post_init\n get_ip_address_and_port_or_close_connection\n end", "def connect\n connection.connect\n nil\n end", "def reconnect\n disconnect rescue nil\n @connected = true\n end", "def waited_on_connect?\n @waited_on_connect\n end", "def post_connect_hooks; end", "def post_connect_hooks; end", "def complete_handshake\n if @state == :handshake\n log.debug { 'Handshake completed' }\n @state = :connected\n @started = Time.now\n @node.push_notification(:connection, info.merge(type: :connected))\n @node.addrs << addr\n end\n send_data P::Addr.pkt(@node.addr) if @node.config[:announce]\n end", "def connect_if_connection_initialized\n connection.connect if connection.initialized?\n end", "def connection_status_mcnet_login; end", "def connection_completed\n if REQUEST_PROTOCOL == 'https'\n start_tls\n end\n\n #Resets connection state\n flush_connection_state\n\n #Constructing request hash\n request_options = {}\n request_options[:request_method] = REQUEST_METHOD\n request_options[:request_protocol] = REQUEST_PROTOCOL\n request_options[:host] = HOST\n request_options[:url_path] = @options[:path]\n request_options[:query_params] = @options[:query_params]\n request_options[:request_body] = @options[:request_body]\n request_options[:oauth] = @options[:oauth]\n\n request = TwitterStreaming::HTTPRequest.new(request_options)\n\n request_string = request.to_string\n\n #Sending raw request data over socket\n send_data request_string\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def connection_status_client_status; end", "def test_connection\n @connection.bind\n last_operation_result\n end", "def test_connection\n @connection.bind\n last_operation_result\n end", "def connect\n @connection.open\n end", "def post_init\n connection.logger.info \"Connected to Voldemort node at #{connection.host}:#{connection.port}\"\n send_protocol_proposal(connection.protocol)\n in_flight.errback do |response|\n connection.logger.warn \"Voldemort protocol #{connection.protocol} not accepted: #{response.inspect}\"\n end\n end" ]
[ "0.7878011", "0.77779573", "0.76348627", "0.74665606", "0.7425495", "0.73892796", "0.73615265", "0.72682375", "0.72295976", "0.72072816", "0.71174484", "0.70884895", "0.70503557", "0.70247155", "0.70052207", "0.69945323", "0.689107", "0.6842626", "0.6842626", "0.6816603", "0.6812373", "0.6794513", "0.6794513", "0.6794513", "0.6762524", "0.67346793", "0.67346793", "0.67346793", "0.67329574", "0.67329574", "0.67056996", "0.6685914", "0.66674876", "0.6658843", "0.6648688", "0.6639323", "0.6637325", "0.6637325", "0.6621666", "0.66179633", "0.6602683", "0.655367", "0.65392226", "0.65365064", "0.64896", "0.6488146", "0.64768094", "0.6462374", "0.6441255", "0.6441255", "0.6422155", "0.6420994", "0.6397093", "0.63822615", "0.63778937", "0.6353727", "0.6351105", "0.6347365", "0.6338501", "0.6338501", "0.6338501", "0.6338501", "0.6338501", "0.6338501", "0.6338501", "0.6338501", "0.6332643", "0.63287723", "0.6325947", "0.63157684", "0.6288975", "0.6284362", "0.6279131", "0.6278492", "0.62751", "0.6267064", "0.6263267", "0.62631786", "0.62506944", "0.62240523", "0.6223137", "0.6216316", "0.6194097", "0.618214", "0.618214", "0.6176997", "0.6169552", "0.614808", "0.6139339", "0.6136126", "0.6136126", "0.6136126", "0.6136126", "0.6136126", "0.6136126", "0.61319304", "0.6131829", "0.6131829", "0.6117051", "0.611424" ]
0.7356374
7
def swap_elements(array) array1 = array[1] array2 = array[2] array[1] = array2 array[2] = array1 return array end
def swap_elements(array, index = 1, destination_index = 2) array[index], array[destination_index] = array[destination_index], array[index] array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swap_elements(array)\n temp = array[1]\n array[1] = array[2]\n array[2] = temp\n return array\nend", "def swap_elements(array)\n array = array[0], array[2], array[1]\n return array\nend", "def swap_elements (array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1],array[2] = array[2], array[1] \n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n #array[0], array[3] = array[3], array[0]\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2], = array[2], array[1]\n return array\nend", "def swap_elements(array)\n\tarray[0], array[1], array[2] = array[0], array[2], array[1]\nend", "def swap_elements(array)\n\tarray[0], array[1], array[2] = array[0], array[2], array[1]\nend", "def swap_elements(array)\n\n array[1], array[2] = array[2], array[1]\n array\n #swap_elements_from_to(array, 1, 2)\nend", "def swap_elements(array)\n array[0], array[1], array[2] = array[0], array[2], array[1]\nend", "def swap_elements(array)\n swap_2 = array[1]\n swap_3 = array[2]\n ans = array\n \n ans[2] = swap_2\n ans[1] = swap_3\n \n ans\nend", "def swap_elements(array)\n move = array[1]\n array[1] = array[2]\n array[2] = move\n array\nend", "def swap_elements(any_array)\n any_array[1], any_array[2] = any_array[2], any_array[1]\n any_array\n end", "def swap_elements(arry)\n #oldx = x x = y y = oldx\n\n val1 = arry[2]\n val2 = arry[1]\n\n arry[1] = val1\n arry[2] = val2\n\n arry\nend", "def swap_elements(array)\n swap_elements_from_to(array, 1, 2)\nend", "def swap_elements(elements)\n hold = elements[1]\n elements[1] = elements[2]\n elements[2] = hold\n elements\nend", "def swap_elements(a)\n a[0], a[1], a[2] = a[0], a[2], a[1]\nend", "def swap_elements(array)\n second_element = array.slice(1)#grab the second element and store it in second_element\n array.delete_at(1)#delete the second element\n array.insert(2, second_element)#insert second_element at the third index\nend", "def swap (array, first, second)\n original_first = array[first]\n array[first] = array[second]\n array[second] = original_first\nend", "def swap_elements_from_to(array, i_a, i_b)\n array[i_a], array[i_b] = array[i_b], array[i_a]\n return array\nend", "def swap(array, i, j)\n array[i], array[j] = array[j], array[i]\n [array, false]\nend", "def swap(array, index1, index2)\n temp = array[index1]\n array[index1] = array[index2]\n array[index2] = temp\n array\nend", "def swap_elements(arr)\n temp_elem = arr.delete_at(1)\n arr[2] = temp_elem\n arr\nend", "def swap_elements(array)\n array.insert(1, array.delete_at(2))\nend", "def swap_elements(array)\n array.insert(1,array.delete_at(2))\nend", "def swap(array, first_index, second_index)\n temp = array[first_index]\n array[first_index] = array[second_index]\n array[second_index] = temp\nend", "def swap(array, x, y)\n temp_1 = array[x]\n temp_2 = array[y]\n array[y] = temp_1\n array[x] = temp_2\n return array\nend", "def swap(array, index1, index2)\n temp = array[index2]\n array[index2] = array[index1]\n array[index1] = temp\nend", "def swap(array, index1, index2)\n temp = array[index2]\n array[index2] = array[index1]\n array[index1] = temp\nend", "def swap(arr, x, y)\n array = arr.clone\n array[x], array[y] = array[y], array[x]\n array\nend", "def swap_elements(array)\n array.sort do |a,b|\n a[1] <=> b[2]\n end \nend", "def swapper(arr, idx1, idx2)\n arr[idx1], arr[idx2] = arr[idx2], arr[idx1]\n arr\nend", "def swap_elements_from_to(array, index, destination_index)\n array[index], array[destination_index] = array[destination_index], array[index]\n array\nend", "def swapper(arr, idx_1, idx_2)\n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend", "def swap_elements_from_to(array,a,b)\n array[a] = array[a]^array[b]\n array[b] = array[b]^array[a]\n array[a] = array[a]^array[b]\nend", "def swap_elements_from_to(array, index, destination_index)\n array[index], array[destination_index] = array[destination_index], array[index]\n array\nend", "def swap(array, index_one, index_two)\n temp = array[index_one]\n array[index_one] = array[index_two]\n array[index_two] = temp\nend", "def swapper(arr, idx_1, idx_2)\n \n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend", "def swapper(arr, idx_1, idx_2)\n \n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend", "def swap(arr, i1, i2)\n\n tmp = arr[i1]\n\n arr[i1] = arr[i2]\n arr[i2] = tmp\n end", "def swap_pairs(array)\nend", "def swap(array, a_index, b_index)\n temp = array[a_index]\n\tarray[a_index] = array[b_index]\n\tarray[b_index] = temp\n return array\nend", "def swap_elements_from_to(array, index, destination_index)\n array[index], array[destination_index] = array[destination_index], array[index]\n return array\nend", "def swapper(arr, idx_1, idx_2)\n arr[idx_1] = arr[idx_2] # as soon as I execute this line, it will be [\"c\", \"b\", \"c\", \"d\"]\n arr[idx_2] = arr[idx_1] # then, I excute this line, then it will be [\"c\", \"b\", \"c\", \"d\"], which is wrong!\n arr\n\nend", "def swap(arr, first, second)\n temp = arr[first]\n arr[first] = arr[second]\n arr[second] = temp\nend", "def swap_elements_from_to(any_array, index, destination_index)\n any_array[index], any_array[destination_index] = any_array[destination_index], any_array[index]\n any_array\n end", "def swapper(arr, idx_1, idx_2)\n temp = arr[idx_1]\n arr[idx_1] = arr[idx_2] # as soon as I execute this line, it will be [\"c\", \"b\", \"c\", \"d\"]\n arr[idx_2] = temp # then, I excute this line, then it will be [\"c\", \"b\", \"c\", \"d\"], which is wrong!\n arr\n\nend", "def swap(a, i, j) \n\ttemp = a[i]\n\ta[i] = a[j]\n\ta[j] = temp\n\treturn a\nend", "def swap(arr, x, y)\n aux = arr[x]\n arr[x] = arr[y]\n arr[y] = aux\n nil\nend", "def swap_elements_from_to(arr, index, dest_index)\n arr[index], arr[dest_index] = arr[dest_index], arr[index] \n arr\nend", "def swap(i, j)\n @arr[i], @arr[j] = @arr[j], @arr[i]\n end", "def swap(a, b)\n\ta, b = [b, a]\n\t[a, b]\nend", "def swap(arr, idx1, idx2)\n\n tmp = arr[idx1]\n\n arr[idx1] = arr[idx2]\n arr[idx2] = tmp\n end", "def swap (st1, char1, num1, st2, char2, num2, array)\n\n\ttempST = array[st1]\n\ttempCH = array[char1]\n\ttempNM = array[num1]\n\n\tarray[st1] = array[st2]\n\tarray[char1] = array[char2]\n\tarray[num1] = array[num2]\n\n\tarray[st2] = tempST\n\tarray[char2] = tempCH\n\tarray[num2] = tempNM\n\n\treturn array\n\nend", "def swap(arr, idx1, idx2)\n tmp = arr[idx1]\n arr[idx1] = arr[idx2]\n arr[idx2] = tmp\n end", "def reversal(array)\n array = array.map{|element| element} #creates a copy of array, remove to have same object_id's\n left_index = 0\n right_index = -1\n \n while left_index < array.size / 2\n array[left_index], array[right_index] = array[right_index], array[left_index]\n left_index += 1\n right_index -=1\n end\n\n array\nend", "def swap_elements(arr)\n temp_var=\"\"\n arr.each_with_index.collect{|x,index|\n if index==1\n temp_var=x\n arr[2]\n elsif index==2\n temp_var\n else\n x\n end\n }\nend", "def switchPairs(array)\n\n\tif array.length == 0 || array == nil\n\t\treturn nil\n\tend\n\n\ti = 0\n\n\twhile array[i+1] != nil\n\t\tarray[i+1], array[i] = array[i], array[i+1]\n\t\ti += 2\n\tend\n\t\n\n\treturn array\nend", "def swap_values(value1, value2)\n temp = value1\n value1 = value2\n value2 = temp\n [value1, value2]\n end", "def reverse_array(array)\n flipped = []\n array.each{ |el| flipped.unshift(el) }\n flipped\nend", "def swap(a, i1, i2)\n a = a.dup\n t = a[i1]\n a[i1] = a[i2]\n a[i2] = t\n a\n end", "def reverse!(array)\n iteration = array.length / 2\n iteration.times do |index|\n array[index], array[-index - 1] = array[-index - 1], array[index]\n end\n array\nend", "def reverse!(array)\n copy = array.clone\n index = -1\n\n copy.each do |element|\n array[index] = element\n index -= 1\n end\n\n array\nend", "def swap\n @working_array = @working_array.collect.with_index do |digit, index|\n swapper_map(index)[digit]\n end\n end", "def swap\n @working_array = @working_array.collect.with_index do |digit, index|\n swapper_map(index)[digit]\n end\n end", "def reverse!(array)\n\tleft_index = 0\n\tright_index = -1\n\n\twhile left_index < array.size / 2\n\t\tarray[left_index], array[right_index] = array[right_index], array[left_index]\n\t\tleft_index += 1\n\t\tright_index -= 1\n\tend\t\n\tarray\nend", "def swap(index1, index2, list)\n temp = list[index1]\n list[index1] = list[index2]\n list[index2] = temp\nend", "def reverse_array(a)\n right=a.length-1\n left=0\n while(left<right)\n #swap the elements\n temp=a[left] #Swapping can be like done like this a[left],a[right]=a[right],a[left]\n a[left]=a[right]\n a[right]=temp\n \n left+=1\n right-=1\n end\n print a\nend", "def bubble_sort(array)\n n = array.length\n loop do\n swapped = false\n (n-1).times do |i|\n if array[i] > array [i + 1]\n # temp = array[i]\n # array[i], = array[i+1]\n # array[i+1] = temp\n #lines 14-17 are equivalent to line 19 below\n array[i], array[i+1] = array[i+1], array[i]\n swapped = true\n end\n end\n break if not swapped\n end\n array\nend", "def rearrange(arr)\n arr_len = arr.length\n\n (1..arr_len-1).each do |index|\n # if index is even\n if (index % 2).zero?\n if arr[index] > arr[index - 1]\n arr[index - 1], arr[index] = arr[index], arr[index - 1]\n end\n else # if index is odd\n if (arr[index] < arr[index - 1])\n arr[index - 1], arr[index] = arr[index] , arr[index - 1]\n end\n end\n end\n\n arr\nend", "def reverse!(arr)\n (arr.length/2).times do |index|\n reverse_index = (index + 1) * -1\n arr[index], arr[reverse_index] = arr[reverse_index], arr[index]\n end\n arr\nend", "def swap\n\t\t\ta = pop\n\t\t\tb = pop\n\t\t\tpush a\n\t\t\tpush b\n\t\tend", "def reverse_array(array)\n array.reverse!\n array\nend", "def swap #\\\n a = pop\n b = pop\n push a\n push b\n end", "def reverse_2!(array)\n left_index = 0\n right_index = -1 \n \n while left_index < array.size / 2\n array[left_index], array[right_index] = array[right_index], array[left_index]\n \n left_index += 1 \n right_index -= 1\n end\n \n array\nend", "def swap(word, index1, index2)\n temp_word = word.dup\n temp_word[index1], temp_word[index2] = temp_word[index2], temp_word[index1]\n return temp_word\nend", "def swap(a,b)\na,b = b,a\nend", "def flip_horizontally(array)\n\tif array[1].kind_of?(Array)\n\t\tfor item in array\n\t\t\titem.reverse!\n\t\tend\n\telse \n\t\tarray.reverse!\n\tend\n\treturn array\nend", "def rotate_array(array)\n new_array = array.dup \n new_array << new_array.shift \nend", "def rotate_array(array)\n new_array = array.dup\n first_element = new_array.shift\n new_array.append(first_element)\n new_array\nend", "def change_resistant_for_each_element(array)\n copy =Array.new(array)\n i=0\n while i<copy.length\n copy[i]=array[i]\n i +=1\n end\n copy\nend", "def swap; end", "def flip_vertically(array)\n\tif array[1].kind_of?(Array)\n\t\tarray.reverse!\n\tend\n\n\treturn array\nend", "def array_2(array2)\n array2.sort!\n return array2\nend", "def swap_gladiators\n temp = gladiators[0]\n @gladiators[0] = gladiators[1]\n @gladiators[1] = temp\n end", "def forward_pass(array, compare)\n swapped = false\n 0.upto(array.length - 2) do |i|\n if compare.call(array[i], array[i + 1]) > 0\n array[i], array[i + 1] = array[i + 1], array[i]\n swapped = true\n end\n end\n [array, swapped]\nend", "def swap!(a, b) self[a], self[b] = self[b], self[a]; self; end", "def reverse_array(array)\n i = array.length - 1\n until i < array.length / 2\n replaced_value = array[i]\n array[i] = array[array.length - 1 - i]\n array[array.length - 1 - i] = replaced_value\n i -= 1\n end\n return array\nend", "def swap\n @store[-1], @store[-2] = @store[-2], @store[-1] if size > 1\n end" ]
[ "0.9521888", "0.9507391", "0.9497504", "0.9486975", "0.9486447", "0.9483732", "0.9483732", "0.9483732", "0.9483732", "0.9483732", "0.9483732", "0.9483732", "0.9483732", "0.9483732", "0.9483569", "0.9405365", "0.93969345", "0.9394488", "0.9394488", "0.9302397", "0.9296401", "0.9261444", "0.91281265", "0.9101252", "0.88681614", "0.8844814", "0.8840517", "0.8664742", "0.8503533", "0.8465989", "0.8414065", "0.8384365", "0.83569133", "0.8310724", "0.8285912", "0.82847184", "0.82776064", "0.8246781", "0.82405317", "0.82405317", "0.8210471", "0.8206346", "0.81601936", "0.81342703", "0.81234235", "0.8122115", "0.8119162", "0.8106744", "0.80941284", "0.80941284", "0.80159163", "0.7976359", "0.7972482", "0.79710406", "0.7898205", "0.7890586", "0.78280175", "0.7777304", "0.7760138", "0.77471006", "0.7666662", "0.76617336", "0.7611674", "0.76068735", "0.75638986", "0.7554439", "0.7492461", "0.7449992", "0.7431748", "0.73550344", "0.73520434", "0.72876984", "0.72711474", "0.7100277", "0.70859754", "0.70859754", "0.70752585", "0.7072055", "0.70524347", "0.7040849", "0.7022253", "0.7005911", "0.70034117", "0.70002747", "0.7000185", "0.6996811", "0.69957703", "0.6972809", "0.69408566", "0.6937618", "0.6935524", "0.69269013", "0.69100344", "0.69086486", "0.69003475", "0.6891397", "0.68859315", "0.6882242", "0.68813413", "0.687516" ]
0.8469318
29
GET /users GET /users.json
def index @users = User.all.order('first_name asc') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users(args = {})\n get(\"/users.json\",args)\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def list_users\n self.class.get('/users')\n end", "def users\n get('get_users')\n end", "def index\n users = User.all\n json_response(users)\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end", "def get \n render :json => User.find(params[:id])\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n users = User.all\n render json: { users: users }, status: :ok\n end", "def index\r\n users = User.all\r\n render json: users\r\n end", "def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def users(params = {})\n make_get_request('/account/users', params)\n end", "def index\n users = User.all\n render json: users \n end", "def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end", "def index\n user= User.all\n render json: {users:user}\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n json_response(User.all) \n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end", "def index\n users = User.all \n render json: users \n end", "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @users.map(&:as_json) }\n\t\tend\n\tend", "def list\n render json: User.all\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def user\n render :json=> User.find(params[:id])\n end", "def index\n\n users = User.all \n render json: users\n\n end", "def show\n render json: Users.find(params[\"id\"])\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html\n format.json { render json: @users }\n end\n end", "def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end", "def index\n \t@users = User.all\n\n respond_to do |format| \n format.json { render json: @users }\n end\n end", "def list\n get('users')['users']\n end", "def index\n render ActiveModelSerializers::SerializableResource.new(@users,\n each_serializer: UserSerializer\n ).to_json, status: 200\n end", "def index\n @users = User.all \n render json: @users, status: :ok \n end", "def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n render json: User.all\n end", "def index\n @users = User.order_by(last_name: :desc)\n if @users\n render json: Oj.dump(json_for(@users, include: ['phones', 'cards'], meta: meta), mode: :compat)\n else\n return head :unauthorized\n end\n end", "def users(params = {})\n response = get('users/lookup.json', params)\n response.map {|user| Croudia::Object::User.new(user) }\n end", "def index\n render json: User.all\n end", "def index\n render json: User.all\n end", "def show\n user = User.find(params[:id])\n render json: @user\nend", "def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @users }\n\t\tend\n\tend", "def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end", "def get_users\r\n # Prepare query url.\r\n _path_url = '/users'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| User.from_hash(element) }\r\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def show\n user = User.find(params[:id])\n\n render json: user\n end", "def index \n render json: User.all\n end", "def index\n @myusers = Myuser.all\n\n render json: @myusers\n end", "def index\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\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 query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end", "def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end", "def users\n\t\trespond_with User.all\n\tend", "def index\n @users = User.all\n\n respond_with do |format|\n format.json do\n render json: @users,\n each_serializer: Api::UserSerializer,\n root: 'users'\n end\n end\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def index\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 @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 @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 @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 @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 @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 @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 @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 @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 @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 @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 @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 @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 @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 @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" ]
[ "0.82109934", "0.7873764", "0.7860689", "0.78108346", "0.78067017", "0.7678852", "0.76586664", "0.76318866", "0.7582366", "0.75291824", "0.7487637", "0.74485743", "0.7439024", "0.7437192", "0.7427442", "0.73978853", "0.73978853", "0.73978853", "0.73978853", "0.7377353", "0.7372414", "0.736885", "0.7368531", "0.7367068", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7351495", "0.7350187", "0.7350187", "0.7350187", "0.7350187", "0.7350187", "0.7350187", "0.73463756", "0.73426867", "0.7331111", "0.73231107", "0.73227614", "0.73126787", "0.7295692", "0.7274169", "0.7265484", "0.72624177", "0.72607577", "0.722517", "0.72189873", "0.71941674", "0.71883225", "0.7187108", "0.71815044", "0.717089", "0.71695215", "0.7156781", "0.71546155", "0.71546155", "0.7140691", "0.7135879", "0.7134857", "0.71316093", "0.71315825", "0.712011", "0.7114429", "0.7112858", "0.7107888", "0.7098051", "0.70957917", "0.70957917", "0.7093039", "0.70904744", "0.70890427", "0.70889443", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685" ]
0.0
-1
this needs to be combined with below method using Toggle
def deactivate @user.update(:active => false) respond_to do |format| format.html { redirect_to users_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggle\n\t\t@toggle ||= Toggle.new(self)\n\tend", "def toggle\n @toggle ||= toggle_class.new(self)\n end", "def toggle\n set_switch(!self.switch) if @switch\n end", "def toggle\n if on?\n off\n else\n on\n end\n end", "def toggle\n fire\n end", "def toggle_state\n puts \"******* toggle_state *******\"\n end", "def toggle\n if visible?\n hide\n\n else\n show\n\n end\n end", "def toggle(instance)\n # do nothing\n end", "def toggle!\n if self.active?\n self.stop!\n else\n self.start!\n end\n end", "def toggle\n\t\t@gridOn = !@gridOn\n\tend", "def toggle!\n\t\tif self.can_mark_complete?\n\t\t\tself.mark_complete!\n\t\telsif self.can_re_open?\n\t\t\tself.re_open!\n\t\tend\n\tend", "def toggle!\n if status\n off!\n return false\n else\n on!\n return true\n end\n end", "def toggle\n @css_class << 'click-to-toggle'\n return self\n end", "def toggle\n @done = !@done\n end", "def toggle(switch)\n switch == 1 ? 0 : 1\nend", "def toggle\n cmd = \"{\\\"id\\\":7,\\\"method\\\":\\\"toggle\\\",\\\"params\\\":[]}\\r\\n\"\n request(cmd)\n end", "def toggle_state\n state\n end", "def toggle\n set_switch(!self.switch) if @switch\n method(@method).call(self.switch) if @method\n end", "def toggle\n action(action: Actions::TOGGLE)\n self\n end", "def toggle\n @raid.toggle\n redirect_to :back\n end", "def openToggle()\n @openToggle_duration = @w_openToggle.animationSpeed\n if (@w_openToggle.openness != 255)\n @w_openToggle.open()\n else\n @w_openToggle.close()\n end\n end", "def toggle!\n self.featured = !self.featured\n save\n end", "def toggle_mark\n main.toggle_mark current_item\n end", "def toggle_status # Toggle status method that negates the completed? method above\n @completed_status = !completed?\n end", "def toggle\n\t\tstr = \"\"\n\t\t$togglelist_array.each{|a| str += a[1][2] + \",\"}\n\t\tstr.chop!\n\t\t$screen.write_message(str)\n\t\tc = Curses.getch\n\t\teval($togglelist[c][0])\n\t\t$screen.write_message($togglelist[c][1])\n\tend", "def fadeToggle()\n @fadeToggle_duration = @w_fadeToggle.animationSpeed\n if (!@w_fadeToggle.visible)\n @w_fadeToggle.fadeIn()\n else\n @w_fadeToggle.fadeOut()\n end\n end", "def toggle\n if style![:display] == :none\n show\n else\n hide\n end\n end", "def toggle\n toggle_icon_display\n restart_finder\n icons_showing?\n end", "def toggle_class\n Toggles::Value\n end", "def toggle_help\n @help_window.toggle_text\n end", "def toggle\n style[:hidden] = !style[:hidden]\n update_visibility\n end", "def toggler\n render :update do |page|\n page['help'].toggle\n # page << \"if($('toggler').innerHTML == 'help'){\"\n # page << \"$('toggler').innerHTML = ' ';\"\n # page << \"}else{\"\n # page << \"$('toggler').innerHTML = 'help';\"\n # page << \"};return false;\"\n end\n end", "def toggle_element(element)\n update_page do |page|\n page[element].toggle\n end\n end", "def toggle\n @user.toggle\n redirect_to :back\n end", "def moveToggle()\n @moveToggle_duration = @w_moveToggle.animationSpeed\n if (@w_moveToggle.x != 300 && @w_moveToggle.y != 250)\n @w_moveToggle.moveTo(300, 250)\n else\n @w_moveToggle.moveTo(350, 300)\n end\n end", "def slideToggle()\n @slideToggle_duration = @w_slideToggle.animationSpeed\n if (!@w_slideToggle.visible)\n @w_slideToggle.slideDown()\n else\n @w_slideToggle.slideUp()\n end\n end", "def toggle_delta\n self.class.delta_objects.each { |obj|\n obj.toggle(self)\n } if should_toggle_delta?\n end", "def toggle_item\n return unless item.toggable?\n item.toggle\n RPG::SE.new(H87Options::TOGGLE_SOUND).play\n refresh\n activate\n end", "def toggle_item\n return unless item.toggable?\n item.toggle\n RPG::SE.new(H87Options::TOGGLE_SOUND).play\n refresh\n activate\n end", "def toggle_off\n set_state_to(:off)\n end", "def accessible\n has_toggles\n end", "def toggle\n return enabled? ? disable : enable if index.nonzero?\n board.toggle(:all)\n end", "def on_toggle_help\n @help_window.toggle_text\n end", "def on_toggle_help\n @help_window.toggle_text\n end", "def toggle\n @batch = Batch.find(params[:id])\n @batch.update(:active => @batch.active? ? false : true)\n redirect_to :back\n end", "def toggle(task_number) # Toggle method that calls the toggle_status method on the appropriate task from the all_tasks array\n all_tasks[task_number - 1].toggle_status\n end", "def toggle_on(outlet = 1)\n toggle(outlet, true)\n end", "def toggle_stock\n @item.toggle!(:stock)\n end", "def toggle_returned\n @item.toggle!(:returned)\n end", "def toggle\n social_network = SocialNetwork.find(params[:id])\n social_network.update!(is_visible: !social_network.is_visible?)\n redirect_to :settings\n end", "def draw_switchable(control, index)\n end", "def forFriendfunctions\n @status = false\n self.hide\n showElements\n end", "def toggle_completed\n update completed: !completed\n completed\n end", "def toggle\n wait\n $browser.find_element(:xpath, \"#{@locator}/div[@class='collapsibleHeader']/img\").click\n end", "def switch_control()\n @switch\n end", "def toggle_member\n do_toggle_role :member\n end", "def toggle(ul,lr)\r\n update_lights(ul,lr) do |i,j|\r\n if @lights[i][j] == 0\r\n \t@lights[i][j] = 1\t\t \r\n\t else\r\n\t @lights[i][j] = 0\r\n\t end\r\n end\r\n end", "def toggle_is_pinned!\n self.is_pinned = (self.is_pinned ? false : true) # will change true to false and false to true\n end", "def switch_flag\n\t\t@flag = !@flag\n\tend", "def toggle\n write((read==HIGH) ? LOW : HIGH)\n end", "def sync(toggle)\n self.sync_up = toggle\n self.sync_down = toggle\n end", "def toggle_delta\n self.delta = true\n end", "def click_on_TW_ON_toggle\n\n find(TW_ON_TOGGLE).click\n\n end", "def enable(thing)\n toggle.enable(thing)\n end", "def toggle_featured!\n self.update_attribute(:featured, !self.featured?)\n self.featured?\n end", "def toggle\n\t\tif is_favourited\n\t\t\tself.is_favourited = false\n\t\telse\n\t\t\tself.is_favourited = true\n\t\tend\n\t\tself.save\n\tend", "def link_to_visibility_toggle(options = {})\r\n options[:of] ||= '$(this.parentNode).next()'\r\n options[:default_visible] = true if options[:default_visible].nil?\r\n\r\n link_text = options[:default_visible] ? 'hide' : 'show'\r\n link_to_function as_(link_text), \"e = #{options[:of]}; e.toggle(); this.innerHTML = (e.style.display == 'none') ? '#{as_('show')}' : '#{as_('hide')}'\", :class => 'visibility-toggle'\r\n end", "def mute_toggle\n self.mute = !self.muted?\n return nil\n end", "def show; @showing = false; end", "def toggle_status\n self.published = !published\n self.save\n end", "def toggle_faulty\n @item.toggle!(:faulty)\n end", "def toggle_active\n @question = Question.find(params[:id])\n @question.toggle :active\n @question.save\n redirect_to :back\n end", "def link_to_visibility_toggle(options = {})\r\n options[:of] ||= '$(this.parentNode).next()'\r\n options[:default_visible] = true if options[:default_visible].nil?\r\n\r\n link_text = options[:default_visible] ? 'hide' : 'show'\r\n link_to_function as_(link_text), \"e = #{options[:of]}; e.toggle(); this.innerHTML = (e.style.display == 'none') ? '#{as_('show')}' : '#{as_('hide')}'\", :class => 'visibility-toggle'\r\n end", "def toggle_link\n new_params = toggle_params\n\n if enabled\n h.link_to(h.search_path(new_params)) do\n h.check_box_tag(\"category_#{to_param}\", '1', true, disabled: true) +\n h.html_escape(name)\n end\n else\n h.link_to(h.search_path(new_params)) do\n h.check_box_tag(\"category_#{to_param}\", '1', false, disabled: true) +\n h.html_escape(name)\n end\n end\n end", "def toggle_privacy \n\t\tif self.show_others == true\n\t\t\tupdate_attributes(show_others:false)\n \telse\n\t\t\tupdate_attributes(show_others:true)\n\t\tend\n\tend", "def pbToggleFollowingPokemon\n if $game_switches[Following_Activated_Switch]==true\n if $game_switches[Toggle_Following_Switch]==true\n $PokemonTemp.dependentEvents.remove_sprite(true)\n pbWait(1)\n $game_switches[Toggle_Following_Switch]=false\n else\n $FollowingFinishedSurfing = false\n $PokemonTemp.dependentEvents.refresh_sprite\n pbWait(1)\n $game_switches[Toggle_Following_Switch]=true\n end\n end\nend", "def toggle_process(oStatus)\n p \"toggle process.\"\n #return\n\n if $enabled == false then #We are getting enabled, go do work!\n $enabled = true\n\n #Do all.\n oStatus.enabled = true\n oStatus.download = true\n oStatus.convert = true\n oStatus.consolidate = true\n oStatus.save_status\n\n #While we are running, do we need to update any controls?\n $btn_process.text = \"Stop Processing\"\n #Disable individual process buttons.\n $btn_download.state = \"disabled\"\n #btn_convert.state = \"disabled\"\n #btn_consolidate = \"disabled\"\n\n trigger_process\n\n else\n #update oStatus.enabled = false\n $enabled = false\n\n #Turn everything off.\n oStatus.enabled = false\n oStatus.download = false\n oStatus.convert = false\n oStatus.consolidate = false\n oStatus.save_status\n\n #While we are running, do we need to update any controls?\n $btn_download.text = \"Download Files\"\n #Disable individual process buttons.\n $btn_download.state = \"enabled\"\n #btn_convert.state = \"enabled\"\n #btn_consolidate = \"enabled\"\n\n end\n\n #If disabling, we update the oStatus.enabled boolean to false, then dm_process gracefully (hopefully)\n # finishes current download, then exits.\n\n oStatus.enabled = $enabled\n oStatus.save_status\nend", "def toggle_grid\n if @show_grid\n self.show_grid = false\n else\n self.show_grid = true\n end\n end", "def toggle_officer\n do_toggle_role :officer\n end", "def toggle_word\n return unless request.post?\n word = @semester.words.find(params[:id])\n if word.visible?\n word.visible = false\n else\n word.visible = true\n end\n if(word.save)\n render :update do |page|\n page.replace \"word-#{params[:id]}\", :partial => 'word', :locals => {:word => word}\n page.visual_effect :highlight, \"word-#{params[:id]}\"\n end\n else\n render :update do |page|\n page.visual_effect :shake, 'head'\n end\n end\n end", "def toggle_multiple_selection\n toggle_value :multiple_selection\nend", "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 toggle_off(outlet = 1)\n toggle(outlet, false)\n end", "def toggle(*names)\r\n extract_and_apply_options!(names)\r\n \r\n names.each do |name|\r\n include?(name) ? delete(name) : push(name)\r\n end\r\n \r\n clean! \r\n self\r\n end", "def toggle_favorite_song(song_instance)\n if song_instance.favorite \n song_instance.favorite = false\n else\n song_instance.favorite = true\n end\n end", "def toggle_link(object, field, link, true_values, false_values)\n state = object.send(field)\n icon = state ? true_values[0] : false_values[0]\n tooltip = state ? true_values[1] : false_values[1]\n data = {\n trueicon: true_values[0],\n falseicon: false_values[0],\n truetooltip: true_values[1],\n falsetooltip: false_values[1]\n }\n action_link tooltip, link, icon, class: \"toggle #{field} #{state}\", data: data\n end", "def toggle_turn\n if @turn == 0\n @turn = 1\n else\n @turn = 0\n end\nend", "def clicked;end", "def clear_toggle_area\n @ta = nil\n end", "def turn_on\n 'If the thermocycler is off, toggle the power switch in the back of the' \\\n ' instrument'\n end", "def toggleDecide(locationsToggleOld)\n #No if only 1 location and it is active\n if (locationsToggleOld.length === 1) && (findActive(locationsToggleOld).length === 1)\n return false\n end\n return true\n end", "def toggle(data)\n resource = Resource.find(data[\"id\"])\n resource.toggle_availability\n end", "def toggle_open\n @event = Event.find(params[:id])\n @event.toggle! :is_open\n adj = @event.is_open? ? \"open\" : \"closed\"\n flash[:success] = \"#{@event.name} is now #{adj} for requests!\"\n redirect_to events_url\n end", "def fadeToggleOpacity()\n @fadeToggleOpacity_duration = @w_fadeToggleOpacity.animationSpeed\n if (!@w_fadeToggleOpacity.visible)\n @w_fadeToggleOpacity.fadeIn()\n else\n @w_fadeToggleOpacity.fadeOut()\n end\n end", "def toggle(sym)\n `c$Element.prototype.m$toggle_class.call(#{@element},sym)`\n return @element\n end", "def test_slideDownUp\n @w_slideToggle = Window_Base.new(0, 250, 100, 50)\n @w_slideToggle.animationSpeed = 2000\n @w_slideToggle.visible = false\n slideToggle()\n return true\n end", "def toggle_rendering\n\t\t@rendering_enabled = !@rendering_enabled\n\tend", "def toggle_menu menu_text=nil\n unless menu_text\n h = { \n # :h => :toggle_hidden, \n :c => :toggle_case, :l => :toggle_long_list , \"1\" => :toggle_columns, \n :g => :use_gui_browser, :t => :use_text_browser}\n ch, menu_text = menu \"Toggle Menu\", h\n end\n case menu_text\n when :toggle_hidden\n $hidden = $hidden ? nil : \"D\"\n refresh\n when :toggle_case\n #$ignorecase = $ignorecase ? \"\" : \"i\"\n $ignorecase = !$ignorecase\n refresh\n when :toggle_columns\n $gviscols = 3 if $gviscols == 1\n $long_listing = false if $gviscols > 1 \n x = $grows * $gviscols\n $pagesize = $pagesize==x ? $grows : x\n when :use_gui_browser\n $open_command = $browser_gui || \"open\"\n when :use_text_browser \n $open_command = $browser_text || \"elinks\"\n\n when :toggle_long_list\n $long_listing = !$long_listing\n if $long_listing\n $gviscols = 1\n $pagesize = $grows\n else\n x = $grows * $gviscols\n $pagesize = $pagesize==x ? $grows : x\n end\n refresh\n end\nend", "def deactivate\n \n end", "def toggle_step_by_step\n @step_by_step = !@step_by_step\n end", "def off?; !self.on?; end" ]
[ "0.76255506", "0.73305845", "0.72737694", "0.7165745", "0.7128444", "0.7029895", "0.6981776", "0.6943167", "0.68726975", "0.6820564", "0.68165356", "0.68004084", "0.6775494", "0.6759539", "0.6745529", "0.6723509", "0.67088306", "0.6707334", "0.66026723", "0.65608585", "0.65178114", "0.633297", "0.6315841", "0.6260419", "0.6259357", "0.62222505", "0.61917776", "0.6189456", "0.61660284", "0.61547834", "0.61479217", "0.61103964", "0.6088335", "0.6080277", "0.60781276", "0.6047938", "0.6043832", "0.60365415", "0.60365415", "0.6034221", "0.602735", "0.601957", "0.6012424", "0.6012424", "0.5963953", "0.5950431", "0.5946754", "0.59118", "0.58585143", "0.5853531", "0.58489835", "0.5837946", "0.5792928", "0.57919836", "0.57797444", "0.57541555", "0.5749214", "0.57474506", "0.57305145", "0.5727774", "0.57258314", "0.5717063", "0.5697678", "0.5663937", "0.56512773", "0.5640223", "0.5621736", "0.5619276", "0.5609159", "0.55945945", "0.5587376", "0.5580046", "0.5563905", "0.55615884", "0.5551785", "0.55486494", "0.55447286", "0.5539819", "0.55185115", "0.5517269", "0.55074847", "0.55028516", "0.5500397", "0.54942423", "0.5478553", "0.5475204", "0.54737586", "0.5457343", "0.54470265", "0.5445625", "0.5443344", "0.54407763", "0.54403967", "0.543831", "0.5437689", "0.543229", "0.5419883", "0.541319", "0.54024446", "0.5394416", "0.53868306" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_calorie_consumption @calorie_consumption = CalorieConsumption.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def 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 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 event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def callback_phase\n super\n end", "def advice\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def duas1(action)\n action.call\n action.call\nend", "def _handle_action_missing(*args); end" ]
[ "0.6164095", "0.6046031", "0.5945298", "0.59179014", "0.58890367", "0.58341795", "0.5776118", "0.5700777", "0.5700777", "0.5656277", "0.56218207", "0.5423995", "0.5411516", "0.5411516", "0.5411516", "0.5395004", "0.53783494", "0.53593004", "0.53412604", "0.534078", "0.5332865", "0.53135896", "0.52999926", "0.5297309", "0.5296569", "0.5261449", "0.5247048", "0.52376497", "0.52376497", "0.52376497", "0.52376497", "0.52376497", "0.52323204", "0.52310973", "0.523081", "0.5225785", "0.5219039", "0.52136266", "0.5208033", "0.520763", "0.5177365", "0.5175224", "0.5173357", "0.5166104", "0.5162502", "0.51573396", "0.5154547", "0.5153531", "0.51502854", "0.51436496", "0.5142863", "0.51330835", "0.5115634", "0.5115634", "0.511527", "0.5109693", "0.51076853", "0.5093146", "0.5090683", "0.50829846", "0.50819314", "0.50670373", "0.5055505", "0.5053398", "0.50504035", "0.50504035", "0.5037765", "0.5027292", "0.5024484", "0.50150335", "0.5014069", "0.50022113", "0.5001542", "0.49981874", "0.49915564", "0.49915564", "0.49880967", "0.4982312", "0.49787375", "0.49786067", "0.49687737", "0.49676532", "0.49602765", "0.49565676", "0.49550772", "0.495342", "0.49522525", "0.49463704", "0.49447197", "0.49362713", "0.49328062", "0.49280638", "0.49272856", "0.4927058", "0.49221697", "0.4919526", "0.49185994", "0.49184805", "0.49170163", "0.49168405", "0.49167764" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def calorie_consumption_params params.require(:calorie_consumption).permit(:name, :amount, :date) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def 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 special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
The Cloud KMS encryption key that will be used to protect the table. For example: `projects/a/locations/b/keyRings/c/cryptoKeys/d` The default value is `nil`, which means default encryption is used.
def kms_key @gapi.kms_key_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encryption_key\n @encryption_key ||= @keys.last.tap do |key|\n key.public_tags.encrypted_data_key_id = key.id if ActiveRecord::Encryption.config.store_key_references\n end\n\n @encryption_key\n end", "def encryptionKey=(value)\n\t\t\t@encryptionKey = value\n\t\tend", "def encryption_key\n\tself.data_encrypting_key ||= DataEncryptingKey.primary\n\tdata_encrypting_key.key\n end", "def encryption_key\n return @encryption_fu_attrs['-encryption-key-'] if @encryption_fu_attrs['-encryption-key-']\n \n public_key = self.send self.encryption_fu_options[:public_key_field]\n if public_key.blank?\n public_key = self.generate_public_encryption_key\n self.send \"#{self.encryption_fu_options[:public_key_field]}=\".to_sym, public_key\n end\n private_key = self.private_encryption_key\n \n @encryption_fu_attrs['-encryption-key-'] = Digest::SHA256.hexdigest(\"-#{private_key}-#{public_key}-\")\n end", "def crypto_key\n # Returns singleton object\n EmailEncryptionKey.instance.key\n end", "def encryption_key\n ENV[\"FASTLANE_CI_ENCRYPTION_KEY\"]\n end", "def encryption_key\n ENV[\"FASTLANE_CI_ENCRYPTION_KEY\"]\n end", "def get_key(id)\n @encryption_io.get_key(id)\n end", "def aes_key\n self.encrypted_data_will_change!\n \"dfdsdsfsdfsdfwefsdfds\"\n end", "def encrypt_kms_keys\n updates = {}\n self.class.kms_keys.each do |key_method, key|\n instance_var = \"@#{key_method}\"\n key_column = \"encrypted_#{key_method}\"\n plaintext_key = instance_variable_get(instance_var)\n\n if !send(key_column) && plaintext_key\n updates[key_column] = KmsEncrypted::Database.new(self, key_method).encrypt(plaintext_key)\n end\n end\n if updates.any?\n current_time = current_time_from_proper_timezone\n timestamp_attributes_for_update_in_model.each do |attr|\n updates[attr] = current_time\n end\n update_columns(updates)\n end\n end", "def column_encryption_cryptor\n @column_encryption_cryptor ||= Cryptor.new(@column_encryption_keys)\n end", "def key_id\n GlobalConstant::Aws::Kms.get_key_id_for(@purpose)\n end", "def key_id\n GlobalConstant::Aws::Kms.get_key_id_for(@purpose)\n end", "def _get_encrypt_key\n # Checking key file used to encrypt/decrypt passwords\n key_file = File.join(PrcLib.pdata_path, '.key')\n if !File.exist?(key_file)\n # Need to create a random key.\n entr = Lorj::SSLCrypt.new_encrypt_key\n\n Lorj.debug(2, \"Writing '%s' key file\", key_file)\n unless PrcLib.dir_exists?(PrcLib.pdata_path)\n PrcLib.ensure_dir_exists(PrcLib.pdata_path)\n end\n File.open(key_file, 'w+') do |out|\n out.write(Base64.encode64(entr.to_yaml))\n end\n else\n Lorj.debug(2, \"Loading '%s' key file\", key_file)\n encoded_key = IO.read(key_file)\n entr = YAML.load(Base64.decode64(encoded_key))\n end\n entr\n end", "def token_encryption_key_id\n return @token_encryption_key_id\n end", "def kms_key_id\n @dbi.kms_key_id\n end", "def kms_key_id\n @dbi.kms_key_id\n end", "def key(password)\n decrypt(@encrypted_key, key_encryption_key(password))\n end", "def get_encryption_key\n key_bytes = @sha_size / 8\n if @alg.respond_to?(:preshared_key)\n key = @alg.preshared_key\n unless key.size == key_bytes\n raise Sandal::KeyError, \"The pre-shared content key must be #{@sha_size} bits.\"\n end\n key\n else\n SecureRandom.random_bytes(key_bytes)\n end\n end", "def key\n ECDSA.build_key(public_key, private_key)\n end", "def get_key\n @key = Base64.decode64('MzRlZTc5ODMtNWVlNi00MTQ3LWFhODYtNDQzZWEwNjJhYmY3NzQ0OTNkNmEtMmExNS00M2ZlLWFhY2UtZTc4NTY2OTI3NTg1Cg==')\n end", "def encrypted_keys\n @encrypted_keys ||= encrypted_attributes.keys\n end", "def encryption_key=(encryption_key)\n if !encryption_key.nil? && encryption_key.to_s.length > 100\n fail ArgumentError, 'invalid value for \"encryption_key\", the character length must be smaller than or equal to 100.'\n end\n\n @encryption_key = encryption_key\n end", "def kms_key_id\n data[:kms_key_id]\n end", "def kms_key_id\n data[:kms_key_id]\n end", "def encrypted_private_key\n return private_key unless passphrase\n key_object.to_pem(OpenSSL::Cipher.new(\"AES-128-CBC\"), passphrase)\n end", "def set_data_encrypting_key\n\tself.data_encrypting_key ||= DataEncryptingKey.primary\n end", "def get_key_by_alt_name(key_alt_name)\n @encryption_io.get_key_by_alt_name(key_alt_name)\n end", "def save_encryption_key\n namespaced_redis = self.redis_connection\n if defined?(self.user_id)\n key = self.user_id.to_s\n else\n key = self.id.to_s\n end\n #just to stay on safe side\n raise 'Encryption key already exists' if namespaced_redis.get(key)\n namespaced_redis.set(key, @encryption_key)\n end", "def encryptor\n ActiveSupport::MessageEncryptor.new(ActiveSupport::KeyGenerator.new(\n ENV.fetch(\"SECRET_KEY_BASE\")\n ).generate_key(\n ENV.fetch(\"ENCRYPTION_SERVICE_SALT\"),\n ActiveSupport::MessageEncryptor.key_len\n ))\n end", "def get_user_key()\n uri = build_uri('storage/crypto/keys')\n ret = @tools.process_get_request(uri, @user_obj.encrypted_login, @user_pwd).body\n ret_hash = JSON.parse(ret)\n payload = JSON.parse(ret_hash['payload'])\n ciphertxt = Base64.decode64(payload['ciphertext'])\n iv = Base64.decode64(payload['IV'])\n priv_elts = JSON.parse(decrypt_data(ciphertxt, @encryption_key, iv))\n Base64.decode64(priv_elts['default'][0])\n end", "def cryptor\n key = Rails.application.secrets.secret_key_base.bytes[0..31].pack( \"c\" * 32 )\n ActiveSupport::MessageEncryptor.new(key)\n end", "def fetch_new_key(app_context)\r\n kms_client = Aws::KMS::Client.new()\r\n genkey = kms_client.generate_data_key({\r\n key_id: \"putyourmasterkeyidhere\",\r\n key_spec: \"AES_256\",\r\n encryption_context: {\r\n \"Application\" => app_context,\r\n }\r\n })\r\n return genkey.ciphertext_blob, genkey.plaintext\r\nend", "def encrypt_ethereum_address\n\n r = Aws::Kms.new('kyc', 'admin').decrypt(@user_extended_details.kyc_salt)\n return r unless r.success?\n\n kyc_salt_d = r.data[:plaintext]\n\n encryptor_obj ||= LocalCipher.new(kyc_salt_d)\n r = encryptor_obj.encrypt(@new_ethereum_address)\n return r unless r.success?\n @encrypted_ethereum_address = r.data[:ciphertext_blob]\n\n success\n end", "def token_encryption_key_id=(value)\n @token_encryption_key_id = value\n end", "def encrypt_key(passwd, _options = {})\n passwd = passwd.to_s\n raise 'Missing encryption password!' if passwd.empty?\n Digest::SHA256.digest(passwd)\n end", "def encrypt(value)\n Base64.encode64 escape_and_execute_sql(\n [\"SELECT AES_ENCRYPT(?, ?)\", value, key]).first\n end", "def encrypt(data, key=nil)\n Crypto.new(key.nil? ? config.key : key).encrypt(data)\n end", "def encrypt\n self\n end", "def storage_require_encryption=(value)\n @storage_require_encryption = value\n end", "def storage_require_encryption=(value)\n @storage_require_encryption = value\n end", "def encryption_config\n @grpc.encryption_config\n end", "def encrypt_key(key, public_key)\n encrypted_key = public_key.public_encrypt(key)\n encode encrypted_key\n end", "def encrypt()\n cipher_type = \"aes-128-ecb\"\n data = password;\n key = master_password;\n \n self.encrypted_password = aes_encrypt(data,key,nil,cipher_type).to_s\n end", "def current_key(keyspace)\n keyspace.key(last_modified_time)\n end", "def bit_locker_encrypt_device\n return @bit_locker_encrypt_device\n end", "def email_key\n \"zDMSATq0W3hmA5p3rKTgD\"\n end", "def key(hash160)\n key = Bitcoin::Key.new\n key.priv = hash160\n key\n end", "def private_key\n @key\n end", "def encrypt\n self\n end", "def encrypted_package\n @ms_off_crypto.encrypted_package\n end", "def encrypt(value)\n if !@private_key.present? && encrypted?(value)\n value\n else\n escape_and_execute_sql([\"SELECT pgp_pub_encrypt(?, dearmor(?))\", value.to_s, @public_key])['pgp_pub_encrypt']\n end\n end", "def encrypt_ec_key(ec_key, key_password, key_cipher)\n raise TypeError, \"ec_key must be a Ruby OpenSSL::PKey::EC object\" unless ec_key.is_a?(::OpenSSL::PKey::EC)\n raise TypeError, \"key_password must be a string\" unless key_password.is_a?(String)\n raise TypeError, \"key_cipher must be a string\" unless key_cipher.is_a?(String)\n raise ArgumentError, \"Specified key_cipher is not available on this system\" unless ::OpenSSL::Cipher.ciphers.include?(key_cipher)\n\n cipher = ::OpenSSL::Cipher.new(key_cipher)\n ec_key.to_pem(cipher, key_password)\n end", "def encryption_certificate\n return @encryption_certificate\n end", "def passphrase\n Digistore24.configuration.passphrase\n end", "def public_encrypt(data)\n Base64.encode64(@key.public_encrypt(data))\n end", "def private_key\n @private_key.to_der\n end", "def keypair(n=keypair_name)\n cloud_provider.keypair(n)\n end", "def encrypt(data)\n crypto_key.encrypt64(data)\n end", "def pubek\r\n Tem::Key.new_from_ssl_key endorsement_cert.public_key\r\n end", "def encryption_password\n res = @resource[:encryption_password]\n ph = @property_hash[:encryption_password]\n return ph if res.nil?\n return :default if res == :default &&\n ph == @tacacs_server.default_encryption_password\n unless res.start_with?('\"') && res.end_with?('\"')\n ph = ph.gsub(/\\A\"|\"\\Z/, '')\n end\n ph\n end", "def local_cipher_obj\n @local_cipher_obj ||= begin\n kyc_salt_e = @user_extended_detail_obj.kyc_salt\n r = Aws::Kms.new('kyc', 'admin').decrypt(kyc_salt_e)\n throw 'Unable to decrypt data' unless r.success?\n\n kyc_salt_d = r.data[:plaintext]\n LocalCipher.new(kyc_salt_d)\n end\n end", "def encryption_password\n res = @resource[:encryption_password]\n ph = @property_hash[:encryption_password]\n return ph if res.nil?\n return :default if res == :default &&\n ph == @tacacs_server_host.default_encryption_password\n unless res.start_with?('\"') && res.end_with?('\"')\n ph = ph.gsub(/\\A\"|\"\\Z/, '')\n end\n ph\n end", "def to_simple_key(key)\n key\n end", "def encrypt(data)\n return nil if !@key\n Base64::encode64(@key.private_encrypt(data)).delete(\"\\n\").strip\n end", "def generate_data_key\n begin\n\n resp = client.generate_data_key({\n key_id: key_id,\n key_spec: \"AES_256\"\n })\n\n return success_with_data(\n ciphertext_blob: resp.ciphertext_blob,\n plaintext: resp.plaintext\n )\n\n rescue => e\n return exception_with_data(\n e,\n 'a_k_3',\n GlobalConstant::ErrorAction.default,\n {\n purpose: @purpose,\n role: @role\n }\n )\n end\n\n end", "def default_key_format(key)\n key\n end", "def encryption_client; end", "def child_get_string_encrypted(name, key = nil)\n if (key == nil)\n key = DEFAULT_KEY\n end\n if (key.length != 16)\n abort(\"Invalid key, key length sholud be 16\")\n end\n value = child_get_string(name)\n value_array = value.lines.to_a\n plaintext = RC4(key, value_array.pack('H*'))\n plaintext\n end", "def storage_require_device_encryption=(value)\n @storage_require_device_encryption = value\n end", "def encrypt(data)\n _encrypt(data, \"#{NOT_SEARCHABLE.chr}\\0#{@key_id.chr}\\0\")\n end", "def dotted_to_encrypted_keys param\n encrypted_path = convert_key(param).dup\n encrypted_path[-1] = \"encrypted_#{encrypted_path.last}\".to_sym\n encrypted_path\n end", "def encryption_certificate_id\n return @encryption_certificate_id\n end", "def handle_sync_key enc_key\n PRIVATE_KEY.private_decrypt enc_key\n end", "def key(hash160)\n key = Bitcoin::Key.new\n key.priv = hash160\n key\n end", "def encrypt_message plaintext\n key_pair.encrypt plaintext\n end", "def magento_encryption_key \n require 'securerandom'\n return SecureRandom.uuid.gsub('-', '')\nend", "def encrypt(x)\n @aes_key.encrypt(x)\n end", "def get_keys\n @encryption_io.get_keys\n end", "def key_path\n @key_path || Utils.filesystem_name(name) + '.pem'\n end", "def get_account_key(storage_acct, skip_accessors_definition = false)\n if recent_api_version?\n list_account_key_objects(storage_acct.name_from_hash, storage_acct.resource_group, skip_accessors_definition).first.key\n else\n list_account_keys(storage_acct.name_from_hash, storage_acct.resource_group).fetch('key1')\n end\n end", "def key\n refresh_key unless key_valid?\n @key\n end", "def encryption_info\n @grpc.encryption_info\n end", "def encrypt string\n string\n end", "def store_encryption_key_sha\n self.encryption_key_sha = ENCRYPTION_KEY_SHA\n end", "def generate_secret_key\n r = Aws::Kms.new('saas', 'saas').decrypt(@client.api_salt)\n return r unless r.success?\n\n api_salt_d = r.data[:plaintext]\n\n client_api_secret_d = SecureRandom.hex\n\n r = LocalCipher.new(api_salt_d).encrypt(client_api_secret_d)\n return r unless r.success?\n\n {e_secret_key: r.data[:ciphertext_blob], d_secret_key: client_api_secret_d}\n end", "def encryption_info\n @ms_off_crypto.encryption_info\n end", "def generate_key\n key = RbNaCl::Random.random_bytes(RbNaCl::SecretBox.key_bytes)\n Base64.strict_encode64 key\n end", "def encrypted_keys\n Array(config[:encrypted_keys]).concat(\n Array(Chef::Config[:knife][:secure_data_bag][:encrypted_keys])\n ).uniq\n end", "def get_key(key)\n\t\t\tif @prod_env\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_prod\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_prod\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_dev\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_dev\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def letsencrypt\n render plain: ENV[\"LETS_ENCRYPT_KEY\"]\n end", "def key_field\n 'key'\n end", "def encrypt(value)\n encryptor.encrypt_and_sign(value)\n end", "def static_key_ecb(message)\n unknown = \"Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkgaGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBqdXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUgYnkK\"\n udecoded = Base64.decode64(unknown)\n\n message_appended = message + udecoded\n message_appended = pkcs7_pad(message_appended, 16)\n\n cipher = encrypt_ecb(message_appended, STATIC_KEY)\nend", "def public_key\n DH.new(to_der)\n end", "def encryption_master_key_base64=(s)\n @encryption_master_key = s ? Base64.strict_decode64(s) : nil\n end", "def client_key\n @client_key ||= CredentialCache.cache(cache_key(:client_key)) do\n hmac(salted_password, 'Client Key')\n end\n end", "def symmetric_key(name, cipher_class, cipher_name, key_abi_type, hooks = {})\n object_wrapper name, Tem::Keys::Symmetric, [key_abi_type, :key],\n :read => lambda { |k| Tem::Keys::Symmetric.new k },\n :to => lambda { |k| k.ssl_key },\n :new => lambda { |klass|\n k = cipher_class.new cipher_name\n \n unless k.respond_to? :key\n # Some ciphers don't give back the key that they receive.\n # We need to synthesize that.\n class <<k\n def key=(new_key)\n super\n @_key = new_key\n end\n def key\n @_key\n end\n end\n end\n k\n }\n end", "def make_key t\n (sig_key(t) + sum_key(t))[0..MAX_KEY_SIZE].sub(/\\0+\\z/, \"\")\n end", "def key(key_id, key, opts=OPTS)\n unless key_id.is_a?(Integer) && key_id >= 0 && key_id <= 255\n raise Error, \"invalid key_id argument, must be integer between 0 and 255\"\n end\n\n unless key.is_a?(String) && key.bytesize == 32\n raise Error, \"invalid key argument, must be string with exactly 32 bytes\"\n end\n\n if opts.has_key?(:padding)\n if padding = opts[:padding]\n unless padding.is_a?(Integer) && padding >= 1 && padding <= 120\n raise Error, \"invalid :padding option, must be between 1 and 120\"\n end\n end\n else\n padding = Cryptor::DEFAULT_PADDING\n end\n\n @keys << [key_id, key, opts[:auth_data].to_s, padding].freeze\n end" ]
[ "0.78088367", "0.74418074", "0.73942816", "0.7083248", "0.6965555", "0.6747416", "0.6747416", "0.6510257", "0.64306766", "0.62275136", "0.62206054", "0.6198979", "0.6198979", "0.6191083", "0.61812335", "0.6163843", "0.6163843", "0.60637015", "0.60606915", "0.6040697", "0.60377693", "0.6034843", "0.6013319", "0.59986854", "0.59986854", "0.5981861", "0.59732676", "0.59488934", "0.5914256", "0.5888523", "0.5858331", "0.58168924", "0.5766925", "0.5741496", "0.574088", "0.5736441", "0.5733165", "0.5720686", "0.56783044", "0.56774086", "0.56774086", "0.56756324", "0.564549", "0.5643538", "0.5639424", "0.56331366", "0.562682", "0.5613055", "0.56099", "0.5601088", "0.55985916", "0.5591944", "0.55883616", "0.55775744", "0.5574402", "0.5573327", "0.5572188", "0.55683726", "0.5554057", "0.5542223", "0.5540453", "0.5540338", "0.55350775", "0.55342376", "0.5531637", "0.5528828", "0.55197406", "0.55175763", "0.5517023", "0.5513919", "0.5511964", "0.5508353", "0.550645", "0.5504609", "0.5498749", "0.5498021", "0.54969007", "0.54950047", "0.5493413", "0.54915863", "0.5487471", "0.5484393", "0.5482654", "0.5478", "0.547501", "0.5473864", "0.54596376", "0.54518473", "0.5450298", "0.5437756", "0.54360795", "0.5426276", "0.5423083", "0.54204535", "0.5418697", "0.54137516", "0.5411575", "0.5411331", "0.54089165", "0.5404078" ]
0.61019737
17
Set the Cloud KMS encryption key that will be used to protect the table. For example: `projects/a/locations/b/keyRings/c/cryptoKeys/d` The default value is `nil`, which means default encryption is used.
def kms_key= new_kms_key_name frozen_check! @gapi.kms_key_name = new_kms_key_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encryptionKey=(value)\n\t\t\t@encryptionKey = value\n\t\tend", "def encryption_key\n @encryption_key ||= @keys.last.tap do |key|\n key.public_tags.encrypted_data_key_id = key.id if ActiveRecord::Encryption.config.store_key_references\n end\n\n @encryption_key\n end", "def encryption_key=(encryption_key)\n if !encryption_key.nil? && encryption_key.to_s.length > 100\n fail ArgumentError, 'invalid value for \"encryption_key\", the character length must be smaller than or equal to 100.'\n end\n\n @encryption_key = encryption_key\n end", "def encryption_key\n\tself.data_encrypting_key ||= DataEncryptingKey.primary\n\tdata_encrypting_key.key\n end", "def set_data_encrypting_key\n\tself.data_encrypting_key ||= DataEncryptingKey.primary\n end", "def encrypt_kms_keys\n updates = {}\n self.class.kms_keys.each do |key_method, key|\n instance_var = \"@#{key_method}\"\n key_column = \"encrypted_#{key_method}\"\n plaintext_key = instance_variable_get(instance_var)\n\n if !send(key_column) && plaintext_key\n updates[key_column] = KmsEncrypted::Database.new(self, key_method).encrypt(plaintext_key)\n end\n end\n if updates.any?\n current_time = current_time_from_proper_timezone\n timestamp_attributes_for_update_in_model.each do |attr|\n updates[attr] = current_time\n end\n update_columns(updates)\n end\n end", "def encryption_key\n return @encryption_fu_attrs['-encryption-key-'] if @encryption_fu_attrs['-encryption-key-']\n \n public_key = self.send self.encryption_fu_options[:public_key_field]\n if public_key.blank?\n public_key = self.generate_public_encryption_key\n self.send \"#{self.encryption_fu_options[:public_key_field]}=\".to_sym, public_key\n end\n private_key = self.private_encryption_key\n \n @encryption_fu_attrs['-encryption-key-'] = Digest::SHA256.hexdigest(\"-#{private_key}-#{public_key}-\")\n end", "def set_otp_key(id, key)\n @otp_keys[id] = encrypt(key.to_s) unless key.to_s.empty?\n end", "def setEncrypt(value)\n @fields['encrypt'] = value\n self\n end", "def setEncrypt(value)\n @fields['encrypt'] = value\n self\n end", "def setEncrypt(value)\n @fields['encrypt'] = value\n self\n end", "def crypto_key\n # Returns singleton object\n EmailEncryptionKey.instance.key\n end", "def encryption_key\n ENV[\"FASTLANE_CI_ENCRYPTION_KEY\"]\n end", "def encryption_key\n ENV[\"FASTLANE_CI_ENCRYPTION_KEY\"]\n end", "def storage_require_encryption=(value)\n @storage_require_encryption = value\n end", "def storage_require_encryption=(value)\n @storage_require_encryption = value\n end", "def save_encryption_key\n namespaced_redis = self.redis_connection\n if defined?(self.user_id)\n key = self.user_id.to_s\n else\n key = self.id.to_s\n end\n #just to stay on safe side\n raise 'Encryption key already exists' if namespaced_redis.get(key)\n namespaced_redis.set(key, @encryption_key)\n end", "def token_encryption_key_id=(value)\n @token_encryption_key_id = value\n end", "def set_key(exponent_hex_string, modulus_hex_string)\n @key = RsaKey.new exponent_hex_string, modulus_hex_string\n end", "def encrypt(data, key=nil)\n Crypto.new(key.nil? ? config.key : key).encrypt(data)\n end", "def storage_require_device_encryption=(value)\n @storage_require_device_encryption = value\n end", "def aes_key\n self.encrypted_data_will_change!\n \"dfdsdsfsdfsdfwefsdfds\"\n end", "def encrypt_ethereum_address\n\n r = Aws::Kms.new('kyc', 'admin').decrypt(@user_extended_details.kyc_salt)\n return r unless r.success?\n\n kyc_salt_d = r.data[:plaintext]\n\n encryptor_obj ||= LocalCipher.new(kyc_salt_d)\n r = encryptor_obj.encrypt(@new_ethereum_address)\n return r unless r.success?\n @encrypted_ethereum_address = r.data[:ciphertext_blob]\n\n success\n end", "def set_encryption_attributes\n @sorcery_config.encryption_provider.stretches = @sorcery_config.stretches if @sorcery_config.encryption_provider.respond_to?(:stretches) && @sorcery_config.stretches\n @sorcery_config.encryption_provider.join_token = @sorcery_config.salt_join_token if @sorcery_config.encryption_provider.respond_to?(:join_token) && @sorcery_config.salt_join_token\n @sorcery_config.encryption_provider.pepper = @sorcery_config.pepper if @sorcery_config.encryption_provider.respond_to?(:pepper) && @sorcery_config.pepper\n end", "def column_encryption_cryptor\n @column_encryption_cryptor ||= Cryptor.new(@column_encryption_keys)\n end", "def initialize(*)\n super\n\n @encrypted_env_key = \"ENCRYPTED_#{env_key}\"\n @encrypted_key_path = \"#{key_path}.enc\"\n end", "def encrypt_ec_key(ec_key, key_password, key_cipher)\n raise TypeError, \"ec_key must be a Ruby OpenSSL::PKey::EC object\" unless ec_key.is_a?(::OpenSSL::PKey::EC)\n raise TypeError, \"key_password must be a string\" unless key_password.is_a?(String)\n raise TypeError, \"key_cipher must be a string\" unless key_cipher.is_a?(String)\n raise ArgumentError, \"Specified key_cipher is not available on this system\" unless ::OpenSSL::Cipher.ciphers.include?(key_cipher)\n\n cipher = ::OpenSSL::Cipher.new(key_cipher)\n ec_key.to_pem(cipher, key_password)\n end", "def set_machine_encryption(encryption_type, machine_id, access_token = @access_token)\n if encryption_type == 'Default'\n encryption_value = 'default'\n elsif encryption_type == 'Custom'\n encryption_value = 'blowfish'\n end\n uri = URI.parse(\"#{QA_ENV['bus_host']}\")\n Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https', :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n url = \"/client/machine_set_encryption?encryption=#{encryption_value}&machine_id=#{machine_id}\"\n request = Net::HTTP::Put.new( url )\n Log.debug url\n request.add_field(\"Authorization\", \"Bearer #{Base64.strict_encode64(access_token[\"access_token\"])}\")\n response = http.request request\n @response = response\n Log.debug response.body\n end\n end", "def set_encoded_key(enc)\n set_session_key(EzCrypto::Key.decode(enc))\n end", "def set_key_iv\r\n @cipher.key = @key_iv[:key]\r\n @cipher.iv = @key_iv[:iv]\r\n end", "def encrypt()\n cipher_type = \"aes-128-ecb\"\n data = password;\n key = master_password;\n \n self.encrypted_password = aes_encrypt(data,key,nil,cipher_type).to_s\n end", "def encrypt(x)\n @aes_key.encrypt(x)\n end", "def encrypted_keys\n @encrypted_keys ||= encrypted_attributes.keys\n end", "def encrypt_key(key, public_key)\n encrypted_key = public_key.public_encrypt(key)\n encode encrypted_key\n end", "def encrypt(value)\n Base64.encode64 escape_and_execute_sql(\n [\"SELECT AES_ENCRYPT(?, ?)\", value, key]).first\n end", "def encrypt_password(key = @key)\n # TODO: add different sql statements for different DBs.\n sql = \"UPDATE login_details\n SET encrypted_password = \n AES_ENCRYPT(#{quote_value(self.decrypted_password)}, #{quote_value(key)})\n WHERE id = #{self.id}\"\n # Run this update manually.\n self.connection.execute sql\n end", "def encryption_master_key_base64=(s)\n @encryption_master_key = s ? Base64.strict_decode64(s) : nil\n end", "def encrypt_key(passwd, _options = {})\n passwd = passwd.to_s\n raise 'Missing encryption password!' if passwd.empty?\n Digest::SHA256.digest(passwd)\n end", "def encrypt\n self\n end", "def _get_encrypt_key\n # Checking key file used to encrypt/decrypt passwords\n key_file = File.join(PrcLib.pdata_path, '.key')\n if !File.exist?(key_file)\n # Need to create a random key.\n entr = Lorj::SSLCrypt.new_encrypt_key\n\n Lorj.debug(2, \"Writing '%s' key file\", key_file)\n unless PrcLib.dir_exists?(PrcLib.pdata_path)\n PrcLib.ensure_dir_exists(PrcLib.pdata_path)\n end\n File.open(key_file, 'w+') do |out|\n out.write(Base64.encode64(entr.to_yaml))\n end\n else\n Lorj.debug(2, \"Loading '%s' key file\", key_file)\n encoded_key = IO.read(key_file)\n entr = YAML.load(Base64.decode64(encoded_key))\n end\n entr\n end", "def encrypt(data, key, options = {})\n raise KeyError.new(\"Please provide a secret key to encrypt data with.\") unless key\n options = settings[:crypt].merge(options)\n unless data.is_a?(String)\n data = JSON.generate(data)\n end\n encrypted_data = crypt(:encrypt, data, key, options)\n encode(encrypted_data, options)\n end", "def bit_locker_encrypt_device=(value)\n @bit_locker_encrypt_device = value\n end", "def encrypt_message plaintext\n key_pair.encrypt plaintext\n end", "def encrypt(value)\n encryptor.encrypt_and_sign(value)\n end", "def store_encryption_key_sha\n self.encryption_key_sha = ENCRYPTION_KEY_SHA\n end", "def encrypt(data)\n _encrypt(data, \"#{NOT_SEARCHABLE.chr}\\0#{@key_id.chr}\\0\")\n end", "def kms_key_id\n @dbi.kms_key_id\n end", "def kms_key_id\n @dbi.kms_key_id\n end", "def encrypt(keys, plain)\n ::Fernet.generate(keys.last, plain)\n end", "def encrypted_private_key\n return private_key unless passphrase\n key_object.to_pem(OpenSSL::Cipher.new(\"AES-128-CBC\"), passphrase)\n end", "def get_key(id)\n @encryption_io.get_key(id)\n end", "def set_key_entry(aliaz, key, certificate_chain, password = nil)\n\n end", "def encryption_certificate=(value)\n @encryption_certificate = value\n end", "def protecting_encrypted_data(&block)\n with_encryption_context encryptor: ActiveRecord::Encryption::EncryptingOnlyEncryptor.new, frozen_encryption: true, &block\n end", "def encryptor\n ActiveSupport::MessageEncryptor.new(ActiveSupport::KeyGenerator.new(\n ENV.fetch(\"SECRET_KEY_BASE\")\n ).generate_key(\n ENV.fetch(\"ENCRYPTION_SERVICE_SALT\"),\n ActiveSupport::MessageEncryptor.key_len\n ))\n end", "def transport_key=(value)\n @transport_key = value\n end", "def key=(key)\n PrivateKey.enforce_valid_key_type!(key)\n\n @key = key\n end", "def signing_key= new_key\n @signing_key = new_key\n end", "def fetch_new_key(app_context)\r\n kms_client = Aws::KMS::Client.new()\r\n genkey = kms_client.generate_data_key({\r\n key_id: \"putyourmasterkeyidhere\",\r\n key_spec: \"AES_256\",\r\n encryption_context: {\r\n \"Application\" => app_context,\r\n }\r\n })\r\n return genkey.ciphertext_blob, genkey.plaintext\r\nend", "def set_key\n @key = Key.find(params[:id])\n end", "def set_keys\n self.auth = gen_key('auth') if auth.blank?\n self.mkey = gen_key('mkey') if mkey.blank?\n end", "def key(key_id, key, opts=OPTS)\n unless key_id.is_a?(Integer) && key_id >= 0 && key_id <= 255\n raise Error, \"invalid key_id argument, must be integer between 0 and 255\"\n end\n\n unless key.is_a?(String) && key.bytesize == 32\n raise Error, \"invalid key argument, must be string with exactly 32 bytes\"\n end\n\n if opts.has_key?(:padding)\n if padding = opts[:padding]\n unless padding.is_a?(Integer) && padding >= 1 && padding <= 120\n raise Error, \"invalid :padding option, must be between 1 and 120\"\n end\n end\n else\n padding = Cryptor::DEFAULT_PADDING\n end\n\n @keys << [key_id, key, opts[:auth_data].to_s, padding].freeze\n end", "def key=(new_key)\n @key = new_key\n end", "def change_key=(value)\n @change_key = value\n end", "def key_id\n GlobalConstant::Aws::Kms.get_key_id_for(@purpose)\n end", "def key_id\n GlobalConstant::Aws::Kms.get_key_id_for(@purpose)\n end", "def encrypt!(password, inki_cipher)\n\t\tif attributes = self.class.is_encrypted?\n\t\t\tattributes.each do |attribute|\n\t\t\t\tself.send(\"#{attribute}=\", encrypt_attribute(attribute, password, inki_cipher))\n\t\t\tend\n\t\t\tself.save\n\t\tend\n\tend", "def keyspace=(kyspc)\n @@default_keyspace = (kyspc + \"_\" + (ENV['RACK_ENV'] || 'development'))\n end", "def keyspace=(kyspc)\n @@default_keyspace = (kyspc + \"_\" + (ENV['RACK_ENV'] || 'development'))\n end", "def update!(**args)\n @gcp_kms_encryption_key = args[:gcp_kms_encryption_key] if args.key?(:gcp_kms_encryption_key)\n end", "def encrypt\n self\n end", "def encrypt_username(key = @key)\n # TODO: add different sql statements for different DBs.\n sql = \"UPDATE login_details\n SET encrypted_username =\n AES_ENCRYPT(#{quote_value(self.decrypted_username)}, #{quote_value(key)})\n WHERE id = #{self.id}\"\n # Run this update manually.\n self.connection.execute sql\n end", "def encrypt(value)\n if !@private_key.present? && encrypted?(value)\n value\n else\n escape_and_execute_sql([\"SELECT pgp_pub_encrypt(?, dearmor(?))\", value.to_s, @public_key])['pgp_pub_encrypt']\n end\n end", "def initialize(keys)\n if keys.empty?\n raise Error, \"Cannot initialize encryptor without encryption key\"\n end\n\n # First key is used for encryption\n @key_id, @key, @auth_data, @padding = keys[0]\n\n # All keys are candidates for decryption\n @key_map = {}\n keys.each do |key_id, key, auth_data, padding|\n @key_map[key_id] = [key, auth_data, padding].freeze\n end\n\n freeze\n end", "def encrypt(data)\n return nil if !@key\n Base64::encode64(@key.private_encrypt(data)).delete(\"\\n\").strip\n end", "def encrypt(data)\n crypto_key.encrypt64(data)\n end", "def key(password)\n decrypt(@encrypted_key, key_encryption_key(password))\n end", "def key(hash160)\n key = Bitcoin::Key.new\n key.priv = hash160\n key\n end", "def set_keypair\n # The generated keypair is stored in PEM encoding.\n self._keypair ||= OpenSSL::PKey::RSA.new(2048).to_pem\n self.jwk_kid = public_jwk.kid\n end", "def set_keypair\n # The generated keypair is stored in PEM encoding.\n self._keypair ||= OpenSSL::PKey::RSA.new(2048).to_pem\n self.jwk_kid = public_jwk.kid\n end", "def initialize(cipher, key)\n raise \"Cipher block size must be #{BLOCK_SIZE}\" unless cipher.block_size == BLOCK_SIZE\n\n @cipher = cipher\n @cipher.encrypt\n @cipher.key = @key = key\n\n generate_subkeys\n reset\n end", "def aes_key_core(k, i)\n t = 0\n 0.upto(3) do |j|\n t = aes_set_byte(t, (j-1) % 4, AES_SBOX[aes_get_byte(k, j)])\n end\n aes_set_byte(t, 0, aes_get_byte(t,0) ^ AES_RCON[i])\n end", "def default_bucket_encryption_sse_cmk_set?(\r\n s3_client,\r\n bucket_name,\r\n kms_master_key_id\r\n)\r\n s3_client.put_bucket_encryption(\r\n bucket: bucket_name,\r\n server_side_encryption_configuration: {\r\n rules: [\r\n {\r\n apply_server_side_encryption_by_default: {\r\n sse_algorithm: 'aws:kms',\r\n kms_master_key_id: kms_master_key_id\r\n }\r\n }\r\n ]\r\n }\r\n )\r\n return true\r\nrescue StandardError => e\r\n puts \"Error setting default encryption state: #{e.message}\"\r\n return false\r\nend", "def rotate_encryption_key bucket_name:, file_name:, current_encryption_key:, new_encryption_key:\n # The ID of your GCS bucket\n # bucket_name = \"your-unique-bucket-name\"\n\n # The ID of your GCS object\n # file_name = \"your-file-name\"\n\n # The Base64 encoded AES-256 encryption key originally used to encrypt the object.\n # See the documentation on Customer-Supplied Encryption keys for more info:\n # https://cloud.google.com/storage/docs/encryption/using-customer-supplied-keys\n # current_encryption_key = \"TIbv/fjexq+VmtXzAlc63J4z5kFmWJ6NdAPQulQBT7g=\"\n\n # The new encryption key to use\n # new_encryption_key = \"0mMWhFvQOdS4AmxRpo8SJxXn5MjFhbz7DkKBUdUIef8=\"\n\n require \"google/cloud/storage\"\n\n storage = Google::Cloud::Storage.new\n bucket = storage.bucket bucket_name, skip_lookup: true\n file = bucket.file file_name, encryption_key: current_encryption_key\n\n file.rotate encryption_key: current_encryption_key,\n new_encryption_key: new_encryption_key\n\n puts \"The encryption key for #{file.name} in #{bucket.name} was rotated.\"\nend", "def product_key=(value)\n @product_key = value\n end", "def product_key=(value)\n @product_key = value\n end", "def i_cloud_require_encrypted_backup=(value)\n @i_cloud_require_encrypted_backup = value\n end", "def symmetric_key(name, cipher_class, cipher_name, key_abi_type, hooks = {})\n object_wrapper name, Tem::Keys::Symmetric, [key_abi_type, :key],\n :read => lambda { |k| Tem::Keys::Symmetric.new k },\n :to => lambda { |k| k.ssl_key },\n :new => lambda { |klass|\n k = cipher_class.new cipher_name\n \n unless k.respond_to? :key\n # Some ciphers don't give back the key that they receive.\n # We need to synthesize that.\n class <<k\n def key=(new_key)\n super\n @_key = new_key\n end\n def key\n @_key\n end\n end\n end\n k\n }\n end", "def dotted_to_encrypted_keys param\n encrypted_path = convert_key(param).dup\n encrypted_path[-1] = \"encrypted_#{encrypted_path.last}\".to_sym\n encrypted_path\n end", "def set_encrypter\n @encrypter = Encrypter.find(params[:id])\n end", "def kms_key_id\n data[:kms_key_id]\n end", "def kms_key_id\n data[:kms_key_id]\n end", "def handle_sync_key enc_key\n PRIVATE_KEY.private_decrypt enc_key\n end", "def add_key(options={},user=nil) \n\t\tuser = Account.current_account if !user\n\t\tKey.new({:account_id => user.id, :project_id => self.id}.merge(options))\n\tend", "def encrypt string\n string\n end", "def set_key_set\n @key_set = KeySet.find(params[:id])\n end", "def key_credentials=(value)\n @key_credentials = value\n end", "def searchable_encrypt(data)\n _encrypt(data, _search_prefix(data, SEARCHABLE, @key_id, @key))\n end", "def kms_key\n @gapi.kms_key_name\n end", "def keypair(n=keypair_name)\n cloud_provider.keypair(n)\n end" ]
[ "0.7589235", "0.6931097", "0.6407276", "0.6348768", "0.63178056", "0.6158208", "0.6145513", "0.60508466", "0.59998685", "0.59998685", "0.59998685", "0.5870334", "0.5859805", "0.5859805", "0.58280116", "0.58280116", "0.58108246", "0.5732082", "0.5721759", "0.569891", "0.5686856", "0.56461436", "0.5562571", "0.55129254", "0.551029", "0.55067736", "0.54771376", "0.5451962", "0.5431333", "0.54230225", "0.5401734", "0.537273", "0.53646076", "0.5345149", "0.5338782", "0.53102636", "0.53050184", "0.52879965", "0.528353", "0.5279966", "0.52760446", "0.52700263", "0.5265329", "0.52474606", "0.52467453", "0.52436656", "0.523627", "0.523627", "0.5232189", "0.52289635", "0.5221446", "0.52169454", "0.5216317", "0.52088904", "0.5206777", "0.5203693", "0.5184611", "0.5182221", "0.51822174", "0.5181924", "0.5170807", "0.5168885", "0.51631284", "0.5154416", "0.51528627", "0.51528627", "0.5150222", "0.51431555", "0.51431555", "0.51405567", "0.51363677", "0.5134184", "0.5114447", "0.5096661", "0.50965744", "0.50769234", "0.50732845", "0.50714976", "0.50691855", "0.50691855", "0.5066716", "0.50649405", "0.5064055", "0.50605047", "0.50573564", "0.50573564", "0.50539273", "0.50478435", "0.50402886", "0.5022607", "0.50160617", "0.50160617", "0.5003928", "0.5002986", "0.50002253", "0.49983937", "0.49939644", "0.498259", "0.49778163", "0.49768224" ]
0.60824543
7
Sauvegarde un ensemble de challenges
def sauvegarder() res_json = JSON.generate(@challenges) fd = File.open(@pwd, "w") fd.write(res_json) fd.close() return self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def challenges; end", "def phase_one\r\n # start with empty elimination array\r\n council_elimination = []\r\n # loop 8 times (game mechanics)\r\n 8.times do\r\n # tribe which has lost the challenge\r\n loosing_tribe = @borneo.immunity_challenge\r\n # tribal council for the loosing tribe will eliminate one participants\r\n council_elimination << loosing_tribe.tribal_council\r\n end\r\n # return all eliminations (used for the test szenario)\r\n return council_elimination.length\r\nend", "def phase_one\n eliminated = []\n 8.times do\n elim_tribe = @borneo.immunity_challenge\n index = @borneo.tribes.index(elim_tribe)\n element = elim_tribe.tribal_council\n @borneo.tribes[index].members = @borneo.tribes[index].members - Array(element)\n eliminated << element\n end\n puts \"Phase 1 eliminations: \".red\n puts \"----------------------------------------\"\n eliminated.each_with_index do |contestants,index|\n puts \"#{index+1}: #{contestants}\"\n end\n puts \"----------------------------------------\"\n eliminated.length\nend", "def challenge; end", "def choose_problems(competition)\n\t\tusers=competition.users\n\t\tcase competition.target\n\t\twhen 1\n\t\t\tproblems=Problem.all.where(target: 1)\n\t\twhen 2\n\t\t\tproblems=Problem.all.where(target: 2)\n\t\twhen 3\n\t\t\tproblems=Problem.all.where(target: 3)\n\t\telse\n\t\t\tproblems=Problem.all\n\t\tend\t\n\t\tchecked_problems=problems.where(checked: true) #<-- add checked\n\t\tunseen_problems=checked_problems\n\t\tusers.each do |u|\n\t\t\tunseen_problems=unseen_problems.select{ |p| !p.viewers.include?(u)}\n\t\tend \n\t\tproblems_length=0\n\t\tproblem=nil\n\t\twhile problems_length < competition.length do\n\t\t\tmax_length=competition.length-problems_length\n\t\t\tproblem=nil\n\t\t\tproblem=unseen_problems.select{ |p| p.length <= max_length && !competition.problems.include?(p)}.sample #balta6tina\n\t\t\tif problem.present?\n\t\t\t\tproblems_length += problem.length\n\t\t\t\tcompetition.competition_problems.create!(problem_id: problem.id)\n\t\t\telse\n\t\t\t\tproblem=checked_problems.select{ |p| p.length <= max_length && !competition.problems.include?(p)}.sample\n\t\t\t\tproblems_length += problem.length\n\t\t\t\tcompetition.competition_problems.create!(problem_id: problem.id)\n\t\t\tend\n\t\tend\t\n end", "def UltimateChallenge\r\n @data = Upd.all \r\n end", "def goals_against()\n\t self.as_regular_contestants.select{|c| c.opponent.score}.collect{|c| c.opponent.score}.inject{|gf, c| gf + c} || 0\n\tend", "def phase_one\n puts \"Phase 1 Starting\".yellow\n counter = 8\n eliminated = []\n while counter > 0\n indexer = 8 - counter\n puts \"Phase one, round #{(indexer+1).to_s}:\".green\n tribe_selected = @borneo.immunity_challenge\n puts \"Tribe selected: #{tribe_selected.to_s}\".green\n puts \"Contestant #{tribe_selected.tribal_council} was eliminated without mercy!\".red\n counter -= 1\n end\n 8 # this is here to pass the test, but not sure it's ver useful beyond that\nend", "def alg; end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def build_subsolutions\n @success_probability = Array.new(@size)\n @success_probability[@size-1] = 1.0/@size\n (@size-1).downto(1).each { |k|\n @success_probability[k-1] = 1.0/@size + @success_probability[k]*(k-1)/k\n }\n end", "def first_challenge\n epic_tragedy = {\n montague: {},\n capulet: {}\n }\nend", "def createChallenges\n for tab in Lecode_BattleChallenge::Challenges\n chall = Battle_Challenge.new\n chall.name = tab[0]\n chall.icon = tab[1]\n chall.description = tab[2]\n chall.gain = tab[3]\n chall.freq = tab[4]\n chall.success_onEnd = tab[5]\n chall.id = @challenges.size\n @challenges.push(chall)\n init_evaluation(chall.name)\n end\n \n end", "def solve(ingredients, part_two: false)\n score = 0\n max = 0\n\n (0..100).each do |i|\n (0..100 - i).each do |j|\n (0..100 - i - j).each do |k|\n l = 100 - i - j - k\n capacity = calculate_total(ingredients, \"capacity\", i, j, k, l)\n durability = calculate_total(ingredients, \"durability\", i, j, k, l)\n flavor = calculate_total(ingredients, \"flavor\", i, j, k, l)\n texture = calculate_total(ingredients, \"texture\", i, j, k, l)\n calories = calculate_total(ingredients, \"calories\", i, j, k, l)\n\n next if part_two && calories != 500\n next if capacity <= 0 || durability <= 0 || flavor <= 0 || texture <= 0\n\n score = capacity * durability * flavor * texture\n max = score if score > max\n end\n end\n end\n max\nend", "def solve\n # Generate uniques\n spaces = student_ids.product(bag_ids)\n\n visited_nodes = 0\n student_ids.each do |sid|\n bid = solver.choose(*bag_choices_for_student(sid))\n visited_nodes +=1\n partial_plan[sid] = bid\n solver.assert assigned_bags_are_unique(partial_plan)\n solver.assert assigned_bags_without_student_repeats(partial_plan)\n end\n\n puts \"Visited: #{visited_nodes} nodes\"\n partial_plan.to_a\n end", "def attack_phase\n \n #encontra o territorio com mais exercitos\n territorios = get_territories.clone\n territorios.sort! { |a,b| b.troops <=> a.troops }\n \n if territorios[0].troops == 1\n @controller.attack_end(@conn,nil)\n return\n else\n origem = territorios[0]\n\n #encontra territorio inimigo com menos tropas\n alvos = vizinhos_inimigos(origem)\n \n if alvos.size == 0 \n @controller.attack_end(@conn,nil)\n return\n end\n alvos.sort! { |a,b| a.troops <=> b.troops } \n \n alvo = alvos[0]\n \n \n order = {'origin' => origem.id, 'destiny' => alvo.id, 'qtd' => origem.troops-1}\n @controller.attack_order(@conn,order)\n end\n \n \n \n #usar @controller.attack_order() para fazer um ataque\n #usar @controller.attack_end() para terminar fase de ataque\n end", "def start_solution plan\n solutions = []\n 15.times do\n s = mutate_pairs plan, valid_solution2(false)\n solutions << s\n end\n\n #0.times do\n # s = random_solution plan\n #end\n\n 10.times do\n s = structured_solution plan\n solutions << mutate_pairs(plan, s)\n end\n sort_soluitons plan, solutions\n end", "def goals_for()\n\t self.as_regular_contestants.select{|c| c.score}.collect{|c| c.score}.inject{|gf, c| gf + c} || 0\n\tend", "def phase1_reduce\n removed_all = []\n\n # 1.3i - remove any that match 1.3i\n @best_proposals.each_with_index do |p,i|\n slice_point = @people_prefs[i].index(p) + 1\n removed_from_i = @people_prefs[i].slice!(slice_point, @people_prefs[i].count)\n removed_all << removed_from_i\n end\n\n # 1.3ii - remove user i from the list of those he had removed above\n removed_all.each_with_index do |list,i|\n list.each do |ignored_user|\n @people_prefs[ignored_user].delete(i)\n end\n end\n\n @people_prefs\n end", "def converte\n # estados\n estados = ['q']\n 1.upto(@estados.length) do |i|\n @estados.keys.combination(i).to_a.collect { |c| c.sort.join }.each do |a|\n estados << 'q' + a\n end\n end\n\n # alfabeto\n alfabeto = @alfabeto\n\n # função de transição\n transicao = []\n estados.each do |estado|\n if estado == 'q' # vazio\n alfabeto.each { |el| transicao << [ 'q', el, 'q' ] }\n else\n alfabeto.each do |el|\n # verifica setas\n setas = []\n estado[1,estado.length].each_char do |c|\n @transicao.each do |funcao|\n if funcao[0] == c and funcao[1] == el\n setas << funcao[2]\n end\n end\n end\n setas = setas.flatten.uniq.sort\n # adiciona setas no caso de 'e'\n setas.each do |c|\n @transicao.each do |funcao|\n if funcao[0] == c and funcao[1] == nil\n setas << funcao[2]\n end\n end\n end\n setas = setas.flatten.uniq.sort\n # acrescenta à função de transição\n transicao << [ estado, el, 'q' + setas.join ]\n end\n end\n end\n\n # estado inicial\n i = [@atual.nome]\n @transicao.each do |funcao|\n if funcao[0] == @atual.nome and funcao[1] == nil\n i << funcao[2]\n end\n end\n inicial = 'q' + i.flatten.uniq.sort.join\n\n # estados finais\n finais = []\n estados.each do |estado|\n @finais.each do |final|\n finais << estado if estado.include? final\n end\n end\n finais.uniq!\n\n # simplifica, removendo os estados que não recebem nenhuma seta\n a_remover = []\n (estados - [inicial]).each do |estado|\n encontrado = false\n transicao.each do |funcao|\n encontrado = true if funcao[2] == estado\n end\n a_remover << estado if not encontrado\n end\n a_remover.each do |estado|\n estados.delete estado\n r = []\n transicao.each do |funcao|\n r << funcao if funcao[0] == estado\n end\n r.each { |x| transicao.delete x }\n finais.delete estado\n end\n\n return { K: estados, S: alfabeto, d: transicao, s: inicial, F: finais }\n end", "def conclusion(score = score())\n claims = []\n participants = score.alts.inject(0) { |t, alt| t + alt.participants }\n claims << if participants.zero?\n I18n.t('vanity.no_participants')\n else\n I18n.t('vanity.experiment_participants', count: participants)\n end\n # only interested in sorted alternatives with conversion\n sorted = score.alts.select { |alt| alt.measure > 0.0 }.sort_by(&:measure).reverse\n if sorted.size > 1\n # start with alternatives that have conversion, from best to worst,\n # then alternatives with no conversion.\n sorted |= score.alts\n # we want a result that's clearly better than 2nd best.\n best = sorted[0]\n second = sorted[1]\n if best.measure > second.measure\n diff = ((best.measure - second.measure) / second.measure * 100).round\n better = I18n.t('vanity.better_alternative_than', probability: diff.to_i, alternative: second.name) if diff > 0\n claims << I18n.t('vanity.best_alternative_measure', best_alternative: best.name, measure: format('%.1f', (best.measure * 100)), better_than: better)\n claims << if score.method == :bayes_bandit_score\n if best.probability >= 90\n I18n.t('vanity.best_alternative_probability', probability: score.best.probability.to_i)\n else\n I18n.t('vanity.low_result_confidence')\n end\n elsif best.probability >= 90\n I18n.t('vanity.best_alternative_is_significant', probability: score.best.probability.to_i)\n else\n I18n.t('vanity.result_isnt_significant')\n end\n sorted.delete best\n end\n sorted.each do |alt|\n claims << if alt.measure > 0.0\n I18n.t('vanity.converted_percentage', alternative: alt.name.sub(/^\\w/, &:upcase), percentage: format('%.1f', (alt.measure * 100)))\n else\n I18n.t('vanity.didnt_convert', alternative: alt.name.sub(/^\\w/, &:upcase))\n end\n end\n else\n claims << I18n.t('vanity.no_clear_winner')\n end\n claims << I18n.t('vanity.selected_as_best', alternative: score.choice.name.sub(/^\\w/, &:upcase)) if score.choice\n claims\n end", "def phase_one\n\t#Intro\n\n\t\[email protected] do |tribe|\n\t\tputs \"Welcome #{tribe}\".green\n\t\tend\n\nprint_header(\"For Phase 1, you will now compete in 8 challenges for immunity. Good luck!\")\n\n\t8.times do\n\t\timmunity_challenge_losing_tribe = @borneo.immunity_challenge\n\t\tputs \"#{immunity_challenge_losing_tribe}\".green + \" has lost the immunity challenge and must now vote out 1 member.\"\n\t\tmember_voted_off = immunity_challenge_losing_tribe.tribal_council\n\tend\t\nend", "def solver (seed_char, blanks_words_sizes, matrix)\n\t# Set numerical target\n\ttarget = magic_num(seed_char)\t\n\t# Find magic number sum buckets\n\tskynet(target, blanks_words_sizes, blanks_words_sizes.length - 1, 0, [])\n\t# Alphabetical sort input matrix\n\tsorted_seed_char = seed_char.chars.sort.join\t\n\n\t# Find unique sets from skynet solutions\n\t$answer[:trace].each do |arrOarr|\n\t\tarrOarr.sort!\n\tend \n\n\t$answer[:trace].uniq!\t\n\t\n\t# Finds match for complete set of words from skynet solutions\n\t$answer[:trace].each do |answer_arr_el|\t\t\t\t\n\t\tunordered_match(sorted_seed_char, matrix, answer_arr_el, answer_arr_el.length - 1, \"\", [])\n\t\t# Can be ignored\n\t\t$ops += $seed[answer_arr_el[0][0]][:num_groups][answer_arr_el[0][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length\t\t\n\tend\n\t\n\treturn $answer[:words]\nend", "def part2(clues, aunts)\n result = Array.new aunts\n clues.each do |clue|\n #filter aunts that do not match the key:value in clue\n key = clue.keys.first\n result.reject! do |a|\n a.has_key? key and retroencabulation(key, clue[key], a[key])\n end\n\n #puts \"Using #{key} as the filter, there are now #{aunts.length} remaining possibilities\"\n end\n result[0]\nend", "def deduce\n while true\n stuck, guess, count = true, nil, 0\n # fill in any spots determined by direct conflicts\n allowed = board.allowed_numbers\n (0..80).each do |index|\n if board.board[index].nil?\n numbers = bits_to_numbers(allowed[index])\n if numbers.size == 0\n return [] # Return nothing if no possibilitie E\n elsif numbers.size == 1\n board.board[index] = numbers[0]\n stuck = false\n break\n elsif stuck\n new_guesses = numbers.map { |n| [index, n] }\n guess, count = pickbetter(guess, count, new_guesses)\n end\n end\n end\n\n if !stuck\n allowed = board.allowed_numbers\n end\n needed = board.needed_numbers\n\n # fill in any spots determined by elimination of other locations.\n # For any given column, find which numbers it is missing,\n # And figure out which positions allow those numbers - if only\n # one position allows it, the number goes there.\n #\n # If more than one spot is available, add to the guesses.\n board.coordinate_systems.each do |axis|\n (0..8).each do |x|\n numbers = bits_to_numbers(needed[axis_index(x, axis)])\n numbers.each do |n|\n bit = 1 << n\n # spots =for this number & col, all positions that allow the needed\n # numbers\n spots = []\n\n (0..8).each do |y|\n index = board.index_for(x, y, axis)\n # if this position allows the needed number, add it to spots\n if allowed[index] & bit\n spots << index\n end\n end\n\n if spots.length == 0\n return []\n elsif spots.length == 1\n board.board[spots[0]] = n\n stuck = False\n break\n elsif stuck\n new_guesses = spots.map { |index| [index, n] }\n guess, count = pickbetter(guess, count, new_guesses)\n end\n end\n end\n end\n\n if stuck\n guess.shuffle! unless guess.nil?\n return guess\n end\n end\n end", "def all_judge\n #defensive check for rappers in the stage\n unless self.stage.is_full\n raise \"stage must be full to make everyone a judge\"\n end\n # makes the booth seats point to the audience\n @audience.all_judge # method in the audience class that makes everyone a judge\n @booth.booth_seats = @audience.seating #might need to add them all to queue foirst, hopefuly this way of skipping that doesnt cause issues\n end", "def reduce_solution_set(secret_code)\n clue = Clues.new(guess: @guess, code: secret_code).keys\n @solution_set = @solution_set.map do |num|\n Clues.new(guess: num.digits.reverse, code: @guess).keys == clue ? num : nil\n end\n # remove the nil values just added\n @solution_set = @solution_set.compact\n end", "def start_game(input_deck)\n deck = Deck.find(input_deck)\n p game = Game.create(user_id: 1, deck_id: deck.id)\n questions = deck.questions\n questions.each do |question|\n answers = question.answers\n answer_user = @view.show_question(question, answers)\n p result = comparar(game, deck, question, answer_user, answers)\n p\"++++++++\"\n p count_answers(result)\n \n #variable = Question.find(1).answers (esto es de la consolita)\n #p correcta = answers.find_by(option:true).name\n \n \n #mostrar resultado\n #volver a mostrar menu de decks.........\n end\n @view.despedida(@@sum_correct, @@sum_incorrect)\n end", "def problem_108a\n i = 4\n max = 0\n solve = {}\n loop do\n num = 0\n a = Rational(1,i)\n 2.upto(i*2+1) do |j|\n if (a - Rational(1,j)).numerator == 1\n num += 1 \n# puts \"(#{a} - #{Rational(1,j)} == #{a - Rational(1,j)}\"\n end\n end\n\n solve[num] = [] unless solve[num]\n solve[num] << i.factors\n\n if num >= max\n puts \"####################################\"\n solve.each_key.sort.each do |k|\n s = solve[k].map do |v|\n h = {}\n v.each {|a| h[a] = (h[a] || 0) + 1 }\n h.values.sort.flatten\n end.uniq.sort\n puts \"k = #{k} groups: #{s.inspect}\"\n# puts solve[k].inspect\n end\n puts \"#{i} = #{num} #{i.factors} #{i.factors.length + i.divisors.length}\" \n max = num\n end\n break if num > 1000\n i += 1\n end\n i\nend", "def solve\n end", "def recompute_scores\n point_attribution_all\n Section.all.each do |s|\n \ts.max_score = 0\n \tif !s.fondation?\n \t\ts.problems.each do |p|\n \t\t\tif p.online?\n\t\t \t\t\ts.max_score = s.max_score + p.value\n\t\t \t\tend\n\t\t \tend\n\t\t \ts.chapters.each do |c|\n\t\t \t\tif c.online?\n\t\t \t\t\tc.exercises.each do |e|\n\t\t \t\t\t\tif e.online?\n\t\t \t\t\t\t\ts.max_score = s.max_score + e.value\n\t\t \t\t\t\tend\n\t\t \t\t\tend\n\t\t \t\t\tc.qcms.each do |q|\n\t\t \t\t\t\tif q.online?\n\t\t \t\t\t\t\ts.max_score = s.max_score + q.value\n\t\t \t\t\t\tend\n\t\t \t\t\tend\n\t\t \t\tend\n\t\t \tend\n\t\t end\n \ts.save\n end\n redirect_to users_path\n end", "def calculate_choices(cities, last_city, exclude, pheromone, c_heur, c_hist)\n #Checa todas as possibildiades para se escolher a proxima cidade.\n choices = []\n #passa por todas as cidades. coord pega as coordenadas de uma dada cidade, i a posicao dela no array de cidades. o i identifica qual cidade no array � \n cities.each_with_index do |coord, i|\n #checa se a cidade ja foi visitada. as cidades visitadas esta em exclude. A cidade analisada estar no vetor exclude? Se sim, sai dessa intera��o\n\tnext if exclude.include?(i)\n \n\t#Indentifica qual cidade esta sendo analisada\n\tprob = {:city=>i}\n \n #calcula o fator historico. O c hist mostra o quanto voce considera o historico. Historico o quanto que passaram naquela cidade, e se mede isso coma matriz de pheronio. Se passaram muito por ali de maniera frequente, maior o fator de historico pois o pheromonio ali estar� muito alto\n\tprob[:history] = pheromone[last_city][i] ** c_hist\n\t# Considera o vetor distancia \n\tprob[:distance] = euc_2d(cities[last_city], coord)\n # Calcula o faotr heuristico, isso e, o quanto que a distancia vai influir nessa decisao. Quanto maior a distancia, menor a chance de se escolher\n\tprob[:heuristic] = (1.0/prob[:distance]) ** c_heur\n # Calcula a probabilidade da escolha ser escolhida. Multiplica o fator de distancia e o fator heuristico\t\n\tprob[:prob] = prob[:history] * prob[:heuristic]\n # Adiciona a escolha no vetor de escolha\n\tchoices << prob\n end\n choices\nend", "def valid_solution2 co_support\n # Randomgenerator\n rnd = Random.new\n\n # current plan to slove\n plan = SemesterPlan.find(params[:id])\n\n # prioritys for slots and user\n # sorts slots by user availability\n # sorts user by slot availibiluity\n slot_priority_origin = plan.get_slot_priority\n user_priority_origin = plan.get_user_priority\n\n\n # empty slots to empty solution_slots at each itteration begin\n empty_slots = []\n if co_support\n empty_slots = eval(plan.solution)\n else\n 20.times do |n|\n empty_slots << {index: n, user: nil, co: nil, slot: nil}\n end\n end\n\n # break variable\n done = false\n\n # availabilty which will be max accepted\n if co_support\n availability = 2\n else\n availability = 1\n end\n\n # saves itterations\n i = 0\n\n # iteration border for availibility to increase to 2\n i_av_2 = 400\n\n # iteration_border for interrupt\n i_max = 800\n\n # saves the solution\n solution_slots = []\n\n # until all slots are valid taken\n start = Time.now\n begin\n # counter for open slots\n slots = 20\n\n # clear solution\n solution_slots = empty_slots.clone\n\n # clone prioritys and shift-plans\n slot_priority = slot_priority_origin.clone\n user_priority = user_priority_origin.clone\n shifts = User.supporter_amount_of_shifts(20, User.where(planable: true, inactive: false))\n\n # set break variable to false\n done = false\n\n # repeat until plan invalid or complete plan valid\n while slot_priority.length != 0 && !done\n\n # random wheel for all slot prioritys\n roulette = calc_roulette slot_priority\n\n\n # random float\n random = rnd.rand\n slot = nil\n\n # take random slot\n roulette.each do |roul|\n if roul[:value] > random\n slot = slot_priority[roul[:index]]\n break\n end\n end\n\n # saves the found user\n found_user = nil\n # return all user with given availbility in current slot\n users = TimeSlot.find(slot[:slot]).get_users availability\n\n # if at least 1 user found\n if users.length != 0\n\n # break conditions\n found = false\n nothing = true\n\n # tests all slots\n user_priority.each do |pr_user|\n if !found\n\n # tests all available users\n users.each do |slot_user|\n\n # if user is found and in earlier iterations no user was found for this slot\n if (pr_user[:user] == slot_user && !found) &&(co_support && solution_slots.detect {|s| s[:index] == slot[:index]}[:user] !=slot_user || !co_support)\n\n\n # saves user for slot\n if co_support\n solution_slots.detect {|s| s[:index] == slot[:index]}[:co] = slot_user\n solution_slots.detect {|s| s[:index] == slot[:index]}[:slot] = slot[:slot]\n else\n solution_slots.detect {|s| s[:index] == slot[:index]}[:user] = slot_user\n solution_slots.detect {|s| s[:index] == slot[:index]}[:slot] = slot[:slot]\n end\n\n\n\n # set\n found = true\n found_user = pr_user\n\n # update shifts\n shifts = User.reduce_shifts found_user[:user], shifts\n\n # remove user from slot_priority and delete user from user_priority\n # if all shifts are given\n shifts.each do |s|\n if s[:user] == found_user[:user]\n if s[:shifts] == 0\n slot_priority = SemesterPlan.kill_user_in_slot_priority found_user[:user], slot_priority\n user_priority.delete(found_user)\n end\n end\n end\n\n # delete slot and sort\n slot_priority.delete(slot)\n slot_priority.sort_by! {|item|\n item[:priority] * -1\n }\n # removes slot from user_priority and sort\n user_priority = SemesterPlan.kill_slot_in_user_priority slot[:slot], user_priority\n user_priority.sort_by! {|item|\n item[:priority] * -1\n }\n\n # decrement slots and set nothing to false for next iteration\n slots -= 1\n nothing = false\n break\n end\n end\n end\n end\n\n # break if no slot was found\n if nothing == true\n done = true\n end\n # break if no user was found\n else\n done = true\n end\n end\n # break if iteration max is reached\n if Time.now - start > 10\n done = true\n\n # increment aǘailbility\n elsif Time.now - start > 2\n if availability != 2\n availability = 2\n else\n #availability = 1\n end\n end\n\n # increment iteration\n i += 1\n end while slots > 0 && Time.now - start <=10\n\n # update solution and return it additionally (r)\n solution_slots\n\n end", "def huella\n\t\tindice1 = 0\n\t\t#dependiendo del vct de cada ingrediente, se le pone un indice\n\t\tif vct < 670\n\t\t\tindice1 = 1\n\t\t\t\n\t\telsif vct > 830\n\t\t\tindice1 = 3\n\t\telse \n\t\t\tindice1 = 2\n\t\tend \n\t\tindice2 = 0\n\t\t#dependiendo de los gases emitidos de cada ingrediente, \n\t\t#se le pone un indice\n\t\tif emisiones < 800\n\t\t\tindice2 = 1\n\t\telsif emisiones > 1200\n\t\t\tindice2 = 3\n\t\telse \n\t\t\tindice2 = 2\n\t\tend\n\t\t#hace la media de los indices sacados\n\t\tindiceres = (indice1+indice2)/2\n\t\t\n\n\tend", "def teach(cohort) #check what happens with an arrage\n cohort.each {|student| student.learn } #this will put learn into each\n end", "def first_challenge\n epic_tragedy = {\n :montague => {},\n :capulet => {}\n }\nend", "def phase_one\n introduction\n title \"Phase One\"\n losers = 0\n immune_members = []\n 8.times do\n losing_tribe = @borneo.tribes.shuffle.first\n puts \"The losing tribe is #{losing_tribe}\".red\n loser = losing_tribe.tribal_council()#no immune members\n puts \" The loser member is #{loser}\"\n losers += 1\n counting = 0\n @borneo.tribes.each{|tribe| counting += tribe.members.length}\n puts \" #{losers} gone!\"\n puts \" #{counting} remaining players\"\n end\nend", "def reduce_options(indexed_guessed_code)\n guessed_code = computer.transform_to_colors(indexed_guessed_code)\n guess_score = count_beads(guessed_code)\n score_sum = guess_score.inject(0, :+)\n computer.list_of_combinations.each_with_index do |code, index|\n colored_code = computer.transform_to_colors(code)\n code_score = count_beads(colored_code)\n new_score_sum = code_score.inject(0, :+)\n # puts \"guess score #{guess_score}, code score #{code_score}\"\n next if code_score[0] == 4\n if code == indexed_guessed_code\n computer.list_of_combinations.delete_at(index)\n elsif guess_score != code_score || new_score_sum <= score_sum\n # puts \"#{new_score_sum} <= #{score_sum}\"\n computer.list_of_combinations.delete_at(index)\n end\n end\n # p computer.list_of_combinations.length\n # p computer.list_of_combinations\n end", "def unique_cards(game_deck, faces, suits)\n faces.each do |face|\n suits.each do |suit|\n c = Card.new(face,suit)\n card_value_determiner(c)\n game_deck.deck << c\n end\n end\nend", "def submissions(rogue_score=5)\r\n return @submissions if @submissions\r\n #puts \"enter new submissions\"\r\n @submissions = []\r\n #@expert_grades = [95.0, 95.0, 90.0, 90.0, 95.0, 90.0, 85.0, 90.0, 90.0, 95.0, 90.0, 90.0, 90.0, 95.0, 95.0, 85.0, 90.0, 95.0, 95.0, 100.0, 80.0, 85.0, 90.0, 85.0, 90.0, 95.0, 95.0, 90.0, 85.0, 90.0, 90.0, 90.0, 90.0, 90.0]\r\n #@expert_grades = [90.0, 85.0, 90.0, 95.0, 90.0, 90.0, 85.0, 85.0]\r\n #@expert_grades = [92.0, 88.0, 98.0, 90.0, 100.0, 93.0, 89.0, 98.0, 87.0, 97.0, 86.0, 90.0, 90.0, 95.0, 88.0, 90.0, 95.0, 96.0, 90.0, 80.0, 75.0, 91.0]\r\n #@expert_grades = [96.0, 110.0, 89.0, 105.0, 110.0, 70.0, 121.0, 96.0, 110.0, 110.0, 110.0, 110.0, 110.0, 110.0, 110.0, 100.0, 108.0, 107.0, 110.0, 100.0, 110.0, 110.0, 110.0, 96.0, 110.0, 104.0, 110.0, 108.0, 110.0, 47.0]\r\n #@expert_grades = [95.0, 91.0, 93.0, 97.0, 91.0, 95.0, 91.0, 99.0, 100.0, 92.0, 100.0, 87.0, 85.0, 93.0, 87.0, 100.0, 94.0, 93.0, 92.0, 96.0, 94.0, 98.0, 100.0, 88.0, 97.0, 91.0, 78.0]\r\n #tasks1~5\r\n #scores = [[nil,nil,nil,87.5,95.0,nil,nil,nil,nil,nil,nil,77.5,nil,nil,nil,nil,nil,nil,nil,nil,87.5,100.0,nil,nil,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,85.0,nil,nil,nil,90.0,nil,nil,nil,100.0,nil,nil,nil,nil,nil,100.0,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,92.5,100.0,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,82.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,87.5,nil,92.5,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.0,87.5,nil,nil,62.5,nil,nil,nil,nil,nil,90.0,97.5,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.0,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,82.5,nil,nil,nil,nil],[nil,nil,nil,nil,87.5,nil,nil,nil,nil,nil,87.5,92.5,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,65.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,nil,95.0,nil,87.5,nil,92.5,nil,95.0,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil],[nil,87.5,nil,nil,97.5,nil,95.0,nil,nil,nil,nil,nil,nil,nil,77.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,90.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,92.5,87.5,nil,nil,nil,nil,nil,72.5,nil,nil,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,85.0,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,97.5,nil,nil,nil,82.5,nil,nil,nil,nil,nil,nil,nil,nil,77.5,nil,82.5,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,90.0,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,82.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,62.5,nil,nil,20.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,75.0,nil,nil,70.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,95.0,nil,nil,nil,nil,90.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,77.5,nil,nil],[nil,90.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,90.0,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,72.5,nil,nil,nil,nil,nil,82.5,nil,nil,nil,nil,nil,nil,nil,87.5,nil,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,90.0,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,82.5,90.0,nil,nil,nil,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,95.0,nil,87.5,nil,87.5,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,75.0,nil,nil,nil,nil,nil,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,20.0,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,95.0,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,77.5,87.5,nil,nil,100.0,nil,97.5,92.5,nil,nil,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,82.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,60.0,80.0,nil,nil,90.0,nil,nil,80.0,95.0,nil,nil,nil,nil,nil,90.0,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,65.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,97.5,67.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,62.5,nil,95.0,nil,nil,100.0,85.0,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,82.5,nil,nil,nil,nil,nil,90.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,72.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,90.0,nil,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,85.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,87.5,nil,nil,nil,100.0,92.5,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,82.5,nil,nil,nil,70.0,nil,nil,nil,92.5,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,92.5,nil,80.0,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,nil,87.5,nil,nil,97.5,75.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.5,95.0,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,97.5,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil,nil,95.0,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,92.5,nil,82.5,nil,nil,nil,100.0,nil,nil,85.0,nil,nil,100.0,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,82.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.0,87.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,90.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,77.5,nil,nil,97.5,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,92.5,87.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,97.5,nil,nil,nil,nil,nil,nil,92.5,nil,nil,nil,nil,87.5,nil,nil,nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,nil,82.5,nil,nil,nil,92.5,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,82.5,nil,nil,nil,90.0,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil,72.5,nil,nil,nil,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,20.0,nil,nil,87.5,nil,nil,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.5,97.5,nil,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,97.5,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,nil,90.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,95.0,nil,90.0,nil,nil,nil,nil,nil,nil,90.0,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,92.5,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,95.0,nil,nil,92.5,nil,87.5,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,97.5,92.5,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,65.0,47.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,87.5,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,65.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,90.0,nil,nil,95.0,nil,nil,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,90.0,nil,nil,90.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,85.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,62.5,97.5,nil,nil,95.0,nil,nil,nil,nil,nil,nil,77.5,nil,97.5,nil,nil,nil,nil,nil,90.0,nil,nil,nil,nil,nil,95.0,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,90.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,85.0,nil,nil,nil,nil,nil,92.5,nil,nil,nil,92.5,nil,nil,nil,nil,nil,82.5,nil,nil,nil,nil,nil,82.5,nil,nil,nil,nil,nil,nil,nil,82.5,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,90.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,95.0,nil,nil,nil,97.5,nil,nil,nil,nil,90.0,nil,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,87.5,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,87.5,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,85.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,90.0,87.5,nil,nil,nil,nil,nil,nil,82.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,70.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,92.5,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,92.5,90.0,nil,nil,nil,nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,85.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,87.5,nil,82.5,nil,nil,nil,nil,nil,nil,nil,nil,90.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,80.0,90.0,92.5,nil,nil,nil,nil,nil,nil,nil,nil,95.0,90.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,65.0,nil,nil,nil,nil,90.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,90.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,90.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,92.5,nil,nil,nil,nil,97.5,nil,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,90.0,nil,nil,nil,nil,nil],[nil,nil,nil,nil,95.0,nil,97.5,nil,nil,nil,nil,70.0,90.0,87.5,nil,nil,nil,nil,nil,nil,90.0,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,95.0,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,100.0,92.5,nil,nil,nil,nil,92.5,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,77.5,nil,nil,nil,nil,nil,nil,nil,67.5,nil,nil,nil,nil,87.5,nil,nil,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,85.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,65.0,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,90.0,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,97.5,nil,nil,nil,87.5,nil,nil,nil,85.0,nil,nil,nil,95.0,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,92.5,90.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.0,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,72.5,nil,nil,nil,77.5,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,97.5,nil,97.5,nil,nil,nil,nil,nil,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,97.5,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,92.5,nil,97.5,nil,nil,97.5,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,90.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,77.5,100.0,nil,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.0,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,87.5,nil,97.5,100.0,nil,nil,nil,nil,77.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,70.0,85.0,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,77.5,nil,nil,nil,97.5,nil,87.5,nil,nil,nil,nil,nil,nil,70.0,nil,nil,85.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,85.0,nil,97.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,65.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,85.0,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,92.5,nil,85.0,nil,nil,nil,nil,nil]]\r\n #scores = [[nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,90.0,97.5,nil,nil,90.0,nil,nil,nil,95.0,nil,92.5,nil,95.0,nil,95.0,nil,nil,nil,nil,95.0,97.5,nil,nil,nil,nil,nil,97.5,85.0,nil,87.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,90.0,95.0,nil,nil,97.5,92.5,nil,nil,nil,nil,nil,nil,nil,95.0,nil,nil,nil,97.5,nil,nil,nil,95.0,nil,nil,nil,97.5,nil,nil,92.5,97.5,nil,nil,nil,nil,nil,90.0,nil,82.5,nil,95.0,nil,nil,nil,nil,nil,97.5,95.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,80.0,80.0,nil,nil,87.5,80.0,67.5,nil,87.5,nil,nil,nil,82.5,nil,85.0,nil,92.5,nil,92.5,nil,nil,nil,nil,90.0,nil,92.5,nil,nil,nil,100.0,77.5,80.0,nil,nil,nil,67.5,nil,nil,nil,nil,nil,55.0,nil,85.0,nil,nil,97.5,nil,nil,nil,75.0,nil,nil,72.5,nil,nil,nil,nil,nil,87.5,nil,nil,nil,80.0,nil,nil,nil,67.5,nil,nil,nil,nil,nil,nil,77.5,nil,70.0,nil,nil,nil,nil,45.0,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,90.0,nil,nil,100.0,97.5,nil,nil,100.0,nil,nil,nil,97.5,nil,100.0,nil,97.5,nil,100.0,nil,nil,nil,nil,95.0,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,90.0,82.5,nil,nil,nil,nil,nil,nil,100.0,nil,nil,100.0,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,97.5,97.5,nil,nil,nil,97.5,87.5,nil,nil,100.0,nil,nil,nil,nil,nil,100.0,90.0,97.5,95.0,nil,nil,97.5,nil,90.0,nil,100.0,nil,100.0,nil,nil,95.0,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,92.5,nil,97.5,92.5,nil,nil,92.5,nil,nil,nil,92.5,nil,95.0,nil,95.0,nil,85.0,90.0,nil,nil,nil,95.0,nil,nil,nil,97.5,nil,100.0,87.5,nil,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,97.5,95.0,nil,nil,100.0,90.0,nil,nil,97.5,nil,nil,nil,nil,nil,nil,97.5,nil,100.0,nil,nil,nil,nil,90.0,nil,nil,95.0,nil,nil,nil,95.0,nil,nil,nil,97.5,85.0,nil,nil,95.0,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil],[nil,97.5,nil,nil,100.0,nil,nil,nil,nil,97.5,nil,nil,92.5,97.5,nil,nil,95.0,nil,nil,nil,95.0,nil,82.5,nil,95.0,92.5,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,90.0,nil,85.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,92.5,nil,nil,100.0,97.5,nil,nil,100.0,97.5,87.5,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,92.5,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,90.0,nil,nil,nil,nil,nil,97.5,nil,85.0,95.0,nil,nil,75.0,nil,90.0,100.0,nil,nil,nil,nil,nil],[nil,95.0,nil,nil,nil,nil,nil,nil,nil,92.5,nil,nil,97.5,100.0,nil,nil,87.5,nil,nil,nil,95.0,nil,97.5,nil,nil,nil,100.0,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,92.5,92.5,nil,95.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,92.5,95.0,57.5,97.5,100.0,95.0,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.0,95.0,97.5,nil,100.0,nil,nil,nil,nil,nil,nil,97.5,97.5,87.5,nil,nil,92.5,nil,nil,nil,nil,nil,97.5,nil,nil,nil,nil,nil,nil,97.5,nil,85.0,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,85.0,87.5,97.5,92.5,85.0,nil,87.5,nil,nil,nil,95.0,nil,97.5,nil,95.0,95.0,100.0,nil,nil,nil,nil,90.0,nil,nil,nil,97.5,nil,nil,nil,nil,nil,87.5,nil,nil,nil,nil,nil,nil,nil,80.0,nil,92.5,27.5,nil,nil,90.0,nil,nil,97.5,nil,nil,95.0,nil,nil,nil,nil,nil,95.0,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,82.5,nil,85.0,nil,nil,nil,nil,82.5,nil,nil,nil,100.0,nil,nil,87.5,nil,nil,72.5,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,80.0,85.0,nil,92.5,nil,nil,nil,85.0,nil,92.5,nil,95.0,nil,97.5,72.5,nil,nil,nil,92.5,nil,nil,nil,nil,nil,nil,87.5,82.5,nil,85.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,87.5,nil,77.5,100.0,92.5,nil,nil,90.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.0,nil,nil,95.0,92.5,nil,nil,nil,nil,90.0,87.5,100.0,77.5,nil,nil,nil,nil,nil,nil,nil,nil,97.5,87.5,nil,77.5,82.5,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil]]\r\n #scores = [[nil,nil,nil,nil,nil,nil,nil,nil,nil,96.0,nil,nil,100.0,100.0,nil,nil,nil,nil,nil,nil,96.0,96.0,100.0,nil,nil,nil,96.0,100.0,100.0,nil,nil,nil,100.0,100.0,92.0,nil,nil,nil,88.0,nil,nil,100.0,nil,nil,80.0,nil,nil,100.0,nil,88.0,96.0,96.0,88.0,96.0,100.0,100.0,100.0,nil,96.0,100.0,100.0,nil,92.0,nil,nil,100.0,100.0,92.0,nil,100.0,nil,nil,nil,nil,nil,100.0,nil,92.0,92.0,nil,nil,100.0,84.0,100.0,76.0,nil,100.0,100.0,nil,nil,nil,nil,96.0,92.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,88.0,nil,nil,nil,nil,76.0,96.0,100.0,96.0,96.0,nil,nil,nil,nil,nil,nil,nil,nil,92.0,nil,100.0,nil,92.0,0.0,80.0,nil,nil,nil,96.0,96.0,96.0,nil,nil,100.0,100.0,nil,nil,96.0,nil,nil,84.0,nil,nil,92.0,nil,nil,96.0,nil,nil,96.0,100.0,nil,96.0,nil,80.0,100.0,100.0,92.0,92.0,nil,76.0,nil,100.0,92.0,nil,nil,nil,nil,nil,nil,nil,96.0,nil,nil,84.0,nil,nil,nil,nil,100.0,76.0,nil,96.0,96.0,nil,nil,nil,nil,100.0,100.0,nil,nil,nil,96.0,nil,nil,96.0,100.0,nil,nil,nil,84.0,nil,nil],[nil,nil,nil,nil,nil,nil,96.0,nil,100.0,96.0,100.0,nil,100.0,nil,nil,nil,nil,nil,nil,nil,92.0,100.0,96.0,nil,100.0,92.0,92.0,nil,92.0,nil,nil,nil,100.0,100.0,nil,nil,nil,100.0,100.0,nil,nil,96.0,nil,nil,nil,100.0,nil,100.0,nil,84.0,nil,96.0,nil,80.0,100.0,nil,100.0,nil,92.0,100.0,100.0,nil,nil,80.0,nil,nil,96.0,84.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,92.0,80.0,nil,nil,nil,88.0,nil,80.0,nil,96.0,100.0,nil,nil,nil,nil,96.0,100.0,nil,nil,96.0,96.0,nil,100.0,96.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,100.0,100.0,80.0,nil,nil,nil,nil,nil,nil,nil,92.0,nil,100.0,92.0,92.0,nil,100.0,nil,nil,96.0,100.0,100.0,88.0,100.0,nil,100.0,100.0,nil,nil,92.0,nil,68.0,nil,100.0,nil,100.0,nil,92.0,100.0,nil,88.0,100.0,100.0,100.0,nil,nil,100.0,92.0,100.0,92.0,92.0,nil,88.0,96.0,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,96.0,nil,100.0,nil,nil,100.0,88.0,nil,68.0,nil,96.0,96.0,nil,nil,nil,nil,96.0,nil,nil,nil,nil,nil,nil,nil,96.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,100.0,nil,nil,60.0,100.0,nil,100.0,nil,84.0,nil,nil,nil,nil,nil,92.0,100.0,88.0,nil,100.0,nil,96.0,nil,100.0,nil,nil,100.0,100.0,100.0,100.0,nil,nil,100.0,96.0,nil,100.0,100.0,nil,nil,80.0,100.0,nil,96.0,nil,88.0,100.0,96.0,nil,100.0,100.0,100.0,nil,nil,100.0,100.0,nil,100.0,nil,nil,nil,nil,nil,96.0,nil,nil,nil,nil,nil,nil,nil,100.0,nil,92.0,92.0,nil,nil,nil,100.0,nil,92.0,nil,92.0,100.0,nil,100.0,nil,nil,88.0,nil,nil,nil,nil,100.0,nil,nil,96.0,nil,nil,nil,nil,nil,nil,nil],[nil,96.0,nil,nil,nil,nil,96.0,nil,nil,96.0,100.0,nil,nil,96.0,76.0,nil,80.0,nil,nil,nil,nil,nil,84.0,nil,100.0,96.0,nil,80.0,68.0,nil,nil,nil,100.0,100.0,nil,nil,nil,100.0,84.0,nil,nil,100.0,nil,nil,80.0,nil,nil,92.0,nil,nil,100.0,84.0,nil,96.0,100.0,nil,100.0,nil,80.0,88.0,100.0,nil,96.0,nil,nil,nil,96.0,nil,nil,nil,nil,96.0,nil,nil,nil,nil,nil,nil,84.0,nil,nil,nil,96.0,100.0,80.0,nil,80.0,72.0,nil,nil,nil,nil,100.0,nil,nil,nil,nil,100.0,nil,56.0,96.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,92.0,nil,nil,100.0,100.0,80.0,nil,nil,nil,nil,nil,nil,nil,84.0,nil,100.0,nil,nil,96.0,80.0,nil,nil,nil,100.0,nil,88.0,100.0,nil,100.0,96.0,nil,nil,100.0,nil,nil,72.0,96.0,nil,92.0,nil,88.0,100.0,92.0,0.0,100.0,nil,nil,96.0,nil,nil,80.0,100.0,92.0,96.0,80.0,84.0,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,100.0,nil,92.0,92.0,nil,nil,100.0,88.0,100.0,72.0,nil,84.0,68.0,nil,nil,nil,nil,100.0,nil,nil,nil,92.0,100.0,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,84.0,96.0,96.0,100.0,nil,nil,80.0,nil,nil,nil,nil,nil,88.0,nil,100.0,nil,96.0,nil,72.0,nil,nil,92.0,100.0,96.0,100.0,nil,nil,92.0,nil,nil,nil,96.0,nil,nil,84.0,nil,nil,100.0,nil,nil,nil,nil,nil,100.0,100.0,nil,96.0,nil,100.0,92.0,100.0,96.0,nil,80.0,nil,92.0,92.0,88.0,nil,nil,nil,nil,nil,100.0,nil,88.0,nil,nil,88.0,nil,nil,nil,92.0,100.0,72.0,nil,100.0,96.0,nil,nil,nil,100.0,100.0,nil,100.0,nil,80.0,100.0,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,96.0,92.0,92.0,100.0,100.0,80.0,nil,nil,nil,nil,nil,92.0,nil,92.0,nil,100.0,96.0,92.0,100.0,nil,nil,nil,nil,100.0,100.0,100.0,nil,nil,100.0,96.0,nil,nil,nil,nil,nil,96.0,nil,nil,100.0,nil,nil,100.0,nil,nil,nil,100.0,nil,80.0,nil,nil,92.0,100.0,84.0,nil,nil,nil,nil,100.0,92.0,nil,nil,nil,88.0,nil,nil,nil,60.0,nil,nil,60.0,84.0,nil,nil,92.0,100.0,80.0,nil,nil,92.0,nil,nil,nil,nil,96.0,100.0,100.0,nil,nil,88.0,nil,nil,100.0,100.0,nil,nil,nil,nil,nil,nil],[nil,nil,nil,96.0,96.0,nil,100.0,nil,nil,80.0,92.0,96.0,100.0,96.0,80.0,nil,nil,nil,nil,nil,96.0,nil,92.0,nil,100.0,nil,92.0,nil,100.0,nil,nil,nil,nil,nil,100.0,nil,nil,100.0,100.0,nil,nil,100.0,nil,nil,80.0,100.0,nil,100.0,nil,nil,nil,92.0,nil,100.0,100.0,nil,nil,nil,nil,100.0,100.0,96.0,100.0,nil,76.0,96.0,nil,92.0,nil,nil,nil,nil,nil,96.0,nil,100.0,96.0,nil,nil,nil,nil,nil,92.0,100.0,84.0,nil,96.0,100.0,nil,nil,nil,nil,80.0,nil,100.0,nil,nil,96.0,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,100.0,nil,nil,84.0,76.0,96.0,100.0,96.0,nil,nil,92.0,nil,nil,nil,96.0,nil,nil,nil,nil,92.0,nil,92.0,88.0,nil,nil,nil,100.0,100.0,100.0,96.0,nil,100.0,nil,nil,nil,96.0,nil,nil,80.0,100.0,nil,nil,nil,nil,nil,88.0,nil,nil,100.0,nil,100.0,nil,72.0,96.0,nil,96.0,84.0,80.0,nil,96.0,nil,92.0,nil,nil,nil,nil,nil,100.0,nil,nil,92.0,88.0,100.0,nil,nil,nil,92.0,100.0,88.0,nil,92.0,80.0,nil,nil,nil,nil,76.0,nil,nil,nil,92.0,88.0,nil,nil,76.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,100.0,nil,100.0,nil,nil,nil,nil,nil,96.0,100.0,100.0,100.0,80.0,nil,nil,nil,nil,nil,92.0,92.0,92.0,nil,100.0,96.0,84.0,nil,88.0,nil,nil,nil,100.0,nil,nil,nil,nil,100.0,96.0,96.0,nil,100.0,nil,76.0,84.0,nil,nil,100.0,nil,nil,100.0,92.0,92.0,100.0,100.0,nil,96.0,nil,96.0,100.0,nil,nil,96.0,80.0,88.0,nil,nil,96.0,nil,nil,nil,nil,nil,nil,nil,92.0,nil,92.0,nil,nil,nil,nil,96.0,nil,68.0,nil,96.0,100.0,nil,100.0,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil],[nil,76.0,nil,nil,nil,nil,100.0,nil,nil,80.0,100.0,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil,92.0,nil,nil,100.0,nil,92.0,84.0,48.0,nil,nil,nil,100.0,96.0,100.0,100.0,nil,92.0,80.0,nil,nil,92.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,84.0,nil,96.0,100.0,nil,92.0,nil,nil,100.0,100.0,96.0,88.0,nil,84.0,88.0,88.0,92.0,nil,nil,nil,88.0,nil,nil,nil,96.0,nil,nil,88.0,nil,nil,nil,88.0,100.0,68.0,nil,64.0,100.0,nil,nil,nil,92.0,88.0,nil,nil,nil,96.0,92.0,nil,nil,96.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,88.0,nil,84.0,nil,88.0,nil,nil,84.0,96.0,nil,nil,92.0,nil,nil,nil,nil,nil,nil,nil,nil,92.0,nil,100.0,84.0,nil,nil,80.0,nil,nil,100.0,nil,nil,nil,nil,nil,84.0,nil,92.0,nil,96.0,nil,72.0,76.0,92.0,nil,100.0,nil,64.0,96.0,88.0,76.0,88.0,96.0,92.0,96.0,nil,92.0,96.0,96.0,nil,88.0,80.0,nil,nil,nil,92.0,nil,nil,nil,nil,nil,nil,nil,88.0,nil,92.0,84.0,nil,nil,nil,84.0,100.0,nil,nil,92.0,92.0,nil,100.0,nil,nil,96.0,nil,nil,nil,80.0,nil,nil,nil,88.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,100.0,nil,100.0,nil,nil,nil,100.0,100.0,100.0,100.0,nil,nil,nil,nil,nil,nil,nil,96.0,96.0,nil,100.0,92.0,92.0,nil,76.0,nil,nil,96.0,100.0,96.0,88.0,nil,nil,100.0,92.0,nil,nil,92.0,nil,64.0,80.0,nil,nil,100.0,nil,88.0,nil,100.0,92.0,100.0,100.0,100.0,nil,nil,96.0,nil,nil,92.0,100.0,nil,80.0,nil,nil,92.0,nil,nil,nil,nil,nil,nil,nil,96.0,100.0,nil,100.0,nil,nil,nil,92.0,nil,92.0,nil,96.0,nil,nil,100.0,nil,nil,100.0,nil,nil,nil,96.0,nil,nil,nil,92.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,100.0,nil,nil,96.0,nil,nil,88.0,96.0,84.0,nil,88.0,76.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,92.0,nil,nil,88.0,nil,nil,92.0,96.0,nil,nil,nil,nil,88.0,84.0,nil,nil,96.0,nil,80.0,76.0,nil,nil,96.0,nil,nil,100.0,nil,80.0,96.0,96.0,92.0,100.0,nil,92.0,96.0,nil,nil,92.0,80.0,nil,92.0,nil,84.0,nil,nil,nil,96.0,nil,nil,nil,96.0,68.0,92.0,92.0,nil,nil,nil,96.0,nil,64.0,nil,96.0,96.0,nil,100.0,nil,nil,92.0,nil,96.0,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,76.0,nil,96.0,nil,nil,nil,100.0,nil,nil,96.0,80.0,nil,nil,nil,nil,nil,nil,nil,80.0,nil,100.0,88.0,92.0,nil,nil,nil,nil,100.0,100.0,100.0,100.0,100.0,nil,100.0,96.0,92.0,nil,96.0,nil,84.0,84.0,nil,nil,88.0,nil,60.0,100.0,88.0,88.0,100.0,100.0,96.0,nil,nil,100.0,100.0,nil,96.0,nil,nil,nil,nil,nil,100.0,nil,nil,nil,92.0,nil,nil,nil,92.0,96.0,92.0,nil,nil,nil,100.0,nil,nil,80.0,nil,92.0,100.0,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,96.0,96.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,100.0,nil,80.0,nil,nil,nil,nil,nil,96.0,nil,92.0,nil,100.0,nil,92.0,100.0,92.0,nil,nil,nil,100.0,100.0,nil,nil,nil,100.0,92.0,nil,nil,96.0,nil,84.0,96.0,nil,nil,100.0,nil,nil,96.0,76.0,nil,100.0,100.0,nil,100.0,nil,nil,96.0,100.0,96.0,100.0,nil,80.0,nil,nil,92.0,nil,nil,nil,nil,nil,nil,nil,100.0,nil,92.0,100.0,nil,nil,nil,92.0,100.0,68.0,nil,88.0,84.0,nil,nil,nil,92.0,96.0,nil,nil,nil,nil,100.0,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,96.0,nil,nil,nil,100.0,nil,84.0,nil,nil,nil,80.0,nil,nil,nil,nil,nil,92.0,96.0,100.0,nil,nil,nil,92.0,100.0,96.0,nil,nil,100.0,100.0,96.0,nil,nil,nil,100.0,92.0,92.0,nil,nil,nil,nil,80.0,60.0,nil,nil,nil,nil,100.0,96.0,84.0,nil,100.0,92.0,100.0,nil,100.0,92.0,100.0,nil,96.0,nil,76.0,nil,100.0,96.0,nil,nil,nil,nil,nil,nil,nil,96.0,100.0,92.0,100.0,nil,nil,100.0,88.0,nil,68.0,nil,96.0,100.0,nil,nil,nil,nil,96.0,nil,92.0,nil,nil,nil,nil,nil,96.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,96.0,76.0,nil,88.0,nil,nil,nil,92.0,92.0,nil,92.0,80.0,nil,nil,nil,nil,nil,nil,nil,96.0,nil,100.0,92.0,92.0,nil,80.0,nil,nil,100.0,100.0,nil,88.0,88.0,nil,96.0,76.0,80.0,100.0,96.0,nil,84.0,nil,96.0,nil,nil,nil,48.0,100.0,80.0,76.0,96.0,100.0,nil,nil,nil,nil,96.0,nil,nil,84.0,80.0,nil,96.0,nil,92.0,nil,92.0,nil,nil,nil,nil,nil,nil,nil,92.0,80.0,nil,nil,nil,nil,nil,60.0,nil,84.0,nil,nil,100.0,nil,nil,96.0,nil,nil,nil,nil,nil,nil,nil,92.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,92.0,nil,nil,nil,nil,100.0,96.0,nil,nil,nil,80.0,nil,nil,nil,nil,nil,96.0,96.0,nil,nil,100.0,nil,92.0,nil,92.0,nil,nil,100.0,100.0,nil,88.0,100.0,nil,100.0,88.0,92.0,nil,96.0,nil,68.0,80.0,100.0,nil,nil,nil,92.0,100.0,nil,88.0,100.0,100.0,nil,nil,nil,nil,96.0,100.0,100.0,92.0,nil,80.0,nil,nil,92.0,nil,nil,nil,nil,nil,nil,nil,nil,88.0,nil,100.0,88.0,nil,nil,84.0,nil,nil,nil,96.0,92.0,nil,100.0,nil,nil,96.0,nil,nil,nil,100.0,nil,nil,88.0,84.0,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,92.0,96.0,100.0,nil,100.0,nil,nil,100.0,nil,nil,nil,92.0,nil,nil,nil,100.0,92.0,92.0,nil,88.0,nil,nil,nil,100.0,100.0,100.0,100.0,nil,100.0,80.0,nil,nil,nil,nil,nil,76.0,nil,nil,92.0,nil,nil,nil,nil,96.0,96.0,100.0,nil,96.0,nil,96.0,100.0,100.0,96.0,100.0,nil,nil,nil,100.0,92.0,nil,nil,nil,nil,nil,nil,nil,96.0,96.0,nil,100.0,nil,nil,nil,92.0,nil,68.0,nil,88.0,100.0,nil,nil,nil,nil,100.0,nil,100.0,nil,92.0,96.0,nil,84.0,100.0,nil,nil,nil,nil,nil,nil,nil]]\r\n #scores = [[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,82.2222,nil,nil,nil,64.4444,nil,nil,nil,86.6667,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,84.4444,nil,nil,nil,nil,nil,nil,nil,nil,20.0,nil,nil,nil,nil,nil,nil,nil,20.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,53.3333,nil,55.5556,nil,nil,nil,nil,64.4444,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,82.2222,nil,nil,nil,nil,nil,nil,nil,nil,91.1111,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,86.6667,nil,nil,nil,nil,nil,nil,nil,nil,nil,84.4444,nil,nil,97.7778,nil,nil,100.0,nil,nil,100.0,nil,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,84.4444,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,51.1111,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,60.0,nil,nil,nil,nil,nil,nil,nil,nil,97.7778,nil,nil,nil,nil,nil,nil,nil,nil,97.7778,nil,nil,nil,nil,nil,48.8889,nil,nil,nil,88.8889,55.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,82.2222,55.5556,82.2222,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,91.1111,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil,82.2222,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,60.0,68.8889,nil,nil,nil,nil,nil,nil,nil,82.2222,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,60.0,nil,75.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,91.1111,nil,nil,nil,nil,nil,73.3333,nil,nil,nil,nil,nil,nil,nil,nil,71.1111,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,86.6667,nil,nil,nil,nil,nil,nil,nil,86.6667,nil,97.7778,95.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,88.8889,95.5556,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,82.2222,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,86.6667,nil,93.3333,nil,nil,nil,nil,nil,nil,nil,93.3333,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,86.6667,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,66.6667,nil,nil,nil,nil,nil,nil,66.6667,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,86.6667,nil,42.2222,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,82.2222,nil,nil,nil,57.7778,nil,nil,nil,nil,nil,84.4444,nil,nil,nil,nil,62.2222,nil,nil,nil,nil,nil,82.2222,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,88.8889,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,66.6667,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,73.3333,nil,nil,nil,nil,nil],[nil,nil,95.5556,nil,nil,nil,nil,nil,73.3333,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,84.4444,93.3333,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,91.1111,nil,91.1111,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,86.6667,nil,nil,75.5556,nil,nil,nil,nil,nil,nil,93.3333,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.0,nil,nil,nil,95.5556,100.0,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,66.6667,66.6667,nil,48.8889,nil,nil,nil,nil,51.1111,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,84.4444,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,46.6667,nil,nil,75.5556,nil,nil,nil,nil,nil,nil,nil,62.2222,nil,nil,nil,nil,nil,73.3333,nil,nil,nil,nil,nil,nil,nil,nil,66.6667,nil,nil,nil,nil,nil,55.5556,nil,nil,nil,nil,nil,nil,nil,nil,26.6667,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,86.6667,nil,nil,82.2222,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,nil,86.6667,nil,77.7778,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.0,nil,nil,80.0,nil,nil,nil,97.7778,nil,nil,nil,nil,nil,75.5556,nil,nil,nil,nil,nil,66.6667,nil,nil,nil,nil,nil,nil,nil,nil,nil,84.4444,nil,nil,nil,nil,82.2222,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,91.1111,73.3333,nil,93.3333,nil,nil,nil,nil,nil,nil,nil,nil,86.6667,nil,nil,nil,nil,nil,86.6667,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,73.3333,nil,nil,nil,nil,nil,nil,nil,nil,82.2222,nil,nil,nil,nil,nil,nil,nil,20.0,nil,93.3333,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,91.1111,80.0,nil,nil,nil,nil,nil,93.3333,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,77.7778,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.5556,95.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,93.3333,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,91.1111,nil,nil,nil,nil,nil,nil,86.6667,97.7778,nil,nil,nil,75.5556,nil,nil,nil,nil,nil,nil,nil,82.2222,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,88.8889,nil,nil,nil,nil,nil,nil,nil,nil,88.8889,71.1111,88.8889,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,77.7778,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,35.5556,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,88.8889,nil,nil,nil,82.2222,nil,95.5556,84.4444,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,75.5556,nil,nil,nil,nil,77.7778,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,97.7778,nil,nil,nil,nil,nil,nil,nil,24.4444,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.5556,80.0,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,71.1111,nil,nil,nil,nil,86.6667,nil,82.2222,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,75.5556,nil,82.2222,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,88.8889,nil,nil,91.1111,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,73.3333,97.7778,nil,nil,nil,nil,nil,nil,nil,91.1111,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,46.6667,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,86.6667,nil,95.5556,nil,nil,nil,91.1111,nil,nil,nil,nil,nil,nil,86.6667,nil,nil,nil,nil,nil,84.4444,nil,nil,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.7778,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,82.2222,nil,nil,95.5556,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,20.0,nil,nil,84.4444,nil,71.1111,nil,nil,nil,nil,64.4444,nil,nil,nil,nil,nil,nil,nil,nil,nil,33.3333,nil,nil,nil,nil,nil,42.2222,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,75.5556,nil,20.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,82.2222,20.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,20.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,75.5556,nil,nil,nil,nil,nil,nil,95.5556,71.1111,73.3333,nil,nil,nil,nil,66.6667,nil,nil,nil,nil,84.4444,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,53.3333,nil,nil,nil,nil,nil,62.2222,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,60.0,nil,71.1111,nil,nil,nil,nil,nil,75.5556,nil,nil,nil,nil,nil,nil,nil,nil,88.8889,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,88.8889,nil,nil,nil,97.7778,nil,nil,nil,nil,nil,nil,nil,nil,91.1111,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,93.3333,nil,73.3333,nil,nil,93.3333,75.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,88.8889,nil,nil,nil,nil,nil,48.8889,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,82.2222,nil,91.1111,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,62.2222,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,86.6667,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.7778,nil,91.1111,nil,nil,nil,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.7778,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,88.8889,nil,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,nil,nil],[nil,73.3333,nil,nil,66.6667,nil,nil,nil,nil,nil,nil,66.6667,nil,nil,nil,nil,80.0,nil,nil,nil,nil,84.4444,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.7778,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,77.7778,64.4444,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,73.3333,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,82.2222,80.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,91.1111,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,64.4444,nil,60.0,nil,86.6667,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,82.2222,nil,nil,71.1111,nil,80.0,nil,nil,nil,nil,nil,75.5556,nil,88.8889,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,60.0,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,91.1111,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.7778,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,88.8889,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,95.5556,nil,nil,97.7778,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,20.0,nil,93.3333,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,88.8889,nil,91.1111,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.5556,93.3333,84.4444,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,82.2222,nil,nil,nil,nil,nil,nil,91.1111,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,86.6667,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,93.3333,nil,51.1111,nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,84.4444,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,97.7778,nil,84.4444,nil,nil,nil,nil,nil,nil,nil,nil,93.3333,nil,nil,nil,nil,nil,88.8889,nil,44.4444,nil,nil,nil,nil,nil,nil,nil,nil,20.0,48.8889,nil,nil,82.2222,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,88.8889,93.3333,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,88.8889,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.7778,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,75.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,75.5556,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,91.1111,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,93.3333,nil,nil,nil,nil,nil,nil,93.3333,nil,nil,nil,nil,nil,nil,nil,86.6667,97.7778,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,91.1111,nil,88.8889,95.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.7778,nil,95.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,100.0,82.2222,nil,nil,nil,93.3333,nil,nil,nil,nil,nil,93.3333,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.7778,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,91.1111,nil,nil,91.1111,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.5556,nil,nil,nil,nil,nil,nil,nil,nil,nil,95.5556,nil,48.8889,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,86.6667,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,91.1111,nil,100.0,nil,nil,nil,nil,nil,nil,nil,57.7778,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,86.6667,nil,nil,nil,nil,nil,nil,nil,73.3333,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.7778,nil,nil,nil,nil,91.1111,nil,nil,nil,nil,91.1111,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,84.4444,nil,nil,nil,97.7778,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,20.0,nil,100.0,nil,nil,88.8889,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,93.3333,88.8889,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,84.4444,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,93.3333,nil,nil,nil,nil,nil,nil,nil,86.6667,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.7778,nil,86.6667,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil,nil,93.3333,75.5556,88.8889,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,97.7778,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil,nil,100.0,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,44.4444,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,51.1111,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,44.4444,40.0,nil,20.0,20.0,nil,nil,nil,nil,nil,nil,20.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,20.0,nil,20.0,nil,nil,88.8889,nil,nil,nil,33.3333,nil,nil,nil,nil,nil,nil,nil,31.1111,nil,nil,nil,nil,nil,nil]]\r\n #scores = [[nil,nil,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,76.1905,nil,nil,nil,nil,nil,nil,nil,nil,80.9524,nil,nil,80.9524,nil,nil,nil,79.0476,nil,nil,nil,nil,80.0,67.619,nil,nil,79.0476,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,52.381,80.9524,76.1905,nil,nil,80.9524,72.381,nil,nil,71.4286,nil,77.1429,nil,71.4286,62.8571,nil,76.1905,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,79.0476,nil,nil,nil,nil,nil,nil,74.2857,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,78.0952,nil,nil,nil,nil,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,78.0952,nil,nil,75.2381,68.5714,63.8095,nil,nil,nil,nil,nil,nil,nil,66.6667,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,60.9524,75.2381,nil,80.0,nil,75.2381,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,75.2381,73.3333,nil,80.9524,nil,nil,nil,nil,nil,nil,nil,74.2857,nil,nil,nil,80.9524,79.0476,nil,nil,nil,nil,72.381,nil,nil,nil,nil,73.3333,nil,nil,nil,nil,nil,78.0952,63.8095,nil,75.2381,nil,nil,nil,nil,nil,nil,79.0476,nil,nil,nil,nil,nil,76.1905,nil,79.0476,nil,63.8095,nil,nil,nil,nil],[nil,nil,72.381,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,78.0952,nil,nil,nil,78.0952,80.9524,80.0,67.619,78.0952,nil,80.9524,nil,nil,nil,nil,nil,76.1905,nil,80.9524,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,79.0476,nil,nil,nil,77.1429,nil,nil,nil,27.619,74.2857,nil,76.1905,nil,nil,nil,nil,69.5238,nil,nil,nil,nil,74.2857,nil,nil,nil,nil,74.2857,nil,nil,nil,nil,nil,nil,80.0,nil,nil,nil,79.0476,nil,nil,nil,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,63.8095,nil,nil,nil,nil,nil,nil,nil,32.381,nil,nil,nil,nil,nil,nil,80.9524,63.8095,nil,nil,nil,79.0476,nil,75.2381,nil,nil,nil,nil,nil,nil,80.9524,nil,80.0,nil,71.4286,nil,nil,nil,nil,75.2381,80.9524,nil,nil,nil,nil,80.9524,nil,60.9524,74.2857,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,nil,78.0952,nil,nil,nil,nil,nil,nil,nil,68.5714,nil,nil,nil,nil,73.3333,nil,nil,nil,nil,73.3333,75.2381,nil,nil,74.2857,nil,nil,nil,nil,nil,nil,nil,77.1429,nil,nil,nil,nil,71.4286,nil,33.3333,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,79.0476,nil,nil,75.2381,nil,nil,nil,nil,60.0,nil,nil,nil,nil,nil,nil,80.0,65.7143,nil,80.9524,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,nil,nil,70.4762,nil,nil,nil,nil,80.9524,nil,60.9524,77.1429,80.9524,nil,nil,nil,73.3333,nil,nil,nil,nil,nil,20.0,nil,nil,80.0,nil,nil,nil,nil,67.619,nil,nil,80.0,nil,nil,nil,nil,nil,nil,nil,76.1905,nil,nil,58.0952,nil,nil,nil,nil,nil,64.7619,nil,nil,nil,nil,67.619,nil,nil,71.4286,76.1905,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,79.0476,nil,nil,78.0952,nil,74.2857,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,79.0476,nil,nil,nil,nil,nil,nil,65.7143,nil,nil,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,60.9524,73.3333,80.9524,77.1429,nil,nil,nil,nil,77.1429,nil,nil,nil,30.4762,nil,68.5714,nil,nil,79.0476,nil,78.0952,64.7619,76.1905,nil,76.1905,nil,75.2381,74.2857,nil,nil,nil,73.3333,nil,nil,nil,72.381,nil,nil,nil,nil,nil,74.2857,nil,nil,nil,73.3333,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,72.381,nil,nil,nil,nil,nil,nil,nil,nil,nil,77.1429,76.1905,nil,61.9048,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.9524,nil,74.2857,nil,nil,nil,nil,nil,nil,78.0952,nil,nil,nil,80.0,75.2381,66.6667,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.9524,nil,nil,nil,80.9524,nil,77.1429,nil,nil,nil,nil,nil,nil,nil,64.7619,76.1905,nil,69.5238,nil,68.5714,nil,nil,70.4762,nil,nil,nil,80.0,75.2381,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,79.0476,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,74.2857,76.1905,nil,nil,nil,nil,nil,nil],[nil,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,74.2857,nil,74.2857,nil,nil,nil,nil,nil,nil,nil,79.0476,79.0476,nil,nil,nil,nil,79.0476,nil,nil,nil,nil,74.2857,nil,80.0,nil,80.0,nil,80.0,nil,nil,nil,nil,nil,nil,70.4762,80.9524,nil,nil,nil,nil,nil,74.2857,nil,73.3333,nil,nil,nil,nil,77.1429,80.0,nil,nil,80.0,65.7143,nil,nil,nil,62.8571,nil,72.381,nil,nil,nil,nil,nil,nil,nil,75.2381,nil,nil,nil,nil,nil,nil,60.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,76.1905,nil,80.9524,nil,nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,79.0476,nil,nil,nil,nil,78.0952,nil,nil,nil,80.0,nil,80.0,nil,nil,nil,75.2381,nil,68.5714,nil,nil,nil,79.0476,nil,nil,80.9524,nil,67.619,73.3333,nil,75.2381,nil,nil,76.1905,80.9524,nil,nil,78.0952,nil,69.5238,nil,nil,77.1429,nil,75.2381,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,77.1429,nil,78.0952,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,69.5238,nil,80.9524,nil,nil,nil,nil,nil,nil,nil,80.9524,64.7619,nil,nil,nil,nil,nil,51.4286,nil,nil,nil,nil,nil,64.7619,nil,nil,nil,nil,nil,nil,78.0952,nil,nil,76.1905,nil,nil,nil,nil,nil,80.9524,nil,nil,nil,80.9524,nil,77.1429,nil,nil,78.0952,nil,nil,nil,nil,nil,77.1429,79.0476,nil,nil,nil,nil,75.2381,66.6667,nil,nil,nil,nil,nil,nil,nil,nil,nil,72.381,nil,nil,nil,70.4762,nil,nil,nil,nil,nil,75.2381,80.9524,nil,nil,60.9524,nil,nil,nil,77.1429,71.4286,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,71.4286,nil,80.9524,nil,nil,nil,79.0476,nil,nil,nil,nil,nil,nil,nil,nil,nil,79.0476,80.9524,nil,nil,76.1905,nil,79.0476,nil,61.9048,nil,nil,79.0476,nil,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,60.9524,nil,nil,nil,nil,nil,nil,80.9524,78.0952,73.3333,nil,nil,77.1429,79.0476,nil,76.1905,nil,nil,nil,80.0,52.381,nil,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,77.1429,nil,nil,75.2381,nil,nil,64.7619,nil,nil,nil,nil,nil,nil,0.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,69.5238,70.4762,nil,80.9524,nil,nil,nil,71.4286,74.2857,nil,nil,nil,nil,nil,nil,nil,nil,76.1905,79.0476,nil,nil,80.9524,nil,nil,nil,nil,nil,nil,74.2857,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,76.1905,80.9524,nil,nil,nil,nil,nil,nil,63.8095,78.0952,80.9524,76.1905,nil,nil,nil,76.1905,nil,nil,78.0952,nil,nil,77.1429,nil,62.8571,nil,80.9524,nil,nil,nil,nil,nil,nil,nil,75.2381,79.0476,nil,nil,nil,nil,nil,59.0476,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,58.0952,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,77.1429,nil,nil,nil,nil,nil,69.5238,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.9524,49.5238,nil,nil,nil,78.0952,nil,nil,79.0476,nil,80.9524,nil,nil,nil,77.1429,nil,nil,nil,nil,nil,nil,nil,50.4762,nil,nil,nil,nil,80.0,nil,nil,nil,nil,nil,77.1429,nil,nil,nil,40.0,77.1429,nil,63.8095,nil,nil,nil,73.3333,69.5238,79.0476,nil,nil,nil,72.381,nil,nil,nil,nil,nil,nil,nil,nil,76.1905,nil,nil,80.9524,nil,68.5714,nil,nil,nil,nil,nil,nil,nil,nil,64.7619,80.9524,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,73.3333,nil,74.2857,nil,nil,73.3333,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,77.1429,nil,nil,nil,nil,nil,nil,50.4762,nil,nil,77.1429,nil,nil,nil,nil,nil,80.9524,nil,nil,80.9524,74.2857,nil,nil,nil,80.0,nil,nil,nil,nil,80.9524,nil,72.381,72.381,80.9524,74.2857,nil,nil,66.6667,nil,nil,nil,68.5714,nil,nil,nil,nil,68.5714,nil,nil,nil,nil,66.6667,nil,nil,nil,nil,76.1905,nil,nil,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,79.0476,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,74.2857,nil,nil,nil,nil],[nil,nil,nil,nil,76.1905,nil,74.2857,nil,nil,71.4286,nil,74.2857,80.9524,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,78.0952,nil,79.0476,nil,nil,nil,nil,nil,79.0476,nil,nil,78.0952,nil,nil,nil,nil,nil,nil,nil,nil,74.2857,nil,nil,nil,nil,nil,80.9524,nil,nil,78.0952,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,nil,23.8095,62.8571,71.4286,nil,nil,80.9524,nil,nil,67.619,nil,nil,nil,nil,nil,nil,nil,nil,nil,74.2857,77.1429,nil,nil,76.1905,nil,nil,nil,nil,nil,nil,nil,nil,nil,62.8571,nil,nil,nil,nil,72.381,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,80.9524,nil,80.9524,nil,nil,nil,nil,nil,nil,65.7143,66.6667,nil,nil,nil,nil,nil,nil,80.0,nil,nil,nil,nil,79.0476,nil,nil,nil,nil,76.1905,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,75.2381,72.381,80.0,80.9524,nil,nil,nil,78.0952,80.9524,nil,73.3333,76.1905,nil,nil,nil,nil,78.0952,nil,79.0476,nil,nil,nil,nil,nil,nil,nil,72.381,nil,nil,nil,80.0,nil,nil,61.9048,nil,nil,78.0952,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,66.6667,nil,80.9524,nil,80.9524,nil,79.0476,73.3333,nil,nil,64.7619,nil,nil,nil,nil,nil,78.0952,79.0476,nil,nil,80.0,76.1905,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,73.3333,nil,80.9524,nil,nil,65.7143,nil,nil,nil,80.0,nil,nil,nil,78.0952,62.8571,nil,nil,72.381,nil,nil,78.0952,80.9524,nil,nil,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,71.4286,nil,nil,nil,80.0,nil,nil,nil,nil,74.2857,75.2381,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,74.2857,74.2857,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.9524,nil,nil,79.0476,61.9048,nil,nil,nil,77.1429,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,nil,73.3333,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,80.9524,nil,80.0,nil,nil,nil,77.1429,nil,nil,nil,63.8095,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,nil,70.4762,72.381,80.9524,74.2857,nil,nil,nil,nil,nil,nil,68.5714,nil,nil,nil,nil,nil,77.1429,nil,nil,nil,nil,76.1905,nil,nil,71.4286,73.3333,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,74.2857,nil,66.6667,nil,nil,78.0952,nil,nil,nil,nil,77.1429,nil,nil,80.9524,nil,nil,nil,61.9048,nil,nil,75.2381,nil,80.0,68.5714,nil,nil,80.0,nil,nil,nil,73.3333,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,61.9048,68.5714,80.9524,nil,nil,nil,nil,nil,nil,nil,79.0476,nil,52.381,nil,80.9524,nil,nil,80.9524,nil,nil,69.5238,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.9524,60.0,nil,nil,nil,nil,nil,nil,nil,77.1429,nil,nil,nil,nil,77.1429,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,67.619,nil,nil,nil,nil,80.9524,nil,76.1905,nil,nil,64.7619,nil,80.9524,nil,nil,nil,nil,80.0,nil,nil,79.0476,nil,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,77.1429,nil,nil,nil,nil,nil,nil,nil,nil,nil,74.2857,nil,nil,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.9524,74.2857,nil,80.0,nil,77.1429,71.4286,nil,nil,nil,nil,nil,nil,nil,nil,nil,74.2857,77.1429,nil,nil,69.5238,nil,nil,nil,nil,nil,nil,nil,79.0476,nil,nil,nil,nil,69.5238,78.0952,80.0,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,73.3333,nil,nil,80.9524,nil,72.381,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,80.9524,nil,nil,80.9524,nil,79.0476,nil,nil,nil,nil,nil,nil,80.0,nil,80.0,nil,nil,nil,nil,nil,78.0952,nil,73.3333,75.2381,nil,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,nil,nil,0.0,nil,77.1429,nil,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,nil,75.2381,nil,nil,nil,nil,73.3333,nil,74.2857,nil,nil,nil,80.9524,63.8095,nil,nil,nil,nil,78.0952,nil,nil,nil,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,nil,nil,nil,nil,nil,78.0952,nil,77.1429,nil,nil,nil,nil,80.9524,nil,nil,nil,79.0476,nil,nil,nil,nil,nil,nil,nil,66.6667,nil,nil,nil,nil,nil,nil,74.2857,nil,80.9524,nil,80.0,nil,74.2857,nil,71.4286,nil,80.9524,nil,75.2381,nil,nil,nil,nil,55.2381,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,59.0476,nil,80.9524,nil,76.1905,67.619,nil,nil,75.2381,nil,72.381,77.1429,nil,nil,79.0476,nil,nil,nil,nil,74.2857,nil,nil,nil,nil,nil,nil,nil,nil,nil,50.4762,70.4762,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,75.2381,nil,80.9524,nil,nil,79.0476,78.0952,nil,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,79.0476,nil,nil,80.9524,nil,nil,nil,45.7143,nil,nil,77.1429,nil,nil,nil,80.0,nil,76.1905,nil,nil,nil,74.2857,nil,nil,nil,nil,nil,nil,nil,nil,80.9524,76.1905,64.7619,80.0,nil,76.1905,nil,nil,78.0952,nil,nil,nil,nil,nil,60.9524,0.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,65.7143,nil,78.0952,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,78.0952,75.2381,nil,80.9524,nil,nil,79.0476,nil,72.381,nil,nil,61.9048,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,72.381,nil,nil,nil,nil,nil,nil,nil,nil,70.4762,80.9524,nil,80.0,nil,nil,nil,nil,nil,59.0476,76.1905,nil,nil,nil,nil,nil,80.9524,nil,71.4286,nil,nil,nil,nil,nil,nil,nil,nil,nil,67.619,nil,nil,75.2381,nil,76.1905,nil,nil,nil,nil,nil,nil,nil,nil,nil,73.3333,nil,nil,nil,nil,nil,80.9524,nil,nil,60.9524,78.0952,nil,79.0476,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,69.5238,nil,nil,nil,nil,69.5238,nil,77.1429,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.0,nil,nil,nil,nil,79.0476,nil,62.8571,nil,nil,nil,nil,79.0476,nil,77.1429,nil,nil,nil,nil,nil,nil,nil,68.5714,76.1905,nil,nil,nil,nil,nil,80.9524,nil,nil,nil,80.9524,nil,77.1429,nil,nil,nil,nil,nil,76.1905,nil,52.381,nil,nil,80.0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,74.2857,80.0,nil,nil,68.5714,nil,nil,79.0476,nil,nil,75.2381,77.1429,nil,nil,nil,nil,nil,nil,nil,79.0476,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,64.7619,nil,79.0476,nil,nil,76.1905,nil,73.3333,75.2381,71.4286,nil,nil,nil,nil,nil,nil,76.1905,77.1429,nil,nil,nil,nil,79.0476,nil,nil,nil,nil,nil,nil,nil,nil,79.0476,nil,80.9524,nil,nil,nil,73.3333,nil,63.8095,70.4762,nil,nil,nil,nil,nil,80.9524,73.3333,68.5714,nil,nil,nil,nil,nil,71.4286,nil,nil,nil,28.5714,63.8095,nil,nil,nil,77.1429,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,80.9524,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,63.8095,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[nil,nil,nil,nil,69.5238,nil,nil,nil,nil,nil,nil,75.2381,75.2381,57.1429,nil,nil,nil,nil,nil,nil,nil,79.0476,nil,nil,80.9524,nil,nil,79.0476,70.4762,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,75.2381,nil,nil,nil,nil,80.9524,74.2857,nil,nil,78.0952,nil,nil,nil,68.5714,nil,nil,nil,nil,60.9524,nil,nil,nil,60.9524,nil,80.9524,nil,nil,nil,nil,nil,78.0952,nil,71.4286,nil,nil,nil,nil,74.2857,72.381,nil,nil,nil,nil,nil,71.4286,nil,37.1429,nil,nil,nil,nil,54.2857,nil,nil,nil,72.381,nil,nil,nil,nil,nil,nil,nil]]\r\n #submission_scores means one row in scores\r\n scores.each_with_index do |submission_scores, index|\r\n #puts submission_scores\r\n # puts \"s1 = Submission.new\"\r\n s1 = Submission.new\r\n i = -1\r\n @review_records=[]\r\n #reviewers.map traverse each element in one row\r\n reviewers.map do |reviewer|\r\n if submission_scores[i+1].nil?\r\n i=i+1\r\n else\r\n r= Review_record.new\r\n r.submission = s1\r\n r.reviewer = reviewer\r\n r.reviewer.review_records ||= []\r\n r.reviewer.review_records << r\r\n r.score = submission_scores[i += 1]\r\n #puts r.inspect\r\n @review_records << r\r\n end\r\n end\r\n s1.review_records = @review_records\r\n s1.expert_grade = @expert_grades[index]\r\n @submissions << s1\r\n #puts \"@submission.size \"[email protected]_s\r\n end\r\n\r\n add_review_records_to_reviewers(scores)\r\n return @submissions\r\nend", "def solve( n = 10_000 )\n (1..n).select {|i| i.amicable?}.reduce( :+ )\n end", "def run\n calculate_ideal_subject_distribution\n\n #p \"population size >>>>>> \" + @population_size.to_s\n #p \"max generations >>>>>> \" + @max_generation.to_s\n\n result = {}\n best_chromosomes = []\n generate_initial_population #Generate initial population \n @max_generation.times do |g|\n\n selected_to_breed = selection #Evaluates current population \n\n offsprings = reproduction selected_to_breed #Generate the population for this new generation\n\n replace_worst_ranked offsprings\n\n #Sort the chromosomes again by fitness after offsprings\n #being merged\n @population.sort! { |a, b| b.fitness <=> a.fitness}\n\n # fs = @population.collect {|x| x.fitness }\n # File.open(\"fitnesses.txt\", \"a\") do |f|\n # f.puts \"generation (#{fs.size}) #{g.to_s} = \" + fs.join(\", \")\n # end\n\n best_chromosomes << @population[0]\n end\n result[:chromosomes] = best_chromosomes\n result[:population_size] = @population_size\n result[:generations] = @max_generation\n return result\n end", "def account_group(cohort)\n group_of_3 = cohort.sample(3)\n cohort -= group_of_3\n puts \"Accountability Group(3 people): \"\n group_of_3.each do |index|\n puts index\n end\n group_of_4 = cohort.sample(4)\n cohort -= group_of_4\n puts \"Accountability Group(4 people): \"\n group_of_4.each do |index|\n puts index\n end\nuntil cohort.empty?\n group_of_5 = cohort.sample(5)\n cohort -= group_of_5\n puts \"Accountability Group: \"\n group_of_5.each do |index|\n puts index\n end\nend\nend", "def all_priors()\n #self.bracketgrouping.bracketcontests.bracketcontestants\n #Bracketcontestant.where(bracketgrouping: self.bracketgrouping).select{|bc|bc.priorcontest().id()==self.id()}.collect{|bc|bc.priorcontest()}\n self.bcadvancements.collect {|bcadv| bcadv.bracketcontestant}\n end", "def solve\n perms = (1..9).to_a.permutation.map {|p| p.join}\n prods = []\n\n perms.each do |p|\n (1..2).each do |len|\n a, b, c = p[0, len].to_i, p[len..4].to_i, p[5, 4].to_i\n prods << c if a * b == c\n end\n end\n \n prods.uniq.reduce( :+ )\n end", "def complete\n # # step 0: 对Solutions的结果做voting,并将最终结果存入Problem的result中\n # PhotoRecognitionJob.perform_later(self.id.to_s)\n # step 1: 修改Problem的状态为solved,未完成的Solutions的状态为failed\n self.set(status: :solved)\n self.solutions.each { |solution|\n if solution.status.waiting?\n solution.set(status: :failed)\n end\n }\n # # step 2: 修改Seeker与Solvers的credit\n # self.creator.crowdsourcing_profile.decrease_credit(self.credit_expend)\n # self.creator.crowdsourcing_profile.decrease_prepared_credit(self.credit_prepared)\n # self.creator.crowdsourcing_profile.touch(:updated_at)\n # self.creator.crowdsourcing_profile.save\n # self.solutions.each { |solution|\n # if solution.status.solved?\n # solution.creator.crowdsourcing_profile.increase_credit(solution.problem.credit)\n # solution.creator.crowdsourcing_profile.touch(:updated_at)\n # solution.creator.crowdsourcing_profile.save\n # end\n # }\n # step 3: 修改Seeker_Profile中的 finished + 1 以及积分变化\n # 修改Solver_Profile:如果完成,finished + 1,积分变化;如果失败,failed + 1,积分不变\n self.creator.seeker_profile.increase_finished\n # self.creator.seeker_profile.increase_credit(self.credit_expend)\n self.creator.seeker_profile.touch(:updated_at)\n self.creator.seeker_profile.save\n self.solutions.each { |solution|\n if solution.status.solved?\n solution.creator.solver_profile.increase_finished\n # solution.creator.solver_profile.increase_credit(solution.problem.credit)\n solution.creator.solver_profile.touch(:updated_at)\n solution.creator.solver_profile.save\n else\n solution.creator.solver_profile.increase_failed\n solution.creator.solver_profile.touch(:updated_at)\n solution.creator.solver_profile.save\n end\n }\n end", "def decisions_by_cd\n [email protected]_id_by_stage(@stage)\n\n decisions=Decision.where(:systematic_review_id=>@sr.id, :canonical_document_id=>cds, :user_id=>@sr.group_users.map {|u| u[:id]}, :stage=>@stage.to_s).group_and_count(:canonical_document_id, :decision).all\n n_jueces_por_cd=AllocationCd.where(:systematic_review_id=>@sr.id, :canonical_document_id=>cds, :stage=>@stage.to_s).group_and_count(:canonical_document_id).as_hash(:canonical_document_id)\n\n\n# [email protected]_users.count\n cds.inject({}) {|ac,v|\n ac[v]=empty_decisions_hash\n ac[v]=ac[v].merge decisions.find_all {|dec| dec[:canonical_document_id]==v }\n .inject({}) {|ac1,v1| ac1[v1[:decision]]=v1[:count]; ac1 }\n suma=ac[v].inject(0) {|ac1,v1| ac1+v1[1]}\n n_jueces=n_jueces_por_cd[v].nil? ? 0 : n_jueces_por_cd[v][:count]\n ac[v][Decision::NO_DECISION]=n_jueces-suma\n ac\n }\n end", "def first_challenge\n epic_tragedy = {\n :montague => {},\n :capulet => {}\n }\nend", "def steal_engine(ltr, pool, stealable, pool_active=[], stealable_active=[], lv=1, candidates=nil)\n all_active = pool_active.join('') + stealable_active.join('')\n\n if candidates.nil?\n print '| '*lv+ \"STEALENGINE: Trying #{stealable_active} + #{pool_active} : \"\n\n candidates = ltr.find_superset_str(all_active)\n return false unless candidates\n\n #puts '| '*lv+ \"STEALENGINE: Trying #{stealable_active} + pool #{pool_active}\"\n puts '| '*lv+ \" : OK! Remain #{stealable} + #{pool}\"\n else\n puts '| '*lv+ \"continue : #{stealable_active} + #{pool_active}\"\n end\n\n puts '| '*lv+ \" : Some candidates: \"+candidates.join(', ')\n\n if stealable.empty? and pool.empty?\n puts '| '*lv+\"COMPLETE\"\n if (!pool_active.empty?) and normalize_word(all_active) == normalize_word(candidates[0])\n return candidates[0]\n else\n return false\n end\n end\n\n if stealable.empty?\n # Deplete the pool\n puts '| '*lv+ \"pool draw\"\n\n pool.each_index do |pool_idx|\n letter = pool[pool_idx]\n\n new_pool = pool.dup\n new_pool.delete_at(pool_idx)\n\n res = steal_engine(ltr, new_pool, stealable, pool_active + [letter], stealable_active, lv+1)\n if res\n return res\n end\n\n res = steal_engine(ltr, new_pool, stealable, pool_active, stealable_active, lv+1, candidates)\n if res\n return res\n end\n end\n\n else\n puts '| '*lv+ \"stealables draw\"\n\n stealable.each_index do |steal_idx|\n steal = stealable[steal_idx]\n\n new_stealable = stealable.dup\n new_stealable.delete_at(steal_idx)\n\n # Try adding this steal\n res = steal_engine(ltr, pool, new_stealable, pool_active, stealable_active + [steal], lv+1)\n if res\n return res\n end\n\n # Try without adding additional steal\n res = steal_engine(ltr, pool, new_stealable, pool_active, stealable_active, lv+1, candidates)\n if res\n return res\n end\n end\n\n end\n\n return false\nend", "def solved(ans)\n\n end", "def determine_players_best_total(current_player)\n # @player1_hand = ['ace of spades', '5 of spades', '4 of spades', 'ace of diamonds']\n # @player1_hand = ['3 of spades', 'ace of hearts', '4 of spades', 'ace of clubs']\n # @player1_hand = ['ace of clubs', '2 of clubs', 'ace of hearts', '4 of hearts']\n sum_of_players_hand = 0\n number_of_aces_in_hand = 0\n if current_player == 1 then\n @player1_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n\n sum_of_players_hand = sum_of_players_hand - 10\n\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 1\n\n if current_player == 2 then\n @player2_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n sum_of_players_hand = sum_of_players_hand - 10\n $stdout.write(\"sum of players hand #{sum_of_players_hand} :\")\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 2\n\n if current_player == 3 then\n @player3_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n sum_of_players_hand = sum_of_players_hand - 10\n# $stdout.write(\"sum of players hand #{sum_of_players_hand} :\")\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 3\n\n if current_player == 4 then\n @player4_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n sum_of_players_hand = sum_of_players_hand - 10\n# $stdout.write(\"sum of players hand #{sum_of_players_hand} :\")\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 4\n # ### This method returns sum of player's best hand\n return sum_of_players_hand\n end", "def recompute_team\n teams = CollegiateResult.where(:year => @year).all\n teams.each do |team|\n ctc = CollegiateTeamComputer.new(team.pilot_contests)\n result = ctc.compute_result\n team.qualified = result.qualified\n team.points = result.total\n team.points_possible = result.total_possible\n team.update_results(result.combination)\n team.save\n end\n RankComputer.compute_result_rankings(teams)\nend", "def minmax_technique\n possible_solutions = []\n @set.each { |solution|\n possible_solutions << solution if evaluate(@guess, solution) == @feedback_to_evaluation\n }\n @set = possible_solutions\n @guess = @set.sample\n @set.delete(@guess)\n return @guess\n end", "def reduce_solved\n before = 9*9*9\n after = entropy\n while before > after\n before = after\n reduce_line\n reduce_col\n reduce_grid\n after = entropy\n end\n self\n end", "def phase_three\n puts \"Phase 3 has been started\"\n\n 7.times do\n immune = @borneo.individual_immunity_challenge\n puts \"#{immune} wins the immunity\".blue\n\t\tvoted_off_contestant = @merge_tribe.tribal_council(immune: immune)\n\t\[email protected]_member voted_off_contestant\n\t\tputs \"#{voted_off_contestant}! is OUT!\".red\n end\nend", "def accountability_groups(students)\n\nthrowaway = []\nunit = []\ngroups = []\n\n3.times do\n\tthrowaway = students.dup\n\ti = 0\n\n\twhile(throwaway.size > 0) do\n\n\t\tunit << throwaway.sample(4) if throwaway.size % 4 == 0 \n\t\tunit << throwaway.sample(5) if throwaway.size % 4 != 0\n\t\tunit[i].each { |student| throwaway.delete(student) }\n\t\ti += 1\n\tend\n\n\tgroups << unit.dup\n\tunit.clear\nend\ngroups\nend", "def all_contestants(data)\n\tarray_of_people = []\n\tdata.each do |season, people|\n\t\tarray_of_people << people\n\tend\n\tarray_of_people.flatten\nend", "def part2 groups\n yeses = groups.map { | g |\n members = g.split(\"\\n\")\n shared_answers = members.reduce(\"abcdefghijklmnopqrstuvwxyz\".chars) { |m,v |\n m & v.chars\n }.uniq.length\n }.reduce(0){ |m,v|\n m+v\n }\nend", "def second_challenge\n groceries = {\n dairy: [\"milk\", \"yogurt\", \"cheese\"],\n vegetable: [\"carrots\", \"broccoli\", \"cucumbers\"],\n meat: [\"chicken\", \"steak\", \"salmon\"],\n grains: [\"rice\", \"pasta\"]\n }\n\n groceries.values.flatten\n\n\nend", "def prepare_preferred_algorithms!; end", "def phase_one\n 8.times do\n @borneo.immunity_challenge.tribal_council()\n puts\n end\nend", "def problem_108(size = 1001)\n func = lambda do |a|\n if a.length == 1\n a[0]+1\n else\n m = a[0]\n (2*m+1) * func.call(a[1,a.length]) -m\n end\n end\n\n primes = Primes.upto(200)\n prime_number = lambda do |a|\n r = 1\n a.sort.reverse.each_with_index { |m,i| r *= primes[i] ** m }\n r\n end\n\n values = {}\n last = 0\n 1.upto(100).each do |nn|\n nn.groupings do |a|\n sols = func.call a\n ans = prime_number.call a\n# puts \"np=#{nn} sols=#{sols} ans=#{ans} => #{a.inspect}\"\n if values[sols]\n values[sols] = [values[sols],[ans,a]].min\n else\n values[sols] = [ans,a]\n end\n true\n end\n size.upto(size*5/4) do |num|\n if values[num]\n puts \"for np = #{nn} => #{num} => #{values[num].inspect}\"\n if last == values[num]\n puts \"factors = #{values[num][0].factors}\"\n return values[num][0] \n end\n last = values[num]\n break\n end\n end\n #values.sort.each do |k,v|\n # puts \"#{k} => #{v}\"\n #end\n end\n nil\nend", "def test_HEURISTIC_20\n path=\"/home/miro/NetBeansProjects/Knapsack/test/\"\n\n p=Solver.new\n\n p.read_problem(path+\"input3\")\n\n assert_equal(1979, p.heuristic)\n\n p=Solver.new\n p.read_problem(path+\"input4\")\n\n assert_equal(2168, p.heuristic)\n\n p=Solver.new\n p.read_problem(path+\"input5\")\n\n assert_equal(2516, p.heuristic)\n\n\n\n end", "def advance_contestants()\n #logger.debug \"Prior(s): #{all_priors.collect{|bc| bc.contestantcode}.inspect()}\"\n winning_team = self.homecontestant.win ? self.homecontestant.team : self.awaycontestant.team\n losing_team = self.homecontestant.loss ? self.homecontestant.team : self.awaycontestant.team\n self.all_priors().each{|bc| bc.team = bc.contestanttype==\"W\" ? winning_team : losing_team; bc.save! }\n end", "def phase_one\n puts \"Phase 1 has been started\"\n\n 8.times do\n selected_tribe = @borneo.immunity_challenge\n\t\tputs \"#{selected_tribe} was the tribe selected to vote\".yellow\n\t\tvoted_off = selected_tribe.tribal_council\n\t\tputs \"#{voted_off} was voted OUT!\".red\n end\nend", "def solve\n @time = Time.new\n for j in 0..@generations\n new_generation = Array.new\n @selection.init(@population)\n \n for i in 0..(@population_size/2)-1\n children = @reproduction.reproduce(@selection.select,@selection.select,@mutation)\n \n son = children[0]\n daughter = children[1]\n \n if son.fitness > @best_fitness\n @best_fitness = son.fitness\n @best_configuration = son.configuration.conf\n end\n \n if daughter.fitness > @best_fitness\n @best_fitness = daughter.fitness\n @best_configuration = daughter.configuration.conf\n end\n \n new_generation.push(son)\n new_generation.push(daughter)\n \n end\n \n @population = new_generation\n \n end\n @time = Time.new - @time\n end", "def all_solution\n all_solution = []\n comments = Comment.where(question: @question)\n solutions = Solution.where(question: @question)\n outputs = Output.where(question: @question)\n push_elements_in_array(all_solution, comments)\n push_elements_in_array(all_solution, solutions)\n push_elements_in_array(all_solution, outputs)\n all_solution.sort_by(&:order)\n end", "def hw_to_sets(hw,book) \n sets = []\n stream_starts_at_set = 1\n hw.each { |stream|\n stream_starts_at_set = stream_starts_at_set+stream[\"delay\"].to_i\n set_number = stream_starts_at_set\n stream[\"chunks\"].each { |chunk|\n if sets[set_number].nil? then sets[set_number]=[] end\n sets[set_number].push(chunk)\n set_number = set_number+1\n }\n }\n 1.upto(sets.length-1) { |set_number|\n if sets[set_number].nil? then sets[set_number]=[] end\n }\n\n read_problems_csv(book)\n\n 1.upto(sets.length-1) { |set_number|\n sets[set_number].each { |chunk|\n chunk.each { |fg|\n flags,probs = fg\n probs.each { |g|\n g.each { |p|\n k = [p[0],p[1]]\n if p[0]<0 then\n fatal_error(\"in hw_to_sets, chapter=#{p[0]} for a problem on hw #{set_number}\")\n end\n label = $num_to_label[k]\n if $problem_assigned_on_set[k].nil?\n $problem_assigned_on_set[k] = set_number\n else\n if p[2].nil? || p[2]=='' then\n fatal_error(\"problem #{p[0]}-#{p[1]}, #{label}, assigned on both hw #{$problem_assigned_on_set[k]} and hw #{set_number}, and no specific parts were given on the second hw\")\n end\n end\n }\n }\n }\n }\n }\n\n return sets\nend", "def output(data_size: \"small\")\n count = 1\n\n get_inputs(data_size).each do |input|\n output = solve(input.to_i)\n puts \"Case ##{count}: #{output}\"\n count += 1\n end\n end", "def solution4(input)\n end", "def run_tests()\n check_solution(1, [1, 4, 10, 13, 15], true)\n check_solution(2, [1, 4, 10, 10, 13, 15], true)\n check_solution(3, [1, 2, 5, 3, 4 ], false)\nend", "def run_tests()\n check_solution(1, [1, 4, 10, 13, 15], true)\n check_solution(2, [1, 4, 10, 10, 13, 15], true)\n check_solution(3, [1, 2, 5, 3, 4 ], false)\nend", "def solution1(seeds)\n turn_map = {}\n seeds.each_with_index { |n, turn| turn_map[n] = [1, turn + 1, turn + 1] }\n last_number = seeds.last\n\n ((seeds.length+1)..2020).each do |turn|\n last_stats = turn_map[last_number]\n if last_stats[TIMES_SPOKEN] == 1\n zero = turn_map[0] || [0, turn, turn]\n zero[TIMES_SPOKEN] += 1\n zero[FIRST_SPOKEN] = zero[LAST_SPOKEN]\n zero[LAST_SPOKEN] = turn\n \n turn_map[0] = zero\n last_number = 0\n else\n age = last_stats[LAST_SPOKEN] - last_stats[FIRST_SPOKEN]\n\n num = turn_map[age] || [0, turn, turn]\n num[TIMES_SPOKEN] += 1\n num[FIRST_SPOKEN] = num[LAST_SPOKEN]\n num[LAST_SPOKEN] = turn\n \n turn_map[age] = num\n last_number = age\n end\n end\n\n last_number\nend", "def phase_one\n\tputs \"Phase One: Pre-Merge\".yellow\n\t8.times do\n\t\tlost_tribe = @borneo.immunity_challenge\n\t\tputs \"Tribe #{lost_tribe.to_s.red} has lost this round. They are voting off a member.\"\n\t\teliminated_contestant = lost_tribe.tribal_council\n\t\tputs \"#{eliminated_contestant.to_s.capitalize.red} was voted off.\"\n\tend\n\t#puts \"Phase one ends. 8 contestants were voted off in this phase, and 12 contestants remain in the game.\"\nend", "def phase_one\n\tputs \"\\nPhase One\".colorize(:color => :blue, :background => :white)\n\t eliminated_members = []\n\t 8.times do\n\t \tlosing_tribe = @borneo.immunity_challenge\n\t \t# losing_tribe = @borneo.get_losing_tribe(immune_tribe)\n\t \teliminated_member = losing_tribe.tribal_council()\n\t \t# losing_tribe.members.delete(eliminated_member)\n\t \teliminated_members.push(eliminated_member)\n\t end\n\teliminated_members.length\nend", "def answers\n return (distractor + [correct]).shuffle\n end", "def answers\n return (distractor + [correct]).shuffle\n end", "def n_queens(num = 8)\n solutions = []\n queens = []\n\n solve(num, 0, queens, solutions)\n\n solutions\nend", "def output(data_size: \"small\")\n count = 1\n\n get_inputs(data_size).each do |input|\n output = solve(input)\n puts \"Case ##{count}: #{output}\"\n count += 1\n end\n end", "def output(data_size: \"small\")\n count = 1\n\n get_inputs(data_size).each do |input|\n output = solve(input)\n puts \"Case ##{count}: #{output}\"\n count += 1\n end\n end", "def phase_one\n puts \"~~~~~PHASE 1~~~~~\".yellow\n 8.times do\n @borneo.immunity_challenge.tribal_council\n puts\n end\nend", "def contests()\n\t\tself.as_contestants.collect{|c| c.contest }\n\tend", "def index\n @contests = Manage::Contest.order(is_deleted: :desc,id: :desc).to_a\n @contests.sort! do |a,b|\n if a.current_compete != 0\n if b.current_compete != 0\n # 如果两个比赛都有对应的正在进行的赛事,就按比赛数量逆序排列\n b.competes_count <=> a.competes_count\n else\n # 如果只有a有,那么a排前面\n -1\n end\n else\n if b.current_compete != nil\n # 如果只有b有,那么b排前面\n 1\n else\n # 如果都没有,也按照比赛数量逆序排序\n b.competes_count <=> a.competes_count\n end\n end\n end\n\n @competes = @contests[0].competes.order(start_time: :desc)\n if params[:contest]\n current = @contests.find_all {|x| x.id == params[:contest].to_i}\n if current.length > 0\n @current = current[0]\n end\n end\n @current ||= @contests[0]\n end", "def solution(number)\nn = 0..number\na = []\nfor i in n\n if i % 3 == 0 || i % 5 == 0\n a = a.push(i)\n end\n end\ns = 0\n# a.pop\na.each {|x| s += x}\ns\nend", "def salida_jugadores\n @jugadores.each do |jugador|\n jugador.casilla_actual = @tablero.casillas.at(0)\n end\n random = Random.new\n \n primero_en_salir = random.rand(@jugadores.size)\n \n @jugador_actual = @jugadores.at(primero_en_salir)\n\n \n @estado_juego = ModeloQytetet::EstadoJuego::JA_PREPARADO;\n end", "def output(data_size: \"small\")\n count = 1\n get_inputs(data_size).each do |input|\n output = solve(input)\n puts \"Case ##{count}: #{output}\"\n count += 1\n end\n end", "def analyze\n @hits.times do\n @guesses << @last_guess unless @guesses.length == 4\n end\n end", "def analyze\n @hits.times do\n @guesses << @last_guess unless @guesses.length == 4\n end\n end", "def run_best_case\n user = User.find(1)\n timetable = user.timetables[2]\n timetable.subjects = user.subjects.ids.sample(5)\n\n p \">>>>>>> Running Best Case for Population Size\"\n run_for_population_size(timetable)\n # p \">>>>>>> Running Best Case for Generations\"\n # run_for_generations(timetable)\n\n # tp all_runs\n #tp all_runs.map { |x| x[:chromosomes] }\n #p all_runs.map(&:fitness).inject(0, :+) / all_runs.size\n #tp all_runs[0].data.collect {|x| x.subject }\n end", "def set_solution\r\n @solutions = true\r\n end", "def initialize\r\n @possible = [\"red\", \"red\", \"red\", \"red\", \"blue\", \"blue\", \"blue\", \"blue\",\r\n \"yellow\", \"yellow\", \"yellow\", \"yellow\", \"green\", \"green\", \"green\",\r\n \"green\", \"magenta\", \"magenta\", \"magenta\", \"magenta\", \"cyan\", \"cyan\", \"cyan\",\r\n \"cyan\"]\r\n @possible_solution = Array.new\r\n @possible_score = {}\r\n end", "def improve_teams\n @teams = steepest_ascent_hill(@teams)\n end", "def solve\n loop { break if !shift }\n return @solutions\n end", "def victory(joueur)\n\t\t# On définit les 8 possibilités de victoires si elles se vérifient les 3 dans la combinaison donnée alors la partie s'arrête\n\t\tif (plateau[0] == joueur.value) && (plateau[1] == joueur.value) && (plateau[2] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\n\t\telsif (plateau[3] == joueur.value) && (plateau[4] == joueur.value) && (plateau[5] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[0] == joueur.value) && (plateau[3] == joueur.value) && (plateau[6] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[2] == joueur.value) && (plateau[4] == joueur.value) && (plateau[6] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[0] == joueur.value) && (plateau[4] == joueur.value) && (plateau[8] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[2] == joueur.value) && (plateau[5] == joueur.value) && (plateau[8] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[1] == joueur.value) && (plateau[4] == joueur.value) && (plateau[7] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telse\n\t\t\treturn\n\t\tend\n\tend", "def determine_choices(stats, options)\n final = []\n options.each do |choice|\n choice.each_index do |i|\n if choice[i] < 0\n break if (stats[i] + choice[i]) > 0\n else\n break if (stats[i] - choice[i]) < 0\n end\n if i == 4\n final += [choice[5]]\n break\n end\n end\n end\n final\n end", "def cupcake_solver(cupcake_counts, number_of_students_in_class)\n # number of cupcakes for each flavor\n cake_set = cupcake_counts\n n = number_of_students_in_class\n cakes_per_student = 0\n\n cake_set.each do |count|\n # cakes per student for this flavor\n c = count / n\n # running total\n cakes_per_student += c\n end\n cakes_per_student\nend", "def solve\n solution_candidate(intersections.next_people_with_similar_tastes)\n end" ]
[ "0.6592503", "0.6181148", "0.5926964", "0.57579315", "0.56257474", "0.55437696", "0.5535676", "0.5531853", "0.5506152", "0.55029285", "0.55029285", "0.55029285", "0.55029285", "0.55029285", "0.54960084", "0.54687876", "0.5464706", "0.5463565", "0.543911", "0.54365885", "0.5434753", "0.5374737", "0.5372078", "0.5368088", "0.53669035", "0.53596854", "0.5349728", "0.5347169", "0.5338787", "0.533462", "0.5333691", "0.53298277", "0.53217596", "0.52816504", "0.52805287", "0.52708226", "0.52669436", "0.5266254", "0.5260293", "0.5251235", "0.52445674", "0.5241592", "0.524028", "0.52338016", "0.5233154", "0.5233066", "0.5231897", "0.5229994", "0.522868", "0.5223019", "0.52177435", "0.5216933", "0.5197575", "0.5192091", "0.518965", "0.5186936", "0.51854885", "0.5181516", "0.51736426", "0.517117", "0.5169842", "0.51571065", "0.51537216", "0.51488906", "0.5135841", "0.5133824", "0.5128628", "0.5127942", "0.5123345", "0.512059", "0.5118491", "0.51113474", "0.5110444", "0.5109614", "0.51027817", "0.51027817", "0.509589", "0.5090697", "0.5090082", "0.5085662", "0.5085662", "0.5084376", "0.50843686", "0.5084102", "0.5082087", "0.5069932", "0.5068346", "0.506777", "0.5067588", "0.50658906", "0.5065024", "0.5065024", "0.5058627", "0.50585717", "0.50573367", "0.5056138", "0.5046531", "0.50450057", "0.504329", "0.5041057", "0.50395155" ]
0.0
-1
Execute gsub multiple times
def gsubs(replacements) str = self.dup replacements.each do |r| str = str.gsub(r[0],r[1]) end str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gsub(*)\n self\n end", "def gsub!(*args, &block)\n str = self.gsub(*args, &block)\n if str != self\n self.replace(str)\n self\n else\n nil\n end\n end", "def gsub(pattern, replace)\n lambda do |rec, acc|\n acc.collect! { |v| v.gsub(pattern, replace) }\n end\n end", "def gsub(regex, &block)\n return StringGsubEnumerator.new(self, :gsub, regex) unless block\n __gsub_perform_block_substitution(regex, &block)\n end", "def gsub(*args, &block)\n if args.size == 2\n split(args[0], -1).join(args[1])\n elsif args.size == 1 && block\n split(args[0], -1).join(block.call(args[0]))\n else\n raise ArgumentError, \"wrong number of arguments\"\n end\n end", "def gsub!(pat, rep)\n each_with_index { |fn, i| self[i] = fn.gsub(pat,rep) }\n self\n end", "def gsub(text, regexp, with)\n total = 0\n Undo.record text do |record|\n text.index('1.0').upto(text.index('end')) do |index|\n lineend = index.lineend\n line = text.get(index, lineend)\n\n if line.gsub!(regexp, with)\n record.replace(index, lineend, line)\n total += 1\n end\n end\n end\n\n text.message \"Performed gsub on #{total} lines\"\n end", "def gsub!(pat, rep)\n each_with_index { |fn, i| self[i] = fn.gsub(pat,rep) }\n self\n end", "def gsub(pat, rep)\n inject(self.class.new) { |res, fn| res << fn.gsub(pat, rep) }\n end", "def gsub!(pat, rep)\n each_with_index { |fn, i| self[i] = fn.gsub(pat, rep) }\n self\n end", "def sub_replacements text\n if REPLACEABLE_TEXT_RX.match? text\n # NOTE interpolation is faster than String#dup\n text = text.to_s\n REPLACEMENTS.each do |pattern, replacement, restore|\n # NOTE Using gsub! as optimization\n text.gsub!(pattern) { do_replacement $LAST_MATCH_INFO, replacement, restore }\n end\n end\n text\n end", "def gsub(regex, replacement)\n __gsub_perform_substitution(regex, replacement)[0]\n end", "def gsub2(re)\n\t\traise \"block required\" unless block_given?\n\t\tsin = self.dup\n\t\tsout = \"\"\n\t\twhile sin.length > 0\n\t\t\tm = re.match(sin)\n\t\t\tif m then\n\t\t\t\tr = yield m\n\t\t\t\tif r.kind_of?(Array) then\n\t\t\t\t\tif (r.length >= 2 && r.length <= 3) then\n\t\t\t\t\t\tsout << r[0] + r[1]\n\t\t\t\t\telse\n\t\t\t\t\t\tthrow \"gsub2: array returned is not of length 2 or 3\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tsout << m.pre_match + r\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif r.kind_of?(Array) && r.length == 3 then\n\t\t\t\t\tsin = r[2]\n\t\t\t\telse\n\t\t\t\t\tsin = m.post_match\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tsout << sin\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\n\t\tsout\n\tend", "def gsub(pattern, replacement = nil, &blk)\n if block_given?\n @string.gsub(pattern, &blk)\n else\n @string.gsub(pattern, replacement)\n end\n end", "def gsub(pattern, replacement = nil, &blk)\n if block_given?\n @string.gsub(pattern, &blk)\n else\n @string.gsub(pattern, replacement)\n end\n end", "def format!\n substitutions.each { |s| sub_string.gsub!(match(s), replace(s)) }\n sub_string\n end", "def replacements; end", "def replace(range, content); end", "def replace(range, content); end", "def replace(range, content); end", "def replace(range, content); end", "def replace(range, content); end", "def replace(range, content); end", "def replace(range, content); end", "def replace(range, content); end", "def apply_replacements(word)\n @replacements.each do |pattern, target|\n word.gsub!(pattern, target)\n end\n \n word\n end", "def subs(re, *args)\n args.inject(self) do |s,arg|\n s.sub(re, arg)\n end\n end", "def sub!(pattern, replacement = T.unsafe(nil), &block); end", "def gsub(pat, rep)\n inject(PropertyGroup::PathList.new) { |res, fn| res << fn.gsub(pat,rep) }\n end", "def replace(p0) end", "def replace(p0) end", "def replace(p0) end", "def gsub(pat, rep)\n inject(FileList.new) { |res, fn| res << fn.gsub(pat,rep) }\n end", "def gsub(event)\n @gsub_parsed.each do |config|\n field = config[:field]\n needle = config[:needle]\n replacement = config[:replacement]\n\n value = event.get(field)\n case value\n when Array\n result = value.map do |v|\n if v.is_a?(String)\n gsub_dynamic_fields(event, v, needle, replacement)\n else \n @log.error('cannot gsub non Strings', \n field: field, \n value: v)\n end\n event.set(field, result)\n end\n when String\n v = gsub_dynamic_fields(event, value, needle, replacement)\n event.set(field, v)\n else\n @log.error('cannot gsub non Strings', field: field, value: value)\n end\n end\n end", "def perform_substitutions(input)\n @data[:presubs].each { |s| input.gsub!(s[0], s[1]) }\n input\nend", "def modify_text(book_text, string_values)\n string_values.each do |search_string, change_string|\n regex = %r[#{search_string}]\n book_text = book_text.gsub(regex, change_string)\n end\n\n return book_text\nend", "def fill_in(s)\n n = 0\n while s =~ /(\\$?\\{([^{}]+)\\})/\n match = $1\n if match[0..0] == '$'\n # A switch [Jon Aquino 2005-07-16]\n s.gsub!(match, yield(match))\n else\n # A substitution [Jon Aquino 2005-07-16]\n s.gsub!(match, response_text(match[1..-2]))\n end\n n += 1\n if n > 50\n # Protection against one form of recursion attack [Jon Aquino 2005-07-16]\n raise 'Max number of substitutions reached'\n end\n end\n return s\n end", "def repeater(str)\n str.gsub(/(.)/, '\\1\\1')\nend", "def repeater(str)\n str.gsub(/(.)/, '\\1\\1')\nend", "def process_text text\n newtext = text.gsub(/if/, 'IF')\n\n 30.times { |i|\n newtext.gsub!(/for/, 'FOR')\n newtext.gsub!(/while/, 'WHILE')\n newtext.gsub!(/switch/, 'SWITCH')\n newtext.gsub!(/case/, 'CASE')\n newtext.gsub!(/goto/, 'GOTO')\n newtext.gsub!(/struct/, 'STRUCT')\n newtext.gsub!(/int/, 'INT')\n newtext.gsub!(/char/, 'CHAR')\n newtext.gsub!(/return/, 'RETURN')\n }\n\n return newtext\nend", "def gsub_file(*args, &block)\n self.log 'gsub_file', args.first\n self.runner.send(:gsub_file, *args, &block)\n end", "def replace\n end", "def gsub_file(path, regexp, *args, &block)\n content = File.read(path).gsub(regexp, *args, &block)\n File.open(path, 'wb') { |file| file.write(content) }\nend", "def scrub_text(text)\n TEXT_GSUBS.inject(text) { |memo, sub| memo = memo.gsub(*sub) }\n end", "def format(text, &block)\n extract(text).each_with_object(text.clone) do |extract, redacted_text|\n sub = block_given? ? block.call(extract) : default_replacement\n redacted_text[extract.start..extract.finish] = sub\n end\n end", "def gsub_functions(text)\n\tlast_function_end = 0\n\n\tresult = text\n\tadjust = 0\n\n\tscan_ignore_comments(/((\\w+)::)?(\\w+)\\s*\\(([^\\)]*?)\\)\\s*\\{/m, text) do |match|\n\t\toffset = match.pre_match.length\n\n\t\tif offset > last_function_end\n\t\t\tclass_name = match[2]\n\t\t\tname = match[3]\n\t\t\tend_offset = find_block_end(text, offset) + 1\n\n\t\t\tblock = text[offset, end_offset - offset]\n\n\t\t\t# Get replacement text.\n\n\t\t\treplacement = yield class_name, name, block\n\n\t\t\t# Substitute old text for new text:\n\n\t\t\tbefore_text = result[0, offset + adjust]\n\t\t\tafter_text = result[end_offset + adjust,\n\t\t\t result.length]\n\t\t\tresult = before_text + replacement + after_text\n\t\t\tadjust += replacement.length - block.length\n\n\t\t\t# Save end position of function so that we won't\n\t\t\t# change anything in this block again.\n\n\t\t\tlast_function_end = end_offset\n\t\tend\n\tend\n\n\tresult\nend", "def rsub(pattern, replacement)\n if i = rindex(pattern) # rubocop:disable Lint/AssignmentInCondition\n s = @string.dup\n s[i] = replacement\n self.class.new s\n else\n self\n end\n end", "def pig_it(text)\n text.gsub(/\\b([a-z0-9]?)([a-z0-9]+)\\b/i, '\\2\\1ay')\n # text.gsub(/\\b([a-z0-9])([a-z0-9]+)*\\b/i, '\\2\\1ay')\n # text.gsub(/([a-z0-9])([a-z0-9]+)*/i, '\\2\\1ay')\nend", "def gsub(value, context, parameters)\n # Try to find a full replacement match - if found, return the actual value of that reference.\n return get_reference_value($1, context, parameters) if value.match(REPLACE_REGEX)\n # No full match, substitute all references with their string representations\n value.gsub(INTERPOLATE_REGEX) { get_reference_value($1, context, parameters) }\n end", "def replace_all(source_text, replacement)\n case\n # For simple cases we just replace runs to try and keep formatting/layout of source\n when replacement.is_a?(String)\n @main_doc.replace_all_with_text(source_text, replacement)\n when (replacement.is_a?(Magick::Image) or replacement.is_a?(Magick::ImageList))\n runs = @main_doc.replace_all_with_empty_runs(source_text)\n runs.each { |r| r.replace_with_run_fragment(create_image_run_fragment(replacement)) }\n when replacement.is_a?(Hash)\n runs = @main_doc.replace_all_with_empty_runs(source_text)\n runs.each { |r| r.replace_with_body_fragments(create_body_fragments(replacement, {:create_table => true})) }\n when replacement.is_a?(Nokogiri::XML::Element)\n runs = @main_doc.replace_all_with_empty_runs(source_text)\n if replacement.name == \"w:tbl\"\n runs.each { |r| r.replace_with_body_fragments(create_body_fragments(replacement)) }\n else\n runs.each { |r| r.replace_with_run_fragment(create_body_fragments(replacement)) }\n end\n else\n runs = @main_doc.replace_all_with_empty_runs(source_text)\n runs.each { |r| r.replace_with_body_fragments(create_body_fragments(replacement)) }\n end\n end", "def recursive_gsub(search_txt, txt_to_replace)\n res = self\n res = res.gsub(search_txt, txt_to_replace).recursive_gsub(search_txt, txt_to_replace) if res.include?(search_txt)\n res\n end", "def rewrite!(content)\n return content unless match?\n \n content.gsub(/#{pattern}/, replacement)\n end", "def apply!(str)\n str.gsub! regexp, ''\n end", "def gsub_file(path, regexp, *args, &block)\n #path = destination_path(relative_destination)\n content = File.read(path)\n check_for = args.first || yield('')\n regex = Regexp.new(regexp.source + Regexp.escape(check_for))\n return if content =~ regex # if we can match the text and its leadin regex, don't add again\n content = content.gsub(regexp, *args, &block)\n File.open(path, 'wb') { |file| file.write(content) }\n end", "def string_replacements\nend", "def shatter(re)\n r = self.gsub(re) { |s| \"\\1\" + s + \"\\1\" }\n while r[ 0, 1] == \"\\1\"; r[0] = ''; end\n while r[-1, 1] == \"\\1\"; r[-1] = ''; end\n r.split(\"\\1\")\n end", "def Dragon n\n return '' unless n.is_a?(Integer) && n >= 0 \n\n string = 'Fa'\n n.times do\n string = string.gsub(/[ab]/, 'a' => 'aRbFR', 'b' => 'LFaLb') \n end\n string.gsub(/[ab]/, '')\nend", "def regex_replace_first(input, regex, replacement = NOTHING)\n input.to_s.sub(Regexp.new(regex), replacement.to_s)\n end", "def mreplace regexp, &block\n matches = []\n offset = 0\n while self[offset..-1] =~ regexp\n matches << [offset, $~]\n offset += $~.end($~.size - 1)\n end\n raise 'unmatched' if matches.empty?\n\n matches.reverse.each do |offset, match|\n slice = self[offset...-1]\n send = (1...match.size).map {|i| slice[match.begin(i)...match.end(i)]}\n if send.length == 1\n recv = block.call(send.first)\n self[offset+match.begin(1)...offset+match.end(1)] = recv\n else\n recv = block.call(*send)\n next unless recv\n (1...match.size).map {|i| [match.begin(i), match.end(i), i-1]}.sort.\n reverse.each do |start, fin, i|\n self[offset+start...offset+fin] = recv[i]\n end\n end\n end\n self\n end", "def do_replacement match, replacement, restore\n if (captured = match[0]).include? RS\n # we have to use sub since we aren't sure it's the first char\n captured.sub RS, ''\n else\n case restore\n when :none\n replacement\n when :bounding\n %(#{match[1]}#{replacement}#{m[2]})\n else # :leading\n %(#{match[1]}#{replacement})\n end\n end\n end", "def replace_all(query, replace, &body)\n count = 0\n ([email protected]_count-1).each do |i| \n begin\n line = body.call(@doc.get_line(i), query, replace) \n \n if line \n @doc.replace_line(i, line.chomp)\n count+=1\n end\n end while line != nil\n end\n puts count\n return count\n end", "def replace_instant_text(text)\n @lines.pop\n @lines.push(text)\n refresh\n end", "def gsub_expression line, t, dtype, line_number=nil, filename=nil\n gsub_expression_re /%%#{t}\\ .*?%%/, line, t, dtype, line_number, filename\n end", "def _perform(text)\n lines = text.split(\"\\n\")\n lines.map! {|line|\n line.gsub(/\\[\\[(.)+\\]\\]/i){|found|\n /\\[\\[([a-z_]*): ([a-z_]*)\\]\\]/i =~ found\n _perform(self.send($1.to_sym, $2))\n }\n }\n lines.join(\"\\n\")\n end", "def add_more_ruby(string)\n string.gsub(\"sad\", \"happy\").gsub(\"Sad\", \"Happy\").gsub(\"SAD\", \"HAPPY\")\nend", "def mgpsub(key_value_pairs=[].freeze)\n regexp_fragments = key_value_pairs.collect { |k,v| k }\n gsub(Regexp.union(*regexp_fragments)) do |match|\n replacement_term = key_value_pairs.detect{|k,v| k=~match}[1]\n vars = [\"$1\", \"$2\", \"$3\", \"$4\", \"$5\", \"$6\", \"$7\", \"$8\", \"$9\", \"$`\", \"$&\", \"$'\"]\n vars.each do |var|\n replacement_term.gsub!( Regexp.compile(\"\\\\\"+var), eval(var)||'' )\n end\n replacement_term\n end\n end", "def transform(text)\n\t\t\[email protected] do |rule|\n\t\t\t\tif rule.replace.is_a?(String)\n\t\t\t\t\ttext = text.gsub(rule.pattern, rule.replace)\n\t\t\t\telse\n\t\t\t\t\ttext = text.gsub(rule.pattern) {rule.replace.call($~)}\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn text\n\t\tend", "def escape input, regexp, map\n input.gsub(regexp) { | char | map[char] || char }\n end", "def mgsub(key_value_pairs=[].freeze)\n regexp_fragments = key_value_pairs.collect { |k,v| k }\n gsub(Regexp.union(*regexp_fragments)) do |match|\n key_value_pairs.detect { |k,v| k =~ match}[1]\n end\n end", "def mgsub(key_value_pairs=[].freeze)\n regexp_fragments = key_value_pairs.collect { |k,v| k }\n gsub(Regexp.union(*regexp_fragments)) do |match|\n key_value_pairs.detect{|k,v| k =~ match}[1]\n end\n end", "def pig_it text\n text.gsub(/(\\w)(\\w+)*/, '\\2\\1ay')\nend", "def pig_it text\n text.gsub(/(\\w)(\\w+)*/, '\\2\\1ay')\nend", "def shortcut_exec(regex)\n if(regex =~ @row;@rgx = $~)\n srcs = @rgx.to_s\n rplc = \"#{@rgx[1]}%!_#{@rgx[2]}~ #{@rgx[3]}\\n\"\n @row.gsub!(srcs,rplc)\n p \"reExe_ #{@row}\" if @dbg[:parse]\n end\n end", "def escape(text)\n replacements.inject(text.to_s) do |corpus, (pattern, replacement)|\n corpus.gsub(pattern, replacement)\n end\n end", "def switcheroo(x)\n x.gsub(/[ab]/, 'a' => 'b', 'b' => 'a')\nend", "def replace_placeholders(text)\n matches = text.scan(/\\{([a-z_]+)\\}/).flatten\n\n return text unless matches.any?\n\n replaced = text.dup\n\n matches.each do |match|\n value = @filing_history.description_values.dig(match.to_sym)\n replaced.sub!(/{#{match}}/, value)\n end\n\n replaced\n end", "def gzub(regexp, format=nil, &proc)\n md = match(regexp)\n raise \"#{self.inspect} doesn't match #{regexp.inspect}\" if md.nil?\n \n s = dup\n pos = 0\n md.captures.each_with_index do |m, n|\n replacement = if block_given?\n proc.call(m)\n elsif Proc === format\n format.call(m)\n else\n format % m\n end\n \n if md.offset(n+1)[0]\n s[md.offset(n+1)[0] + pos, m.length] = replacement\n pos += replacement.length - m.length\n end\n end\n s\n end", "def mess_with_vars3(one, two, three)\n one.gsub!(\"one\",\"two\")\n two.gsub!(\"two\",\"three\")\n three.gsub!(\"three\",\"one\")\nend", "def replace(input_field, regex, into_field, replacement, options = {})\n output = options[:output] || all_fields # Overrides Cascading default\n\n input_field = fields(input_field)\n raise \"input_field must declare exactly one field, was '#{input_field}'\" unless input_field.size == 1\n into_field = fields(into_field)\n raise \"into_field must declare exactly one field, was '#{into_field}'\" unless into_field.size == 1\n\n parameters = [into_field, regex.to_s, replacement.to_s, options[:replace_all]].compact\n each(\n input_field,\n :function => Java::CascadingOperationRegex::RegexReplace.new(*parameters),\n :output => output\n )\n end", "def make_regexp\n @intent = self.intent\n regexp = self.pattern.dup.downcase\n words = regexp.split(\" \")\n words.each do |word|\n if word.include? '/'\n regexp = regexp.gsub(word,\"(#{word})\")\n\n end\n\n end\n regexp = regexp.gsub('/',\"|\")\n regexp = regexp.gsub('^ ','.{0,60}').gsub(' ^','.{0,60}').gsub(' *','.{1,60}').gsub('* ','.{1,60}').gsub('^','.{1,60}').gsub(' [','.{0,60}[')\n regexp = regexp.gsub(' .{0,60}','.{0,60}')\n regexp = regexp.gsub(' .{1,60}','.{1,60}')\n regexp = '.{0,60}' + regexp + '.{0,60}'\n self.regexp = regexp\n chunks = self.pattern.split(' ')\n chunks.each do |ch|\n result= Regexp.new(/\\[.{0,12}\\]/) =~ ch\n if(result==0)\n set = WordSet.find_by_keyword(ch[1..-2])\n str = '(' + set.words.join('|') + ')'\n regexp = self.regexp.gsub(ch,str)\n self.regexp = regexp\n end\n end\n self.save\n end", "def args_replace command, name, args, expression\n initial_offset = offset = (command =~ /\\b#{Regexp.escape name}\\(/) + name.length + 1\n bracket_count = 1\n\n # find the last bracket\n while offset < command.length\n if command[offset] == ?(\n bracket_count += 1\n elsif command[offset] == ?)\n bracket_count -= 1\n break if bracket_count == 0\n end\n\n offset += 1\n end\n\n args_expr = command[initial_offset..(offset - 1)].split(\",\").map(&:strip)\n\n # passed the wrong number of arguments to this function\n if args_expr.length != args.length\n raise Exception.new(\"Error: wrong number of arguments for call to #{name} in command '#{command}'\")\n end\n\n # do the substitutions\n command[0..(initial_offset - name.length - 2)] + \"(\" + args.zip(args_expr).inject(expression) do |result, (find, repl)|\n result.gsub(/\\b#{Regexp.escape find}\\b/, \"(\" + repl + \")\")\n end + \")\" + command[(offset + 1)..-1]\nend", "def subs(input, the_story)\n subbed = the_story.gsub(\"lion\", input).gsub(\"r\", \"rrr\")\n return subbed\nend", "def as_replacements; end", "def as_replacements; end", "def as_replacements; end", "def replace regex, options\n required_options options, [:with, :in]\n add \"sed -i 's/#{regex}/#{options[:with].to_s.gsub('/', '\\/').gsub(\"\\n\", \"\\\\n\")}/' #{options[:in]}\", check_string(options[:with], options[:in])\n end", "def replaceVoids(theLines)\n\n\ttheLines.each do |theLine|\n\t\ttheLine[:text].gsub!(/(\\w)\\(\\s*void\\s*\\)/, '\\1()');\n\tend\n\t\nend", "def sub!(pat, rep)\n each_with_index { |fn, i| self[i] = fn.sub(pat,rep) }\n self\n end", "def subs!(pattern, replacement)\n sub!(pattern, replacement)\n self\n end", "def gsub_file(relative_destination, regexp, *args, &block)\r\n path = destination_path(relative_destination)\r\n content = File.read(path).gsub(regexp, *args, &block)\r\n File.open(path, 'wb') { |file| file.write(content) }\r\n end", "def replace_child(to_replace, replacement); end", "def gsub_file(relative_destination, regexp, *args, &block)\n path = destination_path(relative_destination)\n content = File.read(path).gsub(regexp, *args, &block)\n File.open(path, 'wb') { |file| file.write(content) }\n end", "def rewrite before, after, reg = /\\#\\{(\\w+)\\}/, reg2 = '\\1'\n File.open(after, 'w') do |a|\n File.open(before) do |b|\n b.each do |line|\n a << line.gsub(reg) do\n if reg2.include? '\\1'\n reg2.gsub(%r!\\\\1!, Object.const_get($1))\n else\n reg2\n end\n end\n end\n end\n end\n end", "def rewrite before, after, reg = /\\#\\{(\\w+)\\}/, reg2 = '\\1'\n File.open(after, 'w') do |a|\n File.open(before) do |b|\n b.each do |line|\n a << line.gsub(reg) do\n if reg2.include? '\\1'\n reg2.gsub(%r!\\\\1!, Object.const_get($1))\n else\n reg2\n end\n end\n end\n end\n end\n end", "def rewrite before, after, reg = /\\#\\{(\\w+)\\}/, reg2 = '\\1'\n File.open(after, 'w') do |a|\n File.open(before) do |b|\n b.each do |line|\n a << line.gsub(reg) do\n if reg2.include? '\\1'\n reg2.gsub(%r!\\\\1!, Object.const_get($1))\n else\n reg2\n end\n end\n end\n end\n end\n end", "def rewrite before, after, reg = /\\#\\{(\\w+)\\}/, reg2 = '\\1'\n File.open(after, 'w') do |a|\n File.open(before) do |b|\n b.each do |line|\n a << line.gsub(reg) do\n if reg2.include? '\\1'\n reg2.gsub(%r!\\\\1!, Object.const_get($1))\n else\n reg2\n end\n end\n end\n end\n end\n end", "def rewrite before, after, reg = /\\#\\{(\\w+)\\}/, reg2 = '\\1'\n File.open(after, 'w') do |a|\n File.open(before) do |b|\n b.each do |line|\n a << line.gsub(reg) do\n if reg2.include? '\\1'\n reg2.gsub(%r!\\\\1!, Object.const_get($1))\n else\n reg2\n end\n end\n end\n end\n end\n end", "def gsub_yield line, t, dtype, line_number=nil, filename=nil\n match = line.match YIELD_REGEX\n while !match.nil?\n\n statement = match[0][4...-2]\n result = self.send :eval, statement, binding, filename, line_number\n line[\"%%= #{statement}%%\"] = result.to_s\n\n match = line.match YIELD_REGEX\n end\n line\n end", "def crunch_regex(string)\n string.gsub(/(.)\\1+/, '\\1')\nend", "def rep(original, new)\n # making sure we don't try substituting nil objects or for nil objects\n\toriginal=(original==nil)? \"\":original\n new=(new==nil)? \"\":new\n \n\ttemp=self.inner_html\n self.inner_html=temp.gsub(original, new)\n self\n end" ]
[ "0.7450984", "0.72409743", "0.70312864", "0.6864702", "0.6831023", "0.674454", "0.66314614", "0.65569", "0.6530583", "0.65216374", "0.6475867", "0.639347", "0.6262387", "0.62111574", "0.62111574", "0.61799383", "0.6167272", "0.6150557", "0.6150557", "0.6150557", "0.6150557", "0.6150557", "0.6150557", "0.6150557", "0.6150557", "0.6030366", "0.59990185", "0.5964237", "0.5956694", "0.59119207", "0.59119207", "0.5909872", "0.5876407", "0.58713883", "0.58662266", "0.5849441", "0.58014256", "0.5794244", "0.5794244", "0.577391", "0.5723714", "0.5721801", "0.5643522", "0.56233746", "0.5620889", "0.56129456", "0.5594966", "0.55692476", "0.5569184", "0.556496", "0.5560155", "0.5555487", "0.55471784", "0.5511918", "0.5504897", "0.5500669", "0.54745895", "0.5472757", "0.5464845", "0.5457961", "0.545284", "0.5432211", "0.54120153", "0.54115015", "0.5409002", "0.5395603", "0.53953946", "0.5391867", "0.5385816", "0.5385779", "0.53844", "0.53844", "0.53822696", "0.53404456", "0.5338789", "0.53386647", "0.53341013", "0.5313458", "0.529131", "0.52725655", "0.5242143", "0.52259284", "0.5221951", "0.5221951", "0.5221951", "0.5211574", "0.52058583", "0.5205608", "0.5203528", "0.5189735", "0.5186785", "0.51659566", "0.515973", "0.515973", "0.515973", "0.515973", "0.515973", "0.51484996", "0.5141219", "0.51303005" ]
0.65265185
9
Get forwarding table from tier1 Get forwarding table from tier1
def get_tier1_forwarding_table(tier_1_id, opts = {}) data, _status_code, _headers = get_tier1_forwarding_table_with_http_info(tier_1_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tier1_forwarding_table_0(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_forwarding_table_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/forwarding-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'RoutingTableListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/forwarding-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'RoutingTableListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/forwarding-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'GatewayRouteTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/forwarding-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'GatewayRouteTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_csv(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_forwarding_table_csv_0(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts)\n data\n end", "def read_policy_dns_forwarder_on_tier1_0(tier_1_id, opts = {})\n data, _status_code, _headers = read_policy_dns_forwarder_on_tier1_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_tables\n\t\t@@tables\n\tend", "def get_tables\n tables\n end", "def table_name\n cti_tables ? cti_tables.last : super\n end", "def read_policy_dns_forwarder_on_tier1(tier_1_id, opts = {})\n data, _status_code, _headers = read_policy_dns_forwarder_on_tier1_with_http_info(tier_1_id, opts)\n data\n end", "def getTable\r\n return @pila_t.last #puedes hacer getTable sucesivos sin modificar nada en lo absoluto.\r\n end", "def lookup_address_via_tier1_dns_forwarder_0(tier_1_id, opts = {})\n data, _status_code, _headers = lookup_address_via_tier1_dns_forwarder_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_table(table)\n raise \"Pool #{self} does not have table #{table}\" unless has_table? table\n\n @tables.select{|tb| tb.to_s == table}.first\n end", "def tier\n @tier_cache || self.tiers[0]\n end", "def find_table_name\n client = RemoteAccountingSystemType.find_by_accounting_system_type_id(params[:real_estate_property][:accounting_system_type_id])\n return client.table_name.to_s if client\n end", "def table\n Airmodel.client.table base_config[:base_id], base_config[:table_name]\n end", "def get_table instance_id, table_id, view: nil\n tables.get_table name: table_path(instance_id, table_id), view: view\n end", "def mti_delegate_query_table param\n return self.table_name.to_sym if mti_handles_query_param param\n mti_ancestor_classes.find {|e| e.mti_handles_query_param param}&.table_name&.to_sym\n end", "def get_table_set\n P2::Application.reset CLIENT_INI\n @conn = P2::Connection.new :app_name => 'RecordTest',\n :host => \"127.0.0.1\", :port => 4001\n @conn.Connect\n\n @ds = P2::DataStream.new :stream_name => 'RTS_INDEX_REPL',\n :type => P2::RT_COMBINED_DYNAMIC\n\n @ds.Open(@conn)\n\n @ds.events.on_event { |*args| p args }\n 2.times { @conn.ProcessMessage2(1000) } # Push @ds to receive its TableSet\nend", "def return_table()\r\n\t\t\treturn @table\r\n\t\tend", "def lookup_address_via_tier1_dns_forwarder(tier_1_id, opts = {})\n data, _status_code, _headers = lookup_address_via_tier1_dns_forwarder_with_http_info(tier_1_id, opts)\n data\n end", "def read_policy_dns_forwarder_on_tier1_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.read_policy_dns_forwarder_on_tier1_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.read_policy_dns_forwarder_on_tier1_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/dns-forwarder'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'PolicyDnsForwarder')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi#read_policy_dns_forwarder_on_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tier_id\n self.tier.id if self.tier\n end", "def lookup_table\n return @lookup_table unless @lookup_table.nil?\n @lookup_table = (header_parameters.flags.has_custom_lookup_table ? custom_lookup_table : default_lookup_table)\n @lookup_table\n end", "def read_policy_dns_forwarder_on_tier1_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.read_policy_dns_forwarder_on_tier1 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.read_policy_dns_forwarder_on_tier1\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/dns-forwarder'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'PolicyDnsForwarder')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi#read_policy_dns_forwarder_on_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def getTable() \n puts @table[0][\"name\"];\n end", "def route_tables\n @route_tables ||= init_route_tables\n end", "def get_table(name)\r\n raise('Do not call this method from a server instance!') if server?\r\n raise(ArgumentError, 'Table name must be a symbol!') unless \\\r\n name.is_a?(Symbol)\r\n raise('Table not found!') unless table_exists?(name)\r\n\r\n if @table_hash.has_key?(name)\r\n return @table_hash[name]\r\n else\r\n @table_hash[name] = \\\r\n KBTable.create_called_from_database_instance(self, name, \r\n File.join(@path, name.to_s + @ext))\r\n return @table_hash[name]\r\n end\r\n end", "def get_tier1_interface_arp_table_0(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def default_route\n filters = {\n filters:\n [\n {\n name: 'vpc-id',\n values: [@vpc.id]\n },\n {\n name: 'association.main',\n values: ['true']\n }\n ]\n }\n collection = ec2.route_tables(filters)\n f = []\n collection.map { |e| f.push e }\n # fail \"Name of route table was not unique! Got #{f.length} route tables with name '#{name}'\" if f.length > 1\n f[0]\n end", "def get_table(object)\n raise NotImplementedError, \"Subclasses must implement private method get_table\"\n end", "def read_tier1_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Tier1')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#read_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_0(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_in_csv_0_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def read_tier1_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Tier1')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#read_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def chooseTable\n @metadata.chooseTable\n end", "def get_conversion_table\n @conversion_table ||= retrieve_conversion_table\n end", "def get_all_tables\n\t\ttc = new_sub(@discovery['tables']['url'], @discovery['tables']['capability'])\n\t\ttc.listen.map {|x| JSON.parse(x) rescue nil}.compact\n\tend", "def get_table(table, env=nil)\n require 'net/http'\n http_config = get_remote_credentials(env)\n ret = false\n Net::HTTP.start(http_config['server_name'], http_config['server_port']) {|http|\n req = Net::HTTP::Get.new(\"/dumps/#{table}.txt\")\n req.basic_auth http_config['http_user'], http_config['http_pass']\n resp = http.request(req)\n ret = tab_to_array_of_hashes(resp.body) if resp.code == '200'\n }\n ret\n end", "def get_tier1_policy_multicast_forwarding_0(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_multicast_forwarding_0_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def tables\n @tables ||= if @registration[:tables].present?\n @registration[:tables].call(@connection)\n else\n @connection.tables\n end\n end", "def get_table instance_id, table_id, view: nil\n execute do\n tables.get_table(\n table_path(instance_id, table_id),\n view: view\n )\n end\n end", "def aws_vpc_route_tables_get(opts)\n opts[:vpc].route_tables.select{ |rt| !rt.main? }\n end", "def get_tier1_interface_arp_table_csv_0(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_csv_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def init_route_tables\n @@client.describe_route_tables.route_tables\n end", "def _table; @table end", "def get_tier1_policy_multicast_forwarding(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_multicast_forwarding_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def table(name)\n table = primary.lookup_vals(name)\n\n return nil if table.nil?\n\n if (table.size() == 1)\n return table.tups[0].values[Catalog::Field::OBJECT]\n elsif (table.size() > 1)\n # require 'ruby-debug'; debugger\n raise \"Should be one \" + name.to_s + \" table defined, but there are \"+ table.size.to_s + \"!\"\n end\n end", "def local\n @table\n end", "def get_tables\n get_schemas.keys\n end", "def load_tier\n if id = tier_param_id\n @tier = Tier.find_by_permalink_and_region_and_active(id)\n @tier_class = @tier.class if @tier\n end\n end", "def load_tier\n if id = tier_param_id\n @tier = Tier.find_by_permalink_and_region_and_active(id)\n @tier_class = @tier.class if @tier\n end\n end", "def tables\n raise 'SevenZip#tables should never be called'\n end", "def getforwardingentityid\r\n return getvalue(SVTags::FORWARDING_ENTITY_ID)\r\n end", "def get_tier1_interface_arp_table(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def list_tier1_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'Tier1ListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#list_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_table_list()\n resp = @dynamo_db.list_tables()\n puts \"Table list : \" + resp.table_names.to_s\nend", "def get_downlink_port_arp_table_for_tier1_segment_0(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_0_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_in_csv_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def list_tier1_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'Tier1ListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#list_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_0_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_in_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def table_name\n return 'contact_scrape' if invalid_param('table_name')\n\n @params['table_name']\n end", "def table\n Response\n end", "def get_table(report_type, report_input_filter, pager, order=KalturaNotImplemented, object_ids=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\t# \n\t\t\tclient.add_param(kparams, 'reportType', report_type);\n\t\t\tclient.add_param(kparams, 'reportInputFilter', report_input_filter);\n\t\t\tclient.add_param(kparams, 'pager', pager);\n\t\t\tclient.add_param(kparams, 'order', order);\n\t\t\t# - one ID or more (separated by ',') of specific objects to query\n\t\t\tclient.add_param(kparams, 'objectIds', object_ids);\n\t\t\tclient.queue_service_action_call('report', 'getTable', 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 destination\n table = @gapi.configuration.query.destination_table\n return nil unless table\n retrieve_table table.project_id,\n table.dataset_id,\n table.table_id\n end", "def lookup_address_via_tier1_dns_forwarder_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.lookup_address_via_tier1_dns_forwarder_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.lookup_address_via_tier1_dns_forwarder_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/dns-forwarder/nslookup'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'address'] = opts[:'address'] if !opts[:'address'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].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 => 'AggregatePolicyDnsAnswer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi#lookup_address_via_tier1_dns_forwarder_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tribes\n Tribe.all\n end", "def get_downlink_port_arp_table_for_tier1_segment_0_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'InterfaceArpTable')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_in_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_table(table, identifier)\n if table['quick_look'].has_key?(identifier)\n table['table_data'].reverse_each do |elem|\n return elem[1] if elem[0].eql?identifier\n end\n end\n return nil\nend", "def fetch_user_tables\n Carto::UserTable.select([:name, :table_id]).where(user_id: @user_id).map do |record|\n Carto::TableFacade.new(record[:table_id], record[:name], @user_id)\n end\n end", "def get_table(table, identifier)\n if table['quick_look'].has_key?(identifier)\n table['table_data'].reverse_each do |elem|\n return elem[1] if elem[0].eql?identifier\n end\n end\n return nil\nend", "def get_tier1_interface_arp_table_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'InterfaceArpTable')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connect(table_name)\n conf = HBaseConfiguration.create\n admin = HBaseAdmin.new(conf)\n admin.tableExists('enron2')\n tables = admin.listTables\n table = HTable.new(conf, 'enron2')\nend", "def get_all_tables\n\t\ttc = new_sub(@discovery['tables'])\n\t\ttc.poll[:messages].map {|x| pp x; JSON.parse(x.content) rescue nil}.compact\n\tend", "def get_table(table_name, options = {})\n headers = {\n Azure::Storage::Common::HeaderConstants::ACCEPT => Serialization.get_accept_string(:full_meta),\n }\n options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY\n response = call(:get, table_uri(table_name, new_query(options), options), nil, headers, options)\n Serialization.table_entries_from_json(response.body)\n rescue => e\n raise_with_response(e, response)\n end", "def table_name\n self.name.split('::').last\n end", "def base_route_segments\n table_name.to_s\n end", "def load_tier\n if id = params[:tier_id]\n @tier = Tier.find_by_permalink_and_region_and_active(id)\n end\n end", "def get_downlink_port_arp_table_for_tier1_segment_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'InterfaceArpTable')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def forward_to\n return @forward_to\n end", "def table\n Service\n end", "def patch_policy_dns_forwarder_on_tier1_0(tier_1_id, policy_dns_forwarder, opts = {})\n patch_policy_dns_forwarder_on_tier1_0_with_http_info(tier_1_id, policy_dns_forwarder, opts)\n nil\n end", "def get_table(name, options={})\n return send_message(SkyDB::Message::GetTable.new(name, options))\n end", "def first()\n @tiers.each do |tier|\n unless tier.empty?()\n return tier[0]\n end\n end\n \n return nil\n end", "def get_table_name\n self.class.table_name\n end", "def check_routing_table(family, iface, default_route_table)\n so = shell_out(\"ip -o -f #{family[:name]} route show table #{default_route_table}\")\n so.stdout.lines do |line|\n line.strip!\n logger.trace(\"Plugin Network: Parsing #{line}\")\n if line.include?(\"\\\\\")\n # If we have multipath routing, then the first part will be a normal\n # looking route:\n # default proto ra metric 1024 <other options>\n # Each successive part after that is a hop without those options.\n # So the first thing we do is grab that first part, and split it into\n # the route destination (\"default\"), and the route options.\n parts = line.split(\"\\\\\")\n route_dest, dest_opts = parts.first.split(nil, 2)\n # Then all the route endings, generally just nexthops.\n route_endings = parts[1..]\n if dest_opts && !dest_opts.empty?\n # Route options like proto, metric, etc. only appear once for each\n # multipath configuration. Prepend this information to the route\n # endings so the code below will assign the fields properly.\n route_endings.map! { |e| e.include?(\"nexthop\") ? \"#{dest_opts} #{e}\" : e }\n end\n elsif line =~ /^([^\\s]+)\\s(.*)$/\n route_dest = $1\n route_endings = [$2]\n else\n next\n end\n route_endings.each do |route_ending|\n route_entry = Mash.new(destination: route_dest,\n family: family[:name])\n route_int = nil\n if route_ending =~ /\\bdev\\s+([^\\s]+)\\b/\n route_int = $1\n end\n # does any known interface own the src address?\n # we try to infer the interface/device from its address if it isn't specified\n # we want to override the interface set via nexthop but only if possible\n if line =~ /\\bsrc\\s+([^\\s]+)\\b/ && (!route_int || line.include?(\"nexthop\"))\n # only clobber previously set route_int if we find a match\n if (match = iface.select { |name, intf| intf.fetch(\"addresses\", {}).any? { |addr, _| addr == $1 } }.keys.first)\n route_int = match\n route_entry[:inferred] = true\n end\n end\n\n unless route_int\n logger.trace(\"Plugin Network: Skipping route entry without a device: '#{line}'\")\n next\n end\n route_int = \"venet0:0\" if is_openvz? && !is_openvz_host? && route_int == \"venet0\" && iface[\"venet0:0\"]\n\n unless iface[route_int]\n logger.trace(\"Plugin Network: Skipping previously unseen interface from 'ip route show': #{route_int}\")\n next\n end\n\n %w{via scope metric proto src}.each do |k|\n # http://rubular.com/r/pwTNp65VFf\n route_entry[k] = $1 if route_ending =~ /\\b#{k}\\s+([^\\s]+)/\n end\n # https://rubular.com/r/k1sMrRn5yLjgVi\n route_entry[\"via\"] = $1 if route_ending =~ /\\bvia\\s+inet6\\s+([^\\s]+)/\n\n # a sanity check, especially for Linux-VServer, OpenVZ and LXC:\n # don't report the route entry if the src address isn't set on the node\n # unless the interface has no addresses of this type at all\n if route_entry[:src]\n addr = iface[route_int][:addresses]\n unless addr.nil? || addr.key?(route_entry[:src]) ||\n addr.values.all? { |a| a[\"family\"] != family[:name] }\n logger.trace(\"Plugin Network: Skipping route entry whose src does not match the interface IP\")\n next\n end\n end\n\n iface[route_int][:routes] = [] unless iface[route_int][:routes]\n iface[route_int][:routes] << route_entry\n end\n end\n iface\n end", "def get_tier1_interface_arp_table_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'InterfaceArpTable')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def table\n self.class.table\n end", "def tables()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Tables::TablesRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def lookup_address_via_tier1_dns_forwarder_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.lookup_address_via_tier1_dns_forwarder ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.lookup_address_via_tier1_dns_forwarder\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/dns-forwarder/nslookup'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'address'] = opts[:'address'] if !opts[:'address'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].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 => 'AggregatePolicyDnsAnswer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi#lookup_address_via_tier1_dns_forwarder\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def table table_id, app_profile_id: nil\n ensure_service!\n Client::Table.new(\n @service.client,\n table_path(table_id),\n app_profile_id: app_profile_id\n )\n end", "def get_tier1_interface_arp_table_csv_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tier\n raw_tier || Tier.default\n end", "def get_tier1_policy_multicast_forwarding_0_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/forwarding'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'PolicyMulticastForwarding')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_multicast_forwarding_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tables_from(db=current_database)\n end", "def get_downlink_port_arp_table_for_tier1_segment(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def api_table\n controller_name\n end", "def tables\n []\n end" ]
[ "0.6995687", "0.67749655", "0.67727995", "0.6321426", "0.63078696", "0.6258341", "0.6248698", "0.5563339", "0.55142957", "0.54832894", "0.5469994", "0.5459869", "0.5386865", "0.5375805", "0.5344651", "0.53374344", "0.53162974", "0.5313677", "0.52874166", "0.52423817", "0.5209365", "0.51491266", "0.5122782", "0.51151675", "0.5113339", "0.5062592", "0.50610584", "0.50586987", "0.50460523", "0.5025184", "0.50147617", "0.49985847", "0.49925587", "0.4978256", "0.49648523", "0.49427322", "0.49418855", "0.49348232", "0.4915907", "0.4903501", "0.48999614", "0.489335", "0.4883485", "0.48818824", "0.48804647", "0.48799136", "0.48739952", "0.48730588", "0.48644635", "0.48518884", "0.48497495", "0.48387676", "0.48387676", "0.4837625", "0.48237267", "0.48210633", "0.48092306", "0.48090714", "0.4804881", "0.4781253", "0.47707462", "0.47691602", "0.47670522", "0.4765004", "0.47620705", "0.47560605", "0.47541115", "0.4744642", "0.47438177", "0.47354418", "0.47274745", "0.47272444", "0.47268593", "0.472438", "0.47190166", "0.47188032", "0.4713475", "0.4710116", "0.47080842", "0.4707029", "0.47053367", "0.4700268", "0.46952206", "0.46946722", "0.4694471", "0.4680251", "0.4673409", "0.4672745", "0.4671593", "0.46714383", "0.46697104", "0.46629262", "0.46591014", "0.4654442", "0.46425247", "0.4634579", "0.46319652", "0.46256807", "0.46253332", "0.46214598" ]
0.71132946
0
Get forwarding table from tier1 Get forwarding table from tier1
def get_tier1_forwarding_table_with_http_info(tier_1_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table ...' end # verify the required parameter 'tier_1_id' is set if @api_client.config.client_side_validation && tier_1_id.nil? fail ArgumentError, "Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table" end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table, must be greater than or equal to 0.' end if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source']) fail ArgumentError, 'invalid value for "route_source", must be one of BGP, STATIC, CONNECTED' end # resource path local_var_path = '/global-infra/tier-1s/{tier-1-id}/forwarding-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s) # query parameters query_params = {} query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil? query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil? query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil? query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil? query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil? query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil? query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] 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 => 'RoutingTableListResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tier1_forwarding_table(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_forwarding_table_0(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/forwarding-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'RoutingTableListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/forwarding-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'GatewayRouteTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/forwarding-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'GatewayRouteTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_csv(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_forwarding_table_csv_0(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts)\n data\n end", "def read_policy_dns_forwarder_on_tier1_0(tier_1_id, opts = {})\n data, _status_code, _headers = read_policy_dns_forwarder_on_tier1_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_tables\n\t\t@@tables\n\tend", "def get_tables\n tables\n end", "def table_name\n cti_tables ? cti_tables.last : super\n end", "def read_policy_dns_forwarder_on_tier1(tier_1_id, opts = {})\n data, _status_code, _headers = read_policy_dns_forwarder_on_tier1_with_http_info(tier_1_id, opts)\n data\n end", "def getTable\r\n return @pila_t.last #puedes hacer getTable sucesivos sin modificar nada en lo absoluto.\r\n end", "def lookup_address_via_tier1_dns_forwarder_0(tier_1_id, opts = {})\n data, _status_code, _headers = lookup_address_via_tier1_dns_forwarder_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_table(table)\n raise \"Pool #{self} does not have table #{table}\" unless has_table? table\n\n @tables.select{|tb| tb.to_s == table}.first\n end", "def tier\n @tier_cache || self.tiers[0]\n end", "def find_table_name\n client = RemoteAccountingSystemType.find_by_accounting_system_type_id(params[:real_estate_property][:accounting_system_type_id])\n return client.table_name.to_s if client\n end", "def table\n Airmodel.client.table base_config[:base_id], base_config[:table_name]\n end", "def get_table instance_id, table_id, view: nil\n tables.get_table name: table_path(instance_id, table_id), view: view\n end", "def mti_delegate_query_table param\n return self.table_name.to_sym if mti_handles_query_param param\n mti_ancestor_classes.find {|e| e.mti_handles_query_param param}&.table_name&.to_sym\n end", "def get_table_set\n P2::Application.reset CLIENT_INI\n @conn = P2::Connection.new :app_name => 'RecordTest',\n :host => \"127.0.0.1\", :port => 4001\n @conn.Connect\n\n @ds = P2::DataStream.new :stream_name => 'RTS_INDEX_REPL',\n :type => P2::RT_COMBINED_DYNAMIC\n\n @ds.Open(@conn)\n\n @ds.events.on_event { |*args| p args }\n 2.times { @conn.ProcessMessage2(1000) } # Push @ds to receive its TableSet\nend", "def return_table()\r\n\t\t\treturn @table\r\n\t\tend", "def lookup_address_via_tier1_dns_forwarder(tier_1_id, opts = {})\n data, _status_code, _headers = lookup_address_via_tier1_dns_forwarder_with_http_info(tier_1_id, opts)\n data\n end", "def read_policy_dns_forwarder_on_tier1_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.read_policy_dns_forwarder_on_tier1_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.read_policy_dns_forwarder_on_tier1_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/dns-forwarder'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'PolicyDnsForwarder')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi#read_policy_dns_forwarder_on_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tier_id\n self.tier.id if self.tier\n end", "def lookup_table\n return @lookup_table unless @lookup_table.nil?\n @lookup_table = (header_parameters.flags.has_custom_lookup_table ? custom_lookup_table : default_lookup_table)\n @lookup_table\n end", "def read_policy_dns_forwarder_on_tier1_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.read_policy_dns_forwarder_on_tier1 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.read_policy_dns_forwarder_on_tier1\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/dns-forwarder'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'PolicyDnsForwarder')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi#read_policy_dns_forwarder_on_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def getTable() \n puts @table[0][\"name\"];\n end", "def route_tables\n @route_tables ||= init_route_tables\n end", "def get_table(name)\r\n raise('Do not call this method from a server instance!') if server?\r\n raise(ArgumentError, 'Table name must be a symbol!') unless \\\r\n name.is_a?(Symbol)\r\n raise('Table not found!') unless table_exists?(name)\r\n\r\n if @table_hash.has_key?(name)\r\n return @table_hash[name]\r\n else\r\n @table_hash[name] = \\\r\n KBTable.create_called_from_database_instance(self, name, \r\n File.join(@path, name.to_s + @ext))\r\n return @table_hash[name]\r\n end\r\n end", "def get_tier1_interface_arp_table_0(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def default_route\n filters = {\n filters:\n [\n {\n name: 'vpc-id',\n values: [@vpc.id]\n },\n {\n name: 'association.main',\n values: ['true']\n }\n ]\n }\n collection = ec2.route_tables(filters)\n f = []\n collection.map { |e| f.push e }\n # fail \"Name of route table was not unique! Got #{f.length} route tables with name '#{name}'\" if f.length > 1\n f[0]\n end", "def get_table(object)\n raise NotImplementedError, \"Subclasses must implement private method get_table\"\n end", "def read_tier1_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Tier1')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#read_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_0(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_in_csv_0_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def read_tier1_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Tier1')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#read_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def chooseTable\n @metadata.chooseTable\n end", "def get_conversion_table\n @conversion_table ||= retrieve_conversion_table\n end", "def get_all_tables\n\t\ttc = new_sub(@discovery['tables']['url'], @discovery['tables']['capability'])\n\t\ttc.listen.map {|x| JSON.parse(x) rescue nil}.compact\n\tend", "def get_table(table, env=nil)\n require 'net/http'\n http_config = get_remote_credentials(env)\n ret = false\n Net::HTTP.start(http_config['server_name'], http_config['server_port']) {|http|\n req = Net::HTTP::Get.new(\"/dumps/#{table}.txt\")\n req.basic_auth http_config['http_user'], http_config['http_pass']\n resp = http.request(req)\n ret = tab_to_array_of_hashes(resp.body) if resp.code == '200'\n }\n ret\n end", "def get_tier1_policy_multicast_forwarding_0(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_multicast_forwarding_0_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def tables\n @tables ||= if @registration[:tables].present?\n @registration[:tables].call(@connection)\n else\n @connection.tables\n end\n end", "def get_table instance_id, table_id, view: nil\n execute do\n tables.get_table(\n table_path(instance_id, table_id),\n view: view\n )\n end\n end", "def aws_vpc_route_tables_get(opts)\n opts[:vpc].route_tables.select{ |rt| !rt.main? }\n end", "def get_tier1_interface_arp_table_csv_0(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_csv_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def init_route_tables\n @@client.describe_route_tables.route_tables\n end", "def _table; @table end", "def get_tier1_policy_multicast_forwarding(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_multicast_forwarding_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def table(name)\n table = primary.lookup_vals(name)\n\n return nil if table.nil?\n\n if (table.size() == 1)\n return table.tups[0].values[Catalog::Field::OBJECT]\n elsif (table.size() > 1)\n # require 'ruby-debug'; debugger\n raise \"Should be one \" + name.to_s + \" table defined, but there are \"+ table.size.to_s + \"!\"\n end\n end", "def local\n @table\n end", "def get_tables\n get_schemas.keys\n end", "def load_tier\n if id = tier_param_id\n @tier = Tier.find_by_permalink_and_region_and_active(id)\n @tier_class = @tier.class if @tier\n end\n end", "def load_tier\n if id = tier_param_id\n @tier = Tier.find_by_permalink_and_region_and_active(id)\n @tier_class = @tier.class if @tier\n end\n end", "def tables\n raise 'SevenZip#tables should never be called'\n end", "def getforwardingentityid\r\n return getvalue(SVTags::FORWARDING_ENTITY_ID)\r\n end", "def get_tier1_interface_arp_table(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def get_table_list()\n resp = @dynamo_db.list_tables()\n puts \"Table list : \" + resp.table_names.to_s\nend", "def list_tier1_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'Tier1ListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#list_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_0(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_0_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_in_csv_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def list_tier1_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'Tier1ListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#list_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_0_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_in_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def table_name\n return 'contact_scrape' if invalid_param('table_name')\n\n @params['table_name']\n end", "def table\n Response\n end", "def get_table(report_type, report_input_filter, pager, order=KalturaNotImplemented, object_ids=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\t# \n\t\t\tclient.add_param(kparams, 'reportType', report_type);\n\t\t\tclient.add_param(kparams, 'reportInputFilter', report_input_filter);\n\t\t\tclient.add_param(kparams, 'pager', pager);\n\t\t\tclient.add_param(kparams, 'order', order);\n\t\t\t# - one ID or more (separated by ',') of specific objects to query\n\t\t\tclient.add_param(kparams, 'objectIds', object_ids);\n\t\t\tclient.queue_service_action_call('report', 'getTable', 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 destination\n table = @gapi.configuration.query.destination_table\n return nil unless table\n retrieve_table table.project_id,\n table.dataset_id,\n table.table_id\n end", "def lookup_address_via_tier1_dns_forwarder_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.lookup_address_via_tier1_dns_forwarder_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.lookup_address_via_tier1_dns_forwarder_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/dns-forwarder/nslookup'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'address'] = opts[:'address'] if !opts[:'address'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].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 => 'AggregatePolicyDnsAnswer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi#lookup_address_via_tier1_dns_forwarder_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tribes\n Tribe.all\n end", "def get_downlink_port_arp_table_for_tier1_segment_0_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'InterfaceArpTable')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_in_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def fetch_user_tables\n Carto::UserTable.select([:name, :table_id]).where(user_id: @user_id).map do |record|\n Carto::TableFacade.new(record[:table_id], record[:name], @user_id)\n end\n end", "def get_table(table, identifier)\n if table['quick_look'].has_key?(identifier)\n table['table_data'].reverse_each do |elem|\n return elem[1] if elem[0].eql?identifier\n end\n end\n return nil\nend", "def get_table(table, identifier)\n if table['quick_look'].has_key?(identifier)\n table['table_data'].reverse_each do |elem|\n return elem[1] if elem[0].eql?identifier\n end\n end\n return nil\nend", "def get_tier1_interface_arp_table_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'InterfaceArpTable')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connect(table_name)\n conf = HBaseConfiguration.create\n admin = HBaseAdmin.new(conf)\n admin.tableExists('enron2')\n tables = admin.listTables\n table = HTable.new(conf, 'enron2')\nend", "def get_all_tables\n\t\ttc = new_sub(@discovery['tables'])\n\t\ttc.poll[:messages].map {|x| pp x; JSON.parse(x.content) rescue nil}.compact\n\tend", "def get_table(table_name, options = {})\n headers = {\n Azure::Storage::Common::HeaderConstants::ACCEPT => Serialization.get_accept_string(:full_meta),\n }\n options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY\n response = call(:get, table_uri(table_name, new_query(options), options), nil, headers, options)\n Serialization.table_entries_from_json(response.body)\n rescue => e\n raise_with_response(e, response)\n end", "def table_name\n self.name.split('::').last\n end", "def base_route_segments\n table_name.to_s\n end", "def load_tier\n if id = params[:tier_id]\n @tier = Tier.find_by_permalink_and_region_and_active(id)\n end\n end", "def get_downlink_port_arp_table_for_tier1_segment_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'InterfaceArpTable')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def forward_to\n return @forward_to\n end", "def table\n Service\n end", "def get_table(name, options={})\n return send_message(SkyDB::Message::GetTable.new(name, options))\n end", "def patch_policy_dns_forwarder_on_tier1_0(tier_1_id, policy_dns_forwarder, opts = {})\n patch_policy_dns_forwarder_on_tier1_0_with_http_info(tier_1_id, policy_dns_forwarder, opts)\n nil\n end", "def first()\n @tiers.each do |tier|\n unless tier.empty?()\n return tier[0]\n end\n end\n \n return nil\n end", "def get_table_name\n self.class.table_name\n end", "def check_routing_table(family, iface, default_route_table)\n so = shell_out(\"ip -o -f #{family[:name]} route show table #{default_route_table}\")\n so.stdout.lines do |line|\n line.strip!\n logger.trace(\"Plugin Network: Parsing #{line}\")\n if line.include?(\"\\\\\")\n # If we have multipath routing, then the first part will be a normal\n # looking route:\n # default proto ra metric 1024 <other options>\n # Each successive part after that is a hop without those options.\n # So the first thing we do is grab that first part, and split it into\n # the route destination (\"default\"), and the route options.\n parts = line.split(\"\\\\\")\n route_dest, dest_opts = parts.first.split(nil, 2)\n # Then all the route endings, generally just nexthops.\n route_endings = parts[1..]\n if dest_opts && !dest_opts.empty?\n # Route options like proto, metric, etc. only appear once for each\n # multipath configuration. Prepend this information to the route\n # endings so the code below will assign the fields properly.\n route_endings.map! { |e| e.include?(\"nexthop\") ? \"#{dest_opts} #{e}\" : e }\n end\n elsif line =~ /^([^\\s]+)\\s(.*)$/\n route_dest = $1\n route_endings = [$2]\n else\n next\n end\n route_endings.each do |route_ending|\n route_entry = Mash.new(destination: route_dest,\n family: family[:name])\n route_int = nil\n if route_ending =~ /\\bdev\\s+([^\\s]+)\\b/\n route_int = $1\n end\n # does any known interface own the src address?\n # we try to infer the interface/device from its address if it isn't specified\n # we want to override the interface set via nexthop but only if possible\n if line =~ /\\bsrc\\s+([^\\s]+)\\b/ && (!route_int || line.include?(\"nexthop\"))\n # only clobber previously set route_int if we find a match\n if (match = iface.select { |name, intf| intf.fetch(\"addresses\", {}).any? { |addr, _| addr == $1 } }.keys.first)\n route_int = match\n route_entry[:inferred] = true\n end\n end\n\n unless route_int\n logger.trace(\"Plugin Network: Skipping route entry without a device: '#{line}'\")\n next\n end\n route_int = \"venet0:0\" if is_openvz? && !is_openvz_host? && route_int == \"venet0\" && iface[\"venet0:0\"]\n\n unless iface[route_int]\n logger.trace(\"Plugin Network: Skipping previously unseen interface from 'ip route show': #{route_int}\")\n next\n end\n\n %w{via scope metric proto src}.each do |k|\n # http://rubular.com/r/pwTNp65VFf\n route_entry[k] = $1 if route_ending =~ /\\b#{k}\\s+([^\\s]+)/\n end\n # https://rubular.com/r/k1sMrRn5yLjgVi\n route_entry[\"via\"] = $1 if route_ending =~ /\\bvia\\s+inet6\\s+([^\\s]+)/\n\n # a sanity check, especially for Linux-VServer, OpenVZ and LXC:\n # don't report the route entry if the src address isn't set on the node\n # unless the interface has no addresses of this type at all\n if route_entry[:src]\n addr = iface[route_int][:addresses]\n unless addr.nil? || addr.key?(route_entry[:src]) ||\n addr.values.all? { |a| a[\"family\"] != family[:name] }\n logger.trace(\"Plugin Network: Skipping route entry whose src does not match the interface IP\")\n next\n end\n end\n\n iface[route_int][:routes] = [] unless iface[route_int][:routes]\n iface[route_int][:routes] << route_entry\n end\n end\n iface\n end", "def get_tier1_interface_arp_table_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'InterfaceArpTable')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def table\n self.class.table\n end", "def tables()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Tables::TablesRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def lookup_address_via_tier1_dns_forwarder_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.lookup_address_via_tier1_dns_forwarder ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.lookup_address_via_tier1_dns_forwarder\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/dns-forwarder/nslookup'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'address'] = opts[:'address'] if !opts[:'address'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].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 => 'AggregatePolicyDnsAnswer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi#lookup_address_via_tier1_dns_forwarder\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def table table_id, app_profile_id: nil\n ensure_service!\n Client::Table.new(\n @service.client,\n table_path(table_id),\n app_profile_id: app_profile_id\n )\n end", "def get_tier1_interface_arp_table_csv_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tier\n raw_tier || Tier.default\n end", "def get_tier1_policy_multicast_forwarding_0_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/forwarding'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'PolicyMulticastForwarding')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_multicast_forwarding_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tables_from(db=current_database)\n end", "def get_downlink_port_arp_table_for_tier1_segment(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def api_table\n controller_name\n end", "def get_tier1_policy_multicast_forwarding_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/forwarding'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'PolicyMulticastForwarding')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_multicast_forwarding\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end" ]
[ "0.7113474", "0.6995871", "0.6773197", "0.63217103", "0.63080585", "0.62584335", "0.6248738", "0.55633235", "0.5514428", "0.5482819", "0.5469531", "0.5459894", "0.5386955", "0.5376278", "0.5343992", "0.5336821", "0.5315308", "0.5313424", "0.52876216", "0.52416444", "0.5208858", "0.5149322", "0.51232314", "0.5115633", "0.51126444", "0.5063495", "0.5061571", "0.5058938", "0.5046086", "0.5024733", "0.50147074", "0.49989083", "0.49923944", "0.49783415", "0.4964609", "0.49428466", "0.49407616", "0.49357828", "0.49159226", "0.49033412", "0.4900235", "0.48928976", "0.4883704", "0.4881385", "0.4880336", "0.4880075", "0.48740754", "0.4873172", "0.48639864", "0.4851501", "0.48498774", "0.48386288", "0.48386288", "0.4837716", "0.48240206", "0.48209885", "0.48096603", "0.48094454", "0.48046064", "0.4781075", "0.47709078", "0.47694477", "0.47669417", "0.47645906", "0.47617683", "0.4756397", "0.47548825", "0.47442913", "0.47440276", "0.47358406", "0.47274977", "0.47273222", "0.47267067", "0.472476", "0.4719137", "0.47185048", "0.47142538", "0.47091627", "0.47071883", "0.4706919", "0.47055817", "0.47005263", "0.46947837", "0.46945414", "0.46941552", "0.46798253", "0.46729943", "0.4672181", "0.46719798", "0.4670845", "0.4669085", "0.46637413", "0.4659098", "0.46547925", "0.46414927", "0.46353346", "0.46317276", "0.46253997", "0.46252313", "0.4621368" ]
0.67754143
2
Get forwarding table from tier1 Get forwarding table from tier1
def get_tier1_forwarding_table_0(tier_1_id, opts = {}) data, _status_code, _headers = get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tier1_forwarding_table(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_forwarding_table_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/forwarding-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'RoutingTableListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/forwarding-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'RoutingTableListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/forwarding-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'GatewayRouteTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/forwarding-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'GatewayRouteTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_csv(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_forwarding_table_csv_0(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts)\n data\n end", "def read_policy_dns_forwarder_on_tier1_0(tier_1_id, opts = {})\n data, _status_code, _headers = read_policy_dns_forwarder_on_tier1_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_tables\n\t\t@@tables\n\tend", "def get_tables\n tables\n end", "def table_name\n cti_tables ? cti_tables.last : super\n end", "def read_policy_dns_forwarder_on_tier1(tier_1_id, opts = {})\n data, _status_code, _headers = read_policy_dns_forwarder_on_tier1_with_http_info(tier_1_id, opts)\n data\n end", "def getTable\r\n return @pila_t.last #puedes hacer getTable sucesivos sin modificar nada en lo absoluto.\r\n end", "def lookup_address_via_tier1_dns_forwarder_0(tier_1_id, opts = {})\n data, _status_code, _headers = lookup_address_via_tier1_dns_forwarder_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_table(table)\n raise \"Pool #{self} does not have table #{table}\" unless has_table? table\n\n @tables.select{|tb| tb.to_s == table}.first\n end", "def tier\n @tier_cache || self.tiers[0]\n end", "def find_table_name\n client = RemoteAccountingSystemType.find_by_accounting_system_type_id(params[:real_estate_property][:accounting_system_type_id])\n return client.table_name.to_s if client\n end", "def table\n Airmodel.client.table base_config[:base_id], base_config[:table_name]\n end", "def get_table instance_id, table_id, view: nil\n tables.get_table name: table_path(instance_id, table_id), view: view\n end", "def mti_delegate_query_table param\n return self.table_name.to_sym if mti_handles_query_param param\n mti_ancestor_classes.find {|e| e.mti_handles_query_param param}&.table_name&.to_sym\n end", "def get_table_set\n P2::Application.reset CLIENT_INI\n @conn = P2::Connection.new :app_name => 'RecordTest',\n :host => \"127.0.0.1\", :port => 4001\n @conn.Connect\n\n @ds = P2::DataStream.new :stream_name => 'RTS_INDEX_REPL',\n :type => P2::RT_COMBINED_DYNAMIC\n\n @ds.Open(@conn)\n\n @ds.events.on_event { |*args| p args }\n 2.times { @conn.ProcessMessage2(1000) } # Push @ds to receive its TableSet\nend", "def return_table()\r\n\t\t\treturn @table\r\n\t\tend", "def lookup_address_via_tier1_dns_forwarder(tier_1_id, opts = {})\n data, _status_code, _headers = lookup_address_via_tier1_dns_forwarder_with_http_info(tier_1_id, opts)\n data\n end", "def read_policy_dns_forwarder_on_tier1_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.read_policy_dns_forwarder_on_tier1_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.read_policy_dns_forwarder_on_tier1_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/dns-forwarder'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'PolicyDnsForwarder')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi#read_policy_dns_forwarder_on_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tier_id\n self.tier.id if self.tier\n end", "def lookup_table\n return @lookup_table unless @lookup_table.nil?\n @lookup_table = (header_parameters.flags.has_custom_lookup_table ? custom_lookup_table : default_lookup_table)\n @lookup_table\n end", "def read_policy_dns_forwarder_on_tier1_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.read_policy_dns_forwarder_on_tier1 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.read_policy_dns_forwarder_on_tier1\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/dns-forwarder'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'PolicyDnsForwarder')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi#read_policy_dns_forwarder_on_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def getTable() \n puts @table[0][\"name\"];\n end", "def route_tables\n @route_tables ||= init_route_tables\n end", "def get_table(name)\r\n raise('Do not call this method from a server instance!') if server?\r\n raise(ArgumentError, 'Table name must be a symbol!') unless \\\r\n name.is_a?(Symbol)\r\n raise('Table not found!') unless table_exists?(name)\r\n\r\n if @table_hash.has_key?(name)\r\n return @table_hash[name]\r\n else\r\n @table_hash[name] = \\\r\n KBTable.create_called_from_database_instance(self, name, \r\n File.join(@path, name.to_s + @ext))\r\n return @table_hash[name]\r\n end\r\n end", "def get_tier1_interface_arp_table_0(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def default_route\n filters = {\n filters:\n [\n {\n name: 'vpc-id',\n values: [@vpc.id]\n },\n {\n name: 'association.main',\n values: ['true']\n }\n ]\n }\n collection = ec2.route_tables(filters)\n f = []\n collection.map { |e| f.push e }\n # fail \"Name of route table was not unique! Got #{f.length} route tables with name '#{name}'\" if f.length > 1\n f[0]\n end", "def get_table(object)\n raise NotImplementedError, \"Subclasses must implement private method get_table\"\n end", "def read_tier1_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Tier1')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#read_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_0(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_in_csv_0_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def read_tier1_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Tier1')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#read_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def chooseTable\n @metadata.chooseTable\n end", "def get_conversion_table\n @conversion_table ||= retrieve_conversion_table\n end", "def get_all_tables\n\t\ttc = new_sub(@discovery['tables']['url'], @discovery['tables']['capability'])\n\t\ttc.listen.map {|x| JSON.parse(x) rescue nil}.compact\n\tend", "def get_table(table, env=nil)\n require 'net/http'\n http_config = get_remote_credentials(env)\n ret = false\n Net::HTTP.start(http_config['server_name'], http_config['server_port']) {|http|\n req = Net::HTTP::Get.new(\"/dumps/#{table}.txt\")\n req.basic_auth http_config['http_user'], http_config['http_pass']\n resp = http.request(req)\n ret = tab_to_array_of_hashes(resp.body) if resp.code == '200'\n }\n ret\n end", "def get_tier1_policy_multicast_forwarding_0(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_multicast_forwarding_0_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def tables\n @tables ||= if @registration[:tables].present?\n @registration[:tables].call(@connection)\n else\n @connection.tables\n end\n end", "def get_table instance_id, table_id, view: nil\n execute do\n tables.get_table(\n table_path(instance_id, table_id),\n view: view\n )\n end\n end", "def aws_vpc_route_tables_get(opts)\n opts[:vpc].route_tables.select{ |rt| !rt.main? }\n end", "def get_tier1_interface_arp_table_csv_0(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_csv_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def init_route_tables\n @@client.describe_route_tables.route_tables\n end", "def _table; @table end", "def get_tier1_policy_multicast_forwarding(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_multicast_forwarding_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def table(name)\n table = primary.lookup_vals(name)\n\n return nil if table.nil?\n\n if (table.size() == 1)\n return table.tups[0].values[Catalog::Field::OBJECT]\n elsif (table.size() > 1)\n # require 'ruby-debug'; debugger\n raise \"Should be one \" + name.to_s + \" table defined, but there are \"+ table.size.to_s + \"!\"\n end\n end", "def local\n @table\n end", "def get_tables\n get_schemas.keys\n end", "def load_tier\n if id = tier_param_id\n @tier = Tier.find_by_permalink_and_region_and_active(id)\n @tier_class = @tier.class if @tier\n end\n end", "def load_tier\n if id = tier_param_id\n @tier = Tier.find_by_permalink_and_region_and_active(id)\n @tier_class = @tier.class if @tier\n end\n end", "def tables\n raise 'SevenZip#tables should never be called'\n end", "def getforwardingentityid\r\n return getvalue(SVTags::FORWARDING_ENTITY_ID)\r\n end", "def get_tier1_interface_arp_table(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def get_table_list()\n resp = @dynamo_db.list_tables()\n puts \"Table list : \" + resp.table_names.to_s\nend", "def list_tier1_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'Tier1ListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#list_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_0(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_0_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_in_csv_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def list_tier1_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'Tier1ListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#list_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_0_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_in_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def table_name\n return 'contact_scrape' if invalid_param('table_name')\n\n @params['table_name']\n end", "def table\n Response\n end", "def get_table(report_type, report_input_filter, pager, order=KalturaNotImplemented, object_ids=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\t# \n\t\t\tclient.add_param(kparams, 'reportType', report_type);\n\t\t\tclient.add_param(kparams, 'reportInputFilter', report_input_filter);\n\t\t\tclient.add_param(kparams, 'pager', pager);\n\t\t\tclient.add_param(kparams, 'order', order);\n\t\t\t# - one ID or more (separated by ',') of specific objects to query\n\t\t\tclient.add_param(kparams, 'objectIds', object_ids);\n\t\t\tclient.queue_service_action_call('report', 'getTable', 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 destination\n table = @gapi.configuration.query.destination_table\n return nil unless table\n retrieve_table table.project_id,\n table.dataset_id,\n table.table_id\n end", "def lookup_address_via_tier1_dns_forwarder_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.lookup_address_via_tier1_dns_forwarder_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.lookup_address_via_tier1_dns_forwarder_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/dns-forwarder/nslookup'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'address'] = opts[:'address'] if !opts[:'address'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].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 => 'AggregatePolicyDnsAnswer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi#lookup_address_via_tier1_dns_forwarder_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tribes\n Tribe.all\n end", "def get_downlink_port_arp_table_for_tier1_segment_0_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'InterfaceArpTable')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_in_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def fetch_user_tables\n Carto::UserTable.select([:name, :table_id]).where(user_id: @user_id).map do |record|\n Carto::TableFacade.new(record[:table_id], record[:name], @user_id)\n end\n end", "def get_table(table, identifier)\n if table['quick_look'].has_key?(identifier)\n table['table_data'].reverse_each do |elem|\n return elem[1] if elem[0].eql?identifier\n end\n end\n return nil\nend", "def get_table(table, identifier)\n if table['quick_look'].has_key?(identifier)\n table['table_data'].reverse_each do |elem|\n return elem[1] if elem[0].eql?identifier\n end\n end\n return nil\nend", "def get_tier1_interface_arp_table_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'InterfaceArpTable')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connect(table_name)\n conf = HBaseConfiguration.create\n admin = HBaseAdmin.new(conf)\n admin.tableExists('enron2')\n tables = admin.listTables\n table = HTable.new(conf, 'enron2')\nend", "def get_all_tables\n\t\ttc = new_sub(@discovery['tables'])\n\t\ttc.poll[:messages].map {|x| pp x; JSON.parse(x.content) rescue nil}.compact\n\tend", "def get_table(table_name, options = {})\n headers = {\n Azure::Storage::Common::HeaderConstants::ACCEPT => Serialization.get_accept_string(:full_meta),\n }\n options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY\n response = call(:get, table_uri(table_name, new_query(options), options), nil, headers, options)\n Serialization.table_entries_from_json(response.body)\n rescue => e\n raise_with_response(e, response)\n end", "def table_name\n self.name.split('::').last\n end", "def base_route_segments\n table_name.to_s\n end", "def load_tier\n if id = params[:tier_id]\n @tier = Tier.find_by_permalink_and_region_and_active(id)\n end\n end", "def get_downlink_port_arp_table_for_tier1_segment_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'InterfaceArpTable')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def forward_to\n return @forward_to\n end", "def table\n Service\n end", "def get_table(name, options={})\n return send_message(SkyDB::Message::GetTable.new(name, options))\n end", "def patch_policy_dns_forwarder_on_tier1_0(tier_1_id, policy_dns_forwarder, opts = {})\n patch_policy_dns_forwarder_on_tier1_0_with_http_info(tier_1_id, policy_dns_forwarder, opts)\n nil\n end", "def first()\n @tiers.each do |tier|\n unless tier.empty?()\n return tier[0]\n end\n end\n \n return nil\n end", "def get_table_name\n self.class.table_name\n end", "def check_routing_table(family, iface, default_route_table)\n so = shell_out(\"ip -o -f #{family[:name]} route show table #{default_route_table}\")\n so.stdout.lines do |line|\n line.strip!\n logger.trace(\"Plugin Network: Parsing #{line}\")\n if line.include?(\"\\\\\")\n # If we have multipath routing, then the first part will be a normal\n # looking route:\n # default proto ra metric 1024 <other options>\n # Each successive part after that is a hop without those options.\n # So the first thing we do is grab that first part, and split it into\n # the route destination (\"default\"), and the route options.\n parts = line.split(\"\\\\\")\n route_dest, dest_opts = parts.first.split(nil, 2)\n # Then all the route endings, generally just nexthops.\n route_endings = parts[1..]\n if dest_opts && !dest_opts.empty?\n # Route options like proto, metric, etc. only appear once for each\n # multipath configuration. Prepend this information to the route\n # endings so the code below will assign the fields properly.\n route_endings.map! { |e| e.include?(\"nexthop\") ? \"#{dest_opts} #{e}\" : e }\n end\n elsif line =~ /^([^\\s]+)\\s(.*)$/\n route_dest = $1\n route_endings = [$2]\n else\n next\n end\n route_endings.each do |route_ending|\n route_entry = Mash.new(destination: route_dest,\n family: family[:name])\n route_int = nil\n if route_ending =~ /\\bdev\\s+([^\\s]+)\\b/\n route_int = $1\n end\n # does any known interface own the src address?\n # we try to infer the interface/device from its address if it isn't specified\n # we want to override the interface set via nexthop but only if possible\n if line =~ /\\bsrc\\s+([^\\s]+)\\b/ && (!route_int || line.include?(\"nexthop\"))\n # only clobber previously set route_int if we find a match\n if (match = iface.select { |name, intf| intf.fetch(\"addresses\", {}).any? { |addr, _| addr == $1 } }.keys.first)\n route_int = match\n route_entry[:inferred] = true\n end\n end\n\n unless route_int\n logger.trace(\"Plugin Network: Skipping route entry without a device: '#{line}'\")\n next\n end\n route_int = \"venet0:0\" if is_openvz? && !is_openvz_host? && route_int == \"venet0\" && iface[\"venet0:0\"]\n\n unless iface[route_int]\n logger.trace(\"Plugin Network: Skipping previously unseen interface from 'ip route show': #{route_int}\")\n next\n end\n\n %w{via scope metric proto src}.each do |k|\n # http://rubular.com/r/pwTNp65VFf\n route_entry[k] = $1 if route_ending =~ /\\b#{k}\\s+([^\\s]+)/\n end\n # https://rubular.com/r/k1sMrRn5yLjgVi\n route_entry[\"via\"] = $1 if route_ending =~ /\\bvia\\s+inet6\\s+([^\\s]+)/\n\n # a sanity check, especially for Linux-VServer, OpenVZ and LXC:\n # don't report the route entry if the src address isn't set on the node\n # unless the interface has no addresses of this type at all\n if route_entry[:src]\n addr = iface[route_int][:addresses]\n unless addr.nil? || addr.key?(route_entry[:src]) ||\n addr.values.all? { |a| a[\"family\"] != family[:name] }\n logger.trace(\"Plugin Network: Skipping route entry whose src does not match the interface IP\")\n next\n end\n end\n\n iface[route_int][:routes] = [] unless iface[route_int][:routes]\n iface[route_int][:routes] << route_entry\n end\n end\n iface\n end", "def get_tier1_interface_arp_table_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'InterfaceArpTable')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def table\n self.class.table\n end", "def tables()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Tables::TablesRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def lookup_address_via_tier1_dns_forwarder_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.lookup_address_via_tier1_dns_forwarder ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.lookup_address_via_tier1_dns_forwarder\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/dns-forwarder/nslookup'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'address'] = opts[:'address'] if !opts[:'address'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].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 => 'AggregatePolicyDnsAnswer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi#lookup_address_via_tier1_dns_forwarder\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def table table_id, app_profile_id: nil\n ensure_service!\n Client::Table.new(\n @service.client,\n table_path(table_id),\n app_profile_id: app_profile_id\n )\n end", "def get_tier1_interface_arp_table_csv_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tier\n raw_tier || Tier.default\n end", "def get_tier1_policy_multicast_forwarding_0_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/forwarding'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'PolicyMulticastForwarding')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_multicast_forwarding_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tables_from(db=current_database)\n end", "def get_downlink_port_arp_table_for_tier1_segment(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def api_table\n controller_name\n end", "def get_tier1_policy_multicast_forwarding_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/forwarding'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'PolicyMulticastForwarding')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_multicast_forwarding\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end" ]
[ "0.7113474", "0.67754143", "0.6773197", "0.63217103", "0.63080585", "0.62584335", "0.6248738", "0.55633235", "0.5514428", "0.5482819", "0.5469531", "0.5459894", "0.5386955", "0.5376278", "0.5343992", "0.5336821", "0.5315308", "0.5313424", "0.52876216", "0.52416444", "0.5208858", "0.5149322", "0.51232314", "0.5115633", "0.51126444", "0.5063495", "0.5061571", "0.5058938", "0.5046086", "0.5024733", "0.50147074", "0.49989083", "0.49923944", "0.49783415", "0.4964609", "0.49428466", "0.49407616", "0.49357828", "0.49159226", "0.49033412", "0.4900235", "0.48928976", "0.4883704", "0.4881385", "0.4880336", "0.4880075", "0.48740754", "0.4873172", "0.48639864", "0.4851501", "0.48498774", "0.48386288", "0.48386288", "0.4837716", "0.48240206", "0.48209885", "0.48096603", "0.48094454", "0.48046064", "0.4781075", "0.47709078", "0.47694477", "0.47669417", "0.47645906", "0.47617683", "0.4756397", "0.47548825", "0.47442913", "0.47440276", "0.47358406", "0.47274977", "0.47273222", "0.47267067", "0.472476", "0.4719137", "0.47185048", "0.47142538", "0.47091627", "0.47071883", "0.4706919", "0.47055817", "0.47005263", "0.46947837", "0.46945414", "0.46941552", "0.46798253", "0.46729943", "0.4672181", "0.46719798", "0.4670845", "0.4669085", "0.46637413", "0.4659098", "0.46547925", "0.46414927", "0.46353346", "0.46317276", "0.46253997", "0.46252313", "0.4621368" ]
0.6995871
1
Get forwarding table from tier1 Get forwarding table from tier1
def get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0 ...' end # verify the required parameter 'tier_1_id' is set if @api_client.config.client_side_validation && tier_1_id.nil? fail ArgumentError, "Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0" end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0, must be greater than or equal to 0.' end if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source']) fail ArgumentError, 'invalid value for "route_source", must be one of BGP, STATIC, CONNECTED' end # resource path local_var_path = '/infra/tier-1s/{tier-1-id}/forwarding-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s) # query parameters query_params = {} query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil? query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil? query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil? query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil? query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil? query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil? query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] 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 => 'RoutingTableListResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_0\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tier1_forwarding_table(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_forwarding_table_0(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_forwarding_table_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/forwarding-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'RoutingTableListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/forwarding-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'GatewayRouteTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/forwarding-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'GatewayRouteTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_csv(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_forwarding_table_csv_0(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts)\n data\n end", "def read_policy_dns_forwarder_on_tier1_0(tier_1_id, opts = {})\n data, _status_code, _headers = read_policy_dns_forwarder_on_tier1_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_tables\n\t\t@@tables\n\tend", "def get_tables\n tables\n end", "def table_name\n cti_tables ? cti_tables.last : super\n end", "def read_policy_dns_forwarder_on_tier1(tier_1_id, opts = {})\n data, _status_code, _headers = read_policy_dns_forwarder_on_tier1_with_http_info(tier_1_id, opts)\n data\n end", "def getTable\r\n return @pila_t.last #puedes hacer getTable sucesivos sin modificar nada en lo absoluto.\r\n end", "def lookup_address_via_tier1_dns_forwarder_0(tier_1_id, opts = {})\n data, _status_code, _headers = lookup_address_via_tier1_dns_forwarder_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_table(table)\n raise \"Pool #{self} does not have table #{table}\" unless has_table? table\n\n @tables.select{|tb| tb.to_s == table}.first\n end", "def tier\n @tier_cache || self.tiers[0]\n end", "def find_table_name\n client = RemoteAccountingSystemType.find_by_accounting_system_type_id(params[:real_estate_property][:accounting_system_type_id])\n return client.table_name.to_s if client\n end", "def table\n Airmodel.client.table base_config[:base_id], base_config[:table_name]\n end", "def get_table instance_id, table_id, view: nil\n tables.get_table name: table_path(instance_id, table_id), view: view\n end", "def mti_delegate_query_table param\n return self.table_name.to_sym if mti_handles_query_param param\n mti_ancestor_classes.find {|e| e.mti_handles_query_param param}&.table_name&.to_sym\n end", "def get_table_set\n P2::Application.reset CLIENT_INI\n @conn = P2::Connection.new :app_name => 'RecordTest',\n :host => \"127.0.0.1\", :port => 4001\n @conn.Connect\n\n @ds = P2::DataStream.new :stream_name => 'RTS_INDEX_REPL',\n :type => P2::RT_COMBINED_DYNAMIC\n\n @ds.Open(@conn)\n\n @ds.events.on_event { |*args| p args }\n 2.times { @conn.ProcessMessage2(1000) } # Push @ds to receive its TableSet\nend", "def return_table()\r\n\t\t\treturn @table\r\n\t\tend", "def lookup_address_via_tier1_dns_forwarder(tier_1_id, opts = {})\n data, _status_code, _headers = lookup_address_via_tier1_dns_forwarder_with_http_info(tier_1_id, opts)\n data\n end", "def read_policy_dns_forwarder_on_tier1_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.read_policy_dns_forwarder_on_tier1_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.read_policy_dns_forwarder_on_tier1_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/dns-forwarder'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'PolicyDnsForwarder')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi#read_policy_dns_forwarder_on_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tier_id\n self.tier.id if self.tier\n end", "def lookup_table\n return @lookup_table unless @lookup_table.nil?\n @lookup_table = (header_parameters.flags.has_custom_lookup_table ? custom_lookup_table : default_lookup_table)\n @lookup_table\n end", "def read_policy_dns_forwarder_on_tier1_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.read_policy_dns_forwarder_on_tier1 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.read_policy_dns_forwarder_on_tier1\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/dns-forwarder'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'PolicyDnsForwarder')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi#read_policy_dns_forwarder_on_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def getTable() \n puts @table[0][\"name\"];\n end", "def route_tables\n @route_tables ||= init_route_tables\n end", "def get_table(name)\r\n raise('Do not call this method from a server instance!') if server?\r\n raise(ArgumentError, 'Table name must be a symbol!') unless \\\r\n name.is_a?(Symbol)\r\n raise('Table not found!') unless table_exists?(name)\r\n\r\n if @table_hash.has_key?(name)\r\n return @table_hash[name]\r\n else\r\n @table_hash[name] = \\\r\n KBTable.create_called_from_database_instance(self, name, \r\n File.join(@path, name.to_s + @ext))\r\n return @table_hash[name]\r\n end\r\n end", "def get_tier1_interface_arp_table_0(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def default_route\n filters = {\n filters:\n [\n {\n name: 'vpc-id',\n values: [@vpc.id]\n },\n {\n name: 'association.main',\n values: ['true']\n }\n ]\n }\n collection = ec2.route_tables(filters)\n f = []\n collection.map { |e| f.push e }\n # fail \"Name of route table was not unique! Got #{f.length} route tables with name '#{name}'\" if f.length > 1\n f[0]\n end", "def get_table(object)\n raise NotImplementedError, \"Subclasses must implement private method get_table\"\n end", "def read_tier1_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Tier1')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#read_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_0(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_in_csv_0_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def read_tier1_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Tier1')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#read_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def chooseTable\n @metadata.chooseTable\n end", "def get_conversion_table\n @conversion_table ||= retrieve_conversion_table\n end", "def get_all_tables\n\t\ttc = new_sub(@discovery['tables']['url'], @discovery['tables']['capability'])\n\t\ttc.listen.map {|x| JSON.parse(x) rescue nil}.compact\n\tend", "def get_table(table, env=nil)\n require 'net/http'\n http_config = get_remote_credentials(env)\n ret = false\n Net::HTTP.start(http_config['server_name'], http_config['server_port']) {|http|\n req = Net::HTTP::Get.new(\"/dumps/#{table}.txt\")\n req.basic_auth http_config['http_user'], http_config['http_pass']\n resp = http.request(req)\n ret = tab_to_array_of_hashes(resp.body) if resp.code == '200'\n }\n ret\n end", "def get_tier1_policy_multicast_forwarding_0(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_multicast_forwarding_0_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def tables\n @tables ||= if @registration[:tables].present?\n @registration[:tables].call(@connection)\n else\n @connection.tables\n end\n end", "def get_table instance_id, table_id, view: nil\n execute do\n tables.get_table(\n table_path(instance_id, table_id),\n view: view\n )\n end\n end", "def aws_vpc_route_tables_get(opts)\n opts[:vpc].route_tables.select{ |rt| !rt.main? }\n end", "def get_tier1_interface_arp_table_csv_0(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_csv_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def init_route_tables\n @@client.describe_route_tables.route_tables\n end", "def _table; @table end", "def get_tier1_policy_multicast_forwarding(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_multicast_forwarding_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def table(name)\n table = primary.lookup_vals(name)\n\n return nil if table.nil?\n\n if (table.size() == 1)\n return table.tups[0].values[Catalog::Field::OBJECT]\n elsif (table.size() > 1)\n # require 'ruby-debug'; debugger\n raise \"Should be one \" + name.to_s + \" table defined, but there are \"+ table.size.to_s + \"!\"\n end\n end", "def local\n @table\n end", "def get_tables\n get_schemas.keys\n end", "def load_tier\n if id = tier_param_id\n @tier = Tier.find_by_permalink_and_region_and_active(id)\n @tier_class = @tier.class if @tier\n end\n end", "def load_tier\n if id = tier_param_id\n @tier = Tier.find_by_permalink_and_region_and_active(id)\n @tier_class = @tier.class if @tier\n end\n end", "def tables\n raise 'SevenZip#tables should never be called'\n end", "def getforwardingentityid\r\n return getvalue(SVTags::FORWARDING_ENTITY_ID)\r\n end", "def get_tier1_interface_arp_table(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def list_tier1_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'Tier1ListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#list_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_table_list()\n resp = @dynamo_db.list_tables()\n puts \"Table list : \" + resp.table_names.to_s\nend", "def get_downlink_port_arp_table_for_tier1_segment_0(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_0_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_in_csv_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def list_tier1_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'Tier1ListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#list_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_0_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_in_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def table_name\n return 'contact_scrape' if invalid_param('table_name')\n\n @params['table_name']\n end", "def table\n Response\n end", "def get_table(report_type, report_input_filter, pager, order=KalturaNotImplemented, object_ids=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\t# \n\t\t\tclient.add_param(kparams, 'reportType', report_type);\n\t\t\tclient.add_param(kparams, 'reportInputFilter', report_input_filter);\n\t\t\tclient.add_param(kparams, 'pager', pager);\n\t\t\tclient.add_param(kparams, 'order', order);\n\t\t\t# - one ID or more (separated by ',') of specific objects to query\n\t\t\tclient.add_param(kparams, 'objectIds', object_ids);\n\t\t\tclient.queue_service_action_call('report', 'getTable', 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 destination\n table = @gapi.configuration.query.destination_table\n return nil unless table\n retrieve_table table.project_id,\n table.dataset_id,\n table.table_id\n end", "def lookup_address_via_tier1_dns_forwarder_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.lookup_address_via_tier1_dns_forwarder_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.lookup_address_via_tier1_dns_forwarder_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/dns-forwarder/nslookup'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'address'] = opts[:'address'] if !opts[:'address'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].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 => 'AggregatePolicyDnsAnswer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi#lookup_address_via_tier1_dns_forwarder_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tribes\n Tribe.all\n end", "def get_downlink_port_arp_table_for_tier1_segment_0_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'InterfaceArpTable')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_in_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_table(table, identifier)\n if table['quick_look'].has_key?(identifier)\n table['table_data'].reverse_each do |elem|\n return elem[1] if elem[0].eql?identifier\n end\n end\n return nil\nend", "def fetch_user_tables\n Carto::UserTable.select([:name, :table_id]).where(user_id: @user_id).map do |record|\n Carto::TableFacade.new(record[:table_id], record[:name], @user_id)\n end\n end", "def get_table(table, identifier)\n if table['quick_look'].has_key?(identifier)\n table['table_data'].reverse_each do |elem|\n return elem[1] if elem[0].eql?identifier\n end\n end\n return nil\nend", "def get_tier1_interface_arp_table_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'InterfaceArpTable')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connect(table_name)\n conf = HBaseConfiguration.create\n admin = HBaseAdmin.new(conf)\n admin.tableExists('enron2')\n tables = admin.listTables\n table = HTable.new(conf, 'enron2')\nend", "def get_all_tables\n\t\ttc = new_sub(@discovery['tables'])\n\t\ttc.poll[:messages].map {|x| pp x; JSON.parse(x.content) rescue nil}.compact\n\tend", "def get_table(table_name, options = {})\n headers = {\n Azure::Storage::Common::HeaderConstants::ACCEPT => Serialization.get_accept_string(:full_meta),\n }\n options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY\n response = call(:get, table_uri(table_name, new_query(options), options), nil, headers, options)\n Serialization.table_entries_from_json(response.body)\n rescue => e\n raise_with_response(e, response)\n end", "def table_name\n self.name.split('::').last\n end", "def base_route_segments\n table_name.to_s\n end", "def load_tier\n if id = params[:tier_id]\n @tier = Tier.find_by_permalink_and_region_and_active(id)\n end\n end", "def get_downlink_port_arp_table_for_tier1_segment_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'InterfaceArpTable')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def forward_to\n return @forward_to\n end", "def table\n Service\n end", "def patch_policy_dns_forwarder_on_tier1_0(tier_1_id, policy_dns_forwarder, opts = {})\n patch_policy_dns_forwarder_on_tier1_0_with_http_info(tier_1_id, policy_dns_forwarder, opts)\n nil\n end", "def get_table(name, options={})\n return send_message(SkyDB::Message::GetTable.new(name, options))\n end", "def first()\n @tiers.each do |tier|\n unless tier.empty?()\n return tier[0]\n end\n end\n \n return nil\n end", "def get_table_name\n self.class.table_name\n end", "def check_routing_table(family, iface, default_route_table)\n so = shell_out(\"ip -o -f #{family[:name]} route show table #{default_route_table}\")\n so.stdout.lines do |line|\n line.strip!\n logger.trace(\"Plugin Network: Parsing #{line}\")\n if line.include?(\"\\\\\")\n # If we have multipath routing, then the first part will be a normal\n # looking route:\n # default proto ra metric 1024 <other options>\n # Each successive part after that is a hop without those options.\n # So the first thing we do is grab that first part, and split it into\n # the route destination (\"default\"), and the route options.\n parts = line.split(\"\\\\\")\n route_dest, dest_opts = parts.first.split(nil, 2)\n # Then all the route endings, generally just nexthops.\n route_endings = parts[1..]\n if dest_opts && !dest_opts.empty?\n # Route options like proto, metric, etc. only appear once for each\n # multipath configuration. Prepend this information to the route\n # endings so the code below will assign the fields properly.\n route_endings.map! { |e| e.include?(\"nexthop\") ? \"#{dest_opts} #{e}\" : e }\n end\n elsif line =~ /^([^\\s]+)\\s(.*)$/\n route_dest = $1\n route_endings = [$2]\n else\n next\n end\n route_endings.each do |route_ending|\n route_entry = Mash.new(destination: route_dest,\n family: family[:name])\n route_int = nil\n if route_ending =~ /\\bdev\\s+([^\\s]+)\\b/\n route_int = $1\n end\n # does any known interface own the src address?\n # we try to infer the interface/device from its address if it isn't specified\n # we want to override the interface set via nexthop but only if possible\n if line =~ /\\bsrc\\s+([^\\s]+)\\b/ && (!route_int || line.include?(\"nexthop\"))\n # only clobber previously set route_int if we find a match\n if (match = iface.select { |name, intf| intf.fetch(\"addresses\", {}).any? { |addr, _| addr == $1 } }.keys.first)\n route_int = match\n route_entry[:inferred] = true\n end\n end\n\n unless route_int\n logger.trace(\"Plugin Network: Skipping route entry without a device: '#{line}'\")\n next\n end\n route_int = \"venet0:0\" if is_openvz? && !is_openvz_host? && route_int == \"venet0\" && iface[\"venet0:0\"]\n\n unless iface[route_int]\n logger.trace(\"Plugin Network: Skipping previously unseen interface from 'ip route show': #{route_int}\")\n next\n end\n\n %w{via scope metric proto src}.each do |k|\n # http://rubular.com/r/pwTNp65VFf\n route_entry[k] = $1 if route_ending =~ /\\b#{k}\\s+([^\\s]+)/\n end\n # https://rubular.com/r/k1sMrRn5yLjgVi\n route_entry[\"via\"] = $1 if route_ending =~ /\\bvia\\s+inet6\\s+([^\\s]+)/\n\n # a sanity check, especially for Linux-VServer, OpenVZ and LXC:\n # don't report the route entry if the src address isn't set on the node\n # unless the interface has no addresses of this type at all\n if route_entry[:src]\n addr = iface[route_int][:addresses]\n unless addr.nil? || addr.key?(route_entry[:src]) ||\n addr.values.all? { |a| a[\"family\"] != family[:name] }\n logger.trace(\"Plugin Network: Skipping route entry whose src does not match the interface IP\")\n next\n end\n end\n\n iface[route_int][:routes] = [] unless iface[route_int][:routes]\n iface[route_int][:routes] << route_entry\n end\n end\n iface\n end", "def get_tier1_interface_arp_table_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'InterfaceArpTable')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def table\n self.class.table\n end", "def tables()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Tables::TablesRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def lookup_address_via_tier1_dns_forwarder_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.lookup_address_via_tier1_dns_forwarder ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi.lookup_address_via_tier1_dns_forwarder\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/dns-forwarder/nslookup'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'address'] = opts[:'address'] if !opts[:'address'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].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 => 'AggregatePolicyDnsAnswer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDNSDNSForwarderTier1GatewaysApi#lookup_address_via_tier1_dns_forwarder\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def table table_id, app_profile_id: nil\n ensure_service!\n Client::Table.new(\n @service.client,\n table_path(table_id),\n app_profile_id: app_profile_id\n )\n end", "def get_tier1_interface_arp_table_csv_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tier\n raw_tier || Tier.default\n end", "def get_tier1_policy_multicast_forwarding_0_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/forwarding'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'PolicyMulticastForwarding')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_multicast_forwarding_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tables_from(db=current_database)\n end", "def get_downlink_port_arp_table_for_tier1_segment(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def api_table\n controller_name\n end", "def tables\n []\n end" ]
[ "0.71132946", "0.6995687", "0.67749655", "0.6321426", "0.63078696", "0.6258341", "0.6248698", "0.5563339", "0.55142957", "0.54832894", "0.5469994", "0.5459869", "0.5386865", "0.5375805", "0.5344651", "0.53374344", "0.53162974", "0.5313677", "0.52874166", "0.52423817", "0.5209365", "0.51491266", "0.5122782", "0.51151675", "0.5113339", "0.5062592", "0.50610584", "0.50586987", "0.50460523", "0.5025184", "0.50147617", "0.49985847", "0.49925587", "0.4978256", "0.49648523", "0.49427322", "0.49418855", "0.49348232", "0.4915907", "0.4903501", "0.48999614", "0.489335", "0.4883485", "0.48818824", "0.48804647", "0.48799136", "0.48739952", "0.48730588", "0.48644635", "0.48518884", "0.48497495", "0.48387676", "0.48387676", "0.4837625", "0.48237267", "0.48210633", "0.48092306", "0.48090714", "0.4804881", "0.4781253", "0.47707462", "0.47691602", "0.47670522", "0.4765004", "0.47620705", "0.47560605", "0.47541115", "0.4744642", "0.47438177", "0.47354418", "0.47274745", "0.47272444", "0.47268593", "0.472438", "0.47190166", "0.47188032", "0.4713475", "0.4710116", "0.47080842", "0.4707029", "0.47053367", "0.4700268", "0.46952206", "0.46946722", "0.4694471", "0.4680251", "0.4673409", "0.4672745", "0.4671593", "0.46714383", "0.46697104", "0.46629262", "0.46591014", "0.4654442", "0.46425247", "0.4634579", "0.46319652", "0.46256807", "0.46253332", "0.46214598" ]
0.67727995
3
Get forwarding table from tier1 in CSV format Get forwarding table from tier1 gateway in CSV format.
def get_tier1_forwarding_table_csv(tier_1_id, opts = {}) data, _status_code, _headers = get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/forwarding-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'GatewayRouteTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/forwarding-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'GatewayRouteTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_csv_0(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_policy_multicast_forwarding_in_csv_format_csv_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/forwarding?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'PolicyMulticastForwardingInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_multicast_forwarding_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_policy_multicast_forwarding_in_csv_format_csv_0_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/forwarding?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'PolicyMulticastForwardingInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_multicast_forwarding_in_csv_format_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/forwarding-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'RoutingTableListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/forwarding-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'RoutingTableListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_policy_multicast_forwarding_in_csv_format_csv(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_multicast_forwarding_in_csv_format_csv_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def get_tier1_policy_multicast_forwarding_in_csv_format_csv_0(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_multicast_forwarding_in_csv_format_csv_0_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def get_tier1_interface_arp_table_csv_0(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_csv_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def get_tier1_forwarding_table(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_forwarding_table_0(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_interface_arp_table_csv(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_csv_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def table_1\n @table1 = read_table(File.join(FILE_PATH, \"Lgr_prelim_FPKM.txt\"))\n #send_file(File.join(FILE_PATH, \"Lgr_prelim_FPKM.txt\"), :type => 'text/csv', :disposition => 'inline')\n end", "def get_tier1_segment_port_mac_table_in_csv_with_http_info(tier_1_id, segment_id, port_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv\"\n end\n # verify the required parameter 'port_id' is set\n if @api_client.config.client_side_validation && port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'port_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv\"\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 = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/ports/{port-id}/mac-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s).sub('{' + 'port-id' + '}', port_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?\n query_params[:'transport_node_id'] = opts[:'transport_node_id'] if !opts[:'transport_node_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'SegmentPortMacAddressCsvListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentPortsMACTableApi#get_tier1_segment_port_mac_table_in_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_segment_port_mac_table_in_csv_0_with_http_info(tier_1_id, segment_id, port_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv_0\"\n end\n # verify the required parameter 'port_id' is set\n if @api_client.config.client_side_validation && port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'port_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv_0\"\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 = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/ports/{port-id}/mac-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s).sub('{' + 'port-id' + '}', port_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?\n query_params[:'transport_node_id'] = opts[:'transport_node_id'] if !opts[:'transport_node_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'SegmentPortMacAddressCsvListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentPortsMACTableApi#get_tier1_segment_port_mac_table_in_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_in_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_interface_arp_table_csv_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_logical_router_port_arp_table_in_csv_format_csv_with_http_info(logical_router_port_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi.get_logical_router_port_arp_table_in_csv_format_csv ...'\n end\n # verify the required parameter 'logical_router_port_id' is set\n if @api_client.config.client_side_validation && logical_router_port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_port_id' when calling ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi.get_logical_router_port_arp_table_in_csv_format_csv\"\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 = '/logical-router-ports/{logical-router-port-id}/arp-table?format=csv'.sub('{' + 'logical-router-port-id' + '}', logical_router_port_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?\n query_params[:'transport_node_id'] = opts[:'transport_node_id'] if !opts[:'transport_node_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'LogicalRouterPortArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi#get_logical_router_port_arp_table_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_policy_igmp_memberships_in_csv_format_csv_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/igmp-memberships?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'IgmpMembershipsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_igmp_memberships_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_segment_interface_arp_table_csv_0(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_segment_interface_arp_table_csv_0_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def get_tier1_policy_igmp_memberships_in_csv_format_csv_0_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/igmp-memberships?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'IgmpMembershipsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_igmp_memberships_in_csv_format_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_interface_arp_table_csv_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_0_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_in_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @trainers = Trainer.paginate(:page => params[:page]).order(email_dirigeant: :desc, crawled_for_email: :desc)\n respond_to do |format|\n format.html\n format.csv { send_data Trainer.all.to_csv}\n end\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_in_csv_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def get_segment_interface_arp_table_csv_0_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_segment_interface_arp_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_segment_interface_arp_table_csv_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_segment_interface_arp_table_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_segment_interface_arp_table_csv(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_segment_interface_arp_table_csv_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_0(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_in_csv_0_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def download_table\n params = download_table_params\n table_name = params[:table_name].parameterize.underscore\n action_name = table_name + \"_table\"\n table_url = self.send(\"#{table_name}_table_admin_reports_path\") + \".csv\"\n filters = params.except(:table_name).to_h\n \n redirect_to({\n controller: 'reports', \n action: action_name, \n format: :csv\n }.merge(filters))\n end", "def dump_table(client, fusion_tables, fusion_table_id, backup_directory)\n backup_directory ||= \"backups\"\n FileUtils.mkdir_p backup_directory\n\n fusion_table = client.execute(\n :api_method => fusion_tables.table.get,\n :parameters => {'tableId' => \"#{fusion_table_id}\"}\n )\n fusion_table.data.to_hash\n filename = File.join(backup_directory ,\"#{fusion_table.data.to_hash['name']}-#{fusion_table_id}\")\n $stderr.puts filename\n\n File.open(\"#{filename}.json\",\"w\") do |f|\n f.write(JSON.pretty_generate(fusion_table.data.to_hash))\n end\n\n result = client.execute(\n :api_method => fusion_tables.query.sql_get,\n :parameters => {'sql' => \"SELECT * FROM #{fusion_table_id}\"}\n )\n fusion_table_data = result.data.to_hash\n\n if fusion_table_data['error']\n if fusion_table_data['error']['errors'][0]['reason'] == 'responseSizeTooLarge'\n # use Fusion Tables V2 media downloads API\n result = client.execute(\n :api_method => fusion_tables.query.sql_get,\n :parameters => {'sql' => \"SELECT * FROM #{fusion_table_id}\", 'alt' => 'media'}\n )\n File.open(\"#{filename}.csv\", 'w') { |file| file.write(result.response.body) }\n else\n $stderr.puts \"Unhandled Error:\"\n $stderr.puts fusion_table_data.inspect\n end\n else\n CSV.open(\"#{filename}.csv\", 'w') do |csv|\n if fusion_table_data['rows'] && (fusion_table_data['rows'].length > 0)\n csv << fusion_table_data['columns']\n fusion_table_data['rows'].each do |row|\n csv << row\n end\n end\n end\n end\nend", "def data(table)\n CSV.parse(%x[mdb-export CRBE.mdb #{table}])[1..-1]\nend", "def index\n @trucks = Truck.all.order(:NB_PLATE)\n if Truck != nil and Truck.all.size>0 \n @details = Truck.order(:NB_PLATE).first(20)\n \n\n\n respond_to do |format|\n format.html\n format.csv { send_data @trucks.to_csv, filename: \"trucks-#{Time.now.strftime('s%S/m%M/h%H/')+Date.today.strftime('d%d/m%m/y%Y')}.csv\" }\n format.xls #{ send_data @trucks.to_csv(col_sep: \"\\t\") }\n end\n end\n end", "def transactions\n csv_string = \"\"\n checks.each_with_index do |check, index|\n csv = \"\"\n check_klass = OutputCsv.class_for(\"Check\", check.batch.facility)\n puts \"Applying class #{check_klass}\" if index == 0\n check_obj = check_klass.new(check, index)\n csv = check_obj.generate\n csv_string = csv_string + csv\n # For the first iteration, inorder to execute both header creation and first row writing, generate method is called once more\n if index == 0\n check_obj = check_klass.new(check, 1)\n csv = check_obj.generate\n csv_string = csv_string + csv\n end\n end\n return csv_string\n end", "def csv_report\n tire_cols = params[:tire] || {}\n ar_cols = params[:activerecord] || {}\n assocs_to_include = params[:assoc][:include] || {}\n params[:assoc][:max] ||= {}\n klass = model_class.constantize\n @filename = \"#{model_class.humanize}.csv\"\n\n response.headers['Content-Type'] ||= 'text/plain'\n response.headers['Content-Disposition'] = \"attachment; filename=#{@filename}\"\n response.headers['Content-Transfer-Encoding'] = 'binary'\n response.headers['Last-Modified'] = Time.now.to_s\n\n # Right, try to define a header:\n header = []\n tire_cols.keys.each { |x| header.push(x.humanize) }\n ar_cols.keys.each { |x| header.push(x.humanize) }\n assocs_to_include.keys.each do |assoc|\n if params[:assoc][:max][assoc] == 'join' # Is a has_many with only one real column\n header.push params[:assoc][assoc.to_sym].keys.first\n elsif params[:assoc][:max][assoc] # has_many\n (1 .. (params[:assoc][:max][assoc].to_i)).each do |i|\n params[:assoc][assoc.to_sym].keys.each do |k|\n header.push(\"#{assoc.singularize.humanize} #{i} #{k.humanize}\")\n end\n end\n else # has_a\n params[:assoc][assoc.to_sym].keys.each do |k| # Each key requested from the associated record\n header.push \"#{assoc.humanize} #{k.humanize}\"\n end\n end\n end\n\n results = klass.search({ per: TireSearch::INFINITY }, 1, '')\n self.response_body = Enumerator.new do |y|\n results.each_with_index do |result, i|\n y << header.to_csv if i == 0\n\n line = []\n tire_cols.keys.each { |x| line.push(result[x]) }\n\n result = result.load if ar_cols.count > 0 || assocs_to_include.keys.count > 0\n\n ar_cols.keys.each { |x| line.push(result.send(x)) } if ar_cols.count > 0\n\n assocs_to_include.keys.each do |assoc|\n related = result.send(assoc)\n if params[:assoc][:max][assoc] == 'join' # Is a has_many with only one real column\n col = params[:assoc][assoc.to_sym].keys.first\n line.push related.map { |x| x.send(col) }.join(' // ')\n elsif params[:assoc][:max][assoc]\n (0 .. (params[:assoc][:max][assoc].to_i - 1)).each do |j|\n params[:assoc][assoc.to_sym].keys.each do |k|\n line.push(related[j] ? related[j].send(k) : nil)\n end\n end\n else\n params[:assoc][assoc.to_sym].keys.each do |k| # Each key requested from the associated record\n line.push related ? related.send(k) : nil\n end\n end\n end\n y << line.to_csv\n GC.start if i % 500 == 0\n end\n end\n end", "def grab_lookup_table(csv_url)\n cmd = `curl #{csv_url} -s`\n csv = cmd.gsub(\"\\r\",\"\\n\").split(/\\n+/).map{ |x| x.split(\",\")}\n table = {}\n csv.each {|row| table[row[0]] = row[1]}\n return table\n end", "def table\n Airmodel.client.table base_config[:base_id], base_config[:table_name]\n end", "def get_table(table, env=nil)\n require 'net/http'\n http_config = get_remote_credentials(env)\n ret = false\n Net::HTTP.start(http_config['server_name'], http_config['server_port']) {|http|\n req = Net::HTTP::Get.new(\"/dumps/#{table}.txt\")\n req.basic_auth http_config['http_user'], http_config['http_pass']\n resp = http.request(req)\n ret = tab_to_array_of_hashes(resp.body) if resp.code == '200'\n }\n ret\n end", "def get_tier1_segment_port_mac_table_in_csv_0(tier_1_id, segment_id, port_id, opts = {})\n data, _status_code, _headers = get_tier1_segment_port_mac_table_in_csv_0_with_http_info(tier_1_id, segment_id, port_id, opts)\n data\n end", "def atop_csv\n \"#{@archive_root}/#{master.hostname}/atop_log_#{@gatling_scenario.downcase.gsub('.', '_')}.csv\"\n end", "def csv(meth)\n @output_type = 'csv'\n @output_filename = \"#{model.link.downcase}_#{normalized_type}.csv\"\n columns = model.columns_for(type, request)\n headers = columns.map{|column| column_label_for(type, request, model, column)}\n EnumCSV.csv(model.send(meth, normalized_type, request, :all_results=>true), :headers=>headers) do |obj|\n columns.map{|column| model.column_value(type, request, obj, column)}\n end\n end", "def index\n @inwards = Inward.all\n respond_to do |format|\n format.html\n format.csv { send_data @inwards.to_csv }\n format.xls { send_data @inwards.to_csv(col_sep: \"\\t\") }\n end\n #@inwards = Inward.paginate(:page => params[:page], :per_page => 10)\n end", "def import_csv_full\n \n end", "def index\n @trial_sites = TrialSite.all\n respond_to do |format|\n format.html\n format.csv { send_data @trial_sites.to_csv }\n format.xls { send_data @trial_sites.to_csv(col_sep: \"\\t\") }\n end\n end", "def csv_export_chrono\n csv_string = CSV.generate do |csv|\n\n csv << [ \"Plaque\", \"Equipe\", \"Nom VTT\", \"Prenom VTT\", \"ADN VTT\", \"Nom Route\", \"Prenom Route\", \"ADN Route\", \"Categorie\"]\n\n Team.order_by(:plate).each do |t|\n cat = t.category\n next unless cat\n\n cname = cat.map { |v| v.capitalize }.join('-')\n csv << [ t.plate, t.name, \n t.vtt.profile.name.upcase, t.vtt.profile.surname.capitalize, t.vtt.profile.birth.year, \n t.route.profile.name.upcase, t.route.profile.surname.capitalize, t.route.profile.birth.year, cname]\n end\n end\n\n respond!(csv_string, 200, 'Content-Type' => 'text/csv')\n end", "def get_tier0_bgp_neighbor_routes_in_csv_format_csv_with_http_info(tier_0_id, locale_service_id, neighbor_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv\"\n end\n # verify the required parameter 'neighbor_id' is set\n if @api_client.config.client_side_validation && neighbor_id.nil?\n fail ArgumentError, \"Missing the required parameter 'neighbor_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}/routes?format=csv'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'neighbor-id' + '}', neighbor_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'BgpNeighborRouteDetailsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbor_routes_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_segment_port_mac_table_in_csv(tier_1_id, segment_id, port_id, opts = {})\n data, _status_code, _headers = get_tier1_segment_port_mac_table_in_csv_with_http_info(tier_1_id, segment_id, port_id, opts)\n data\n end", "def export\n @transactions = Transaction.find_all_by_user_id(current_user.id)\n csv = \"\"\n i = 0\n @transactions.each do |trans|\n if (i==0)\n csv += trans.to_csv(true)\n else\n csv += trans.to_csv(false)\n end\n i += 1\n end\n\n respond_to do |format|\n format.csv { send_data csv }\n end\n end", "def index\n @q = Turno.ransack(params[:q])\n @turnos = @q.result\n\n respond_to do |format|\n format.html\n format.pdf do \n render pdf: 'Listado de turnos'\n end \n format.csv do\n send_data @turnos.to_csv\n end\n\n\n end\n end", "def get_tier1_policy_igmp_memberships_in_csv_format_csv_0(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_igmp_memberships_in_csv_format_csv_0_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def index\n @tariffs = Tariff.order(:id)\n\n respond_to do |format|\n format.html\n format.csv { send_data @tariffs.to_csv(:col_sep => \";\") }\n end\n end", "def open_csv(table)\n command = \"mdb-export -bstrip -D '%F %T' -d #{Shellwords.escape(delimiter)} #{file_name} #{table}\"\n Open3.popen3(command) do |stdin, stdout, stderr|\n yield CSV.new(stdout, col_sep: delimiter)\n end\n end", "def generate_csv\n @project = Project.find(params[:id])\n \n content_type = if request.user_agent =~ /windows/i\n ' application/vnd.ms-excel '\n else\n ' text/csv '\n end\n \n project_net = @project.find_all_connections(friend = true, follower = false) \n \n CSV::Writer.generate(output = \"\") do |csv|\n csv << [\"DL n=\" + @project.persons.count.to_s ]\n csv << [\"format = edgelist1\"]\n csv << [\"labels embedded:\"]\n csv << [\"data:\"]\n project_net.each do |entry|\n csv << [entry[0], entry[1], \"1\"]\n end\n @project.persons.each do |person|\n csv << [person.username]\n end\n end\n send_data(output,\n :type => content_type,\n :filename => @project.name.to_s + \"_FF_SNA.csv\")\n end", "def export(params={})\n columns = delimited_string_to_array(Settings.export.travel_fields)\n send_data Travel.export(columns), :filename => \"travel.csv\"\n end", "def create_csv()\n hashes = Transaction.all_as_hashes\n CSV.generate do |csv|\n # Adds the keys as headings on the first line\n csv << hashes.first.keys\n # Iterates through the transactions and populates CSV\n hashes.each do |hash|\n csv << hash.values\n end\n end\n end", "def index\n @clientes = filter(params[:filter]) || Cliente.includes(:plano, :atividades, historicos: [:status_transacao_pag_seguro]).all # Cliente.all\n \n respond_to do |format|\n format.html # show index.html.erb\n format.csv { send_data @clientes.to_csv }\n end\n end", "def index\n @opttrucks = Opttruck.all\n @shortopttrucks = Opttruck.first(100)\n \n respond_to do |format|\n format.html \n format.json\n format.csv { send_data @opttrucks.to_csv }\n\n end\n end", "def csvexport_all_tables\n @wires = Wire.all.sort_by {|obj| obj.kabeltyp}\n @switchgears_einbau = Switchgear.all.sort_by {|obj| obj.kennung}\n @switchgears = Switchgear.where(:typ => 1).sort_by {|obj| obj.kennung}\n @assemblies = Assembly.all.sort_by {|obj| obj.kennung}\n @electrical_installations = ElectricalInstallation.all.sort_by {|obj| obj.kennung}\n @drives = Drive.all.sort_by {|obj| obj.kennung}\n @devices = Device.all.sort_by {|obj| obj.definition}\n @iogroups = Iogroup.all.sort_by {|obj| obj.name}\n @switchgearcombinations = Switchgearcombination.all.sort_by {|obj| obj.name}\n @offertpositions = Offertposition.where(:subsubproject_id => params[:subsubproject_id]).sort_by {|obj| obj.name}\n @subsubproject = Subsubproject.find(params[:subsubproject_id])\n @subsubprojects = @subsubproject.subproject.subsubprojects.sort_by {|obj| obj.name}\n @subsystems = @subsubproject.subproject.project.subsystems.all.sort_by {|obj| obj.name}\n @units = Unit.where(:subsystem_id => @subsystems.pluck(:id)).sort_by {|obj| obj.name}\n\n CSV.open(\"export_all_tables#{Time.now.strftime(\"%Y-%m-%d-%H-%M\")}.csv\", \"wb\", {:headers => true, :encoding => \"iso-8859-1\", :col_sep => \";\"}) do |csv|\n csv << ['Geraetetypen', '']\n @devices.each do |entry| csv << [entry.id, entry.definition] end\n csv << ['SPS-Modultypen', '']\n @assemblies.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Frequenzumrichtertypen', '']\n @drives.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Kabeltypen', '']\n @wires.each do |entry| csv << [entry.id, entry.kabeltyp] end\n csv << ['Elektroinstallationstypen', '']\n @electrical_installations.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Schaltschranktypen', '']\n @switchgears.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Schaltschrankeinbautypen', '']\n @switchgears_einbau.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Schaltgeraetekombinationen', '']\n @switchgearcombinations.each do |entry| csv << [entry.id, entry.name] end\n csv << ['IO-Gruppen', '']\n @iogroups.each do |entry| csv << [entry.id, entry.name] end\n csv << ['Offertpositionen', '']\n @offertpositions.each do |entry| csv << [entry.id, entry.name] end\n csv << ['Teilanlagen', '']\n @subsystems.each do |entry| csv << [entry.id, entry.name] end\n csv << ['TeilanlagenUnits', '']\n @units.each do |entry| csv << [entry.id, entry.name] end\n csv << ['Projektversionen', '']\n @subsubprojects.each do |entry| csv << [entry.id, entry.name] end\n end\n\n redirect_to settings_path, :notice => \"Export wurde unter \" + Rails.root.to_s + \"/ abgelegt!\"\n end", "def export_csv\n export_string = \"#{@id},#{type_string},#{@name.gsub(/[\\,,\\s]/,\"\")},\"\n @details.each{|k,v| export_string << \"#{k}=#{v};\".gsub(/[\\,,\\s]/,\"\") }\n export_string\n end", "def export_csv\n export_string = \"#{@id},#{type_string},#{@name.gsub(/[\\,,\\s]/,\"\")},\"\n @details.each{|k,v| export_string << \"#{k}=#{v};\".gsub(/[\\,,\\s]/,\"\") }\n export_string\n end", "def import_csv_smart\n \n end", "def index\n @pagetitle = \"Suppliers\"\n \n @companies = Company.all\n\n @path = 'suppliers'\n\n @suppliercsv = Supplier.all \n respond_to do |format|\n format.html\n format.csv { send_data @suppliercsv.to_csv }\n \n end\n\n\n end", "def index\n @q = Servidor.ransack(params[:q])\n @q.sorts = 'nome'\n @servidores = @q.result.page params[:page]\n respond_to do |format|\n format.html\n format.csv do\n send_data @servidores.except(:limit, :offset).to_csv, filename: \"concentradores -#{Date.today}.csv\"\n end\n end\n end", "def index\n @localbrs = Localbr.all\n respond_to do |format|\n format.csv { send_data @localbrs.to_csv}\n format.html\n end\n end", "def index\n @transmission_f_records = TransmissionFRecord.all\n\n respond_to do |format|\n format.html\n format.csv { send_data @transmission_f_records.to_csv, filename: \"transmission-f-record-#{Date.today}.csv\" }\n end\n end", "def csv\n @csv_table ||= begin\n csv_raw = File.read(CSV_PATH)\n CSV.parse(csv_raw, headers: true)\n end\n\nend", "def index\n @mobiles = Customer.pluck(:mobile)\n @agents = User.where(\"role = ?\", 2).pluck(:fname, :id)\n @franchises = User.where(\"role = ?\", 1).pluck(:fname, :id)\n @customers_csv = (policy_scope Customer).order(\"id desc\")\n @customers = (policy_scope Customer).order(\"id desc\").page params[:page]\n authorize Customer.new, :index?\n \n respond_to do |format|\n format.html\n format.csv { send_data @customers_csv.as_csv }\n end\n\n\n end", "def get_tier0_bgp_neighbor_routes_in_csv_format_csv_0_with_http_info(tier_0_id, locale_service_id, neighbor_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0\"\n end\n # verify the required parameter 'neighbor_id' is set\n if @api_client.config.client_side_validation && neighbor_id.nil?\n fail ArgumentError, \"Missing the required parameter 'neighbor_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}/routes?format=csv'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'neighbor-id' + '}', neighbor_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'BgpNeighborRouteDetailsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbor_routes_in_csv_format_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def csv(csv_file)\n Slacker.get_csv(csv_file)\n end", "def csv_params\n\n owner_id = owner_id\n owner_id = id if usertype == \"reseller\"\n sep = Confline.get_value(\"CSV_Separator\", owner_id).to_s\n dec = Confline.get_value(\"CSV_Decimal\", owner_id).to_s\n\n sep = Confline.get_value(\"CSV_Separator\", 0).to_s if sep.to_s.length == 0\n dec = Confline.get_value(\"CSV_Decimal\", 0).to_s if dec.to_s.length == 0\n\n sep = \",\" if sep.blank?\n dec = \".\" if dec.blank?\n\n return sep, dec\n end", "def get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_with_http_info(tier_0_id, locale_service_id, neighbor_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv\"\n end\n # verify the required parameter 'neighbor_id' is set\n if @api_client.config.client_side_validation && neighbor_id.nil?\n fail ArgumentError, \"Missing the required parameter 'neighbor_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}/advertised-routes?format=csv'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'neighbor-id' + '}', neighbor_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'BgpNeighborRouteDetailsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @vendor_profiles = VendorProfile.all\n \n respond_to do |format|\n format.html\n format.csv { send_data @vendor_profiles.as_csv } \n end\n end", "def getToolsSyndicateFactualcsv( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"get\",\"/tools/syndicate/factualcsv\",params)\n end", "def csvString\n resultColumns = self.generateResultColumns\n headers = resultColumns[:columns].keys\n # Start off instantiating the csv string with the header values\n csvString = headers.map{|s| self.filterValue(s)}.join(@options[:delimiter])\n\n # Now iterate over each row, sticking its value under each header\n (0..resultColumns[:maxRowIndex]).each do |rowIndex|\n csvString << \"\\r\\n\"\n csvString << headers.map{ |header|\n self.filterValue(resultColumns[:columns][header][rowIndex])\n }.join(@options[:delimiter])\n end\n return csvString\n end", "def csv\n @records = Reply.all\n csv_string = FasterCSV.generate do |csv|\n csv << %w{Code Name Email Engagement Engagement_Adults Engagement_Children Wedding Wedding_Adults Wedding_Children Camping Diet Notes Updated}\n @records.each do |line|\n csv << [\n line['code'],\n line['name'], \n line['email'],\n line['engagement'],\n line['engagement_adults'],\n line['engagement_children'],\n line['wedding'],\n line['wedding_adults'],\n line['wedding_children'],\n line['camping'],\n line['diet'],\n line['notes'],\n line['updated_at']\n ]\n end\n end\n filename = \"rsvp_download\" + Time.now.strftime(\"%d%m%y-%H%M\").to_s + \".csv\"\n send_data(csv_string,\n :type => 'text/csv; charset=utf-8; header=present',\n :filename => filename)\n end", "def csv\n send_data(Map.to_csv, {:filename => \"maps.csv\" })\n end", "def index\n @candidatos = Candidato.all\n respond_to do |format|\n format.html\n format.csv { send_data @candidatos.to_csv }\n #format.xls \n end\n end", "def read_tier1_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Tier1')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#read_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def fee_reciepts_export_csv\n parameters={:search => params[:search] ,:filename => filename}\n csv_export('finance_transaction', 'fee_reciepts_export', parameters) \n end", "def genCsvRowSpeed()\n row = configIndex() ;\n row.push(getAveSpeed()) ;\n return row ;\n end", "def clients_csv(options = {})\n CSV.generate(options) do |csv|\n csv << ['Nombre', 'INE', 'Teléfono', 'Dirección']\n all.find_each do |client|\n csv << [\n client.full_name,\n client.ine,\n client.phone,\n client.address\n ]\n client.client_services.find_each do |service|\n csv << ['Servicios']\n csv << ['ID', 'Descripcion', 'Total']\n csv << [\n service.id,\n service.description,\n service.total.to_s\n ]\n end\n client.client_printers.find_each do |printer|\n csv << ['Impresoras']\n csv << ['ID', 'Descripcion', 'Total']\n csv << [\n printer.id,\n printer.adquisition_date\n ]\n end\n client.product_sales.find_each do |sale|\n csv << ['Compras']\n csv << ['ID', 'Fecha Compra', 'Cantidad']\n csv << [\n sale.id,\n sale.sale_date,\n sale.quantity\n ]\n end\n end\n end\n end", "def csv_output_path()\n return @base_path\n end", "def csv\n claim_filter = ClaimFilter.new()\n claim_filter.restore_from_session(session,:claim_filter)\n claim_filter.organisation_id = params[:id].to_i\n\n content_type = ( request.user_agent =~ /windows/i ? 'application/vnd.ms-excel' : 'text/csv' )\n content = Claim.csv_by_filter(claim_filter)\n send_data(content,:type => content_type, :filename => 'claims.csv' )\n end", "def index\n @repairs = Repair.all.includes(:driver, :bus)\n\n respond_to do |format|\n format.html\n format.csv { send_data @repairs.to_csv, filename: \"jobcards-#{Date.today}.csv\" }\n end\n end", "def table_csv_string(options = {})\n opt = {\n :klass => nil,\n :header_row => true\n }.merge!(options)\n str = ''\n \n return false if !opt[:klass]\n\n klass_name = opt[:klass].name\n tbl = ActiveSupport::Inflector.tableize(opt[:klass].name.to_s)\n\n cols = []\n sql = ''\n\n if klass_name == \"Person\" \n cols = %w(id last_name first_name middle_name login)\n else\n cols = opt[:klass].columns.map(&:name) \n end\n\n cols_str = cols.join(\", \")\n\n case opt[:klass].name\n when \"Person\"\n sql = \"SELECT #{cols_str} FROM people p INNER JOIN people_projs pp on p.id = pp.person_id WHERE pp.proj_id = #{self.id};\"\n when \"Ref\"\n cols_str = cols.collect{|c| \"r.#{c}\"}.join(\", \") # refs shared across projects, be more explicit for the join table\n sql = \"SELECT #{cols_str} FROM refs r INNER JOIN projs_refs pr on r.id = pr.ref_id WHERE pr.proj_id = #{self.id};\"\n when \"TaxonName\"\n sql = \"SELECT #{cols_str} FROM taxon_names WHERE #{self.sql_for_taxon_names}\"\n when \"Author\"\n sql = \"SELECT #{cols_str} FROM authors a WHERE a.ref_id IN (SELECT r.id FROM refs r INNER JOIN projs_refs pr on r.id = pr.ref_id WHERE pr.proj_id = #{self.id})\"\n when \"ChrState\"\n sql = \"SELECT #{cols_str} FROM chr_states cs WHERE cs.chr_id IN (SELECT chrs.id from chrs WHERE chrs.proj_id = #{self.id})\" \n # when \"Identifier\"\n # sql = \"SELECT #{cols_str} FROM identifiers si WHERE si.specimen_id IN (SELECT specimens.id from specimens WHERE specimens.proj_id = #{self.id})\"\n when \"SpecimenDetermination\"\n sql = \"SELECT #{cols_str} FROM specimen_determinations sd WHERE sd.specimen_id IN (SELECT specimens.id from specimens WHERE specimens.proj_id = #{self.id})\"\n\n else\n sql = \"SELECT #{cols_str} FROM #{tbl}\" \n end\n\n # add the project level restrictions if they exist\n sql << \" WHERE proj_id = #{self.id}\" if opt[:klass].columns.collect{|c| c.name}.include?(\"proj_id\")\n\n # build the str\n str << cols.join(\"\\t\") if opt[:header_row]# the header row\n str << \"\\n\"\n\n ActiveRecord::Base.connection.select_rows(sql).each do |row| \n # not filtering for tab characters here, likely should\n str << row.collect{|c| c == nil ? nil : c.gsub(/\\n|\\r\\n|\\r/, '\\n')}.join(\"\\t\") + \"\\n\"\n end\n str\n end", "def genCsvRowSummary()\n row = configIndex() ;\n\n row.push(getAveSpeed()) ;\n row.push(getShareRatio()) ;\n row.push(getCumulativeShare()) ;\n return row ;\n end", "def extract_heads(name_table)\n headers = CSV.read(name_table, { :headers => true, :skip_blanks => true, encoding:'iso-8859-1:utf-8',:row_sep => :auto, :col_sep => \";\"}).headers\n @heads = headers\n end", "def index\n @linhkiens = Linhkien.all\n @linhkien = Linhkien.new\n respond_to do |format|\n format.html\n format.csv { send_data @linhkiens.to_csv }\n format.xls # { send_data @products.to_csv(col_sep: \"\\t\") }\n end\n end", "def csv_for_company\n filter = params[:filter]\n company_name = Company.find(params[:company_id]).name\n csv_name = filter.present? ?\n \"#{company_name}_operations_filtered_by_#{filter}.csv\" :\n \"#{company_name}_operations.csv\"\n respond_to do |format|\n format.csv { send_data to_csv ,filename: csv_name}\n end\n end", "def getRoutingtable(hostMap, native, fileName)\n\tnodes = $dist.keys;\n\tputs nodes\n\tif fileName == nil then\n\t\tfileName = \"routingTable.csv\"\n\tend\n\tFile.open(fileName, \"w\") do |f|\n\t\tfor i in 0..nodes.length - 1\n\t\t\tvalue = nodes[i];\n\t\t\t\tif value == native then\n\t\t\t\t\tnativeIp = Socket.getaddrinfo(\"localhost\",nil)[0][3]\n\t\t\t\t\tf.puts \"#{nativeIp},#{nativeIp},#{native},0\"\n\t\t\t\telse\n\t\t\t\t\tipAddr = hostMap[value];\n\t\t\t\t\tf.puts \"#{ipAddr[1]},#{ipAddr[0]},#{$nextNode[value]},#{$dist[value]}\";\n\t\t\t\tend\t\n\t\tend\n\tend\nend", "def genCsvSpeed()\n csv = [] ;\n to_a.each{|analyzer|\n csv.push(analyzer.genCsvRowSpeed()) ;\n }\n return csv ;\n end", "def fetch_csv\n convert_to_csv(fetch)\n end", "def index\n @casein_page_title = 'Fees'\n @fees = Fee.order(sort_order(:courseformat_id)).paginate :page => params[:page]\n respond_to do |format|\n format.html\n format.csv { send_data Fee.all.to_csv, filename: \"fees-#{Date.today}.csv\"}\n format.xlsx\n end\n end", "def list_tier1_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'Tier1ListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#list_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @registrations = Registration.current.order('seat_number')\n respond_to do |format|\n format.html\n format.csv { send_data @registrations.to_csv }\n end\n end", "def download_heat_tsv\n heat = params[:heat_number]\n exporter = Exporters::Competition::Swiss.new(@competition, heat)\n csv_string = TsvGenerator.new(exporter).generate\n\n filename = \"#{@competition.to_s.parameterize}_heat_#{heat}.txt\"\n send_data(csv_string,\n type: 'text/csv; charset=utf-8; header=present',\n filename: filename)\n end", "def get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0_with_http_info(tier_0_id, locale_service_id, neighbor_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0\"\n end\n # verify the required parameter 'neighbor_id' is set\n if @api_client.config.client_side_validation && neighbor_id.nil?\n fail ArgumentError, \"Missing the required parameter 'neighbor_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}/advertised-routes?format=csv'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'neighbor-id' + '}', neighbor_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'BgpNeighborRouteDetailsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @providers = Provider.all\n\n respond_to do |format|\n format.html\n format.csv { send_data Provider.to_csv }\n end\n end", "def getToolsSyndicateInfobelcsv( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"get\",\"/tools/syndicate/infobelcsv\",params)\n end" ]
[ "0.7411211", "0.73354864", "0.7312457", "0.6424258", "0.6279351", "0.6236259", "0.62193143", "0.61991376", "0.6177326", "0.61690235", "0.61520094", "0.60460424", "0.6045946", "0.5967651", "0.5710281", "0.57012516", "0.56104255", "0.5588531", "0.55537957", "0.5548589", "0.554607", "0.5545361", "0.55029744", "0.5499577", "0.54935074", "0.5463141", "0.5454703", "0.5439698", "0.5419898", "0.5400944", "0.5324786", "0.5234267", "0.5176439", "0.5126826", "0.5087025", "0.5061524", "0.50418615", "0.5017559", "0.4993312", "0.4957883", "0.49552616", "0.4951324", "0.49453586", "0.49391878", "0.4931793", "0.49229094", "0.49167764", "0.4905972", "0.48930088", "0.4889885", "0.48854265", "0.48837662", "0.48829162", "0.48765907", "0.48739678", "0.48673066", "0.48642573", "0.48610634", "0.48462802", "0.4845725", "0.4845725", "0.4842677", "0.48402488", "0.48289156", "0.48244345", "0.4823614", "0.48210442", "0.4806569", "0.48057044", "0.48029006", "0.47931424", "0.47898617", "0.47865877", "0.47809756", "0.47762027", "0.47595873", "0.47561166", "0.47551453", "0.47516015", "0.47472706", "0.47438967", "0.4742668", "0.47330913", "0.47254407", "0.47225317", "0.47209895", "0.47143647", "0.46968767", "0.46922225", "0.4688606", "0.4687879", "0.46852544", "0.46851805", "0.46829653", "0.46820265", "0.4681798", "0.4680927", "0.4680763", "0.46805814", "0.46793702" ]
0.7500307
0
Get forwarding table from tier1 in CSV format Get forwarding table from tier1 gateway in CSV format.
def get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv ...' end # verify the required parameter 'tier_1_id' is set if @api_client.config.client_side_validation && tier_1_id.nil? fail ArgumentError, "Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv" end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv, must be greater than or equal to 0.' end if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source']) fail ArgumentError, 'invalid value for "route_source", must be one of BGP, STATIC, CONNECTED' end # resource path local_var_path = '/global-infra/tier-1s/{tier-1-id}/forwarding-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s) # query parameters query_params = {} query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil? query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil? query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil? query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil? query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil? query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil? query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['text/csv']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] 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 => 'GatewayRouteTableInCsvFormat') if @api_client.config.debugging @api_client.config.logger.debug "API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_csv\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tier1_forwarding_table_csv(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/forwarding-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'GatewayRouteTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_csv_0(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_policy_multicast_forwarding_in_csv_format_csv_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/forwarding?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'PolicyMulticastForwardingInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_multicast_forwarding_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_policy_multicast_forwarding_in_csv_format_csv_0_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/forwarding?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'PolicyMulticastForwardingInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_multicast_forwarding_in_csv_format_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/forwarding-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'RoutingTableListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/forwarding-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'RoutingTableListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_policy_multicast_forwarding_in_csv_format_csv(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_multicast_forwarding_in_csv_format_csv_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def get_tier1_policy_multicast_forwarding_in_csv_format_csv_0(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_multicast_forwarding_in_csv_format_csv_0_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def get_tier1_interface_arp_table_csv_0(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_csv_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def get_tier1_forwarding_table(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_forwarding_table_0(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_interface_arp_table_csv(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_csv_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def table_1\n @table1 = read_table(File.join(FILE_PATH, \"Lgr_prelim_FPKM.txt\"))\n #send_file(File.join(FILE_PATH, \"Lgr_prelim_FPKM.txt\"), :type => 'text/csv', :disposition => 'inline')\n end", "def get_tier1_segment_port_mac_table_in_csv_with_http_info(tier_1_id, segment_id, port_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv\"\n end\n # verify the required parameter 'port_id' is set\n if @api_client.config.client_side_validation && port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'port_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv\"\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 = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/ports/{port-id}/mac-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s).sub('{' + 'port-id' + '}', port_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?\n query_params[:'transport_node_id'] = opts[:'transport_node_id'] if !opts[:'transport_node_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'SegmentPortMacAddressCsvListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentPortsMACTableApi#get_tier1_segment_port_mac_table_in_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_segment_port_mac_table_in_csv_0_with_http_info(tier_1_id, segment_id, port_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv_0\"\n end\n # verify the required parameter 'port_id' is set\n if @api_client.config.client_side_validation && port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'port_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv_0\"\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 = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/ports/{port-id}/mac-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s).sub('{' + 'port-id' + '}', port_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?\n query_params[:'transport_node_id'] = opts[:'transport_node_id'] if !opts[:'transport_node_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'SegmentPortMacAddressCsvListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentPortsMACTableApi#get_tier1_segment_port_mac_table_in_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_in_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_interface_arp_table_csv_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_logical_router_port_arp_table_in_csv_format_csv_with_http_info(logical_router_port_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi.get_logical_router_port_arp_table_in_csv_format_csv ...'\n end\n # verify the required parameter 'logical_router_port_id' is set\n if @api_client.config.client_side_validation && logical_router_port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_port_id' when calling ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi.get_logical_router_port_arp_table_in_csv_format_csv\"\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 = '/logical-router-ports/{logical-router-port-id}/arp-table?format=csv'.sub('{' + 'logical-router-port-id' + '}', logical_router_port_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?\n query_params[:'transport_node_id'] = opts[:'transport_node_id'] if !opts[:'transport_node_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'LogicalRouterPortArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi#get_logical_router_port_arp_table_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_policy_igmp_memberships_in_csv_format_csv_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/igmp-memberships?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'IgmpMembershipsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_igmp_memberships_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_policy_igmp_memberships_in_csv_format_csv_0_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/igmp-memberships?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'IgmpMembershipsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_igmp_memberships_in_csv_format_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_segment_interface_arp_table_csv_0(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_segment_interface_arp_table_csv_0_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def get_tier1_interface_arp_table_csv_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_0_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_in_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @trainers = Trainer.paginate(:page => params[:page]).order(email_dirigeant: :desc, crawled_for_email: :desc)\n respond_to do |format|\n format.html\n format.csv { send_data Trainer.all.to_csv}\n end\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_in_csv_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def get_segment_interface_arp_table_csv_0_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_segment_interface_arp_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_segment_interface_arp_table_csv_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_segment_interface_arp_table_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_segment_interface_arp_table_csv(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_segment_interface_arp_table_csv_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_0(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_in_csv_0_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def download_table\n params = download_table_params\n table_name = params[:table_name].parameterize.underscore\n action_name = table_name + \"_table\"\n table_url = self.send(\"#{table_name}_table_admin_reports_path\") + \".csv\"\n filters = params.except(:table_name).to_h\n \n redirect_to({\n controller: 'reports', \n action: action_name, \n format: :csv\n }.merge(filters))\n end", "def dump_table(client, fusion_tables, fusion_table_id, backup_directory)\n backup_directory ||= \"backups\"\n FileUtils.mkdir_p backup_directory\n\n fusion_table = client.execute(\n :api_method => fusion_tables.table.get,\n :parameters => {'tableId' => \"#{fusion_table_id}\"}\n )\n fusion_table.data.to_hash\n filename = File.join(backup_directory ,\"#{fusion_table.data.to_hash['name']}-#{fusion_table_id}\")\n $stderr.puts filename\n\n File.open(\"#{filename}.json\",\"w\") do |f|\n f.write(JSON.pretty_generate(fusion_table.data.to_hash))\n end\n\n result = client.execute(\n :api_method => fusion_tables.query.sql_get,\n :parameters => {'sql' => \"SELECT * FROM #{fusion_table_id}\"}\n )\n fusion_table_data = result.data.to_hash\n\n if fusion_table_data['error']\n if fusion_table_data['error']['errors'][0]['reason'] == 'responseSizeTooLarge'\n # use Fusion Tables V2 media downloads API\n result = client.execute(\n :api_method => fusion_tables.query.sql_get,\n :parameters => {'sql' => \"SELECT * FROM #{fusion_table_id}\", 'alt' => 'media'}\n )\n File.open(\"#{filename}.csv\", 'w') { |file| file.write(result.response.body) }\n else\n $stderr.puts \"Unhandled Error:\"\n $stderr.puts fusion_table_data.inspect\n end\n else\n CSV.open(\"#{filename}.csv\", 'w') do |csv|\n if fusion_table_data['rows'] && (fusion_table_data['rows'].length > 0)\n csv << fusion_table_data['columns']\n fusion_table_data['rows'].each do |row|\n csv << row\n end\n end\n end\n end\nend", "def data(table)\n CSV.parse(%x[mdb-export CRBE.mdb #{table}])[1..-1]\nend", "def index\n @trucks = Truck.all.order(:NB_PLATE)\n if Truck != nil and Truck.all.size>0 \n @details = Truck.order(:NB_PLATE).first(20)\n \n\n\n respond_to do |format|\n format.html\n format.csv { send_data @trucks.to_csv, filename: \"trucks-#{Time.now.strftime('s%S/m%M/h%H/')+Date.today.strftime('d%d/m%m/y%Y')}.csv\" }\n format.xls #{ send_data @trucks.to_csv(col_sep: \"\\t\") }\n end\n end\n end", "def transactions\n csv_string = \"\"\n checks.each_with_index do |check, index|\n csv = \"\"\n check_klass = OutputCsv.class_for(\"Check\", check.batch.facility)\n puts \"Applying class #{check_klass}\" if index == 0\n check_obj = check_klass.new(check, index)\n csv = check_obj.generate\n csv_string = csv_string + csv\n # For the first iteration, inorder to execute both header creation and first row writing, generate method is called once more\n if index == 0\n check_obj = check_klass.new(check, 1)\n csv = check_obj.generate\n csv_string = csv_string + csv\n end\n end\n return csv_string\n end", "def csv_report\n tire_cols = params[:tire] || {}\n ar_cols = params[:activerecord] || {}\n assocs_to_include = params[:assoc][:include] || {}\n params[:assoc][:max] ||= {}\n klass = model_class.constantize\n @filename = \"#{model_class.humanize}.csv\"\n\n response.headers['Content-Type'] ||= 'text/plain'\n response.headers['Content-Disposition'] = \"attachment; filename=#{@filename}\"\n response.headers['Content-Transfer-Encoding'] = 'binary'\n response.headers['Last-Modified'] = Time.now.to_s\n\n # Right, try to define a header:\n header = []\n tire_cols.keys.each { |x| header.push(x.humanize) }\n ar_cols.keys.each { |x| header.push(x.humanize) }\n assocs_to_include.keys.each do |assoc|\n if params[:assoc][:max][assoc] == 'join' # Is a has_many with only one real column\n header.push params[:assoc][assoc.to_sym].keys.first\n elsif params[:assoc][:max][assoc] # has_many\n (1 .. (params[:assoc][:max][assoc].to_i)).each do |i|\n params[:assoc][assoc.to_sym].keys.each do |k|\n header.push(\"#{assoc.singularize.humanize} #{i} #{k.humanize}\")\n end\n end\n else # has_a\n params[:assoc][assoc.to_sym].keys.each do |k| # Each key requested from the associated record\n header.push \"#{assoc.humanize} #{k.humanize}\"\n end\n end\n end\n\n results = klass.search({ per: TireSearch::INFINITY }, 1, '')\n self.response_body = Enumerator.new do |y|\n results.each_with_index do |result, i|\n y << header.to_csv if i == 0\n\n line = []\n tire_cols.keys.each { |x| line.push(result[x]) }\n\n result = result.load if ar_cols.count > 0 || assocs_to_include.keys.count > 0\n\n ar_cols.keys.each { |x| line.push(result.send(x)) } if ar_cols.count > 0\n\n assocs_to_include.keys.each do |assoc|\n related = result.send(assoc)\n if params[:assoc][:max][assoc] == 'join' # Is a has_many with only one real column\n col = params[:assoc][assoc.to_sym].keys.first\n line.push related.map { |x| x.send(col) }.join(' // ')\n elsif params[:assoc][:max][assoc]\n (0 .. (params[:assoc][:max][assoc].to_i - 1)).each do |j|\n params[:assoc][assoc.to_sym].keys.each do |k|\n line.push(related[j] ? related[j].send(k) : nil)\n end\n end\n else\n params[:assoc][assoc.to_sym].keys.each do |k| # Each key requested from the associated record\n line.push related ? related.send(k) : nil\n end\n end\n end\n y << line.to_csv\n GC.start if i % 500 == 0\n end\n end\n end", "def grab_lookup_table(csv_url)\n cmd = `curl #{csv_url} -s`\n csv = cmd.gsub(\"\\r\",\"\\n\").split(/\\n+/).map{ |x| x.split(\",\")}\n table = {}\n csv.each {|row| table[row[0]] = row[1]}\n return table\n end", "def table\n Airmodel.client.table base_config[:base_id], base_config[:table_name]\n end", "def get_table(table, env=nil)\n require 'net/http'\n http_config = get_remote_credentials(env)\n ret = false\n Net::HTTP.start(http_config['server_name'], http_config['server_port']) {|http|\n req = Net::HTTP::Get.new(\"/dumps/#{table}.txt\")\n req.basic_auth http_config['http_user'], http_config['http_pass']\n resp = http.request(req)\n ret = tab_to_array_of_hashes(resp.body) if resp.code == '200'\n }\n ret\n end", "def get_tier1_segment_port_mac_table_in_csv_0(tier_1_id, segment_id, port_id, opts = {})\n data, _status_code, _headers = get_tier1_segment_port_mac_table_in_csv_0_with_http_info(tier_1_id, segment_id, port_id, opts)\n data\n end", "def atop_csv\n \"#{@archive_root}/#{master.hostname}/atop_log_#{@gatling_scenario.downcase.gsub('.', '_')}.csv\"\n end", "def csv(meth)\n @output_type = 'csv'\n @output_filename = \"#{model.link.downcase}_#{normalized_type}.csv\"\n columns = model.columns_for(type, request)\n headers = columns.map{|column| column_label_for(type, request, model, column)}\n EnumCSV.csv(model.send(meth, normalized_type, request, :all_results=>true), :headers=>headers) do |obj|\n columns.map{|column| model.column_value(type, request, obj, column)}\n end\n end", "def index\n @inwards = Inward.all\n respond_to do |format|\n format.html\n format.csv { send_data @inwards.to_csv }\n format.xls { send_data @inwards.to_csv(col_sep: \"\\t\") }\n end\n #@inwards = Inward.paginate(:page => params[:page], :per_page => 10)\n end", "def import_csv_full\n \n end", "def index\n @trial_sites = TrialSite.all\n respond_to do |format|\n format.html\n format.csv { send_data @trial_sites.to_csv }\n format.xls { send_data @trial_sites.to_csv(col_sep: \"\\t\") }\n end\n end", "def csv_export_chrono\n csv_string = CSV.generate do |csv|\n\n csv << [ \"Plaque\", \"Equipe\", \"Nom VTT\", \"Prenom VTT\", \"ADN VTT\", \"Nom Route\", \"Prenom Route\", \"ADN Route\", \"Categorie\"]\n\n Team.order_by(:plate).each do |t|\n cat = t.category\n next unless cat\n\n cname = cat.map { |v| v.capitalize }.join('-')\n csv << [ t.plate, t.name, \n t.vtt.profile.name.upcase, t.vtt.profile.surname.capitalize, t.vtt.profile.birth.year, \n t.route.profile.name.upcase, t.route.profile.surname.capitalize, t.route.profile.birth.year, cname]\n end\n end\n\n respond!(csv_string, 200, 'Content-Type' => 'text/csv')\n end", "def get_tier0_bgp_neighbor_routes_in_csv_format_csv_with_http_info(tier_0_id, locale_service_id, neighbor_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv\"\n end\n # verify the required parameter 'neighbor_id' is set\n if @api_client.config.client_side_validation && neighbor_id.nil?\n fail ArgumentError, \"Missing the required parameter 'neighbor_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}/routes?format=csv'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'neighbor-id' + '}', neighbor_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'BgpNeighborRouteDetailsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbor_routes_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_segment_port_mac_table_in_csv(tier_1_id, segment_id, port_id, opts = {})\n data, _status_code, _headers = get_tier1_segment_port_mac_table_in_csv_with_http_info(tier_1_id, segment_id, port_id, opts)\n data\n end", "def export\n @transactions = Transaction.find_all_by_user_id(current_user.id)\n csv = \"\"\n i = 0\n @transactions.each do |trans|\n if (i==0)\n csv += trans.to_csv(true)\n else\n csv += trans.to_csv(false)\n end\n i += 1\n end\n\n respond_to do |format|\n format.csv { send_data csv }\n end\n end", "def index\n @q = Turno.ransack(params[:q])\n @turnos = @q.result\n\n respond_to do |format|\n format.html\n format.pdf do \n render pdf: 'Listado de turnos'\n end \n format.csv do\n send_data @turnos.to_csv\n end\n\n\n end\n end", "def get_tier1_policy_igmp_memberships_in_csv_format_csv_0(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_igmp_memberships_in_csv_format_csv_0_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def index\n @tariffs = Tariff.order(:id)\n\n respond_to do |format|\n format.html\n format.csv { send_data @tariffs.to_csv(:col_sep => \";\") }\n end\n end", "def open_csv(table)\n command = \"mdb-export -bstrip -D '%F %T' -d #{Shellwords.escape(delimiter)} #{file_name} #{table}\"\n Open3.popen3(command) do |stdin, stdout, stderr|\n yield CSV.new(stdout, col_sep: delimiter)\n end\n end", "def generate_csv\n @project = Project.find(params[:id])\n \n content_type = if request.user_agent =~ /windows/i\n ' application/vnd.ms-excel '\n else\n ' text/csv '\n end\n \n project_net = @project.find_all_connections(friend = true, follower = false) \n \n CSV::Writer.generate(output = \"\") do |csv|\n csv << [\"DL n=\" + @project.persons.count.to_s ]\n csv << [\"format = edgelist1\"]\n csv << [\"labels embedded:\"]\n csv << [\"data:\"]\n project_net.each do |entry|\n csv << [entry[0], entry[1], \"1\"]\n end\n @project.persons.each do |person|\n csv << [person.username]\n end\n end\n send_data(output,\n :type => content_type,\n :filename => @project.name.to_s + \"_FF_SNA.csv\")\n end", "def export(params={})\n columns = delimited_string_to_array(Settings.export.travel_fields)\n send_data Travel.export(columns), :filename => \"travel.csv\"\n end", "def create_csv()\n hashes = Transaction.all_as_hashes\n CSV.generate do |csv|\n # Adds the keys as headings on the first line\n csv << hashes.first.keys\n # Iterates through the transactions and populates CSV\n hashes.each do |hash|\n csv << hash.values\n end\n end\n end", "def index\n @clientes = filter(params[:filter]) || Cliente.includes(:plano, :atividades, historicos: [:status_transacao_pag_seguro]).all # Cliente.all\n \n respond_to do |format|\n format.html # show index.html.erb\n format.csv { send_data @clientes.to_csv }\n end\n end", "def index\n @opttrucks = Opttruck.all\n @shortopttrucks = Opttruck.first(100)\n \n respond_to do |format|\n format.html \n format.json\n format.csv { send_data @opttrucks.to_csv }\n\n end\n end", "def csvexport_all_tables\n @wires = Wire.all.sort_by {|obj| obj.kabeltyp}\n @switchgears_einbau = Switchgear.all.sort_by {|obj| obj.kennung}\n @switchgears = Switchgear.where(:typ => 1).sort_by {|obj| obj.kennung}\n @assemblies = Assembly.all.sort_by {|obj| obj.kennung}\n @electrical_installations = ElectricalInstallation.all.sort_by {|obj| obj.kennung}\n @drives = Drive.all.sort_by {|obj| obj.kennung}\n @devices = Device.all.sort_by {|obj| obj.definition}\n @iogroups = Iogroup.all.sort_by {|obj| obj.name}\n @switchgearcombinations = Switchgearcombination.all.sort_by {|obj| obj.name}\n @offertpositions = Offertposition.where(:subsubproject_id => params[:subsubproject_id]).sort_by {|obj| obj.name}\n @subsubproject = Subsubproject.find(params[:subsubproject_id])\n @subsubprojects = @subsubproject.subproject.subsubprojects.sort_by {|obj| obj.name}\n @subsystems = @subsubproject.subproject.project.subsystems.all.sort_by {|obj| obj.name}\n @units = Unit.where(:subsystem_id => @subsystems.pluck(:id)).sort_by {|obj| obj.name}\n\n CSV.open(\"export_all_tables#{Time.now.strftime(\"%Y-%m-%d-%H-%M\")}.csv\", \"wb\", {:headers => true, :encoding => \"iso-8859-1\", :col_sep => \";\"}) do |csv|\n csv << ['Geraetetypen', '']\n @devices.each do |entry| csv << [entry.id, entry.definition] end\n csv << ['SPS-Modultypen', '']\n @assemblies.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Frequenzumrichtertypen', '']\n @drives.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Kabeltypen', '']\n @wires.each do |entry| csv << [entry.id, entry.kabeltyp] end\n csv << ['Elektroinstallationstypen', '']\n @electrical_installations.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Schaltschranktypen', '']\n @switchgears.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Schaltschrankeinbautypen', '']\n @switchgears_einbau.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Schaltgeraetekombinationen', '']\n @switchgearcombinations.each do |entry| csv << [entry.id, entry.name] end\n csv << ['IO-Gruppen', '']\n @iogroups.each do |entry| csv << [entry.id, entry.name] end\n csv << ['Offertpositionen', '']\n @offertpositions.each do |entry| csv << [entry.id, entry.name] end\n csv << ['Teilanlagen', '']\n @subsystems.each do |entry| csv << [entry.id, entry.name] end\n csv << ['TeilanlagenUnits', '']\n @units.each do |entry| csv << [entry.id, entry.name] end\n csv << ['Projektversionen', '']\n @subsubprojects.each do |entry| csv << [entry.id, entry.name] end\n end\n\n redirect_to settings_path, :notice => \"Export wurde unter \" + Rails.root.to_s + \"/ abgelegt!\"\n end", "def export_csv\n export_string = \"#{@id},#{type_string},#{@name.gsub(/[\\,,\\s]/,\"\")},\"\n @details.each{|k,v| export_string << \"#{k}=#{v};\".gsub(/[\\,,\\s]/,\"\") }\n export_string\n end", "def export_csv\n export_string = \"#{@id},#{type_string},#{@name.gsub(/[\\,,\\s]/,\"\")},\"\n @details.each{|k,v| export_string << \"#{k}=#{v};\".gsub(/[\\,,\\s]/,\"\") }\n export_string\n end", "def import_csv_smart\n \n end", "def index\n @pagetitle = \"Suppliers\"\n \n @companies = Company.all\n\n @path = 'suppliers'\n\n @suppliercsv = Supplier.all \n respond_to do |format|\n format.html\n format.csv { send_data @suppliercsv.to_csv }\n \n end\n\n\n end", "def index\n @q = Servidor.ransack(params[:q])\n @q.sorts = 'nome'\n @servidores = @q.result.page params[:page]\n respond_to do |format|\n format.html\n format.csv do\n send_data @servidores.except(:limit, :offset).to_csv, filename: \"concentradores -#{Date.today}.csv\"\n end\n end\n end", "def index\n @localbrs = Localbr.all\n respond_to do |format|\n format.csv { send_data @localbrs.to_csv}\n format.html\n end\n end", "def index\n @transmission_f_records = TransmissionFRecord.all\n\n respond_to do |format|\n format.html\n format.csv { send_data @transmission_f_records.to_csv, filename: \"transmission-f-record-#{Date.today}.csv\" }\n end\n end", "def csv\n @csv_table ||= begin\n csv_raw = File.read(CSV_PATH)\n CSV.parse(csv_raw, headers: true)\n end\n\nend", "def index\n @mobiles = Customer.pluck(:mobile)\n @agents = User.where(\"role = ?\", 2).pluck(:fname, :id)\n @franchises = User.where(\"role = ?\", 1).pluck(:fname, :id)\n @customers_csv = (policy_scope Customer).order(\"id desc\")\n @customers = (policy_scope Customer).order(\"id desc\").page params[:page]\n authorize Customer.new, :index?\n \n respond_to do |format|\n format.html\n format.csv { send_data @customers_csv.as_csv }\n end\n\n\n end", "def get_tier0_bgp_neighbor_routes_in_csv_format_csv_0_with_http_info(tier_0_id, locale_service_id, neighbor_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0\"\n end\n # verify the required parameter 'neighbor_id' is set\n if @api_client.config.client_side_validation && neighbor_id.nil?\n fail ArgumentError, \"Missing the required parameter 'neighbor_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}/routes?format=csv'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'neighbor-id' + '}', neighbor_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'BgpNeighborRouteDetailsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbor_routes_in_csv_format_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def csv(csv_file)\n Slacker.get_csv(csv_file)\n end", "def csv_params\n\n owner_id = owner_id\n owner_id = id if usertype == \"reseller\"\n sep = Confline.get_value(\"CSV_Separator\", owner_id).to_s\n dec = Confline.get_value(\"CSV_Decimal\", owner_id).to_s\n\n sep = Confline.get_value(\"CSV_Separator\", 0).to_s if sep.to_s.length == 0\n dec = Confline.get_value(\"CSV_Decimal\", 0).to_s if dec.to_s.length == 0\n\n sep = \",\" if sep.blank?\n dec = \".\" if dec.blank?\n\n return sep, dec\n end", "def get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_with_http_info(tier_0_id, locale_service_id, neighbor_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv\"\n end\n # verify the required parameter 'neighbor_id' is set\n if @api_client.config.client_side_validation && neighbor_id.nil?\n fail ArgumentError, \"Missing the required parameter 'neighbor_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}/advertised-routes?format=csv'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'neighbor-id' + '}', neighbor_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'BgpNeighborRouteDetailsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @vendor_profiles = VendorProfile.all\n \n respond_to do |format|\n format.html\n format.csv { send_data @vendor_profiles.as_csv } \n end\n end", "def getToolsSyndicateFactualcsv( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"get\",\"/tools/syndicate/factualcsv\",params)\n end", "def csvString\n resultColumns = self.generateResultColumns\n headers = resultColumns[:columns].keys\n # Start off instantiating the csv string with the header values\n csvString = headers.map{|s| self.filterValue(s)}.join(@options[:delimiter])\n\n # Now iterate over each row, sticking its value under each header\n (0..resultColumns[:maxRowIndex]).each do |rowIndex|\n csvString << \"\\r\\n\"\n csvString << headers.map{ |header|\n self.filterValue(resultColumns[:columns][header][rowIndex])\n }.join(@options[:delimiter])\n end\n return csvString\n end", "def csv\n @records = Reply.all\n csv_string = FasterCSV.generate do |csv|\n csv << %w{Code Name Email Engagement Engagement_Adults Engagement_Children Wedding Wedding_Adults Wedding_Children Camping Diet Notes Updated}\n @records.each do |line|\n csv << [\n line['code'],\n line['name'], \n line['email'],\n line['engagement'],\n line['engagement_adults'],\n line['engagement_children'],\n line['wedding'],\n line['wedding_adults'],\n line['wedding_children'],\n line['camping'],\n line['diet'],\n line['notes'],\n line['updated_at']\n ]\n end\n end\n filename = \"rsvp_download\" + Time.now.strftime(\"%d%m%y-%H%M\").to_s + \".csv\"\n send_data(csv_string,\n :type => 'text/csv; charset=utf-8; header=present',\n :filename => filename)\n end", "def csv\n send_data(Map.to_csv, {:filename => \"maps.csv\" })\n end", "def index\n @candidatos = Candidato.all\n respond_to do |format|\n format.html\n format.csv { send_data @candidatos.to_csv }\n #format.xls \n end\n end", "def read_tier1_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Tier1')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#read_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def fee_reciepts_export_csv\n parameters={:search => params[:search] ,:filename => filename}\n csv_export('finance_transaction', 'fee_reciepts_export', parameters) \n end", "def genCsvRowSpeed()\n row = configIndex() ;\n row.push(getAveSpeed()) ;\n return row ;\n end", "def clients_csv(options = {})\n CSV.generate(options) do |csv|\n csv << ['Nombre', 'INE', 'Teléfono', 'Dirección']\n all.find_each do |client|\n csv << [\n client.full_name,\n client.ine,\n client.phone,\n client.address\n ]\n client.client_services.find_each do |service|\n csv << ['Servicios']\n csv << ['ID', 'Descripcion', 'Total']\n csv << [\n service.id,\n service.description,\n service.total.to_s\n ]\n end\n client.client_printers.find_each do |printer|\n csv << ['Impresoras']\n csv << ['ID', 'Descripcion', 'Total']\n csv << [\n printer.id,\n printer.adquisition_date\n ]\n end\n client.product_sales.find_each do |sale|\n csv << ['Compras']\n csv << ['ID', 'Fecha Compra', 'Cantidad']\n csv << [\n sale.id,\n sale.sale_date,\n sale.quantity\n ]\n end\n end\n end\n end", "def csv_output_path()\n return @base_path\n end", "def csv\n claim_filter = ClaimFilter.new()\n claim_filter.restore_from_session(session,:claim_filter)\n claim_filter.organisation_id = params[:id].to_i\n\n content_type = ( request.user_agent =~ /windows/i ? 'application/vnd.ms-excel' : 'text/csv' )\n content = Claim.csv_by_filter(claim_filter)\n send_data(content,:type => content_type, :filename => 'claims.csv' )\n end", "def index\n @repairs = Repair.all.includes(:driver, :bus)\n\n respond_to do |format|\n format.html\n format.csv { send_data @repairs.to_csv, filename: \"jobcards-#{Date.today}.csv\" }\n end\n end", "def table_csv_string(options = {})\n opt = {\n :klass => nil,\n :header_row => true\n }.merge!(options)\n str = ''\n \n return false if !opt[:klass]\n\n klass_name = opt[:klass].name\n tbl = ActiveSupport::Inflector.tableize(opt[:klass].name.to_s)\n\n cols = []\n sql = ''\n\n if klass_name == \"Person\" \n cols = %w(id last_name first_name middle_name login)\n else\n cols = opt[:klass].columns.map(&:name) \n end\n\n cols_str = cols.join(\", \")\n\n case opt[:klass].name\n when \"Person\"\n sql = \"SELECT #{cols_str} FROM people p INNER JOIN people_projs pp on p.id = pp.person_id WHERE pp.proj_id = #{self.id};\"\n when \"Ref\"\n cols_str = cols.collect{|c| \"r.#{c}\"}.join(\", \") # refs shared across projects, be more explicit for the join table\n sql = \"SELECT #{cols_str} FROM refs r INNER JOIN projs_refs pr on r.id = pr.ref_id WHERE pr.proj_id = #{self.id};\"\n when \"TaxonName\"\n sql = \"SELECT #{cols_str} FROM taxon_names WHERE #{self.sql_for_taxon_names}\"\n when \"Author\"\n sql = \"SELECT #{cols_str} FROM authors a WHERE a.ref_id IN (SELECT r.id FROM refs r INNER JOIN projs_refs pr on r.id = pr.ref_id WHERE pr.proj_id = #{self.id})\"\n when \"ChrState\"\n sql = \"SELECT #{cols_str} FROM chr_states cs WHERE cs.chr_id IN (SELECT chrs.id from chrs WHERE chrs.proj_id = #{self.id})\" \n # when \"Identifier\"\n # sql = \"SELECT #{cols_str} FROM identifiers si WHERE si.specimen_id IN (SELECT specimens.id from specimens WHERE specimens.proj_id = #{self.id})\"\n when \"SpecimenDetermination\"\n sql = \"SELECT #{cols_str} FROM specimen_determinations sd WHERE sd.specimen_id IN (SELECT specimens.id from specimens WHERE specimens.proj_id = #{self.id})\"\n\n else\n sql = \"SELECT #{cols_str} FROM #{tbl}\" \n end\n\n # add the project level restrictions if they exist\n sql << \" WHERE proj_id = #{self.id}\" if opt[:klass].columns.collect{|c| c.name}.include?(\"proj_id\")\n\n # build the str\n str << cols.join(\"\\t\") if opt[:header_row]# the header row\n str << \"\\n\"\n\n ActiveRecord::Base.connection.select_rows(sql).each do |row| \n # not filtering for tab characters here, likely should\n str << row.collect{|c| c == nil ? nil : c.gsub(/\\n|\\r\\n|\\r/, '\\n')}.join(\"\\t\") + \"\\n\"\n end\n str\n end", "def genCsvRowSummary()\n row = configIndex() ;\n\n row.push(getAveSpeed()) ;\n row.push(getShareRatio()) ;\n row.push(getCumulativeShare()) ;\n return row ;\n end", "def extract_heads(name_table)\n headers = CSV.read(name_table, { :headers => true, :skip_blanks => true, encoding:'iso-8859-1:utf-8',:row_sep => :auto, :col_sep => \";\"}).headers\n @heads = headers\n end", "def index\n @linhkiens = Linhkien.all\n @linhkien = Linhkien.new\n respond_to do |format|\n format.html\n format.csv { send_data @linhkiens.to_csv }\n format.xls # { send_data @products.to_csv(col_sep: \"\\t\") }\n end\n end", "def getRoutingtable(hostMap, native, fileName)\n\tnodes = $dist.keys;\n\tputs nodes\n\tif fileName == nil then\n\t\tfileName = \"routingTable.csv\"\n\tend\n\tFile.open(fileName, \"w\") do |f|\n\t\tfor i in 0..nodes.length - 1\n\t\t\tvalue = nodes[i];\n\t\t\t\tif value == native then\n\t\t\t\t\tnativeIp = Socket.getaddrinfo(\"localhost\",nil)[0][3]\n\t\t\t\t\tf.puts \"#{nativeIp},#{nativeIp},#{native},0\"\n\t\t\t\telse\n\t\t\t\t\tipAddr = hostMap[value];\n\t\t\t\t\tf.puts \"#{ipAddr[1]},#{ipAddr[0]},#{$nextNode[value]},#{$dist[value]}\";\n\t\t\t\tend\t\n\t\tend\n\tend\nend", "def csv_for_company\n filter = params[:filter]\n company_name = Company.find(params[:company_id]).name\n csv_name = filter.present? ?\n \"#{company_name}_operations_filtered_by_#{filter}.csv\" :\n \"#{company_name}_operations.csv\"\n respond_to do |format|\n format.csv { send_data to_csv ,filename: csv_name}\n end\n end", "def genCsvSpeed()\n csv = [] ;\n to_a.each{|analyzer|\n csv.push(analyzer.genCsvRowSpeed()) ;\n }\n return csv ;\n end", "def fetch_csv\n convert_to_csv(fetch)\n end", "def list_tier1_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'Tier1ListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#list_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @casein_page_title = 'Fees'\n @fees = Fee.order(sort_order(:courseformat_id)).paginate :page => params[:page]\n respond_to do |format|\n format.html\n format.csv { send_data Fee.all.to_csv, filename: \"fees-#{Date.today}.csv\"}\n format.xlsx\n end\n end", "def index\n @registrations = Registration.current.order('seat_number')\n respond_to do |format|\n format.html\n format.csv { send_data @registrations.to_csv }\n end\n end", "def index\n @providers = Provider.all\n\n respond_to do |format|\n format.html\n format.csv { send_data Provider.to_csv }\n end\n end", "def download_heat_tsv\n heat = params[:heat_number]\n exporter = Exporters::Competition::Swiss.new(@competition, heat)\n csv_string = TsvGenerator.new(exporter).generate\n\n filename = \"#{@competition.to_s.parameterize}_heat_#{heat}.txt\"\n send_data(csv_string,\n type: 'text/csv; charset=utf-8; header=present',\n filename: filename)\n end", "def get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0_with_http_info(tier_0_id, locale_service_id, neighbor_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0\"\n end\n # verify the required parameter 'neighbor_id' is set\n if @api_client.config.client_side_validation && neighbor_id.nil?\n fail ArgumentError, \"Missing the required parameter 'neighbor_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}/advertised-routes?format=csv'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'neighbor-id' + '}', neighbor_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'BgpNeighborRouteDetailsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_cloudkit_participants_csv\n to_return = [AppleCloudKitShareParticipant.to_csv_headers]\n @cloud_kit_participants.each do |key, participant|\n to_return.push(participant.to_csv)\n end\n to_return\n end" ]
[ "0.7501166", "0.73362494", "0.73132205", "0.6424593", "0.6279723", "0.6238052", "0.6221068", "0.6200105", "0.6178392", "0.6168175", "0.61543816", "0.6048137", "0.60450304", "0.5966902", "0.5710236", "0.57012016", "0.5610148", "0.5587682", "0.555284", "0.5548864", "0.5545675", "0.5545145", "0.5502168", "0.54993457", "0.54933405", "0.54634696", "0.545388", "0.543877", "0.5418954", "0.54013395", "0.53245413", "0.52338165", "0.5174834", "0.51257294", "0.5086115", "0.50610983", "0.5040419", "0.5016875", "0.49924153", "0.49589375", "0.49530348", "0.49493676", "0.49456117", "0.4936999", "0.49318674", "0.49224633", "0.49151504", "0.4907026", "0.4892473", "0.4890788", "0.48862898", "0.48830628", "0.48807475", "0.48767385", "0.4874028", "0.4866383", "0.48633897", "0.48608643", "0.48460427", "0.48446968", "0.48446968", "0.48402825", "0.48397958", "0.48289895", "0.48239094", "0.4823295", "0.48187852", "0.4806776", "0.4804164", "0.48002824", "0.47907615", "0.47884443", "0.47867826", "0.47789136", "0.47751644", "0.47587615", "0.47556084", "0.47540644", "0.47515884", "0.47460085", "0.47424665", "0.47409284", "0.47313297", "0.4725089", "0.47225535", "0.47205314", "0.47126606", "0.46957472", "0.46914607", "0.46877393", "0.46869266", "0.46837962", "0.4683124", "0.4682994", "0.46823883", "0.46814683", "0.46807882", "0.4679876", "0.46793708", "0.46778452" ]
0.7411981
1
Get forwarding table from tier1 in CSV format Get forwarding table from tier1 gateway in CSV format.
def get_tier1_forwarding_table_csv_0(tier_1_id, opts = {}) data, _status_code, _headers = get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tier1_forwarding_table_csv(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/forwarding-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'GatewayRouteTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/forwarding-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'GatewayRouteTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_policy_multicast_forwarding_in_csv_format_csv_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/forwarding?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'PolicyMulticastForwardingInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_multicast_forwarding_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_policy_multicast_forwarding_in_csv_format_csv_0_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/forwarding?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'PolicyMulticastForwardingInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_multicast_forwarding_in_csv_format_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/forwarding-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'RoutingTableListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/forwarding-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'RoutingTableListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_policy_multicast_forwarding_in_csv_format_csv(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_multicast_forwarding_in_csv_format_csv_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def get_tier1_policy_multicast_forwarding_in_csv_format_csv_0(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_multicast_forwarding_in_csv_format_csv_0_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def get_tier1_interface_arp_table_csv_0(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_csv_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def get_tier1_forwarding_table(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_forwarding_table_0(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_interface_arp_table_csv(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_csv_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def table_1\n @table1 = read_table(File.join(FILE_PATH, \"Lgr_prelim_FPKM.txt\"))\n #send_file(File.join(FILE_PATH, \"Lgr_prelim_FPKM.txt\"), :type => 'text/csv', :disposition => 'inline')\n end", "def get_tier1_segment_port_mac_table_in_csv_with_http_info(tier_1_id, segment_id, port_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv\"\n end\n # verify the required parameter 'port_id' is set\n if @api_client.config.client_side_validation && port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'port_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv\"\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 = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/ports/{port-id}/mac-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s).sub('{' + 'port-id' + '}', port_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?\n query_params[:'transport_node_id'] = opts[:'transport_node_id'] if !opts[:'transport_node_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'SegmentPortMacAddressCsvListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentPortsMACTableApi#get_tier1_segment_port_mac_table_in_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_segment_port_mac_table_in_csv_0_with_http_info(tier_1_id, segment_id, port_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv_0\"\n end\n # verify the required parameter 'port_id' is set\n if @api_client.config.client_side_validation && port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'port_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv_0\"\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 = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/ports/{port-id}/mac-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s).sub('{' + 'port-id' + '}', port_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?\n query_params[:'transport_node_id'] = opts[:'transport_node_id'] if !opts[:'transport_node_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'SegmentPortMacAddressCsvListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentPortsMACTableApi#get_tier1_segment_port_mac_table_in_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_in_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_interface_arp_table_csv_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_logical_router_port_arp_table_in_csv_format_csv_with_http_info(logical_router_port_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi.get_logical_router_port_arp_table_in_csv_format_csv ...'\n end\n # verify the required parameter 'logical_router_port_id' is set\n if @api_client.config.client_side_validation && logical_router_port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_port_id' when calling ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi.get_logical_router_port_arp_table_in_csv_format_csv\"\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 = '/logical-router-ports/{logical-router-port-id}/arp-table?format=csv'.sub('{' + 'logical-router-port-id' + '}', logical_router_port_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?\n query_params[:'transport_node_id'] = opts[:'transport_node_id'] if !opts[:'transport_node_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'LogicalRouterPortArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi#get_logical_router_port_arp_table_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_policy_igmp_memberships_in_csv_format_csv_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/igmp-memberships?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'IgmpMembershipsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_igmp_memberships_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_policy_igmp_memberships_in_csv_format_csv_0_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/igmp-memberships?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'IgmpMembershipsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_igmp_memberships_in_csv_format_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_segment_interface_arp_table_csv_0(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_segment_interface_arp_table_csv_0_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def get_tier1_interface_arp_table_csv_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_0_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_in_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @trainers = Trainer.paginate(:page => params[:page]).order(email_dirigeant: :desc, crawled_for_email: :desc)\n respond_to do |format|\n format.html\n format.csv { send_data Trainer.all.to_csv}\n end\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_in_csv_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def get_segment_interface_arp_table_csv_0_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_segment_interface_arp_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_segment_interface_arp_table_csv_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_segment_interface_arp_table_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_segment_interface_arp_table_csv(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_segment_interface_arp_table_csv_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_0(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_in_csv_0_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def download_table\n params = download_table_params\n table_name = params[:table_name].parameterize.underscore\n action_name = table_name + \"_table\"\n table_url = self.send(\"#{table_name}_table_admin_reports_path\") + \".csv\"\n filters = params.except(:table_name).to_h\n \n redirect_to({\n controller: 'reports', \n action: action_name, \n format: :csv\n }.merge(filters))\n end", "def dump_table(client, fusion_tables, fusion_table_id, backup_directory)\n backup_directory ||= \"backups\"\n FileUtils.mkdir_p backup_directory\n\n fusion_table = client.execute(\n :api_method => fusion_tables.table.get,\n :parameters => {'tableId' => \"#{fusion_table_id}\"}\n )\n fusion_table.data.to_hash\n filename = File.join(backup_directory ,\"#{fusion_table.data.to_hash['name']}-#{fusion_table_id}\")\n $stderr.puts filename\n\n File.open(\"#{filename}.json\",\"w\") do |f|\n f.write(JSON.pretty_generate(fusion_table.data.to_hash))\n end\n\n result = client.execute(\n :api_method => fusion_tables.query.sql_get,\n :parameters => {'sql' => \"SELECT * FROM #{fusion_table_id}\"}\n )\n fusion_table_data = result.data.to_hash\n\n if fusion_table_data['error']\n if fusion_table_data['error']['errors'][0]['reason'] == 'responseSizeTooLarge'\n # use Fusion Tables V2 media downloads API\n result = client.execute(\n :api_method => fusion_tables.query.sql_get,\n :parameters => {'sql' => \"SELECT * FROM #{fusion_table_id}\", 'alt' => 'media'}\n )\n File.open(\"#{filename}.csv\", 'w') { |file| file.write(result.response.body) }\n else\n $stderr.puts \"Unhandled Error:\"\n $stderr.puts fusion_table_data.inspect\n end\n else\n CSV.open(\"#{filename}.csv\", 'w') do |csv|\n if fusion_table_data['rows'] && (fusion_table_data['rows'].length > 0)\n csv << fusion_table_data['columns']\n fusion_table_data['rows'].each do |row|\n csv << row\n end\n end\n end\n end\nend", "def data(table)\n CSV.parse(%x[mdb-export CRBE.mdb #{table}])[1..-1]\nend", "def index\n @trucks = Truck.all.order(:NB_PLATE)\n if Truck != nil and Truck.all.size>0 \n @details = Truck.order(:NB_PLATE).first(20)\n \n\n\n respond_to do |format|\n format.html\n format.csv { send_data @trucks.to_csv, filename: \"trucks-#{Time.now.strftime('s%S/m%M/h%H/')+Date.today.strftime('d%d/m%m/y%Y')}.csv\" }\n format.xls #{ send_data @trucks.to_csv(col_sep: \"\\t\") }\n end\n end\n end", "def transactions\n csv_string = \"\"\n checks.each_with_index do |check, index|\n csv = \"\"\n check_klass = OutputCsv.class_for(\"Check\", check.batch.facility)\n puts \"Applying class #{check_klass}\" if index == 0\n check_obj = check_klass.new(check, index)\n csv = check_obj.generate\n csv_string = csv_string + csv\n # For the first iteration, inorder to execute both header creation and first row writing, generate method is called once more\n if index == 0\n check_obj = check_klass.new(check, 1)\n csv = check_obj.generate\n csv_string = csv_string + csv\n end\n end\n return csv_string\n end", "def csv_report\n tire_cols = params[:tire] || {}\n ar_cols = params[:activerecord] || {}\n assocs_to_include = params[:assoc][:include] || {}\n params[:assoc][:max] ||= {}\n klass = model_class.constantize\n @filename = \"#{model_class.humanize}.csv\"\n\n response.headers['Content-Type'] ||= 'text/plain'\n response.headers['Content-Disposition'] = \"attachment; filename=#{@filename}\"\n response.headers['Content-Transfer-Encoding'] = 'binary'\n response.headers['Last-Modified'] = Time.now.to_s\n\n # Right, try to define a header:\n header = []\n tire_cols.keys.each { |x| header.push(x.humanize) }\n ar_cols.keys.each { |x| header.push(x.humanize) }\n assocs_to_include.keys.each do |assoc|\n if params[:assoc][:max][assoc] == 'join' # Is a has_many with only one real column\n header.push params[:assoc][assoc.to_sym].keys.first\n elsif params[:assoc][:max][assoc] # has_many\n (1 .. (params[:assoc][:max][assoc].to_i)).each do |i|\n params[:assoc][assoc.to_sym].keys.each do |k|\n header.push(\"#{assoc.singularize.humanize} #{i} #{k.humanize}\")\n end\n end\n else # has_a\n params[:assoc][assoc.to_sym].keys.each do |k| # Each key requested from the associated record\n header.push \"#{assoc.humanize} #{k.humanize}\"\n end\n end\n end\n\n results = klass.search({ per: TireSearch::INFINITY }, 1, '')\n self.response_body = Enumerator.new do |y|\n results.each_with_index do |result, i|\n y << header.to_csv if i == 0\n\n line = []\n tire_cols.keys.each { |x| line.push(result[x]) }\n\n result = result.load if ar_cols.count > 0 || assocs_to_include.keys.count > 0\n\n ar_cols.keys.each { |x| line.push(result.send(x)) } if ar_cols.count > 0\n\n assocs_to_include.keys.each do |assoc|\n related = result.send(assoc)\n if params[:assoc][:max][assoc] == 'join' # Is a has_many with only one real column\n col = params[:assoc][assoc.to_sym].keys.first\n line.push related.map { |x| x.send(col) }.join(' // ')\n elsif params[:assoc][:max][assoc]\n (0 .. (params[:assoc][:max][assoc].to_i - 1)).each do |j|\n params[:assoc][assoc.to_sym].keys.each do |k|\n line.push(related[j] ? related[j].send(k) : nil)\n end\n end\n else\n params[:assoc][assoc.to_sym].keys.each do |k| # Each key requested from the associated record\n line.push related ? related.send(k) : nil\n end\n end\n end\n y << line.to_csv\n GC.start if i % 500 == 0\n end\n end\n end", "def grab_lookup_table(csv_url)\n cmd = `curl #{csv_url} -s`\n csv = cmd.gsub(\"\\r\",\"\\n\").split(/\\n+/).map{ |x| x.split(\",\")}\n table = {}\n csv.each {|row| table[row[0]] = row[1]}\n return table\n end", "def table\n Airmodel.client.table base_config[:base_id], base_config[:table_name]\n end", "def get_table(table, env=nil)\n require 'net/http'\n http_config = get_remote_credentials(env)\n ret = false\n Net::HTTP.start(http_config['server_name'], http_config['server_port']) {|http|\n req = Net::HTTP::Get.new(\"/dumps/#{table}.txt\")\n req.basic_auth http_config['http_user'], http_config['http_pass']\n resp = http.request(req)\n ret = tab_to_array_of_hashes(resp.body) if resp.code == '200'\n }\n ret\n end", "def get_tier1_segment_port_mac_table_in_csv_0(tier_1_id, segment_id, port_id, opts = {})\n data, _status_code, _headers = get_tier1_segment_port_mac_table_in_csv_0_with_http_info(tier_1_id, segment_id, port_id, opts)\n data\n end", "def atop_csv\n \"#{@archive_root}/#{master.hostname}/atop_log_#{@gatling_scenario.downcase.gsub('.', '_')}.csv\"\n end", "def csv(meth)\n @output_type = 'csv'\n @output_filename = \"#{model.link.downcase}_#{normalized_type}.csv\"\n columns = model.columns_for(type, request)\n headers = columns.map{|column| column_label_for(type, request, model, column)}\n EnumCSV.csv(model.send(meth, normalized_type, request, :all_results=>true), :headers=>headers) do |obj|\n columns.map{|column| model.column_value(type, request, obj, column)}\n end\n end", "def index\n @inwards = Inward.all\n respond_to do |format|\n format.html\n format.csv { send_data @inwards.to_csv }\n format.xls { send_data @inwards.to_csv(col_sep: \"\\t\") }\n end\n #@inwards = Inward.paginate(:page => params[:page], :per_page => 10)\n end", "def import_csv_full\n \n end", "def index\n @trial_sites = TrialSite.all\n respond_to do |format|\n format.html\n format.csv { send_data @trial_sites.to_csv }\n format.xls { send_data @trial_sites.to_csv(col_sep: \"\\t\") }\n end\n end", "def csv_export_chrono\n csv_string = CSV.generate do |csv|\n\n csv << [ \"Plaque\", \"Equipe\", \"Nom VTT\", \"Prenom VTT\", \"ADN VTT\", \"Nom Route\", \"Prenom Route\", \"ADN Route\", \"Categorie\"]\n\n Team.order_by(:plate).each do |t|\n cat = t.category\n next unless cat\n\n cname = cat.map { |v| v.capitalize }.join('-')\n csv << [ t.plate, t.name, \n t.vtt.profile.name.upcase, t.vtt.profile.surname.capitalize, t.vtt.profile.birth.year, \n t.route.profile.name.upcase, t.route.profile.surname.capitalize, t.route.profile.birth.year, cname]\n end\n end\n\n respond!(csv_string, 200, 'Content-Type' => 'text/csv')\n end", "def get_tier0_bgp_neighbor_routes_in_csv_format_csv_with_http_info(tier_0_id, locale_service_id, neighbor_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv\"\n end\n # verify the required parameter 'neighbor_id' is set\n if @api_client.config.client_side_validation && neighbor_id.nil?\n fail ArgumentError, \"Missing the required parameter 'neighbor_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}/routes?format=csv'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'neighbor-id' + '}', neighbor_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'BgpNeighborRouteDetailsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbor_routes_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_segment_port_mac_table_in_csv(tier_1_id, segment_id, port_id, opts = {})\n data, _status_code, _headers = get_tier1_segment_port_mac_table_in_csv_with_http_info(tier_1_id, segment_id, port_id, opts)\n data\n end", "def export\n @transactions = Transaction.find_all_by_user_id(current_user.id)\n csv = \"\"\n i = 0\n @transactions.each do |trans|\n if (i==0)\n csv += trans.to_csv(true)\n else\n csv += trans.to_csv(false)\n end\n i += 1\n end\n\n respond_to do |format|\n format.csv { send_data csv }\n end\n end", "def index\n @q = Turno.ransack(params[:q])\n @turnos = @q.result\n\n respond_to do |format|\n format.html\n format.pdf do \n render pdf: 'Listado de turnos'\n end \n format.csv do\n send_data @turnos.to_csv\n end\n\n\n end\n end", "def get_tier1_policy_igmp_memberships_in_csv_format_csv_0(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_igmp_memberships_in_csv_format_csv_0_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def index\n @tariffs = Tariff.order(:id)\n\n respond_to do |format|\n format.html\n format.csv { send_data @tariffs.to_csv(:col_sep => \";\") }\n end\n end", "def open_csv(table)\n command = \"mdb-export -bstrip -D '%F %T' -d #{Shellwords.escape(delimiter)} #{file_name} #{table}\"\n Open3.popen3(command) do |stdin, stdout, stderr|\n yield CSV.new(stdout, col_sep: delimiter)\n end\n end", "def generate_csv\n @project = Project.find(params[:id])\n \n content_type = if request.user_agent =~ /windows/i\n ' application/vnd.ms-excel '\n else\n ' text/csv '\n end\n \n project_net = @project.find_all_connections(friend = true, follower = false) \n \n CSV::Writer.generate(output = \"\") do |csv|\n csv << [\"DL n=\" + @project.persons.count.to_s ]\n csv << [\"format = edgelist1\"]\n csv << [\"labels embedded:\"]\n csv << [\"data:\"]\n project_net.each do |entry|\n csv << [entry[0], entry[1], \"1\"]\n end\n @project.persons.each do |person|\n csv << [person.username]\n end\n end\n send_data(output,\n :type => content_type,\n :filename => @project.name.to_s + \"_FF_SNA.csv\")\n end", "def export(params={})\n columns = delimited_string_to_array(Settings.export.travel_fields)\n send_data Travel.export(columns), :filename => \"travel.csv\"\n end", "def create_csv()\n hashes = Transaction.all_as_hashes\n CSV.generate do |csv|\n # Adds the keys as headings on the first line\n csv << hashes.first.keys\n # Iterates through the transactions and populates CSV\n hashes.each do |hash|\n csv << hash.values\n end\n end\n end", "def index\n @clientes = filter(params[:filter]) || Cliente.includes(:plano, :atividades, historicos: [:status_transacao_pag_seguro]).all # Cliente.all\n \n respond_to do |format|\n format.html # show index.html.erb\n format.csv { send_data @clientes.to_csv }\n end\n end", "def index\n @opttrucks = Opttruck.all\n @shortopttrucks = Opttruck.first(100)\n \n respond_to do |format|\n format.html \n format.json\n format.csv { send_data @opttrucks.to_csv }\n\n end\n end", "def csvexport_all_tables\n @wires = Wire.all.sort_by {|obj| obj.kabeltyp}\n @switchgears_einbau = Switchgear.all.sort_by {|obj| obj.kennung}\n @switchgears = Switchgear.where(:typ => 1).sort_by {|obj| obj.kennung}\n @assemblies = Assembly.all.sort_by {|obj| obj.kennung}\n @electrical_installations = ElectricalInstallation.all.sort_by {|obj| obj.kennung}\n @drives = Drive.all.sort_by {|obj| obj.kennung}\n @devices = Device.all.sort_by {|obj| obj.definition}\n @iogroups = Iogroup.all.sort_by {|obj| obj.name}\n @switchgearcombinations = Switchgearcombination.all.sort_by {|obj| obj.name}\n @offertpositions = Offertposition.where(:subsubproject_id => params[:subsubproject_id]).sort_by {|obj| obj.name}\n @subsubproject = Subsubproject.find(params[:subsubproject_id])\n @subsubprojects = @subsubproject.subproject.subsubprojects.sort_by {|obj| obj.name}\n @subsystems = @subsubproject.subproject.project.subsystems.all.sort_by {|obj| obj.name}\n @units = Unit.where(:subsystem_id => @subsystems.pluck(:id)).sort_by {|obj| obj.name}\n\n CSV.open(\"export_all_tables#{Time.now.strftime(\"%Y-%m-%d-%H-%M\")}.csv\", \"wb\", {:headers => true, :encoding => \"iso-8859-1\", :col_sep => \";\"}) do |csv|\n csv << ['Geraetetypen', '']\n @devices.each do |entry| csv << [entry.id, entry.definition] end\n csv << ['SPS-Modultypen', '']\n @assemblies.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Frequenzumrichtertypen', '']\n @drives.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Kabeltypen', '']\n @wires.each do |entry| csv << [entry.id, entry.kabeltyp] end\n csv << ['Elektroinstallationstypen', '']\n @electrical_installations.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Schaltschranktypen', '']\n @switchgears.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Schaltschrankeinbautypen', '']\n @switchgears_einbau.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Schaltgeraetekombinationen', '']\n @switchgearcombinations.each do |entry| csv << [entry.id, entry.name] end\n csv << ['IO-Gruppen', '']\n @iogroups.each do |entry| csv << [entry.id, entry.name] end\n csv << ['Offertpositionen', '']\n @offertpositions.each do |entry| csv << [entry.id, entry.name] end\n csv << ['Teilanlagen', '']\n @subsystems.each do |entry| csv << [entry.id, entry.name] end\n csv << ['TeilanlagenUnits', '']\n @units.each do |entry| csv << [entry.id, entry.name] end\n csv << ['Projektversionen', '']\n @subsubprojects.each do |entry| csv << [entry.id, entry.name] end\n end\n\n redirect_to settings_path, :notice => \"Export wurde unter \" + Rails.root.to_s + \"/ abgelegt!\"\n end", "def export_csv\n export_string = \"#{@id},#{type_string},#{@name.gsub(/[\\,,\\s]/,\"\")},\"\n @details.each{|k,v| export_string << \"#{k}=#{v};\".gsub(/[\\,,\\s]/,\"\") }\n export_string\n end", "def export_csv\n export_string = \"#{@id},#{type_string},#{@name.gsub(/[\\,,\\s]/,\"\")},\"\n @details.each{|k,v| export_string << \"#{k}=#{v};\".gsub(/[\\,,\\s]/,\"\") }\n export_string\n end", "def import_csv_smart\n \n end", "def index\n @pagetitle = \"Suppliers\"\n \n @companies = Company.all\n\n @path = 'suppliers'\n\n @suppliercsv = Supplier.all \n respond_to do |format|\n format.html\n format.csv { send_data @suppliercsv.to_csv }\n \n end\n\n\n end", "def index\n @q = Servidor.ransack(params[:q])\n @q.sorts = 'nome'\n @servidores = @q.result.page params[:page]\n respond_to do |format|\n format.html\n format.csv do\n send_data @servidores.except(:limit, :offset).to_csv, filename: \"concentradores -#{Date.today}.csv\"\n end\n end\n end", "def index\n @localbrs = Localbr.all\n respond_to do |format|\n format.csv { send_data @localbrs.to_csv}\n format.html\n end\n end", "def index\n @transmission_f_records = TransmissionFRecord.all\n\n respond_to do |format|\n format.html\n format.csv { send_data @transmission_f_records.to_csv, filename: \"transmission-f-record-#{Date.today}.csv\" }\n end\n end", "def csv\n @csv_table ||= begin\n csv_raw = File.read(CSV_PATH)\n CSV.parse(csv_raw, headers: true)\n end\n\nend", "def index\n @mobiles = Customer.pluck(:mobile)\n @agents = User.where(\"role = ?\", 2).pluck(:fname, :id)\n @franchises = User.where(\"role = ?\", 1).pluck(:fname, :id)\n @customers_csv = (policy_scope Customer).order(\"id desc\")\n @customers = (policy_scope Customer).order(\"id desc\").page params[:page]\n authorize Customer.new, :index?\n \n respond_to do |format|\n format.html\n format.csv { send_data @customers_csv.as_csv }\n end\n\n\n end", "def get_tier0_bgp_neighbor_routes_in_csv_format_csv_0_with_http_info(tier_0_id, locale_service_id, neighbor_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0\"\n end\n # verify the required parameter 'neighbor_id' is set\n if @api_client.config.client_side_validation && neighbor_id.nil?\n fail ArgumentError, \"Missing the required parameter 'neighbor_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}/routes?format=csv'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'neighbor-id' + '}', neighbor_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'BgpNeighborRouteDetailsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbor_routes_in_csv_format_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def csv(csv_file)\n Slacker.get_csv(csv_file)\n end", "def csv_params\n\n owner_id = owner_id\n owner_id = id if usertype == \"reseller\"\n sep = Confline.get_value(\"CSV_Separator\", owner_id).to_s\n dec = Confline.get_value(\"CSV_Decimal\", owner_id).to_s\n\n sep = Confline.get_value(\"CSV_Separator\", 0).to_s if sep.to_s.length == 0\n dec = Confline.get_value(\"CSV_Decimal\", 0).to_s if dec.to_s.length == 0\n\n sep = \",\" if sep.blank?\n dec = \".\" if dec.blank?\n\n return sep, dec\n end", "def get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_with_http_info(tier_0_id, locale_service_id, neighbor_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv\"\n end\n # verify the required parameter 'neighbor_id' is set\n if @api_client.config.client_side_validation && neighbor_id.nil?\n fail ArgumentError, \"Missing the required parameter 'neighbor_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}/advertised-routes?format=csv'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'neighbor-id' + '}', neighbor_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'BgpNeighborRouteDetailsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @vendor_profiles = VendorProfile.all\n \n respond_to do |format|\n format.html\n format.csv { send_data @vendor_profiles.as_csv } \n end\n end", "def getToolsSyndicateFactualcsv( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"get\",\"/tools/syndicate/factualcsv\",params)\n end", "def csvString\n resultColumns = self.generateResultColumns\n headers = resultColumns[:columns].keys\n # Start off instantiating the csv string with the header values\n csvString = headers.map{|s| self.filterValue(s)}.join(@options[:delimiter])\n\n # Now iterate over each row, sticking its value under each header\n (0..resultColumns[:maxRowIndex]).each do |rowIndex|\n csvString << \"\\r\\n\"\n csvString << headers.map{ |header|\n self.filterValue(resultColumns[:columns][header][rowIndex])\n }.join(@options[:delimiter])\n end\n return csvString\n end", "def csv\n @records = Reply.all\n csv_string = FasterCSV.generate do |csv|\n csv << %w{Code Name Email Engagement Engagement_Adults Engagement_Children Wedding Wedding_Adults Wedding_Children Camping Diet Notes Updated}\n @records.each do |line|\n csv << [\n line['code'],\n line['name'], \n line['email'],\n line['engagement'],\n line['engagement_adults'],\n line['engagement_children'],\n line['wedding'],\n line['wedding_adults'],\n line['wedding_children'],\n line['camping'],\n line['diet'],\n line['notes'],\n line['updated_at']\n ]\n end\n end\n filename = \"rsvp_download\" + Time.now.strftime(\"%d%m%y-%H%M\").to_s + \".csv\"\n send_data(csv_string,\n :type => 'text/csv; charset=utf-8; header=present',\n :filename => filename)\n end", "def csv\n send_data(Map.to_csv, {:filename => \"maps.csv\" })\n end", "def index\n @candidatos = Candidato.all\n respond_to do |format|\n format.html\n format.csv { send_data @candidatos.to_csv }\n #format.xls \n end\n end", "def read_tier1_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Tier1')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#read_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def fee_reciepts_export_csv\n parameters={:search => params[:search] ,:filename => filename}\n csv_export('finance_transaction', 'fee_reciepts_export', parameters) \n end", "def genCsvRowSpeed()\n row = configIndex() ;\n row.push(getAveSpeed()) ;\n return row ;\n end", "def clients_csv(options = {})\n CSV.generate(options) do |csv|\n csv << ['Nombre', 'INE', 'Teléfono', 'Dirección']\n all.find_each do |client|\n csv << [\n client.full_name,\n client.ine,\n client.phone,\n client.address\n ]\n client.client_services.find_each do |service|\n csv << ['Servicios']\n csv << ['ID', 'Descripcion', 'Total']\n csv << [\n service.id,\n service.description,\n service.total.to_s\n ]\n end\n client.client_printers.find_each do |printer|\n csv << ['Impresoras']\n csv << ['ID', 'Descripcion', 'Total']\n csv << [\n printer.id,\n printer.adquisition_date\n ]\n end\n client.product_sales.find_each do |sale|\n csv << ['Compras']\n csv << ['ID', 'Fecha Compra', 'Cantidad']\n csv << [\n sale.id,\n sale.sale_date,\n sale.quantity\n ]\n end\n end\n end\n end", "def csv_output_path()\n return @base_path\n end", "def csv\n claim_filter = ClaimFilter.new()\n claim_filter.restore_from_session(session,:claim_filter)\n claim_filter.organisation_id = params[:id].to_i\n\n content_type = ( request.user_agent =~ /windows/i ? 'application/vnd.ms-excel' : 'text/csv' )\n content = Claim.csv_by_filter(claim_filter)\n send_data(content,:type => content_type, :filename => 'claims.csv' )\n end", "def index\n @repairs = Repair.all.includes(:driver, :bus)\n\n respond_to do |format|\n format.html\n format.csv { send_data @repairs.to_csv, filename: \"jobcards-#{Date.today}.csv\" }\n end\n end", "def table_csv_string(options = {})\n opt = {\n :klass => nil,\n :header_row => true\n }.merge!(options)\n str = ''\n \n return false if !opt[:klass]\n\n klass_name = opt[:klass].name\n tbl = ActiveSupport::Inflector.tableize(opt[:klass].name.to_s)\n\n cols = []\n sql = ''\n\n if klass_name == \"Person\" \n cols = %w(id last_name first_name middle_name login)\n else\n cols = opt[:klass].columns.map(&:name) \n end\n\n cols_str = cols.join(\", \")\n\n case opt[:klass].name\n when \"Person\"\n sql = \"SELECT #{cols_str} FROM people p INNER JOIN people_projs pp on p.id = pp.person_id WHERE pp.proj_id = #{self.id};\"\n when \"Ref\"\n cols_str = cols.collect{|c| \"r.#{c}\"}.join(\", \") # refs shared across projects, be more explicit for the join table\n sql = \"SELECT #{cols_str} FROM refs r INNER JOIN projs_refs pr on r.id = pr.ref_id WHERE pr.proj_id = #{self.id};\"\n when \"TaxonName\"\n sql = \"SELECT #{cols_str} FROM taxon_names WHERE #{self.sql_for_taxon_names}\"\n when \"Author\"\n sql = \"SELECT #{cols_str} FROM authors a WHERE a.ref_id IN (SELECT r.id FROM refs r INNER JOIN projs_refs pr on r.id = pr.ref_id WHERE pr.proj_id = #{self.id})\"\n when \"ChrState\"\n sql = \"SELECT #{cols_str} FROM chr_states cs WHERE cs.chr_id IN (SELECT chrs.id from chrs WHERE chrs.proj_id = #{self.id})\" \n # when \"Identifier\"\n # sql = \"SELECT #{cols_str} FROM identifiers si WHERE si.specimen_id IN (SELECT specimens.id from specimens WHERE specimens.proj_id = #{self.id})\"\n when \"SpecimenDetermination\"\n sql = \"SELECT #{cols_str} FROM specimen_determinations sd WHERE sd.specimen_id IN (SELECT specimens.id from specimens WHERE specimens.proj_id = #{self.id})\"\n\n else\n sql = \"SELECT #{cols_str} FROM #{tbl}\" \n end\n\n # add the project level restrictions if they exist\n sql << \" WHERE proj_id = #{self.id}\" if opt[:klass].columns.collect{|c| c.name}.include?(\"proj_id\")\n\n # build the str\n str << cols.join(\"\\t\") if opt[:header_row]# the header row\n str << \"\\n\"\n\n ActiveRecord::Base.connection.select_rows(sql).each do |row| \n # not filtering for tab characters here, likely should\n str << row.collect{|c| c == nil ? nil : c.gsub(/\\n|\\r\\n|\\r/, '\\n')}.join(\"\\t\") + \"\\n\"\n end\n str\n end", "def genCsvRowSummary()\n row = configIndex() ;\n\n row.push(getAveSpeed()) ;\n row.push(getShareRatio()) ;\n row.push(getCumulativeShare()) ;\n return row ;\n end", "def extract_heads(name_table)\n headers = CSV.read(name_table, { :headers => true, :skip_blanks => true, encoding:'iso-8859-1:utf-8',:row_sep => :auto, :col_sep => \";\"}).headers\n @heads = headers\n end", "def index\n @linhkiens = Linhkien.all\n @linhkien = Linhkien.new\n respond_to do |format|\n format.html\n format.csv { send_data @linhkiens.to_csv }\n format.xls # { send_data @products.to_csv(col_sep: \"\\t\") }\n end\n end", "def getRoutingtable(hostMap, native, fileName)\n\tnodes = $dist.keys;\n\tputs nodes\n\tif fileName == nil then\n\t\tfileName = \"routingTable.csv\"\n\tend\n\tFile.open(fileName, \"w\") do |f|\n\t\tfor i in 0..nodes.length - 1\n\t\t\tvalue = nodes[i];\n\t\t\t\tif value == native then\n\t\t\t\t\tnativeIp = Socket.getaddrinfo(\"localhost\",nil)[0][3]\n\t\t\t\t\tf.puts \"#{nativeIp},#{nativeIp},#{native},0\"\n\t\t\t\telse\n\t\t\t\t\tipAddr = hostMap[value];\n\t\t\t\t\tf.puts \"#{ipAddr[1]},#{ipAddr[0]},#{$nextNode[value]},#{$dist[value]}\";\n\t\t\t\tend\t\n\t\tend\n\tend\nend", "def csv_for_company\n filter = params[:filter]\n company_name = Company.find(params[:company_id]).name\n csv_name = filter.present? ?\n \"#{company_name}_operations_filtered_by_#{filter}.csv\" :\n \"#{company_name}_operations.csv\"\n respond_to do |format|\n format.csv { send_data to_csv ,filename: csv_name}\n end\n end", "def genCsvSpeed()\n csv = [] ;\n to_a.each{|analyzer|\n csv.push(analyzer.genCsvRowSpeed()) ;\n }\n return csv ;\n end", "def fetch_csv\n convert_to_csv(fetch)\n end", "def list_tier1_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'Tier1ListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#list_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @casein_page_title = 'Fees'\n @fees = Fee.order(sort_order(:courseformat_id)).paginate :page => params[:page]\n respond_to do |format|\n format.html\n format.csv { send_data Fee.all.to_csv, filename: \"fees-#{Date.today}.csv\"}\n format.xlsx\n end\n end", "def index\n @registrations = Registration.current.order('seat_number')\n respond_to do |format|\n format.html\n format.csv { send_data @registrations.to_csv }\n end\n end", "def index\n @providers = Provider.all\n\n respond_to do |format|\n format.html\n format.csv { send_data Provider.to_csv }\n end\n end", "def download_heat_tsv\n heat = params[:heat_number]\n exporter = Exporters::Competition::Swiss.new(@competition, heat)\n csv_string = TsvGenerator.new(exporter).generate\n\n filename = \"#{@competition.to_s.parameterize}_heat_#{heat}.txt\"\n send_data(csv_string,\n type: 'text/csv; charset=utf-8; header=present',\n filename: filename)\n end", "def get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0_with_http_info(tier_0_id, locale_service_id, neighbor_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0\"\n end\n # verify the required parameter 'neighbor_id' is set\n if @api_client.config.client_side_validation && neighbor_id.nil?\n fail ArgumentError, \"Missing the required parameter 'neighbor_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}/advertised-routes?format=csv'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'neighbor-id' + '}', neighbor_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'BgpNeighborRouteDetailsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_cloudkit_participants_csv\n to_return = [AppleCloudKitShareParticipant.to_csv_headers]\n @cloud_kit_participants.each do |key, participant|\n to_return.push(participant.to_csv)\n end\n to_return\n end" ]
[ "0.7501166", "0.7411981", "0.73362494", "0.6424593", "0.6279723", "0.6238052", "0.6221068", "0.6200105", "0.6178392", "0.6168175", "0.61543816", "0.6048137", "0.60450304", "0.5966902", "0.5710236", "0.57012016", "0.5610148", "0.5587682", "0.555284", "0.5548864", "0.5545675", "0.5545145", "0.5502168", "0.54993457", "0.54933405", "0.54634696", "0.545388", "0.543877", "0.5418954", "0.54013395", "0.53245413", "0.52338165", "0.5174834", "0.51257294", "0.5086115", "0.50610983", "0.5040419", "0.5016875", "0.49924153", "0.49589375", "0.49530348", "0.49493676", "0.49456117", "0.4936999", "0.49318674", "0.49224633", "0.49151504", "0.4907026", "0.4892473", "0.4890788", "0.48862898", "0.48830628", "0.48807475", "0.48767385", "0.4874028", "0.4866383", "0.48633897", "0.48608643", "0.48460427", "0.48446968", "0.48446968", "0.48402825", "0.48397958", "0.48289895", "0.48239094", "0.4823295", "0.48187852", "0.4806776", "0.4804164", "0.48002824", "0.47907615", "0.47884443", "0.47867826", "0.47789136", "0.47751644", "0.47587615", "0.47556084", "0.47540644", "0.47515884", "0.47460085", "0.47424665", "0.47409284", "0.47313297", "0.4725089", "0.47225535", "0.47205314", "0.47126606", "0.46957472", "0.46914607", "0.46877393", "0.46869266", "0.46837962", "0.4683124", "0.4682994", "0.46823883", "0.46814683", "0.46807882", "0.4679876", "0.46793708", "0.46778452" ]
0.73132205
3
Get forwarding table from tier1 in CSV format Get forwarding table from tier1 gateway in CSV format.
def get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0 ...' end # verify the required parameter 'tier_1_id' is set if @api_client.config.client_side_validation && tier_1_id.nil? fail ArgumentError, "Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0" end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0, must be greater than or equal to 0.' end if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source']) fail ArgumentError, 'invalid value for "route_source", must be one of BGP, STATIC, CONNECTED' end # resource path local_var_path = '/infra/tier-1s/{tier-1-id}/forwarding-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s) # query parameters query_params = {} query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil? query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil? query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil? query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil? query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil? query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil? query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['text/csv']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] 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 => 'GatewayRouteTableInCsvFormat') if @api_client.config.debugging @api_client.config.logger.debug "API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_csv_0\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tier1_forwarding_table_csv(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/forwarding-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'GatewayRouteTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_csv_0(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_policy_multicast_forwarding_in_csv_format_csv_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/forwarding?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'PolicyMulticastForwardingInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_multicast_forwarding_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_policy_multicast_forwarding_in_csv_format_csv_0_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_multicast_forwarding_in_csv_format_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/forwarding?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'PolicyMulticastForwardingInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_multicast_forwarding_in_csv_format_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/forwarding-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'RoutingTableListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'route_source'] && !['BGP', 'STATIC', 'CONNECTED'].include?(opts[:'route_source'])\n fail ArgumentError, 'invalid value for \"route_source\", must be one of BGP, STATIC, CONNECTED'\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/forwarding-table'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_id'] = opts[:'edge_id'] if !opts[:'edge_id'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'network_prefix'] = opts[:'network_prefix'] if !opts[:'network_prefix'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'route_source'] = opts[:'route_source'] if !opts[:'route_source'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'RoutingTableListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi#get_tier1_forwarding_table_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_policy_multicast_forwarding_in_csv_format_csv(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_multicast_forwarding_in_csv_format_csv_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def get_tier1_policy_multicast_forwarding_in_csv_format_csv_0(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_multicast_forwarding_in_csv_format_csv_0_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def get_tier1_interface_arp_table_csv_0(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_csv_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def get_tier1_forwarding_table(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_forwarding_table_0(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts)\n data\n end", "def get_tier1_interface_arp_table_csv(tier_1_id, locale_service_id, interface_id, opts = {})\n data, _status_code, _headers = get_tier1_interface_arp_table_csv_with_http_info(tier_1_id, locale_service_id, interface_id, opts)\n data\n end", "def table_1\n @table1 = read_table(File.join(FILE_PATH, \"Lgr_prelim_FPKM.txt\"))\n #send_file(File.join(FILE_PATH, \"Lgr_prelim_FPKM.txt\"), :type => 'text/csv', :disposition => 'inline')\n end", "def get_tier1_segment_port_mac_table_in_csv_with_http_info(tier_1_id, segment_id, port_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv\"\n end\n # verify the required parameter 'port_id' is set\n if @api_client.config.client_side_validation && port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'port_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv\"\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 = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/ports/{port-id}/mac-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s).sub('{' + 'port-id' + '}', port_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?\n query_params[:'transport_node_id'] = opts[:'transport_node_id'] if !opts[:'transport_node_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'SegmentPortMacAddressCsvListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentPortsMACTableApi#get_tier1_segment_port_mac_table_in_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_segment_port_mac_table_in_csv_0_with_http_info(tier_1_id, segment_id, port_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv_0\"\n end\n # verify the required parameter 'port_id' is set\n if @api_client.config.client_side_validation && port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'port_id' when calling PolicyNetworkingConnectivitySegmentPortsMACTableApi.get_tier1_segment_port_mac_table_in_csv_0\"\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 = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/ports/{port-id}/mac-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s).sub('{' + 'port-id' + '}', port_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?\n query_params[:'transport_node_id'] = opts[:'transport_node_id'] if !opts[:'transport_node_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'SegmentPortMacAddressCsvListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentPortsMACTableApi#get_tier1_segment_port_mac_table_in_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_in_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_interface_arp_table_csv_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_logical_router_port_arp_table_in_csv_format_csv_with_http_info(logical_router_port_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi.get_logical_router_port_arp_table_in_csv_format_csv ...'\n end\n # verify the required parameter 'logical_router_port_id' is set\n if @api_client.config.client_side_validation && logical_router_port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_port_id' when calling ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi.get_logical_router_port_arp_table_in_csv_format_csv\"\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 = '/logical-router-ports/{logical-router-port-id}/arp-table?format=csv'.sub('{' + 'logical-router-port-id' + '}', logical_router_port_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?\n query_params[:'transport_node_id'] = opts[:'transport_node_id'] if !opts[:'transport_node_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'LogicalRouterPortArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi#get_logical_router_port_arp_table_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_policy_igmp_memberships_in_csv_format_csv_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/igmp-memberships?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'IgmpMembershipsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_igmp_memberships_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_segment_interface_arp_table_csv_0(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_segment_interface_arp_table_csv_0_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def get_tier1_policy_igmp_memberships_in_csv_format_csv_0_with_http_info(tier_1_id, locale_services_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysMulticastApi.get_tier1_policy_igmp_memberships_in_csv_format_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/multicast/igmp-memberships?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'IgmpMembershipsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysMulticastApi#get_tier1_policy_igmp_memberships_in_csv_format_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_interface_arp_table_csv_0_with_http_info(tier_1_id, locale_service_id, interface_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_tier1_interface_arp_table_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/interfaces/{interface-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_tier1_interface_arp_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_0_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_downlink_port_arp_table_for_tier1_segment_in_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/gateway-interface-arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_downlink_port_arp_table_for_tier1_segment_in_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @trainers = Trainer.paginate(:page => params[:page]).order(email_dirigeant: :desc, crawled_for_email: :desc)\n respond_to do |format|\n format.html\n format.csv { send_data Trainer.all.to_csv}\n end\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_in_csv_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def get_segment_interface_arp_table_csv_0_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_segment_interface_arp_table_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_segment_interface_arp_table_csv_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi.get_segment_interface_arp_table_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/arp-table?format=csv'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'edge_path'] = opts[:'edge_path'] if !opts[:'edge_path'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'InterfaceArpTableInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesARPTableApi#get_segment_interface_arp_table_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_segment_interface_arp_table_csv(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_segment_interface_arp_table_csv_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def get_downlink_port_arp_table_for_tier1_segment_in_csv_0(tier_1_id, segment_id, opts = {})\n data, _status_code, _headers = get_downlink_port_arp_table_for_tier1_segment_in_csv_0_with_http_info(tier_1_id, segment_id, opts)\n data\n end", "def download_table\n params = download_table_params\n table_name = params[:table_name].parameterize.underscore\n action_name = table_name + \"_table\"\n table_url = self.send(\"#{table_name}_table_admin_reports_path\") + \".csv\"\n filters = params.except(:table_name).to_h\n \n redirect_to({\n controller: 'reports', \n action: action_name, \n format: :csv\n }.merge(filters))\n end", "def dump_table(client, fusion_tables, fusion_table_id, backup_directory)\n backup_directory ||= \"backups\"\n FileUtils.mkdir_p backup_directory\n\n fusion_table = client.execute(\n :api_method => fusion_tables.table.get,\n :parameters => {'tableId' => \"#{fusion_table_id}\"}\n )\n fusion_table.data.to_hash\n filename = File.join(backup_directory ,\"#{fusion_table.data.to_hash['name']}-#{fusion_table_id}\")\n $stderr.puts filename\n\n File.open(\"#{filename}.json\",\"w\") do |f|\n f.write(JSON.pretty_generate(fusion_table.data.to_hash))\n end\n\n result = client.execute(\n :api_method => fusion_tables.query.sql_get,\n :parameters => {'sql' => \"SELECT * FROM #{fusion_table_id}\"}\n )\n fusion_table_data = result.data.to_hash\n\n if fusion_table_data['error']\n if fusion_table_data['error']['errors'][0]['reason'] == 'responseSizeTooLarge'\n # use Fusion Tables V2 media downloads API\n result = client.execute(\n :api_method => fusion_tables.query.sql_get,\n :parameters => {'sql' => \"SELECT * FROM #{fusion_table_id}\", 'alt' => 'media'}\n )\n File.open(\"#{filename}.csv\", 'w') { |file| file.write(result.response.body) }\n else\n $stderr.puts \"Unhandled Error:\"\n $stderr.puts fusion_table_data.inspect\n end\n else\n CSV.open(\"#{filename}.csv\", 'w') do |csv|\n if fusion_table_data['rows'] && (fusion_table_data['rows'].length > 0)\n csv << fusion_table_data['columns']\n fusion_table_data['rows'].each do |row|\n csv << row\n end\n end\n end\n end\nend", "def data(table)\n CSV.parse(%x[mdb-export CRBE.mdb #{table}])[1..-1]\nend", "def index\n @trucks = Truck.all.order(:NB_PLATE)\n if Truck != nil and Truck.all.size>0 \n @details = Truck.order(:NB_PLATE).first(20)\n \n\n\n respond_to do |format|\n format.html\n format.csv { send_data @trucks.to_csv, filename: \"trucks-#{Time.now.strftime('s%S/m%M/h%H/')+Date.today.strftime('d%d/m%m/y%Y')}.csv\" }\n format.xls #{ send_data @trucks.to_csv(col_sep: \"\\t\") }\n end\n end\n end", "def transactions\n csv_string = \"\"\n checks.each_with_index do |check, index|\n csv = \"\"\n check_klass = OutputCsv.class_for(\"Check\", check.batch.facility)\n puts \"Applying class #{check_klass}\" if index == 0\n check_obj = check_klass.new(check, index)\n csv = check_obj.generate\n csv_string = csv_string + csv\n # For the first iteration, inorder to execute both header creation and first row writing, generate method is called once more\n if index == 0\n check_obj = check_klass.new(check, 1)\n csv = check_obj.generate\n csv_string = csv_string + csv\n end\n end\n return csv_string\n end", "def csv_report\n tire_cols = params[:tire] || {}\n ar_cols = params[:activerecord] || {}\n assocs_to_include = params[:assoc][:include] || {}\n params[:assoc][:max] ||= {}\n klass = model_class.constantize\n @filename = \"#{model_class.humanize}.csv\"\n\n response.headers['Content-Type'] ||= 'text/plain'\n response.headers['Content-Disposition'] = \"attachment; filename=#{@filename}\"\n response.headers['Content-Transfer-Encoding'] = 'binary'\n response.headers['Last-Modified'] = Time.now.to_s\n\n # Right, try to define a header:\n header = []\n tire_cols.keys.each { |x| header.push(x.humanize) }\n ar_cols.keys.each { |x| header.push(x.humanize) }\n assocs_to_include.keys.each do |assoc|\n if params[:assoc][:max][assoc] == 'join' # Is a has_many with only one real column\n header.push params[:assoc][assoc.to_sym].keys.first\n elsif params[:assoc][:max][assoc] # has_many\n (1 .. (params[:assoc][:max][assoc].to_i)).each do |i|\n params[:assoc][assoc.to_sym].keys.each do |k|\n header.push(\"#{assoc.singularize.humanize} #{i} #{k.humanize}\")\n end\n end\n else # has_a\n params[:assoc][assoc.to_sym].keys.each do |k| # Each key requested from the associated record\n header.push \"#{assoc.humanize} #{k.humanize}\"\n end\n end\n end\n\n results = klass.search({ per: TireSearch::INFINITY }, 1, '')\n self.response_body = Enumerator.new do |y|\n results.each_with_index do |result, i|\n y << header.to_csv if i == 0\n\n line = []\n tire_cols.keys.each { |x| line.push(result[x]) }\n\n result = result.load if ar_cols.count > 0 || assocs_to_include.keys.count > 0\n\n ar_cols.keys.each { |x| line.push(result.send(x)) } if ar_cols.count > 0\n\n assocs_to_include.keys.each do |assoc|\n related = result.send(assoc)\n if params[:assoc][:max][assoc] == 'join' # Is a has_many with only one real column\n col = params[:assoc][assoc.to_sym].keys.first\n line.push related.map { |x| x.send(col) }.join(' // ')\n elsif params[:assoc][:max][assoc]\n (0 .. (params[:assoc][:max][assoc].to_i - 1)).each do |j|\n params[:assoc][assoc.to_sym].keys.each do |k|\n line.push(related[j] ? related[j].send(k) : nil)\n end\n end\n else\n params[:assoc][assoc.to_sym].keys.each do |k| # Each key requested from the associated record\n line.push related ? related.send(k) : nil\n end\n end\n end\n y << line.to_csv\n GC.start if i % 500 == 0\n end\n end\n end", "def grab_lookup_table(csv_url)\n cmd = `curl #{csv_url} -s`\n csv = cmd.gsub(\"\\r\",\"\\n\").split(/\\n+/).map{ |x| x.split(\",\")}\n table = {}\n csv.each {|row| table[row[0]] = row[1]}\n return table\n end", "def table\n Airmodel.client.table base_config[:base_id], base_config[:table_name]\n end", "def get_table(table, env=nil)\n require 'net/http'\n http_config = get_remote_credentials(env)\n ret = false\n Net::HTTP.start(http_config['server_name'], http_config['server_port']) {|http|\n req = Net::HTTP::Get.new(\"/dumps/#{table}.txt\")\n req.basic_auth http_config['http_user'], http_config['http_pass']\n resp = http.request(req)\n ret = tab_to_array_of_hashes(resp.body) if resp.code == '200'\n }\n ret\n end", "def get_tier1_segment_port_mac_table_in_csv_0(tier_1_id, segment_id, port_id, opts = {})\n data, _status_code, _headers = get_tier1_segment_port_mac_table_in_csv_0_with_http_info(tier_1_id, segment_id, port_id, opts)\n data\n end", "def atop_csv\n \"#{@archive_root}/#{master.hostname}/atop_log_#{@gatling_scenario.downcase.gsub('.', '_')}.csv\"\n end", "def csv(meth)\n @output_type = 'csv'\n @output_filename = \"#{model.link.downcase}_#{normalized_type}.csv\"\n columns = model.columns_for(type, request)\n headers = columns.map{|column| column_label_for(type, request, model, column)}\n EnumCSV.csv(model.send(meth, normalized_type, request, :all_results=>true), :headers=>headers) do |obj|\n columns.map{|column| model.column_value(type, request, obj, column)}\n end\n end", "def index\n @inwards = Inward.all\n respond_to do |format|\n format.html\n format.csv { send_data @inwards.to_csv }\n format.xls { send_data @inwards.to_csv(col_sep: \"\\t\") }\n end\n #@inwards = Inward.paginate(:page => params[:page], :per_page => 10)\n end", "def import_csv_full\n \n end", "def index\n @trial_sites = TrialSite.all\n respond_to do |format|\n format.html\n format.csv { send_data @trial_sites.to_csv }\n format.xls { send_data @trial_sites.to_csv(col_sep: \"\\t\") }\n end\n end", "def csv_export_chrono\n csv_string = CSV.generate do |csv|\n\n csv << [ \"Plaque\", \"Equipe\", \"Nom VTT\", \"Prenom VTT\", \"ADN VTT\", \"Nom Route\", \"Prenom Route\", \"ADN Route\", \"Categorie\"]\n\n Team.order_by(:plate).each do |t|\n cat = t.category\n next unless cat\n\n cname = cat.map { |v| v.capitalize }.join('-')\n csv << [ t.plate, t.name, \n t.vtt.profile.name.upcase, t.vtt.profile.surname.capitalize, t.vtt.profile.birth.year, \n t.route.profile.name.upcase, t.route.profile.surname.capitalize, t.route.profile.birth.year, cname]\n end\n end\n\n respond!(csv_string, 200, 'Content-Type' => 'text/csv')\n end", "def get_tier0_bgp_neighbor_routes_in_csv_format_csv_with_http_info(tier_0_id, locale_service_id, neighbor_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv\"\n end\n # verify the required parameter 'neighbor_id' is set\n if @api_client.config.client_side_validation && neighbor_id.nil?\n fail ArgumentError, \"Missing the required parameter 'neighbor_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}/routes?format=csv'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'neighbor-id' + '}', neighbor_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'BgpNeighborRouteDetailsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbor_routes_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_tier1_segment_port_mac_table_in_csv(tier_1_id, segment_id, port_id, opts = {})\n data, _status_code, _headers = get_tier1_segment_port_mac_table_in_csv_with_http_info(tier_1_id, segment_id, port_id, opts)\n data\n end", "def export\n @transactions = Transaction.find_all_by_user_id(current_user.id)\n csv = \"\"\n i = 0\n @transactions.each do |trans|\n if (i==0)\n csv += trans.to_csv(true)\n else\n csv += trans.to_csv(false)\n end\n i += 1\n end\n\n respond_to do |format|\n format.csv { send_data csv }\n end\n end", "def index\n @q = Turno.ransack(params[:q])\n @turnos = @q.result\n\n respond_to do |format|\n format.html\n format.pdf do \n render pdf: 'Listado de turnos'\n end \n format.csv do\n send_data @turnos.to_csv\n end\n\n\n end\n end", "def get_tier1_policy_igmp_memberships_in_csv_format_csv_0(tier_1_id, locale_services_id, opts = {})\n data, _status_code, _headers = get_tier1_policy_igmp_memberships_in_csv_format_csv_0_with_http_info(tier_1_id, locale_services_id, opts)\n data\n end", "def index\n @tariffs = Tariff.order(:id)\n\n respond_to do |format|\n format.html\n format.csv { send_data @tariffs.to_csv(:col_sep => \";\") }\n end\n end", "def open_csv(table)\n command = \"mdb-export -bstrip -D '%F %T' -d #{Shellwords.escape(delimiter)} #{file_name} #{table}\"\n Open3.popen3(command) do |stdin, stdout, stderr|\n yield CSV.new(stdout, col_sep: delimiter)\n end\n end", "def generate_csv\n @project = Project.find(params[:id])\n \n content_type = if request.user_agent =~ /windows/i\n ' application/vnd.ms-excel '\n else\n ' text/csv '\n end\n \n project_net = @project.find_all_connections(friend = true, follower = false) \n \n CSV::Writer.generate(output = \"\") do |csv|\n csv << [\"DL n=\" + @project.persons.count.to_s ]\n csv << [\"format = edgelist1\"]\n csv << [\"labels embedded:\"]\n csv << [\"data:\"]\n project_net.each do |entry|\n csv << [entry[0], entry[1], \"1\"]\n end\n @project.persons.each do |person|\n csv << [person.username]\n end\n end\n send_data(output,\n :type => content_type,\n :filename => @project.name.to_s + \"_FF_SNA.csv\")\n end", "def export(params={})\n columns = delimited_string_to_array(Settings.export.travel_fields)\n send_data Travel.export(columns), :filename => \"travel.csv\"\n end", "def create_csv()\n hashes = Transaction.all_as_hashes\n CSV.generate do |csv|\n # Adds the keys as headings on the first line\n csv << hashes.first.keys\n # Iterates through the transactions and populates CSV\n hashes.each do |hash|\n csv << hash.values\n end\n end\n end", "def index\n @clientes = filter(params[:filter]) || Cliente.includes(:plano, :atividades, historicos: [:status_transacao_pag_seguro]).all # Cliente.all\n \n respond_to do |format|\n format.html # show index.html.erb\n format.csv { send_data @clientes.to_csv }\n end\n end", "def index\n @opttrucks = Opttruck.all\n @shortopttrucks = Opttruck.first(100)\n \n respond_to do |format|\n format.html \n format.json\n format.csv { send_data @opttrucks.to_csv }\n\n end\n end", "def csvexport_all_tables\n @wires = Wire.all.sort_by {|obj| obj.kabeltyp}\n @switchgears_einbau = Switchgear.all.sort_by {|obj| obj.kennung}\n @switchgears = Switchgear.where(:typ => 1).sort_by {|obj| obj.kennung}\n @assemblies = Assembly.all.sort_by {|obj| obj.kennung}\n @electrical_installations = ElectricalInstallation.all.sort_by {|obj| obj.kennung}\n @drives = Drive.all.sort_by {|obj| obj.kennung}\n @devices = Device.all.sort_by {|obj| obj.definition}\n @iogroups = Iogroup.all.sort_by {|obj| obj.name}\n @switchgearcombinations = Switchgearcombination.all.sort_by {|obj| obj.name}\n @offertpositions = Offertposition.where(:subsubproject_id => params[:subsubproject_id]).sort_by {|obj| obj.name}\n @subsubproject = Subsubproject.find(params[:subsubproject_id])\n @subsubprojects = @subsubproject.subproject.subsubprojects.sort_by {|obj| obj.name}\n @subsystems = @subsubproject.subproject.project.subsystems.all.sort_by {|obj| obj.name}\n @units = Unit.where(:subsystem_id => @subsystems.pluck(:id)).sort_by {|obj| obj.name}\n\n CSV.open(\"export_all_tables#{Time.now.strftime(\"%Y-%m-%d-%H-%M\")}.csv\", \"wb\", {:headers => true, :encoding => \"iso-8859-1\", :col_sep => \";\"}) do |csv|\n csv << ['Geraetetypen', '']\n @devices.each do |entry| csv << [entry.id, entry.definition] end\n csv << ['SPS-Modultypen', '']\n @assemblies.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Frequenzumrichtertypen', '']\n @drives.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Kabeltypen', '']\n @wires.each do |entry| csv << [entry.id, entry.kabeltyp] end\n csv << ['Elektroinstallationstypen', '']\n @electrical_installations.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Schaltschranktypen', '']\n @switchgears.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Schaltschrankeinbautypen', '']\n @switchgears_einbau.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Schaltgeraetekombinationen', '']\n @switchgearcombinations.each do |entry| csv << [entry.id, entry.name] end\n csv << ['IO-Gruppen', '']\n @iogroups.each do |entry| csv << [entry.id, entry.name] end\n csv << ['Offertpositionen', '']\n @offertpositions.each do |entry| csv << [entry.id, entry.name] end\n csv << ['Teilanlagen', '']\n @subsystems.each do |entry| csv << [entry.id, entry.name] end\n csv << ['TeilanlagenUnits', '']\n @units.each do |entry| csv << [entry.id, entry.name] end\n csv << ['Projektversionen', '']\n @subsubprojects.each do |entry| csv << [entry.id, entry.name] end\n end\n\n redirect_to settings_path, :notice => \"Export wurde unter \" + Rails.root.to_s + \"/ abgelegt!\"\n end", "def export_csv\n export_string = \"#{@id},#{type_string},#{@name.gsub(/[\\,,\\s]/,\"\")},\"\n @details.each{|k,v| export_string << \"#{k}=#{v};\".gsub(/[\\,,\\s]/,\"\") }\n export_string\n end", "def export_csv\n export_string = \"#{@id},#{type_string},#{@name.gsub(/[\\,,\\s]/,\"\")},\"\n @details.each{|k,v| export_string << \"#{k}=#{v};\".gsub(/[\\,,\\s]/,\"\") }\n export_string\n end", "def import_csv_smart\n \n end", "def index\n @pagetitle = \"Suppliers\"\n \n @companies = Company.all\n\n @path = 'suppliers'\n\n @suppliercsv = Supplier.all \n respond_to do |format|\n format.html\n format.csv { send_data @suppliercsv.to_csv }\n \n end\n\n\n end", "def index\n @q = Servidor.ransack(params[:q])\n @q.sorts = 'nome'\n @servidores = @q.result.page params[:page]\n respond_to do |format|\n format.html\n format.csv do\n send_data @servidores.except(:limit, :offset).to_csv, filename: \"concentradores -#{Date.today}.csv\"\n end\n end\n end", "def index\n @localbrs = Localbr.all\n respond_to do |format|\n format.csv { send_data @localbrs.to_csv}\n format.html\n end\n end", "def index\n @transmission_f_records = TransmissionFRecord.all\n\n respond_to do |format|\n format.html\n format.csv { send_data @transmission_f_records.to_csv, filename: \"transmission-f-record-#{Date.today}.csv\" }\n end\n end", "def csv\n @csv_table ||= begin\n csv_raw = File.read(CSV_PATH)\n CSV.parse(csv_raw, headers: true)\n end\n\nend", "def index\n @mobiles = Customer.pluck(:mobile)\n @agents = User.where(\"role = ?\", 2).pluck(:fname, :id)\n @franchises = User.where(\"role = ?\", 1).pluck(:fname, :id)\n @customers_csv = (policy_scope Customer).order(\"id desc\")\n @customers = (policy_scope Customer).order(\"id desc\").page params[:page]\n authorize Customer.new, :index?\n \n respond_to do |format|\n format.html\n format.csv { send_data @customers_csv.as_csv }\n end\n\n\n end", "def get_tier0_bgp_neighbor_routes_in_csv_format_csv_0_with_http_info(tier_0_id, locale_service_id, neighbor_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0\"\n end\n # verify the required parameter 'neighbor_id' is set\n if @api_client.config.client_side_validation && neighbor_id.nil?\n fail ArgumentError, \"Missing the required parameter 'neighbor_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_routes_in_csv_format_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}/routes?format=csv'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'neighbor-id' + '}', neighbor_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'BgpNeighborRouteDetailsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbor_routes_in_csv_format_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def csv(csv_file)\n Slacker.get_csv(csv_file)\n end", "def csv_params\n\n owner_id = owner_id\n owner_id = id if usertype == \"reseller\"\n sep = Confline.get_value(\"CSV_Separator\", owner_id).to_s\n dec = Confline.get_value(\"CSV_Decimal\", owner_id).to_s\n\n sep = Confline.get_value(\"CSV_Separator\", 0).to_s if sep.to_s.length == 0\n dec = Confline.get_value(\"CSV_Decimal\", 0).to_s if dec.to_s.length == 0\n\n sep = \",\" if sep.blank?\n dec = \".\" if dec.blank?\n\n return sep, dec\n end", "def get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_with_http_info(tier_0_id, locale_service_id, neighbor_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv\"\n end\n # verify the required parameter 'neighbor_id' is set\n if @api_client.config.client_side_validation && neighbor_id.nil?\n fail ArgumentError, \"Missing the required parameter 'neighbor_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv\"\n end\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}/advertised-routes?format=csv'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'neighbor-id' + '}', neighbor_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'BgpNeighborRouteDetailsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @vendor_profiles = VendorProfile.all\n \n respond_to do |format|\n format.html\n format.csv { send_data @vendor_profiles.as_csv } \n end\n end", "def getToolsSyndicateFactualcsv( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"get\",\"/tools/syndicate/factualcsv\",params)\n end", "def csvString\n resultColumns = self.generateResultColumns\n headers = resultColumns[:columns].keys\n # Start off instantiating the csv string with the header values\n csvString = headers.map{|s| self.filterValue(s)}.join(@options[:delimiter])\n\n # Now iterate over each row, sticking its value under each header\n (0..resultColumns[:maxRowIndex]).each do |rowIndex|\n csvString << \"\\r\\n\"\n csvString << headers.map{ |header|\n self.filterValue(resultColumns[:columns][header][rowIndex])\n }.join(@options[:delimiter])\n end\n return csvString\n end", "def csv\n @records = Reply.all\n csv_string = FasterCSV.generate do |csv|\n csv << %w{Code Name Email Engagement Engagement_Adults Engagement_Children Wedding Wedding_Adults Wedding_Children Camping Diet Notes Updated}\n @records.each do |line|\n csv << [\n line['code'],\n line['name'], \n line['email'],\n line['engagement'],\n line['engagement_adults'],\n line['engagement_children'],\n line['wedding'],\n line['wedding_adults'],\n line['wedding_children'],\n line['camping'],\n line['diet'],\n line['notes'],\n line['updated_at']\n ]\n end\n end\n filename = \"rsvp_download\" + Time.now.strftime(\"%d%m%y-%H%M\").to_s + \".csv\"\n send_data(csv_string,\n :type => 'text/csv; charset=utf-8; header=present',\n :filename => filename)\n end", "def csv\n send_data(Map.to_csv, {:filename => \"maps.csv\" })\n end", "def index\n @candidatos = Candidato.all\n respond_to do |format|\n format.html\n format.csv { send_data @candidatos.to_csv }\n #format.xls \n end\n end", "def read_tier1_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'Tier1')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#read_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def fee_reciepts_export_csv\n parameters={:search => params[:search] ,:filename => filename}\n csv_export('finance_transaction', 'fee_reciepts_export', parameters) \n end", "def genCsvRowSpeed()\n row = configIndex() ;\n row.push(getAveSpeed()) ;\n return row ;\n end", "def clients_csv(options = {})\n CSV.generate(options) do |csv|\n csv << ['Nombre', 'INE', 'Teléfono', 'Dirección']\n all.find_each do |client|\n csv << [\n client.full_name,\n client.ine,\n client.phone,\n client.address\n ]\n client.client_services.find_each do |service|\n csv << ['Servicios']\n csv << ['ID', 'Descripcion', 'Total']\n csv << [\n service.id,\n service.description,\n service.total.to_s\n ]\n end\n client.client_printers.find_each do |printer|\n csv << ['Impresoras']\n csv << ['ID', 'Descripcion', 'Total']\n csv << [\n printer.id,\n printer.adquisition_date\n ]\n end\n client.product_sales.find_each do |sale|\n csv << ['Compras']\n csv << ['ID', 'Fecha Compra', 'Cantidad']\n csv << [\n sale.id,\n sale.sale_date,\n sale.quantity\n ]\n end\n end\n end\n end", "def csv_output_path()\n return @base_path\n end", "def csv\n claim_filter = ClaimFilter.new()\n claim_filter.restore_from_session(session,:claim_filter)\n claim_filter.organisation_id = params[:id].to_i\n\n content_type = ( request.user_agent =~ /windows/i ? 'application/vnd.ms-excel' : 'text/csv' )\n content = Claim.csv_by_filter(claim_filter)\n send_data(content,:type => content_type, :filename => 'claims.csv' )\n end", "def index\n @repairs = Repair.all.includes(:driver, :bus)\n\n respond_to do |format|\n format.html\n format.csv { send_data @repairs.to_csv, filename: \"jobcards-#{Date.today}.csv\" }\n end\n end", "def table_csv_string(options = {})\n opt = {\n :klass => nil,\n :header_row => true\n }.merge!(options)\n str = ''\n \n return false if !opt[:klass]\n\n klass_name = opt[:klass].name\n tbl = ActiveSupport::Inflector.tableize(opt[:klass].name.to_s)\n\n cols = []\n sql = ''\n\n if klass_name == \"Person\" \n cols = %w(id last_name first_name middle_name login)\n else\n cols = opt[:klass].columns.map(&:name) \n end\n\n cols_str = cols.join(\", \")\n\n case opt[:klass].name\n when \"Person\"\n sql = \"SELECT #{cols_str} FROM people p INNER JOIN people_projs pp on p.id = pp.person_id WHERE pp.proj_id = #{self.id};\"\n when \"Ref\"\n cols_str = cols.collect{|c| \"r.#{c}\"}.join(\", \") # refs shared across projects, be more explicit for the join table\n sql = \"SELECT #{cols_str} FROM refs r INNER JOIN projs_refs pr on r.id = pr.ref_id WHERE pr.proj_id = #{self.id};\"\n when \"TaxonName\"\n sql = \"SELECT #{cols_str} FROM taxon_names WHERE #{self.sql_for_taxon_names}\"\n when \"Author\"\n sql = \"SELECT #{cols_str} FROM authors a WHERE a.ref_id IN (SELECT r.id FROM refs r INNER JOIN projs_refs pr on r.id = pr.ref_id WHERE pr.proj_id = #{self.id})\"\n when \"ChrState\"\n sql = \"SELECT #{cols_str} FROM chr_states cs WHERE cs.chr_id IN (SELECT chrs.id from chrs WHERE chrs.proj_id = #{self.id})\" \n # when \"Identifier\"\n # sql = \"SELECT #{cols_str} FROM identifiers si WHERE si.specimen_id IN (SELECT specimens.id from specimens WHERE specimens.proj_id = #{self.id})\"\n when \"SpecimenDetermination\"\n sql = \"SELECT #{cols_str} FROM specimen_determinations sd WHERE sd.specimen_id IN (SELECT specimens.id from specimens WHERE specimens.proj_id = #{self.id})\"\n\n else\n sql = \"SELECT #{cols_str} FROM #{tbl}\" \n end\n\n # add the project level restrictions if they exist\n sql << \" WHERE proj_id = #{self.id}\" if opt[:klass].columns.collect{|c| c.name}.include?(\"proj_id\")\n\n # build the str\n str << cols.join(\"\\t\") if opt[:header_row]# the header row\n str << \"\\n\"\n\n ActiveRecord::Base.connection.select_rows(sql).each do |row| \n # not filtering for tab characters here, likely should\n str << row.collect{|c| c == nil ? nil : c.gsub(/\\n|\\r\\n|\\r/, '\\n')}.join(\"\\t\") + \"\\n\"\n end\n str\n end", "def genCsvRowSummary()\n row = configIndex() ;\n\n row.push(getAveSpeed()) ;\n row.push(getShareRatio()) ;\n row.push(getCumulativeShare()) ;\n return row ;\n end", "def extract_heads(name_table)\n headers = CSV.read(name_table, { :headers => true, :skip_blanks => true, encoding:'iso-8859-1:utf-8',:row_sep => :auto, :col_sep => \";\"}).headers\n @heads = headers\n end", "def index\n @linhkiens = Linhkien.all\n @linhkien = Linhkien.new\n respond_to do |format|\n format.html\n format.csv { send_data @linhkiens.to_csv }\n format.xls # { send_data @products.to_csv(col_sep: \"\\t\") }\n end\n end", "def csv_for_company\n filter = params[:filter]\n company_name = Company.find(params[:company_id]).name\n csv_name = filter.present? ?\n \"#{company_name}_operations_filtered_by_#{filter}.csv\" :\n \"#{company_name}_operations.csv\"\n respond_to do |format|\n format.csv { send_data to_csv ,filename: csv_name}\n end\n end", "def getRoutingtable(hostMap, native, fileName)\n\tnodes = $dist.keys;\n\tputs nodes\n\tif fileName == nil then\n\t\tfileName = \"routingTable.csv\"\n\tend\n\tFile.open(fileName, \"w\") do |f|\n\t\tfor i in 0..nodes.length - 1\n\t\t\tvalue = nodes[i];\n\t\t\t\tif value == native then\n\t\t\t\t\tnativeIp = Socket.getaddrinfo(\"localhost\",nil)[0][3]\n\t\t\t\t\tf.puts \"#{nativeIp},#{nativeIp},#{native},0\"\n\t\t\t\telse\n\t\t\t\t\tipAddr = hostMap[value];\n\t\t\t\t\tf.puts \"#{ipAddr[1]},#{ipAddr[0]},#{$nextNode[value]},#{$dist[value]}\";\n\t\t\t\tend\t\n\t\tend\n\tend\nend", "def genCsvSpeed()\n csv = [] ;\n to_a.each{|analyzer|\n csv.push(analyzer.genCsvRowSpeed()) ;\n }\n return csv ;\n end", "def fetch_csv\n convert_to_csv(fetch)\n end", "def index\n @casein_page_title = 'Fees'\n @fees = Fee.order(sort_order(:courseformat_id)).paginate :page => params[:page]\n respond_to do |format|\n format.html\n format.csv { send_data Fee.all.to_csv, filename: \"fees-#{Date.today}.csv\"}\n format.xlsx\n end\n end", "def list_tier1_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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 => 'Tier1ListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#list_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @registrations = Registration.current.order('seat_number')\n respond_to do |format|\n format.html\n format.csv { send_data @registrations.to_csv }\n end\n end", "def download_heat_tsv\n heat = params[:heat_number]\n exporter = Exporters::Competition::Swiss.new(@competition, heat)\n csv_string = TsvGenerator.new(exporter).generate\n\n filename = \"#{@competition.to_s.parameterize}_heat_#{heat}.txt\"\n send_data(csv_string,\n type: 'text/csv; charset=utf-8; header=present',\n filename: filename)\n end", "def get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0_with_http_info(tier_0_id, locale_service_id, neighbor_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0\"\n end\n # verify the required parameter 'neighbor_id' is set\n if @api_client.config.client_side_validation && neighbor_id.nil?\n fail ArgumentError, \"Missing the required parameter 'neighbor_id' when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0\"\n end\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi.get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/bgp/neighbors/{neighbor-id}/advertised-routes?format=csv'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'neighbor-id' + '}', neighbor_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['text/csv'])\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 => 'BgpNeighborRouteDetailsInCsvFormat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysRoutingBGPApi#get_tier0_bgp_neighbor_advertised_routes_in_csv_format_csv_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @providers = Provider.all\n\n respond_to do |format|\n format.html\n format.csv { send_data Provider.to_csv }\n end\n end", "def getToolsSyndicateInfobelcsv( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"get\",\"/tools/syndicate/infobelcsv\",params)\n end" ]
[ "0.7500307", "0.7411211", "0.7312457", "0.6424258", "0.6279351", "0.6236259", "0.62193143", "0.61991376", "0.6177326", "0.61690235", "0.61520094", "0.60460424", "0.6045946", "0.5967651", "0.5710281", "0.57012516", "0.56104255", "0.5588531", "0.55537957", "0.5548589", "0.554607", "0.5545361", "0.55029744", "0.5499577", "0.54935074", "0.5463141", "0.5454703", "0.5439698", "0.5419898", "0.5400944", "0.5324786", "0.5234267", "0.5176439", "0.5126826", "0.5087025", "0.5061524", "0.50418615", "0.5017559", "0.4993312", "0.4957883", "0.49552616", "0.4951324", "0.49453586", "0.49391878", "0.4931793", "0.49229094", "0.49167764", "0.4905972", "0.48930088", "0.4889885", "0.48854265", "0.48837662", "0.48829162", "0.48765907", "0.48739678", "0.48673066", "0.48642573", "0.48610634", "0.48462802", "0.4845725", "0.4845725", "0.4842677", "0.48402488", "0.48289156", "0.48244345", "0.4823614", "0.48210442", "0.4806569", "0.48057044", "0.48029006", "0.47931424", "0.47898617", "0.47865877", "0.47809756", "0.47762027", "0.47595873", "0.47561166", "0.47551453", "0.47516015", "0.47472706", "0.47438967", "0.4742668", "0.47330913", "0.47254407", "0.47225317", "0.47209895", "0.47143647", "0.46968767", "0.46922225", "0.4688606", "0.4687879", "0.46852544", "0.46851805", "0.46829653", "0.46820265", "0.4681798", "0.4680927", "0.4680763", "0.46805814", "0.46793702" ]
0.73354864
2
GET /protocol_drugs GET /protocol_drugs.json
def index @protocol_drugs = ProtocolDrug.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def drugbank_get(route, params)\n url = $drugbank_api + route\n res = HTTParty.get(url, :query => params, :headers => $drugbank_headers)\n return res\nend", "def get_gdpr_requests_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: GeneralDataProtectionRegulationApi.get_gdpr_requests ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/gdpr/requests\".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 => 'GDPRRequestEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GeneralDataProtectionRegulationApi#get_gdpr_requests\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotelstaticdatagd }\n end\n end", "def show\n @grm_dog = GrmDog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_dog }\n end\n end", "def show\n @grm_grappt = GrmGrappt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_grappt }\n end\n end", "def json\n url = 'http://api.dribbble.com/players/' + @user + '/shots?per_page=' + @shots_per_page.to_s + '&page=' + @page.to_s\n resp = Net::HTTP.get_response(URI.parse(url))\n return resp.body\n end", "def api_get url_suffix\n url = URI::encode \"#{@@oauth_info[:api_url]}/gems/#{url_suffix}\"\n data = {:client_id => @@oauth_info[:client_id]}\n headers = {:Authorization => \"Bearer #{@access_token}\"}\n\n conn = get_conn url\n #Try request 3 times\n for i in 1..3\n res = conn.get(url, data, headers)\n if res.status == 200 then return JSON.parse(res.body) end\n sleep 1\n end\n raise OAuthSessionError, \"GET Failed. Status: #{res.status}. Body: #{res.body}\"\n end", "def index\n @gpsds = Gpsd.all\n #respond_to do |format|\n # format.json { render }\n #end\n end", "def index\n @drugs = Drug.all\n # @permitted_drugs = Drug.permitted.alphabetical.all\n # @prohibited_drugs = Drug.prohibited.alphabetical.all\n # @restricted_drugs = Drug.restricted.alphabetical.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drugs }\n end\n end", "def get_from_digg\n raw_response = RestClient.get('http://digg.com/api/news/popular.json')\n response = JSON.load(raw_response)\n\n response[\"data\"][\"feed\"].map do |story|\n story_hash = {\n title: story[\"content\"][\"title_alt\"],\n author: story[\"content\"][\"author\"],\n score: story[\"digg_score\"],\n category: story[\"content\"][\"tags\"].map {|tag| tag[\"display\"]}\n }\n end\n\n\nend", "def create\n @protocol_drug = ProtocolDrug.new(protocol_drug_params)\n\n respond_to do |format|\n if @protocol_drug.save\n format.html { redirect_to @protocol_drug, notice: 'Protocol drug was successfully created.' }\n format.json { render :show, status: :created, location: @protocol_drug }\n else\n format.html { render :new }\n format.json { render json: @protocol_drug.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @gpath = Gpath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gpath }\n end\n end", "def room_descriptions_method\r\n my_port = 8081\r\n htttproomnumber = $roomnumber\r\n roomsNtext = \"/#{htttproomnumber}\"\r\n rooms_message = \"/rooms#{roomsNtext}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{rooms_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n return my_json[\"room\"].to_s\r\nend", "def get_digg\n\nresponse = JSON.parse(RestClient.get 'http://digg.com/api/news/popular.json')\n# puts response['data']['feed'][0]['content']['title']\n\nstories = []\n\nresponse['data']['feed'].each do |story|\n\tstory_hash = {}\n\tstory_hash[:title] = story['content']['title']\n\tstory_hash[:category] = story['content']['tags'][0]['display']\n\tcalculate_upvotes(story_hash)\n\tstories.push(story_hash)\n\tend\n\tshow_all_stories(stories)\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend", "def get_from_digg\n route = 'http://digg.com/api/news/popular.json'\n raw_response = RestClient.get route\n response = JSON.load raw_response\n response[\"data\"][\"feed\"].map do |story|\n categories = []\n story[\"content\"][\"tags\"].map do |tags|\n categories.push(tags[\"display\"]) # Push the 'tags' for each Digg article to an array.\n end\n category_string = categories.join(\", \") # Make a string for each story's category array for Digg.\n story_hash = {\n title: story[\"content\"][\"title\"],\n score: story[\"digg_score\"],\n category: category_string, # There are multiple categories so you're going to have to use .join to get all the different categories to be part of the array.\n author: story[\"content\"][\"author\"]\n }\n end\nend", "def get\n @research_output = @service.get({type: params[:graph], detail: params[:detail], id: params[:id]},\n host: request.env[\"HTTP_HOST\"], limit: params[:num_results], offset: params[:start_offset], :per_project => params[:per_project], format: params[:format])\n\n respond_with @research_output\n end", "def protocol_drug_params\n params.require(:protocol_drug).permit(:dose, :additional_analgesic, :drug_id, :protocol_id)\n end", "def index\n @pugs = Pug.all\n\n render json: @pugs\n end", "def get_champion_data(patch_number)\n response_string = RestClient.get(\"http://ddragon.leagueoflegends.com/cdn/#{patch_number}/data/en_US/champion.json\")\n response_hash = JSON.parse(response_string)\n champion_data = response_hash[\"data\"]\nend", "def gist_url\n \"#{api_url}/gists/%s\"\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def show\n @drug = Drug.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drug }\n end\n end", "def get_dogs\n user_dog = User.find(params[:id]).dog\n if user_dog\n render json: user_dog.to_json(include: :dog_photos)\n else\n render json: []\n end\n end", "def show\n @glass = Glass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @glass }\n end\n end", "def get_game_graphics_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UniverseApi.get_game_graphics ...\"\n end\n if opts[:'datasource'] && !['tranquility', 'singularity'].include?(opts[:'datasource'])\n fail ArgumentError, 'invalid value for \"datasource\", must be one of tranquility, singularity'\n end\n # resource path\n local_var_path = \"/universe/graphics/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'datasource'] = opts[:'datasource'] if !opts[:'datasource'].nil?\n query_params[:'user_agent'] = opts[:'user_agent'] if !opts[:'user_agent'].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 header_params[:'X-User-Agent'] = opts[:'x_user_agent'] if !opts[:'x_user_agent'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Integer>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UniverseApi#get_game_graphics\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def json_ld; end", "def set_protocol_drug\n @protocol_drug = ProtocolDrug.find(params[:id])\n end", "def get_response url, format\r\n begin\r\n response = Net::HTTP.get_response(URI.parse(url))\r\n if format.to_sym == :json\r\n res = JSON.parse response.body\r\n else\r\n res = response.body\r\n end\r\n rescue Exception => e\r\n res = \"ERROR: There is a problem while fetching data, please check whether OpenTSDB is running or not.\"\r\n end\r\n res\r\n end", "def show\n @gopy = Gopy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gopy }\n end\n end", "def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end", "def show\n @grumble = Grumble.find(params[:id])\n render status: 200, json: @grumble.to_json\n end", "def protocols\n get(\"/shodan/protocols\")\n end", "def get url\n puts \"COMMUNICATING WITH TOGGL SERVER COMMUNICATING WITH TOGGL SERVER\"\n uri = URI.parse( url )\n http = Net::HTTP.new( uri.host, uri.port )\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth( @api_key, \"api_token\" )\n request[\"Content-Type\"] = \"application/json\"\n response = http.request( request )\n \n if response.code.to_i==200 # OK\n hash = JSON.parse( response.body )\n elsif response.code.to_i==403 # Authentication\n raise Exceptions::AuthenticationError\n else\n puts \"Error, code #{ response.code }.\"\n puts response.body\n end\n end", "def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end", "def show\n @sleuths = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @sleuth.ext_gene + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @sleuth.ext_gene,\n :headers =>{'Content-Type' => 'application/json'} )\n end", "def get_bgg_game\n response = HTTParty.get('https://www.boardgamegeek.com/xmlapi2/thing?id='+ @gameid)\n end", "def show\n #@plugs = Plug.where(\"legend!='Root' AND legend!='Plugins' AND legend!='Fields'\")\n #@plugs = Plug.where(\"legend!='Root'\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plug }\n end\n end", "def show\n @redpack = Redpack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @redpack }\n end\n end", "def show\n @sampled_url = SampledUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sampled_url }\n end\n end", "def show\n @dataload_ga = DataloadGa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dataload_ga }\n end\n end", "def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend", "def gadget\n fetch('doraemon.gadgets')\n end", "def interesting(options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/interesting/#{@api_key}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200 \n end", "def show\n @socket_gem = SocketGem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socket_gem }\n end\n end", "def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def show\n @gig_request = GigRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gig_request }\n end\n end", "def show\n @citation = Citation.find(params[:id])\n @galaxies = @citation.galaxies\n @citation.galaxy_ids_array\n\n respond_to do |format|\n format.html { render :show }\n format.json { render :json => @citation.to_json(\n :only => [:title, :author, :bibtex, :journal, :year,\n :volume, :pages, :month, :note, :key],\n :methods => [:galaxy_ids_array]\n )\n }\n end\n end", "def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend", "def show\n @droplet = Droplet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @droplet }\n end\n end", "def get_data_from_api\n # address1 = address.parameterize('+')\n # state1 = state.parameterize('+')\n # city1 = city.parameterize('+')\n# \trequest_string = \"https://www.googleapis.com/civicinfo/v2/representatives/?address=#{address}%2C+#{city}%2C+#{state}%2C+#{zipcode}&levels=country&roles=legislatorLowerBody&key=AIzaSyDFYpjPCBUVQLyfS39-lBKRWCkD7-u4zug\" \n# \tcreates a url to access API data\n request_string = \"https://www.googleapis.com/civicinfo/v2/representatives/?address=9+Melrose+Dr.%2C+Livingston%2C+NJ%2C+07039&levels=country&roles=legislatorLowerBody&key=AIzaSyDFYpjPCBUVQLyfS39-lBKRWCkD7-u4zug\"\n\tsample_response = HTTParty.get(request_string) #go grab the data in the portal\n\tsample_parsedResponse = JSON.parse(sample_response.body, {:symbolize_names => true}) #makes data easy to read\n puts sample_parsedResponse[:officials][0][:name] \n puts sample_parsedResponse[:officials][0][:party] \n puts sample_parsedResponse[:officials][0][:phones] \n #returns first element in items array\n end", "def gist(id)\n get \"/gists/#{id}\"\n end", "def show\n @grm = Grm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm }\n end\n end", "def getdifficulty\n @api.request 'getdifficulty'\n end", "def index \n ip_addr = request.env['REMOTE_ADDR'] \n @browse_by = [[\"Browse By\",''],[\"Guides\",'1'],[\"Places\",'2']]\n @characteristics = [\"Latest\",'1'],[\"Most Popular\",'2'],[\"Highest Rated\",'3'],[\"Stress Factor\",'4']\n @notice = notice\n @guides = Guide.where(\"publish=?\",true).order(\"CREATED_AT DESC\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guides }\n end\n end", "def get_drug_info(client)\n name = self.name.split(\" \")[0]\n drugs = client.call(:get_drugs, message: {name: name}).body[:multi_ref]\n drug_info_hash = drugs.find{|hash| hash.find{|key, value| key != :rx_concept && key == :cui}}\n end", "def show\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go_slim }\n end\n end", "def show\n @gmap = Gmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gmap }\n end\n end", "def index\n @glasses = Glass.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @glasses }\n end\n end", "def get_greetings_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: GreetingsApi.get_greetings ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/greetings\".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 => 'DomainEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GreetingsApi#get_greetings\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @grm_pic = GrmPic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_pic }\n end\n end", "def get(path)\n request = Net::HTTP::Get.new @uri.path+'/'+path\n request.basic_auth @api_key, ''\n request['User-Agent'] = USER_AGENT\n response = @https.request request\n JSON.parse response.body\n end", "def show\n @tagg = Tagg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tagg }\n end\n end", "def request_raw_pantheons_data\n return unless authenticated?\n\n response = RestClient.get(\n \"https://godvillegame.com/fbh/feed?a=#{@pantheons_guid}\",\n cookies: @cookies, content_type: :json, accept: :json\n )\n JSON.parse(response)\n end", "def json_url\n \"#{REDDIT_URL_PREFIX}#{permalink}.json\"\n end", "def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end", "def show\n @gist = Gist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gist }\n end\n end", "def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend", "def get_content(mid)\r\n uri = URI.parse(\"https://www.googleapis.com/freebase/v1/rdf/\" << mid)\r\n http = Net::HTTP.new(uri.host, uri.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\r\n request = Net::HTTP::Get.new(uri.request_uri)\r\n response = http.request(request)\r\n if response.code == \"403\"\r\n response.code \r\n else\r\n response.body\r\n end\r\nend", "def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def show\n @gymnasium = Gymnasium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gymnasium }\n end\n end", "def get_from_reddit\n #no parameters needed. We're just going to return the data from the json file.\n route = 'http://www.reddit.com/.json'\n raw_response = RestClient.get route\n response = JSON.load raw_response\n response[\"data\"][\"children\"].map do |story|\n story_hash = {\n title: story[\"data\"][\"title\"],\n score: story[\"data\"][\"score\"],\n category: story[\"data\"][\"subreddit\"],\n author: story[\"data\"][\"author\"]\n }\n end\nend", "def new\n @grm_grappt = GrmGrappt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grm_grappt }\n end\n end", "def show\n @gnode = Gnode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gnode }\n end\n end", "def show\n @hack = Hack.find(params[:id])\n @hacks = Hack.all\n @voters = Voter.all\n @departments = ['Analytics','Rails','WEB TEAM','Clients','Core Services','Infrastructure','Other','Product','UX']\n @vote_directions = Vote.select(\"id AS x,direction AS y\").order(\"created_at\").limit(40).to_json\n @vote_times = Vote.select(\"created_at\").order(\"created_at\").to_json\n\n respond_to do |format|\n format.html # show.html.erb}\n format.json { render json: @hack }\n end\n end", "def get_module_info(mod)\n pull_url = \"https://api.github.com/repos/puppetlabs/puppetlabs-#{mod.name}/issues?state=open&access_token=AUTHTOKEN\"\n response = HTTParty.get pull_url#, :headers=>{\"Authorization\"=>\"Token token=\\\"AUTHTOKEN\\\"\", \"User-Agent\"=>\"craig.gomes\"}\n\n\n json = JSON.parse(response.body)\n ticket_count = get_ticket_count_for_module(mod.name)\n component_count = get_component_count_for_module(mod.name)\n p mod.name\n return [\"#{mod.name}\", \"#{json.length}\",\"#{ticket_count}\",\"#{component_count}\",\"#{mod.supported}\", \"#{mod.homepage_url}\"]\n \nend", "def full_response\n puts JSON.pretty_generate(@google_object)\n end", "def show\n @gram = Gram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gram }\n end\n end", "def fetch_json(game)\n RestClient.post(\"#{ENV['BASE_URI']}\" + \"#{ENV['ENDPOINT']}\", game.to_json, content_type: :json)\n end", "def get_graphs_data\n service_response = DashboardManagement::GetGraphsData.new(params).perform\n\n if service_response.success?\n render :json => service_response.data\n elsif\n service_response.http_code = 404\n render_api_response(service_response)\n end\n end", "def new\n # @gethotelstaticdatagd = Gethotelstaticdatagd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gethotelstaticdatagd }\n end\n end", "def destroy\n @protocol_drug.destroy\n respond_to do |format|\n format.html { redirect_to protocol_drugs_url, notice: 'Protocol drug was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\n @gethotel = Gethotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotel }\n end\n end", "def get_bloodlines_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UniverseApi.get_bloodlines ...\"\n end\n if opts[:'datasource'] && !['tranquility', 'singularity'].include?(opts[:'datasource'])\n fail ArgumentError, 'invalid value for \"datasource\", must be one of tranquility, singularity'\n end\n if opts[:'language'] && !['de', 'en-us', 'fr', 'ja', 'ru', 'zh'].include?(opts[:'language'])\n fail ArgumentError, 'invalid value for \"language\", must be one of de, en-us, fr, ja, ru, zh'\n end\n # resource path\n local_var_path = \"/universe/bloodlines/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'datasource'] = opts[:'datasource'] if !opts[:'datasource'].nil?\n query_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?\n query_params[:'user_agent'] = opts[:'user_agent'] if !opts[:'user_agent'].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 header_params[:'X-User-Agent'] = opts[:'x_user_agent'] if !opts[:'x_user_agent'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Bloodline>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UniverseApi#get_bloodlines\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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 swapi_fetch(url)\n JSON.parse(open(url).read)\nend", "def show\n dog = Dog.find(params[:id])\n render json: dog\n end", "def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend", "def getToolsSyndicateGoogle( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"get\",\"/tools/syndicate/google\",params)\n end", "def rating(food)\n url = 'https://thereportoftheweek-api.herokuapp.com/reports'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n result = JSON.parse(response)\n puts result[7]['product']\n \n end", "def fetch(url)\n response = RestClient.get(url)\n data = JSON.parse(response)\n @google_results = data[\"results\"].first(15).map do |result|\n {\n name: result[\"name\"],\n address: result[\"formatted_address\"],\n coordinates: {\n latitude: result[\"geometry\"][\"location\"][\"lat\"],\n longitude: result[\"geometry\"][\"location\"][\"lng\"]\n },\n opening_hours: result[\"opening_hours\"],\n type: result[\"types\"].first,\n rating: result[\"rating\"]\n }\n end\n @google_results\n end", "def show\n @dog = Dog::Dog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dog }\n end\n end", "def fetch_json(query)\n # query the JSON API using the queries provided below\n # uncomment next line to see the queries being sent to the api in the console. useful for debugging.\n # puts(ENDPOINT + query)\n JSON.load(open(ENDPOINT + query))\n end", "def show\n @garbage = Garbage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @garbage }\n end\n end", "def get_book(search)\n\trequest_string = \"https://www.googleapis.com/books/v1/volumes?q=#{search.gsub(\" \",\"+\")}\"\n\t\n\tsample_uri = URI(request_string) #opens a portal to the data at that link\n\tsample_response = Net::HTTP.get(sample_uri) #go grab the data in the portal\n\tsample_parsedResponse = JSON.parse(sample_response) #makes data easy to read\n\tsample_parsedResponse[\"items\"]\nend", "def show\n @hackplatformrelation = Hackplatformrelation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hackplatformrelation }\n end\n end", "def index\n @q = Galaxy.search(params[:q])\n @q.sorts = 'id asc' if @q.sorts.empty?\n if params[:page] != \"false\"\n @galaxies = @q.result(distinct: true).page(params[:page])\n else\n @galaxies = @q.result(distinct: true)\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render :json => @galaxies.to_json(\n :only => [:id, :galaxy_name, :galaxy_type, :distance, :luminosity, :scale_length,\n :mass_hydrogen, :mass_disk, :velocities_citation, :luminosity_citation, :mass_hydrogen_citation, :scale_length_citation],\n :methods => [:citation_ids_array, :r_last, :vrot_data_last, :velocities_count]\n )\n }\n end\n end" ]
[ "0.6083534", "0.5529922", "0.54482985", "0.54143727", "0.5394134", "0.53941214", "0.5389429", "0.5381269", "0.53785396", "0.53672487", "0.53242886", "0.52991337", "0.52722", "0.5271619", "0.5182331", "0.5175179", "0.51739705", "0.51604325", "0.5157284", "0.51530826", "0.5152622", "0.5139838", "0.5136615", "0.51347125", "0.51347125", "0.51140034", "0.509599", "0.50886905", "0.5078751", "0.50650305", "0.50642586", "0.50629115", "0.5042161", "0.5041728", "0.50267214", "0.5021075", "0.50209683", "0.5004969", "0.5004348", "0.49985492", "0.49848092", "0.49813557", "0.49716753", "0.4955725", "0.49377254", "0.49329293", "0.4927422", "0.49235582", "0.4921728", "0.49024537", "0.4900408", "0.49002567", "0.48977014", "0.48930857", "0.4883394", "0.48770225", "0.48708978", "0.48682308", "0.48681965", "0.4867417", "0.48563123", "0.48557314", "0.48525167", "0.48430437", "0.48359987", "0.48301423", "0.48255402", "0.48249054", "0.48156777", "0.47974876", "0.4797011", "0.47967848", "0.47924373", "0.4784799", "0.47834364", "0.4782401", "0.47812265", "0.47807512", "0.4779878", "0.47711936", "0.47682604", "0.47670728", "0.47637865", "0.47606796", "0.47585207", "0.47488636", "0.47488308", "0.4746172", "0.47426063", "0.47361445", "0.47237596", "0.47196946", "0.4715056", "0.47122994", "0.4711145", "0.47077936", "0.47052354", "0.4703431", "0.4702561", "0.47025454" ]
0.6723771
0
GET /protocol_drugs/1 GET /protocol_drugs/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @protocol_drugs = ProtocolDrug.all\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def show\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotelstaticdatagd }\n end\n end", "def show\n @grm_grappt = GrmGrappt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_grappt }\n end\n end", "def create\n @protocol_drug = ProtocolDrug.new(protocol_drug_params)\n\n respond_to do |format|\n if @protocol_drug.save\n format.html { redirect_to @protocol_drug, notice: 'Protocol drug was successfully created.' }\n format.json { render :show, status: :created, location: @protocol_drug }\n else\n format.html { render :new }\n format.json { render json: @protocol_drug.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @gpath = Gpath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gpath }\n end\n end", "def index\n @gpsds = Gpsd.all\n #respond_to do |format|\n # format.json { render }\n #end\n end", "def get_gdpr_requests_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: GeneralDataProtectionRegulationApi.get_gdpr_requests ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/gdpr/requests\".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 => 'GDPRRequestEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GeneralDataProtectionRegulationApi#get_gdpr_requests\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def room_descriptions_method\r\n my_port = 8081\r\n htttproomnumber = $roomnumber\r\n roomsNtext = \"/#{htttproomnumber}\"\r\n rooms_message = \"/rooms#{roomsNtext}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{rooms_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n return my_json[\"room\"].to_s\r\nend", "def api_get url_suffix\n url = URI::encode \"#{@@oauth_info[:api_url]}/gems/#{url_suffix}\"\n data = {:client_id => @@oauth_info[:client_id]}\n headers = {:Authorization => \"Bearer #{@access_token}\"}\n\n conn = get_conn url\n #Try request 3 times\n for i in 1..3\n res = conn.get(url, data, headers)\n if res.status == 200 then return JSON.parse(res.body) end\n sleep 1\n end\n raise OAuthSessionError, \"GET Failed. Status: #{res.status}. Body: #{res.body}\"\n end", "def set_protocol_drug\n @protocol_drug = ProtocolDrug.find(params[:id])\n end", "def show\n @grm_dog = GrmDog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_dog }\n end\n end", "def get\n @research_output = @service.get({type: params[:graph], detail: params[:detail], id: params[:id]},\n host: request.env[\"HTTP_HOST\"], limit: params[:num_results], offset: params[:start_offset], :per_project => params[:per_project], format: params[:format])\n\n respond_with @research_output\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_response url, format\r\n begin\r\n response = Net::HTTP.get_response(URI.parse(url))\r\n if format.to_sym == :json\r\n res = JSON.parse response.body\r\n else\r\n res = response.body\r\n end\r\n rescue Exception => e\r\n res = \"ERROR: There is a problem while fetching data, please check whether OpenTSDB is running or not.\"\r\n end\r\n res\r\n end", "def drugbank_get(route, params)\n url = $drugbank_api + route\n res = HTTParty.get(url, :query => params, :headers => $drugbank_headers)\n return res\nend", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend", "def get_game_graphics_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UniverseApi.get_game_graphics ...\"\n end\n if opts[:'datasource'] && !['tranquility', 'singularity'].include?(opts[:'datasource'])\n fail ArgumentError, 'invalid value for \"datasource\", must be one of tranquility, singularity'\n end\n # resource path\n local_var_path = \"/universe/graphics/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'datasource'] = opts[:'datasource'] if !opts[:'datasource'].nil?\n query_params[:'user_agent'] = opts[:'user_agent'] if !opts[:'user_agent'].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 header_params[:'X-User-Agent'] = opts[:'x_user_agent'] if !opts[:'x_user_agent'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Integer>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UniverseApi#get_game_graphics\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @gopy = Gopy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gopy }\n end\n end", "def new\n # @gethotelstaticdatagd = Gethotelstaticdatagd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gethotelstaticdatagd }\n end\n end", "def get_champion_data(patch_number)\n response_string = RestClient.get(\"http://ddragon.leagueoflegends.com/cdn/#{patch_number}/data/en_US/champion.json\")\n response_hash = JSON.parse(response_string)\n champion_data = response_hash[\"data\"]\nend", "def json\n url = 'http://api.dribbble.com/players/' + @user + '/shots?per_page=' + @shots_per_page.to_s + '&page=' + @page.to_s\n resp = Net::HTTP.get_response(URI.parse(url))\n return resp.body\n end", "def show\n @sampled_url = SampledUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sampled_url }\n end\n end", "def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend", "def show\n @dataload_ga = DataloadGa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dataload_ga }\n end\n end", "def show\n @glass = Glass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @glass }\n end\n end", "def show\n @socket_gem = SocketGem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socket_gem }\n end\n end", "def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end", "def show\n @grumble = Grumble.find(params[:id])\n render status: 200, json: @grumble.to_json\n end", "def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend", "def show\n @gid2name = Gid2name.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gid2name }\n end\n end", "def show\n @redpack = Redpack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @redpack }\n end\n end", "def show\n @grm_pic = GrmPic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm_pic }\n end\n end", "def new\n @grm_grappt = GrmGrappt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grm_grappt }\n end\n end", "def index\n @pugs = Pug.all\n\n render json: @pugs\n end", "def get_bgg_game\n response = HTTParty.get('https://www.boardgamegeek.com/xmlapi2/thing?id='+ @gameid)\n end", "def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end", "def show\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go_slim }\n end\n end", "def show\n @drug = Drug.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drug }\n end\n end", "def protocol_drug_params\n params.require(:protocol_drug).permit(:dose, :additional_analgesic, :drug_id, :protocol_id)\n end", "def show\n @grm = Grm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grm }\n end\n end", "def show\n @gig_request = GigRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gig_request }\n end\n end", "def get_graphs_data\n service_response = DashboardManagement::GetGraphsData.new(params).perform\n\n if service_response.success?\n render :json => service_response.data\n elsif\n service_response.http_code = 404\n render_api_response(service_response)\n end\n end", "def show\n @src_gst = SrcGst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @src_gst }\n end\n end", "def show\n @gnode = Gnode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gnode }\n end\n end", "def get url\n puts \"COMMUNICATING WITH TOGGL SERVER COMMUNICATING WITH TOGGL SERVER\"\n uri = URI.parse( url )\n http = Net::HTTP.new( uri.host, uri.port )\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth( @api_key, \"api_token\" )\n request[\"Content-Type\"] = \"application/json\"\n response = http.request( request )\n \n if response.code.to_i==200 # OK\n hash = JSON.parse( response.body )\n elsif response.code.to_i==403 # Authentication\n raise Exceptions::AuthenticationError\n else\n puts \"Error, code #{ response.code }.\"\n puts response.body\n end\n end", "def show\n @gymnasium = Gymnasium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gymnasium }\n end\n end", "def json_ld; end", "def show\n @protocol = Protocol.find(params[:id])\n @title = \"Protocols\"\n\n @s = Sampling.find(@protocol.sampling_id)\n @pt = Partner.find(@s.partner_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @protocol }\n end\n end", "def get(path)\n request = Net::HTTP::Get.new @uri.path+'/'+path\n request.basic_auth @api_key, ''\n request['User-Agent'] = USER_AGENT\n response = @https.request request\n JSON.parse response.body\n end", "def series_get(id)\n begin\n api = \"#{$config['sonarr']['api_url']}/series/#{id}\"\n log_debug(api)\n uri = URI(api)\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json', 'X-Api-Key'=> $config['sonarr']['api_key'])\n \n json = {}\n json['id'] = id\n \n req.body = json.to_json\n res = http.request(req) \n json = JSON.parse(res.body)\n debug json\n rescue => e\n puts \"failed #{e}\"\n end\n end", "def show\n @gmap = Gmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gmap }\n end\n end", "def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end", "def fetch_json(game)\n RestClient.post(\"#{ENV['BASE_URI']}\" + \"#{ENV['ENDPOINT']}\", game.to_json, content_type: :json)\n end", "def gist_url\n \"#{api_url}/gists/%s\"\n end", "def show\n @bg_setup = BgSetup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bg_setup }\n end\n end", "def new\n @protocol = Protocol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @protocol }\n end\n end", "def show\n #@plugs = Plug.where(\"legend!='Root' AND legend!='Plugins' AND legend!='Fields'\")\n #@plugs = Plug.where(\"legend!='Root'\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plug }\n end\n end", "def show\n @networking = Networking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @networking }\n end\n end", "def show\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gauge }\n end\n end", "def traffic id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/traffic?date=#{date}\"\n fetch uri\n end", "def get_gdpr_request_with_http_info(request_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: GeneralDataProtectionRegulationApi.get_gdpr_request ...\"\n end\n \n \n # verify the required parameter 'request_id' is set\n fail ArgumentError, \"Missing the required parameter 'request_id' when calling GeneralDataProtectionRegulationApi.get_gdpr_request\" if request_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/gdpr/requests/{requestId}\".sub('{format}','json').sub('{' + 'requestId' + '}', request_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GDPRRequest')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GeneralDataProtectionRegulationApi#get_gdpr_request\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_json_stats_from(ip, port)\n Net::HTTP.start(ip, port) {|http| http.get('/stats.json') }.body rescue \"{}\"\nend", "def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend", "def get_genre_by_id_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: GenreApi.get_genre_by_id ...\"\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 GenreApi.get_genre_by_id\"\n end\n if @api_client.config.client_side_validation && id < 0\n fail ArgumentError, 'invalid value for \"id\" when calling GenreApi.get_genre_by_id, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = \"/genres/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'_external_station_id'] = opts[:'_external_station_id'] if !opts[:'_external_station_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['API Key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GenreResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GenreApi#get_genre_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def json\n fields = dataset.dataset_fields\n e_doc = Hpricot(open(url))\n data = {\"id\"=> id, \"url\"=> url }\n fields.each do |field|\n p field\n data[field.name] = (e_doc/field.css).text.strip\n end\n puts data.inspect \n \n data.to_json \n end", "def new\n @redpack = Redpack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @redpack }\n end\n end", "def index\n @drugs = Drug.all\n # @permitted_drugs = Drug.permitted.alphabetical.all\n # @prohibited_drugs = Drug.prohibited.alphabetical.all\n # @restricted_drugs = Drug.restricted.alphabetical.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drugs }\n end\n end", "def show\n respond_to do |format|\n format.html {}\n format.json {}\n format.rdf { render rdf: @paper }\n end\n end", "def show\n @hackplatformrelation = Hackplatformrelation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hackplatformrelation }\n end\n end", "def show\n @go = Go.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go }\n end\n end", "def show\n @drawable = Drawable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drawable }\n end\n end", "def get(type, id)\n info = json_get(@target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\",\n @key_style, headers)\n\n fake_client_id(info) if type == :client # hide client reply, not quite scim\n info\n end", "def show\n @gram = Gram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gram }\n end\n end", "def show\n @http_domain_rule = collection.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @http_domain_rule }\n end\n end", "def get_data_from_api\n # address1 = address.parameterize('+')\n # state1 = state.parameterize('+')\n # city1 = city.parameterize('+')\n# \trequest_string = \"https://www.googleapis.com/civicinfo/v2/representatives/?address=#{address}%2C+#{city}%2C+#{state}%2C+#{zipcode}&levels=country&roles=legislatorLowerBody&key=AIzaSyDFYpjPCBUVQLyfS39-lBKRWCkD7-u4zug\" \n# \tcreates a url to access API data\n request_string = \"https://www.googleapis.com/civicinfo/v2/representatives/?address=9+Melrose+Dr.%2C+Livingston%2C+NJ%2C+07039&levels=country&roles=legislatorLowerBody&key=AIzaSyDFYpjPCBUVQLyfS39-lBKRWCkD7-u4zug\"\n\tsample_response = HTTParty.get(request_string) #go grab the data in the portal\n\tsample_parsedResponse = JSON.parse(sample_response.body, {:symbolize_names => true}) #makes data easy to read\n puts sample_parsedResponse[:officials][0][:name] \n puts sample_parsedResponse[:officials][0][:party] \n puts sample_parsedResponse[:officials][0][:phones] \n #returns first element in items array\n end", "def new\n @gpath = Gpath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gpath }\n end\n end", "def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def json_url\n \"#{REDDIT_URL_PREFIX}#{permalink}.json\"\n end", "def show\n @scheme = Scheme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scheme }\n end\n end", "def get_digg\n\nresponse = JSON.parse(RestClient.get 'http://digg.com/api/news/popular.json')\n# puts response['data']['feed'][0]['content']['title']\n\nstories = []\n\nresponse['data']['feed'].each do |story|\n\tstory_hash = {}\n\tstory_hash[:title] = story['content']['title']\n\tstory_hash[:category] = story['content']['tags'][0]['display']\n\tcalculate_upvotes(story_hash)\n\tstories.push(story_hash)\n\tend\n\tshow_all_stories(stories)\nend", "def get_from_digg\n raw_response = RestClient.get('http://digg.com/api/news/popular.json')\n response = JSON.load(raw_response)\n\n response[\"data\"][\"feed\"].map do |story|\n story_hash = {\n title: story[\"content\"][\"title_alt\"],\n author: story[\"content\"][\"author\"],\n score: story[\"digg_score\"],\n category: story[\"content\"][\"tags\"].map {|tag| tag[\"display\"]}\n }\n end\n\n\nend", "def show\n @genotype = Genotype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @genotype }\n end\n end", "def get_dogs\n user_dog = User.find(params[:id]).dog\n if user_dog\n render json: user_dog.to_json(include: :dog_photos)\n else\n render json: []\n end\n end", "def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end", "def show\n @quality_lot_gauge = QualityLotGauge.find(params[:quality_lot_gauge_id])\n @quality_lot_gauge_result = @quality_lot_gauge.quality_lot_gauge_results.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @quality_lot_gauge_result }\n end\n end", "def show\n @rubygem = Rubygem.find(params[:id])\n\n render json: @rubygem\n end", "def show\n @traffic = Traffic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @traffic }\n end\n end", "def show\n @graphic = Graphic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @graphic }\n end\n end", "def show\n @graphic = Graphic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @graphic }\n end\n end", "def show\n @tagg = Tagg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tagg }\n end\n end", "def show\n @lab_device = LabDevice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_device }\n end\n end", "def new\n @grm_dog = GrmDog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grm_dog }\n end\n end", "def show\n @glyph = Glyph.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @glyph }\n end\n end", "def show\n @quality_lot_gauge = QualityLotGauge.find(params[:quality_lot_gauge_id])\n @quality_lot_gauge_dimension = @quality_lot_gauge.quality_lot_gauge_dimensions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @quality_lot_gauge_dimension }\n end\n end", "def show\n @green = Green.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @green }\n end\n end", "def show\n @gethotel = Gethotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotel }\n end\n end", "def new\n @dataload_ga = DataloadGa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dataload_ga }\n end\n end", "def show\n @dimgeom = Dimgeom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dimgeom }\n end\n end" ]
[ "0.6471411", "0.60211474", "0.5700465", "0.551893", "0.5500407", "0.54537416", "0.54525906", "0.54347014", "0.5418249", "0.5398395", "0.5374502", "0.5337369", "0.53373367", "0.5336355", "0.5305261", "0.5305261", "0.5303837", "0.5299168", "0.5291861", "0.5261096", "0.5195701", "0.51757514", "0.5171898", "0.5165268", "0.51631993", "0.51565605", "0.51564646", "0.5142512", "0.5138934", "0.51335543", "0.5117717", "0.51056546", "0.5104336", "0.50974655", "0.50907624", "0.5086528", "0.5074131", "0.50734127", "0.50655437", "0.5059481", "0.50572485", "0.50516385", "0.50209874", "0.50174636", "0.5012782", "0.5010085", "0.49952692", "0.4980222", "0.49757984", "0.49701133", "0.49698117", "0.49686736", "0.4968277", "0.49665678", "0.49558157", "0.49493018", "0.4946085", "0.49445203", "0.4943758", "0.49436724", "0.49403113", "0.4930994", "0.4930832", "0.4922503", "0.4922266", "0.49213472", "0.49074945", "0.49040034", "0.49024448", "0.4901802", "0.4896858", "0.48968464", "0.48941934", "0.48937517", "0.4889608", "0.48891467", "0.4884156", "0.48832217", "0.48782048", "0.4877879", "0.4871357", "0.48659372", "0.48651546", "0.48557", "0.48547894", "0.48526472", "0.4845607", "0.48383522", "0.48360577", "0.48349538", "0.48312363", "0.48312363", "0.48307595", "0.48307458", "0.48290303", "0.48287728", "0.48287427", "0.48267642", "0.48259783", "0.48251167", "0.48246893" ]
0.0
-1
POST /protocol_drugs POST /protocol_drugs.json
def create @protocol_drug = ProtocolDrug.new(protocol_drug_params) respond_to do |format| if @protocol_drug.save format.html { redirect_to @protocol_drug, notice: 'Protocol drug was successfully created.' } format.json { render :show, status: :created, location: @protocol_drug } else format.html { render :new } format.json { render json: @protocol_drug.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def protocol_drug_params\n params.require(:protocol_drug).permit(:dose, :additional_analgesic, :drug_id, :protocol_id)\n end", "def post_gdpr_requests_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: GeneralDataProtectionRegulationApi.post_gdpr_requests ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling GeneralDataProtectionRegulationApi.post_gdpr_requests\" if body.nil?\n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/gdpr/requests\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'deleteConfirmed'] = opts[:'delete_confirmed'] if opts[:'delete_confirmed']\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 => 'GDPRRequest')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GeneralDataProtectionRegulationApi#post_gdpr_requests\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @protocol_drugs = ProtocolDrug.all\n end", "def post_new_gist content \n\t\t\t\turl = GITHUB_API_GIST_LINK \n\t\t\t\tresponse = https_open_for ({url: url, mthd:\"post\", content: content})\n \t\t\t\tJSON.parse response.body\n\t\t\tend", "def protocol_params\n params.require(:protocol).permit(:tile, :abstract, :materials_and_methods, :journal, :journal_id, :publication_date, :highlights)\n end", "def set_protocol_drug\n @protocol_drug = ProtocolDrug.find(params[:id])\n end", "def create\n @gadget = Gadget.new(gadget_params)\n\n respond_to do |format|\n if @gadget.save\n format.html { redirect_to @gadget, notice: 'Gadget was successfully created.' }\n format.json { render :show, status: :created, location: @gadget }\n else\n format.html { render :new }\n format.json { render json: @gadget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gpsd = Gpsd.new(gpsd_params)\n\n if @gpsd.save\n render json: @gpsd, status: :created, location: @gpsd\n else\n render json: @gpsd.errors, status: :unprocessable_entity\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 generate_tags\n uri = URI.parse(\"https://api.thomsonreuters.com/permid/calais\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n post_body = []\n post_body << \"<Document><Body>\"\n # stip html\n post_body << ActionView::Base.full_sanitizer.sanitize(params[:desc])\n # no strip\n # post_body << params[:desc]\n post_body << \"</Body></Document>\"\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field(\"Content-Type\",\"text/xml\")\n request.add_field(\"outputFormat\",\"application/json\")\n #request.add_field(\"outputFormat\",\"text/n3\") \n request.add_field(\"x-ag-access-token\",\"fY7WUM3GGCXHm9ATOhtzhrvlWX8oPo5X\")\n request.body = post_body.join\n # request[\"Content-Type\"] = \"multipart/form-data, boundary=#{BOUNDARY}\"\n\n render :json => http.request(request).body\n end", "def ddc_params\n params.require(:ddc).permit(:name, :description, :reference_url, :json, :examples)\n end", "def post_gdpr_requests(body, opts = {})\n data, _status_code, _headers = post_gdpr_requests_with_http_info(body, opts)\n return data\n end", "def upload_submission(sub_info)\n uri = URI.parse(TARGET_API)\n http = Net::HTTP.new(uri.host, uri.port)\n\n req = Net::HTTP::Post.new(\"/ontologies/#{sub_info['ontology']['acronym']}/submissions\")\n req['Content-Type'] = 'application/json'\n req['Authorization'] = \"apikey token=#{TARGET_APIKEY}\"\n\n # Check if the source BioPortal is pulling the ontology from an URL\n # If yes then we will pull the ontology from this place (allow auto update of the ontology when the ontology is changed in its source URL)\n if sub_info['pullLocation'].nil?\n pull_location = \"#{sub_info['ontology']['links']['download']}?apikey=#{SOURCE_APIKEY}\"\n else\n pull_location = sub_info['pullLocation']\n end\n\n # Extract contacts\n contacts = []\n sub_info['contact'].each do |contact|\n contacts.push({'name': contact['name'],'email': contact['email']})\n end\n\n # Build the json body\n # hasOntologyLanguage options: OWL, UMLS, SKOS, OBO\n # status: alpha, beta, production, retired\n req.body = {\n 'contact': contacts,\n 'hasOntologyLanguage': sub_info['hasOntologyLanguage'],\n 'released': sub_info['released'],\n 'ontology': \"#{TARGET_API}/ontologies/#{sub_info['ontology']['acronym']}\",\n 'description': sub_info['description'],\n 'status': sub_info['status'],\n 'version': sub_info['version'],\n 'homepage': sub_info['homepage'],\n 'documentation': sub_info['documentation'],\n 'publication': sub_info['publication'],\n 'naturalLanguage': sub_info['naturalLanguage'],\n 'pullLocation': pull_location\n }.to_json\n\n #puts req.body.to_s\n response = http.start do |http|\n http.request(req)\n end\n\n return response\nend", "def send(key)\n HTTParty.post(@add_url, {\n :headers => {\n \"Content-Type\" => \"application/json; charset=UTF8\",\n \"X-Accept\" => \"application/json\"\n },\n :body => {\n #:url => formatted[:url],\n :url => \"https://www.engadget.com/2016/10/09/more-galaxy-note-7-replacement-fires/\",\n #:tags => formatted[:tags],\n :consumer_key => ENV['POCKET_CONSUMER_KEY'],\n :access_token => key\n }.to_json\n })\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create\n @protocol = Protocol.new(params[:protocol])\n\n respond_to do |format|\n if @protocol.save\n format.html { redirect_to @protocol, notice: 'Protocol was successfully created.' }\n format.json { render json: @protocol, status: :created, location: @protocol }\n else\n format.html { render action: \"new\" }\n format.json { render json: @protocol.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dog_poly = DogPoly.new(dog_poly_params)\n\n respond_to do |format|\n if @dog_poly.save\n format.html { redirect_to @dog_poly, notice: 'Dog poly was successfully created.' }\n format.json { render :show, status: :created, location: @dog_poly }\n else\n format.html { render :new }\n format.json { render json: @dog_poly.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_rest_api(endpoint, data, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP POST request against the specified REST API endpoint\n request = Net::HTTP::Post.new(rest_api_endpoint)\n # Set the Content-Type and data of the HTTP POST request\n request.content_type = \"application/json\"\n request.body = data\n # Submit the request\n response = http.request(request)\n # Return the response bosy (JSON containing the result of the POST operation)\n response.body\nend", "def create\n @drug = Drug.new(params[:drug])\n\n respond_to do |format|\n if @drug.save\n format.html { redirect_to @drug, notice: 'Drug was successfully created.' }\n format.json { render json: @drug, status: :created, location: @drug }\n else\n format.html { render action: \"new\" }\n format.json { render json: @drug.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(path, json, params = {})\n if path.include?('covid19')\n request = Net::HTTP::Post.new(path, @headers)\n else\n request = Net::HTTP::Post.new('/v2' + path, @headers)\n end\n request.add_field('Content-Type', 'application/json')\n request.body = json\n params.each do |k, v|\n request[k] = v\n end\n send_request(request)\n end", "def destroy\n @protocol_drug.destroy\n respond_to do |format|\n format.html { redirect_to protocol_drugs_url, notice: 'Protocol drug was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @grm_dog = GrmDog.new(params[:grm_dog])\n\n respond_to do |format|\n if @grm_dog.save\n format.html { redirect_to @grm_dog, notice: 'Dog was succesfully created.' }\n format.json { render json: @grm_dog, status: :created, location: @grm_dog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @grm_dog.errors, status: :unprocessable_entity }\n end\n end\n end", "def puggle_params\n params.require(:puggle).permit(:name, :color, :build, :temperament)\n end", "def create\n @protocol = Protocol.new(protocol_params)\n\n respond_to do |format|\n if @protocol.save\n format.html { redirect_to protocols_url, notice: 'Protocolo creado.' }\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @protocol.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @type = params[:type]\n item = params.require(:item)\n @mac = item.require(:machine)\n machine = Machine.check(@mac.permit(:mac))\n\n data = item.require(:data)\n @result = Array.new\n\n data.each do |d|\n ads = Array.new\n\n ad_list = d.require(:ads)\n ad_list.each do |ad_data|\n ads << Ad.new(ad_data.permit(:channel, :value, :range))\n end\n\n gp40 = machine.gp40s.create(d.permit(:date, :beginning))\n gp40.ads = ads\n\n @result << gp40\n end\n\n render :status => :created\n end", "def protocol_params\n params.require(:protocol).permit(:code, :name, :sponsor_id, :patients_commitment,\n :principal_investigator_id, :coordinator_id, :backup_coordinator_id,\n :monitor_name, :monitor_phone, :monitor_mobile, :monitor_email,\n :monitor_name1, :monitor_phone1, :monitor_mobile1, :monitor_email1,\n :monitor_name2, :monitor_phone2, :monitor_mobile2, :monitor_email2,\n :referring_doctor_payment_price, sub_investigator_ids:[])\n end", "def create \n render json: Tuning.create(tuning_params)\n end", "def create\n @protocol_relationship = ProtocolRelationship.new(protocol_relationship_params)\n\n respond_to do |format|\n if @protocol_relationship.save\n format.html { redirect_to @protocol_relationship, notice: 'Protocol relationship was successfully created.' }\n format.json { render :show, status: :created, location: @protocol_relationship }\n else\n format.html { render :new }\n format.json { render json: @protocol_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_all_the_dogs_are_in_one_pack\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, Rover, Doggie, and Lassie are all in one pack. Oh no!', last_response.body\n end", "def create\n @pug = Pug.new(pug_params)\n\n if @pug.save\n render json: @pug, status: :created, location: @pug\n else\n render json: @pug.errors, status: :unprocessable_entity\n end\n end", "def create\n @garbage_type = GarbageType.new(garbage_type_params)\n\n respond_to do |format|\n if @garbage_type.save\n format.html { redirect_to @garbage_type, notice: 'Garbage type was successfully created.' }\n format.json { render :show, status: :created, location: @garbage_type }\n else\n format.html { render :new }\n format.json { render json: @garbage_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def ga_datum_params\n params.require(:ga_datum).permit(:ga_label_id, :profile, :json)\n end", "def post_report dep_name, user, vars, log\n require 'net/http'\n require 'uri'\n\n returning(Net::HTTP.post_form(\n URI.parse('http://gist.github.com/api/v1/xml/new'),\n {\n \"files[from]\" => user,\n \"files[vars.yml]\" => vars,\n \"files[#{dep_name}.log]\" => log.decolorize\n }\n )) do |response|\n report_report_result dep_name, response\n end.is_a? Net::HTTPSuccess\n end", "def update\n respond_to do |format|\n if @protocol_drug.update(protocol_drug_params)\n format.html { redirect_to @protocol_drug, notice: 'Protocol drug was successfully updated.' }\n format.json { render :show, status: :ok, location: @protocol_drug }\n else\n format.html { render :edit }\n format.json { render json: @protocol_drug.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_assignment(name)\n @url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/assignments\"\n puts \"@url is #{@url}\"\n\n @payload={'assignment': { \n 'name': name,\n 'points_possible': '0',\n 'grading_type': 'pass_fail',\n 'published': 'true',\n 'submission_types': [ \"none\" ]\n }\n }\n\n @postResponse = HTTParty.post(@url, :body => @payload.to_json, :headers => $header )\n puts(\" POST to create assignment has Response.code #{@postResponse.code} and postResponse is #{@postRepsone}\")\nend", "def create\n gethotelstaticdatagd = Gethotelstaticdatagd.get_hotel_static_data_gds(params)\n\n respond_to do |format|\n if gethotelstaticdatagd.body.include?(\"<boolean xmlns=\\\"http://www.reconline.com/\\\">true</boolean>\")\n flash[:notice] = 'Gethotelstaticdatagd was successfully created.'\n format.html { redirect_to :action=>:index }\n format.json { render json: @gethotelstaticdatagd, status: :created, location: @gethotelstaticdatagd }\n else\n flash[:notice] = gethotelstaticdatagd.body\n format.html { render action: \"new\" }\n format.json { render json: @gethotelstaticdatagd.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dishtype = Dishtype.new(dishtype_params)\n\n respond_to do |format|\n if @dishtype.save\n format.html { redirect_to @dishtype, notice: 'Dishtype was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dishtype }\n else\n format.html { render action: 'new' }\n format.json { render json: @dishtype.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_gdpr_requests_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: GeneralDataProtectionRegulationApi.get_gdpr_requests ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/gdpr/requests\".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 => 'GDPRRequestEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GeneralDataProtectionRegulationApi#get_gdpr_requests\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @redpack = Redpack.new(params[:redpack])\n\n respond_to do |format|\n if @redpack.save\n format.html { redirect_to @redpack, notice: 'Redpack was successfully created.' }\n format.json { render json: @redpack, status: :created, location: @redpack }\n else\n format.html { render action: \"new\" }\n format.json { render json: @redpack.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_recipe_request(version, auth_headers, data = {})\n post \"/api/recipes\", params: data, headers: {'Content-Type' => \"application/json\", 'Accept' => \"application/vnd.ink.#{version}\" }.merge(auth_headers)\nend", "def create\n @gig_type = GigType.new(gig_type_params)\n\n respond_to do |format|\n if @gig_type.save\n format.html { redirect_to @gig_type, notice: 'Gig type was successfully created.' }\n format.json { render :show, status: :created, location: @gig_type }\n else\n format.html { render :new }\n format.json { render json: @gig_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @g4_dongal_board_social = G4DongalBoardSocial.new(g4_dongal_board_social_params)\n\n respond_to do |format|\n if @g4_dongal_board_social.save\n format.html { redirect_to @g4_dongal_board_social, notice: 'G4 dongal board social was successfully created.' }\n format.json { render :show, status: :created, location: @g4_dongal_board_social }\n else\n format.html { render :new }\n format.json { render json: @g4_dongal_board_social.errors, status: :unprocessable_entity }\n end\n end\n end", "def ns_catalogue_poster()\n url = 'http://apis.t-nova.eu:4011/network-services'\n puts url\n uri = URI.parse(url)\n puts uri\n\n params = File.read('config/catalogue_nsd.json')\n puts params\n\n http = Net::HTTP.new(uri.host, uri.port)\n #http.use_ssl = true\n #http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(uri.request_uri)\n\n #request.set_form_data('code' => token, 'client_id' => @client_id, 'client_secret' => client_secret, 'redirect_uri' => googleauth_url, 'grant_type' => 'authorization_code')\n request.content_type = 'application/json'\n request.body = params\n response = http.request(request)\n response.code\n\n if response.code == 201\n puts \"#{response.code}\".color(Colors::GREEN)\n else\n puts \"#{response.code}\".color(Colors::RED)\n end\n\n return response.code\n end", "def create_url\n \"#{api_url}/gists\"\n end", "def gg_params\n params.require(:gg).permit(:code, :alias, :description)\n end", "def post(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n response = http.start {|http| http.request(request) }\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend", "def bridges_create(params = {})\n post \"bridges\", params\n end", "def create\n @hackplatformrelation = Hackplatformrelation.new(params[:hackplatformrelation])\n\n respond_to do |format|\n if @hackplatformrelation.save\n format.html { redirect_to @hackplatformrelation, :notice => 'Hackplatformrelation was successfully created.' }\n format.json { render :json => @hackplatformrelation, :status => :created, :location => @hackplatformrelation }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @hackplatformrelation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def gongdan_params\n params.require(:gongdan).permit(:number, :title, :creator, :department, :area, :demander, :emergent, :file_time, :appoint_worker_again, :image, :avatar,\n :description, :appoint_worker, :state, :evaluate, :user_id, :e_timeliness, :e_attitude,:accept_time,\n :dispatch_time, :dispatch_time_second, :transfer_time, :e_quality, :e_improvement, :experience_base, :file,\n :finish_time, :transger_reson, :appoint_worker_again, :flag, :build_way, :appoint_department,:category, :processing_procedure,\n :helpers => [] )\n\n end", "def create\n @release = Release.new(release_params)\n\n # release_title = release_params[:title]\n # artist_name = @artist.name\n #\n # discogs_api_key = ENV.fetch('DISCOGS_API_KEY')\n # discogs_secret_api_key = ENV.fetch('DISCOGS_SECRET_API_KEY')\n #\n # response = HTTParty.get(\"https://api.discogs.com/database/search?release_title=#{release_title}&artist=#{artist_name}&key=#{discogs_api_key}&secret=#{discogs_secret_api_key}\")\n\n # byebug\n\n response['results'].each do |result|\n if result['format'].include? \"Vinyl\"\n @release.artist_id = @artist\n\n release_title = response['title'].split(' - ').last\n @release.title = release_title\n\n format_array = response['format'].split(' ')\n format_type = format_array.select { |format| format == \"LP\" }\n @release.format = format_type.join\n\n @release.released_at = response['year']\n @release.image_data = response['images'][0]['resource_url']\n @release.country_code = response['id']\n @release.format = response['id']\n @release.artist_id = response['id']\n end\n end\n\n respond_to do |format|\n if @release.save\n format.html { redirect_to @release, notice: 'Release was successfully created.' }\n format.json { render :show, status: :created, location: @release }\n else\n format.html { render :new }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end", "def json_ld; end", "def create\n @sudoku = Sudoku.new(sudoku_params)\n @sudoku.gaps = Sudoku.generate_gaps\n respond_to do |format|\n if @sudoku.save\n format.html { redirect_to @sudoku }\n format.json { render :show, status: :created, location: @sudoku }\n else\n format.html { render :new }\n format.json { render json: @sudoku.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dataload_ga = DataloadGa.new(params[:dataload_ga])\n\n respond_to do |format|\n if @dataload_ga.save\n format.html { redirect_to edit_dataload_ga_path(@dataload_ga), notice: 'Dataload ga was successfully created.' }\n format.json { render json: @dataload_ga, status: :created, location: @dataload_ga }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dataload_ga.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_prowl(options)\n uri = URI.parse(\"https://prowl.weks.net/publicapi/add\")\n https = Net::HTTP.new(uri.host, uri.port)\n # We have to use SSL\n https.use_ssl = true\n # Avoid to get warning\n https.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Post.new(uri.path)\n # Default options for notifications\n options = {:apikey => $configure[:prowl][:apikey], :application => \"Twitter\", :priority => 0}.merge(options)\n req.set_form_data(options)\n https.request(req)\nend", "def create\n @drug_interaction = DrugInteraction.new(drug_interaction_params)\n\n respond_to do |format|\n if @drug_interaction.save\n format.html { redirect_to @drug_interaction, notice: 'Drug interaction was successfully created.' }\n format.json { render :show, status: :created, location: @drug_interaction }\n else\n format.html { render :new }\n format.json { render json: @drug_interaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def add datapoints, opts={}\n datapoints = [*datapoints]\n\n datapoints.each do |dp|\n # we grab these datapoints for ourselves\n dp.goal = self\n \n data = {\n \"sendmail\" => opts[:sendmail] || false\n }.merge(dp.to_hash)\n\n # TODO create_all doesn't work because Ruby's POST encoding of arrays is broken.\n @user.post \"users/me/goals/#{@slug}/datapoints.json\", data\n end\n end", "def create\n @gym_rat = GymRat.new(gym_rat_params)\n\n respond_to do |format|\n if @gym_rat.save\n format.html { redirect_to @gym_rat, notice: \"Gym rat was successfully created.\" }\n format.json { render :show, status: :created, location: @gym_rat }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @gym_rat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @header.merge!({'Content-Type' => \"application/json\"})\n query = {name: \"Default\", region: \"sfo1\", size: \"512mb\", image: '5141286'}\n response = self.class.post('/droplets', {query: query, headers: @header})\n tratar_response(response)\n end", "def datum_params\n params.require(:datum).permit(:name, :audio, :video, :gesture, :actor_id, :topic_id, :gesture_tag_id, :keywords, gesture_tag_attributes: [:iconic, :metaphoric, :deictic, :beat])\n end", "def create\n @shared_url = SharedUrl.new(params[:shared_url])\n @shared_url.topic_list = params[:tags]\n @shared_url.rated_difficulties.build(:difficulty => params[:level])\n respond_to do |format|\n if @shared_url.save\n format.html { redirect_to @shared_url, notice: 'Shared url was successfully created.' }\n format.json { render json: @shared_url, status: :created, location: @shared_url }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shared_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def packages_upload_dart_with_http_info(owner, repo, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PackagesApi.packages_upload_dart ...\"\n end\n # verify the required parameter 'owner' is set\n if @api_client.config.client_side_validation && owner.nil?\n fail ArgumentError, \"Missing the required parameter 'owner' when calling PackagesApi.packages_upload_dart\"\n end\n # verify the required parameter 'repo' is set\n if @api_client.config.client_side_validation && repo.nil?\n fail ArgumentError, \"Missing the required parameter 'repo' when calling PackagesApi.packages_upload_dart\"\n end\n # resource path\n local_var_path = \"/packages/{owner}/{repo}/upload/dart/\".sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'data'])\n auth_names = ['apikey']\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 => 'AlpinePackageUpload')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PackagesApi#packages_upload_dart\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def post_telephony_providers_edges_didpools_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TelephonyProvidersEdgeApi.post_telephony_providers_edges_didpools ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling TelephonyProvidersEdgeApi.post_telephony_providers_edges_didpools\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/telephony/providers/edges/didpools\".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 => 'DIDPool')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TelephonyProvidersEdgeApi#post_telephony_providers_edges_didpools\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def post_slack available_licenses\n\n proxy_addr = 'proxy-corp-apps.intranet'\n proxy_port = 80\n\n url = URI(\"https://hooks.slack.com/services/..../.../xxxxxxxxx\")\n\n http = Net::HTTP.new(url.host, url.port, proxy_addr, proxy_port)\n\thttp.use_ssl = true\n\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n if available_licenses <=50\n \tpriority = 'danger'\n else\n \tpriority = 'warning' \t\n end\n\n\trequest = Net::HTTP::Post.new(url)\n\trequest[\"content-type\"] = 'application/json'\n\trequest[\"cache-control\"] = 'no-cache'\n\trequest.body = \"{\\n\\n \n\t\t\t\t\t\t\\\"channel\\\":\\\"#sistemas-base-monit\\\",\\n \n\t\t\t\t\t\t\\\"username\\\":\\\"Bitbucket Alert\\\",\\n \n\t\t\t\t\t\t\\\"icon_url\\\":\\\"https://avatars.slack-edge.com/2018-12-05/00000_0000_0.png\\\",\\n \n\t\t\t\t\t\t\\\"attachments\\\": [\\n \n\t\t\t\t\t\t\t{\\n \n\t\t\t\t\t\t\t\t\\\"fallback\\\": \\\"Licenças disponíveis\\\",\\n \n\t\t\t\t\t\t\t\t\\\"pretext\\\": \\\"Bitbucket\\\",\\n \n\t\t\t\t\t\t\t\t\\\"title\\\": \\\"Licenças disponíveis\\\",\\n \n\t\t\t\t\t\t\t\t\\\"text\\\": \\\"<!channel> Atualmente temos #{available_licenses} licenças disponíveis\\\",\\n \n\t\t\t\t\t\t\t\t\\\"color\\\": \\\"#{priority}\\\"\\n \n\t\t\t\t\t\t\t}\\n \n\t\t\t\t\t\t]\\n\n\t\t\t\t\t}\"\n\n\tresponse = http.request(request)\nend", "def drill_params\n params.require(:drill).permit(:question, solutions_attributes: [:id, :solution, :_destroy])\n end", "def generate_bulk_data_params\n {\n 'inputFormat': 'application/fhir+ndjson',\n 'inputSource': @testing_instance.url,\n 'storageDetail': {\n 'type': 'https'\n },\n 'input': [{\n 'type': 'Bundle',\n 'url': generate_ndjson_url\n }]\n }\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 @drugmaster = Drugmaster.new(drugmaster_params)\n\n respond_to do |format|\n if @drugmaster.save\n format.html { redirect_to @drugmaster, notice: 'Drugmaster was successfully created.' }\n format.json { render :show, status: :created, location: @drugmaster }\n else\n format.html { render :new }\n format.json { render json: @drugmaster.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bracket_golfer = BracketGolfer.new(bracket_golfer_params)\n\n respond_to do |format|\n if @bracket_golfer.save\n format.json { respond_with @bracket_golfer }\n else\n format.json { render json: @bracket_golfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def greffe_params\n params.require(:greffe).permit(:id,\n :number,\n :name,\n :scrap_coordinates,\n :latitude,\n :longitude,\n :scrap_address,\n :address,\n :zip_code,\n :phone,\n :fax,\n :website_url,\n :schedule,\n :clerks,\n :tribunal_type,\n :monday_hours,\n :tuesday_hours,\n :thursday_hours,\n :friday_hours,\n :saturday_hours,\n :sunday_hours,\n :slug,\n :priority_order,\n :scrap_data,\n :description,\n :department_id,\n :city_id\n )\n end", "def grcrd_params\n params.require(:grcrd).permit(:g_nam1, :g_name2, :g_idnum, :g_photo, :g_title, :g_email)\n end", "def create\n gig = Gig.new()\n respond_to do |format|\n if update_gig(gig)\n format.html { render json: gig, status: :created, location: gig }\n format.json { render json: gig, status: :created, location: gig }\n else\n format.html { render action: \"new\" }\n format.json { render json: gig.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(data)\n data.each do |response|\n puts person = @person_repository.create_or_find(response)\n homeworld_response = StarwarsService.get_response(response[\"homeworld\"])\n planet = @planet_repository.find(homeworld_response[\"name\"]).first\n person.planet_id = planet.id\n\n if response[\"species\"].empty? == false\n species_response = StarwarsService.get_response(response[\"species\"].first)\n specie = @specie_repository.find(species_response[\"name\"]).first\n person.specie_id = specie.id\n end\n person.save\n end\n end", "def create\n dive = Dive.new(dive_params)\n if dive.save\n render json: dive\n else\n render json: {message: dive.errors}, status: 400\n end\n end", "def build_gcp_request( item )\n\n use_item = validate_item( item )\n\n return {\n item: item,\n printer_id: 0, # will be cue to create new record\n gcp_printer_name: \"gcp_#{item}_printer\",\n capability_ppd: @seed_data[use_item]['capability_ppd'],\n capability_cdd: @seed_data[use_item]['capability_cdd'],\n cups_alias: @seed_data[use_item]['cups_alias'],\n gcp_uuid: @seed_data[use_item]['gcp_uuid'],\n gcp_manufacturer: @seed_data[use_item]['gcp_manufacturer'],\n gcp_model: @seed_data[use_item]['gcp_model'],\n gcp_setup_url: @seed_data[use_item]['gcp_setup_url'],\n gcp_support_url: @seed_data[use_item]['gcp_support_url'],\n gcp_update_url: @seed_data[use_item]['gcp_update_url'],\n gcp_firmware: @seed_data[use_item]['gcp_firmware'],\n }\n end", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def create\n @gpsquest = Gpsquest.new(gpsquest_params)\n\n respond_to do |format|\n if @gpsquest.save\n format.html { redirect_to @gpsquest, notice: 'Gpsquest was successfully created.' }\n format.json { render :show, status: :created, location: @gpsquest }\n else\n format.html { render :new }\n format.json { render json: @gpsquest.errors, status: :unprocessable_entity }\n end\n end\n end", "def badge_params\n params.require(:badge).permit(:title, :image, :rule, :rule_parameter)\n end", "def new\n # @gethotelstaticdatagd = Gethotelstaticdatagd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gethotelstaticdatagd }\n end\n end", "def create\n @scratcher = Scratcher.new(permitted_params)\n\n if @scratcher.save\n render json: @scratcher, status: :created, location: @scratcher\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end", "def yh_graphic_params\n params.require(:yh_graphic).permit(:action, :service_type, :content_id, :date, :time, :urgency, :category, :class_code, :attriubute_code, :source, :credit, :region, :title, :comment, :body, :picture, :taken_by)\n end", "def dpm_params\n params.require(:dpm).permit(:filename, :graph_number, :youngs_modulus, :gauge_length, :necking_point, :fitting_param, :threshold) end", "def data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end", "def log(data)\n t = Thread.new do\n uri = URI(\"http://logs-01.loggly.com/inputs/.../tag/ost/\")\n req = Net::HTTP::Post.new(uri)\n req['content-type'] = \"content-type:application/x-www-form-urlencoded\"\n req.body = data.to_json\n res = Net::HTTP.start(uri.hostname, uri.port) {|http|\n http.request(req)\n }\n end\nend", "def create\n @comment = Comment.new(params_plus_user_id)\n gadget = Gadget.find_by_id(comment_params[:gadget_id])\n \n respond_to do |format|\n if @comment.save\n format.html { redirect_to gadget, notice: 'Comment was successfully created.' }\n format.json { head :no_content }\n else\n format.html { redirect_to gadget }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_app_generate(application_id, type, opts={})\n # \n # default_options = {\n # \"name\" => \"\",\n # \"author\" => \"\",\n # \"description\" => \"\",\n # \"guid\" => \"\",\n # \"datasets\" => \"\",\n # \"env\" => \"prod\",\n # \"image_url\" => \"http://appresource.s3.amazonaws.com/apiappimages/missing_icard.jpg\",\n # \"runtime\" => \"\"\n # }\n # options = default_options.merge(opts)\n return post_response(\"app/#{application_id}/generate/#{type}\", opts,:json)\n end", "def create\n @dog = Dog.new(dog_params)\n\n if @dog.save\n render json: @dog, status: 201\n else\n render json: {\n errors: @dog.errors\n }\n end\n end", "def new\n id = params[:format]\n line = \"https://gtcollab.herokuapp.com/api/groups/\" + id + \"/join/\"\n \n #puts line\n #puts $token\n\n require \"net/http\"\n require \"uri\"\n\n parsed_url = URI.parse(line)\n\n http = Net::HTTP.new(parsed_url.host, parsed_url.port)\n http.use_ssl = true\n\n req = Net::HTTP::Post.new(parsed_url.request_uri)\n\n req.add_field(\"authorization\", $token)\n\n response = http.request(req)\n response.inspect\n\n #puts response.body\n redirect_to courses_path\n end", "def create\n kick and return if not is_god?\n @puzzle = Puzzle.new(params[:puzzle])\n link_ids = extract_link_ids(params)\n link_ids.each do |lid|\n @puzzle.linked_puzzles << Puzzle.find(lid)\n end\n\n respond_to do |format|\n if @puzzle.save\n format.html { redirect_to @puzzle, notice: 'Puzzle was successfully created.' }\n format.json { render json: @puzzle, status: :created, location: @puzzle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @puzzle.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_gdpr_request_with_http_info(request_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: GeneralDataProtectionRegulationApi.get_gdpr_request ...\"\n end\n \n \n # verify the required parameter 'request_id' is set\n fail ArgumentError, \"Missing the required parameter 'request_id' when calling GeneralDataProtectionRegulationApi.get_gdpr_request\" if request_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/gdpr/requests/{requestId}\".sub('{format}','json').sub('{' + 'requestId' + '}', request_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GDPRRequest')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GeneralDataProtectionRegulationApi#get_gdpr_request\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @dogshare = Dogshare.new(dogshare_params)\n\n respond_to do |format|\n if @dogshare.save\n format.html { redirect_to @dogshare, notice: 'Dogshare was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dogshare }\n else\n format.html { render action: 'new' }\n format.json { render json: @dogshare.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @scan_protocol = (@site.blank? ? ScanProtocol : @site.scan_protocols).new(scan_protocol_params)\n\n respond_to do |format|\n if @scan_protocol.save\n format.html { redirect_to @scan_protocol, notice: 'Scan protocol was successfully created.' }\n format.json { render :show, status: :created, location: @scan_protocol }\n else\n format.html { render :new }\n format.json { render json: @scan_protocol.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gymnasium = Gymnasium.new(params[:gymnasium])\n\n respond_to do |format|\n if @gymnasium.save\n format.html { redirect_to @gymnasium, notice: 'Gymnasium was successfully created.' }\n format.json { render json: @gymnasium, status: :created, location: @gymnasium }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gymnasium.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sundry_grn = SundryGrn.new(params[:sundry_grn])\n\n respond_to do |format|\n if @sundry_grn.save\n format.html { redirect_to @sundry_grn, :notice => 'Sundry grn was successfully created.' }\n format.json { render :json => @sundry_grn, :status => :created, :location => @sundry_grn }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sundry_grn.errors, :status => :unprocessable_entity }\n end\n end\n end", "def grooming_service_params\n params.require(:grooming_service).permit(:service_id, :grooming_id, :notes)\n end", "def create\n begin\n if params[:paper_id]\n # Create a tag for the paper\n paper = Paper.find(params[:paper_id])\n # Authenticate\n club_id = paper.club_id\n else\n club_id = params[:club_id]\n end\n # Authenticate\n club = can_access_club?(club_id)\n # Tag name is lowercase\n name = params[:name].downcase\n # Find or create the tag for the club\n new_tag = Tag.find_or_create_by_club_id_and_name( club_id, \n params[:name] )\n if params[:paper_id]\n new_collection = Collection.find_or_create_by_paper_id_and_tag_id(\n paper.id, new_tag.id)\n end\n render :json => new_tag \n rescue ActiveRecord::RecordNotFound\n error \"Can't access the club or the paper\"\n end\n end", "def create\n @gig_request = GigRequest.new(params[:gig_request])\n\n respond_to do |format|\n if @gig_request.save\n format.html { redirect_to @gig_request, notice: 'Gig request was successfully created.' }\n format.json { render json: @gig_request, status: :created, location: @gig_request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gig_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dis_datasource = DisDatasource.new(dis_datasource_params)\n\n respond_to do |format|\n if @dis_datasource.save\n format.html { redirect_to @dis_datasource, notice: 'Dis datasource was successfully created.' }\n format.json { render :show, status: :created, location: @dis_datasource }\n else\n format.html { render :new }\n format.json { render json: @dis_datasource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gadget_file = GadgetFile.new(gadget_file_params)\n\n respond_to do |format|\n if @gadget_file.save\n format.html { redirect_to @gadget_file, notice: 'Gadget file was successfully created.' }\n format.json { render :show, status: :created, location: @gadget_file }\n else\n format.html { render :new }\n format.json { render json: @gadget_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n #puts \"🤖 POST #{path}\"\n #puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n #puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n #puts result[:result]\n result\nend", "def create\n @garply = Garply.new(garply_params)\n\n respond_to do |format|\n if @garply.save\n format.html { redirect_to @garply, notice: 'Garply was successfully created.' }\n format.json { render :show, status: :created, location: @garply }\n else\n format.html { render :new }\n format.json { render json: @garply.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.61437654", "0.5386075", "0.53488016", "0.53340554", "0.5272529", "0.51993316", "0.5165713", "0.51535004", "0.514137", "0.49960467", "0.4969755", "0.4957309", "0.49340117", "0.491641", "0.49078697", "0.49070337", "0.490129", "0.48646334", "0.48455867", "0.48304892", "0.48221105", "0.4819593", "0.4819322", "0.48101482", "0.4790305", "0.47895426", "0.4785331", "0.47831646", "0.4779241", "0.47687143", "0.47612378", "0.4738875", "0.4732148", "0.4719691", "0.47184896", "0.47173432", "0.4714537", "0.47129846", "0.47123855", "0.4685014", "0.46839383", "0.46761277", "0.46712467", "0.4671079", "0.46671495", "0.46643946", "0.4663973", "0.4652046", "0.46516192", "0.46515906", "0.46475124", "0.46470144", "0.46337062", "0.46323878", "0.4629086", "0.4625727", "0.46236178", "0.46221307", "0.46204665", "0.4614748", "0.46094772", "0.46093804", "0.46092474", "0.46071914", "0.46061322", "0.46039075", "0.4603617", "0.46034905", "0.45984733", "0.45982537", "0.458933", "0.45841828", "0.4584147", "0.45839384", "0.45824155", "0.4580599", "0.4579275", "0.45785037", "0.45735186", "0.45734176", "0.45732802", "0.45719138", "0.4571687", "0.4570567", "0.4567384", "0.45641485", "0.4563679", "0.45619804", "0.45550478", "0.45531723", "0.45529917", "0.45503247", "0.45496073", "0.45472726", "0.4546868", "0.4545391", "0.45437747", "0.45398697", "0.45393157", "0.45390943" ]
0.6559209
0
PATCH/PUT /protocol_drugs/1 PATCH/PUT /protocol_drugs/1.json
def update respond_to do |format| if @protocol_drug.update(protocol_drug_params) format.html { redirect_to @protocol_drug, notice: 'Protocol drug was successfully updated.' } format.json { render :show, status: :ok, location: @protocol_drug } else format.html { render :edit } format.json { render json: @protocol_drug.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def patch!\n request! :patch\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end", "def update # PATCH\n raise NotImplementedError\n end", "def patch(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Patch.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n response = http.start {|http| http.request(request) }\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend", "def update\n @protocol = Protocol.find(params[:id])\n\n respond_to do |format|\n if @protocol.update_attributes(params[:protocol])\n format.html { redirect_to @protocol, notice: 'Protocol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @protocol.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 do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = if @resource\n DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user) # update dataset\n else\n DatasetParser.new(hash: params['dataset'], user: @user, id_string: params[:id]) # upsert dataset with identifier\n end\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end", "def patch_model dataset_id, model_id, patched_model_gapi, etag = nil\n patch_with_backoff = false\n options = { skip_deserialization: true }\n if etag\n options[:header] = { \"If-Match\" => etag }\n # The patch with etag operation is considered idempotent\n patch_with_backoff = true\n end\n execute backoff: patch_with_backoff do\n json_txt = service.patch_model @project, dataset_id, model_id, patched_model_gapi, options: options\n JSON.parse json_txt, symbolize_names: true\n end\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\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 rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "def patch(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 options={}\n client.put(\"/#{id}\", options)\n end", "def patch\n end", "def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def patch(path, **args); end", "def patch(url, data, headers = {})\n request(:patch, url, headers, :data => data)\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_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def patch_resource(payload)\n execute(resource_path, method: :patch, payload: payload.to_json)\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 patch(uri, options = T.unsafe(nil)); 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 update\n respond_to do |format|\n if @protocol.update(protocol_params)\n format.html { redirect_to protocols_url, notice: 'Protocolo actualizado.' }\n format.json { head :no_content }\n else\n format.html { render :show }\n format.json { render json: @protocol.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @protocol_relationship.update(protocol_relationship_params)\n format.html { redirect_to @protocol_relationship, notice: 'Protocol relationship was successfully updated.' }\n format.json { render :show, status: :ok, location: @protocol_relationship }\n else\n format.html { render :edit }\n format.json { render json: @protocol_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end", "def put!\n request! :put\n end", "def from_merge_patch_json\n if request.patch?\n from_json\n else\n 415\n end\n end", "def update!(**args)\n @group_kinds = args[:group_kinds] if args.key?(:group_kinds)\n @json_path = args[:json_path] if args.key?(:json_path)\n @namespaces = args[:namespaces] if args.key?(:namespaces)\n end", "def update_feature_request(folder_id, feature_content, file_name)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders/#{folder_id}/update_from_feature\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Patch.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n request[\"Content-Type\"] = 'application/json'\n\n data = {\n data: {\n attributes: {\n \"feature\": feature_content\n }\n }\n }\n\n request.body = JSON.generate(data)\n response = http.request(request)\n\n if response.code == 200.to_s\n update_response = JSON.parse(response.read_body)['data']\n puts \"Feature '#{update_response['attributes']['name']}' with '#{update_response['attributes']['scenarios-count']} scenario(s)' updated.\"\n $success_uploaded_count = $success_uploaded_count + 1\n $uploaded_features_list.push(file_name)\n $updated_count = $updated_count + 1\n else\n $fail_uploaded_count = $fail_uploaded_count + 1\n $not_uploaded_features_list.push(file_name)\n end\n\n response.code\nend", "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 create_method\n :http_put\n end", "def create_method\n :http_put\n end", "def patch; end", "def patch; 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 fire_patch(url_or_path, entity, options = {}, &block)\n url = absolute_url(url_or_path)\n headers = {:Accept => MEDIA_TYPE_JSON, :'Content-type' => ENCODED_MEDIA_TYPE_JSON_PATCH}.\n merge(options.fetch(:headers, {}))\n headers = merge_log_weasel_header(headers)\n timeout = options.fetch(:timeout, Ladon.default_request_timeout)\n body = encode_entity(entity)\n response = Typhoeus::Request.run(url, headers: headers, timeout: timeout, body: body, method: :patch)\n handle_response(response, method: :patch, url: url, default_data: options[:default_data],\n raise_on_error: options[:raise_on_error], &block)\n end", "def update\n respond_to do |format|\n if @datasource.update(form_params)\n format.json { render json: { datasources: @datasource }, status: :ok, location: @datasource }\n else\n format.json { render json: @datasource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio_rg.update(socio_rg_params)\n format.html { redirect_to @socio_rg, notice: 'Socio rg was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_rg.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(url, payload, headers: {}, options: {})\n request_with_payload(:patch, url, payload, headers, options)\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "def patch_rule request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_patch_rule_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def update\n id = shift_argument\n validate_arguments!\n dataclip_reference = options[:dataclip]\n uri = URI(\"#{base_url}/#{id}\")\n req = Net::HTTP::Patch.new(uri.path)\n body = prepare_body(dataclip_reference)\n execute_and_print(uri, req, body)\n end", "def update\n# respond_to do |format|\n# if @req.update(req_params)\n format.json { render :json => {:status => 'success'}}\n# format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n# format.json { render :show, status: :ok, location: @req }\n# else\n format.json { render :json => {:status => 'failed'}}\n# format.html { render :edit }\n# format.json { render json: @req.errors, status: :unprocessable_entity }\n# end\n# end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @protocol = Protocol.find(params[:id])\n @title = \"Protocol\"\n\n respond_to do |format|\n if @protocol.update_attributes(params[:protocol])\n format.html { redirect_to(@protocol, :notice => 'Protocol was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @protocol.errors, :status => :unprocessable_entity }\n end\n end\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 update\n respond_to do |format|\n if @dog_poly.update(dog_poly_params)\n format.html { redirect_to @dog_poly, notice: 'Dog poly was successfully updated.' }\n format.json { render :show, status: :ok, location: @dog_poly }\n else\n format.html { render :edit }\n format.json { render json: @dog_poly.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_or_update_profile_configuration(args = {}) \n id = args['profileId']\n temp_path = \"/profiles.json/{profileId}/configuration\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"profileId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end", "def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end", "def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end", "def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def update\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n if @go_slim.update_attributes(params[:go_slim])\n format.html { redirect_to @go_slim, notice: 'Go slim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_slim.errors, status: :unprocessable_entity }\n end\n end\n end", "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 put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def update(path)\n output { patch(path, params) }\n end", "def update!(**args)\n @http_request = args[:http_request] if args.key?(:http_request)\n @insert_id = args[:insert_id] if args.key?(:insert_id)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @operation = args[:operation] if args.key?(:operation)\n @proto_payload = args[:proto_payload] if args.key?(:proto_payload)\n @severity = args[:severity] if args.key?(:severity)\n @source_location = args[:source_location] if args.key?(:source_location)\n @struct_payload = args[:struct_payload] if args.key?(:struct_payload)\n @text_payload = args[:text_payload] if args.key?(:text_payload)\n @timestamp = args[:timestamp] if args.key?(:timestamp)\n @trace = args[:trace] if args.key?(:trace)\n end", "def create_method\n :put_json\n end", "def update\n respond_to do |format|\n if @serving_format.update(serving_format_params)\n format.html { redirect_to @serving_format, notice: \"Serving format was successfully updated.\" }\n format.json { render :show, status: :ok, location: @serving_format }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @serving_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def update(options: {}, **data)\n\n refresh_with(parse(client.put(\"/tags/#{gid}\", body: data, options: options)).first)\n end", "def update\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n\n respond_to do |format|\n if @gethotelstaticdatagd.update_attributes(params[:gethotelstaticdatagd])\n format.html { redirect_to @gethotelstaticdatagd, notice: 'Gethotelstaticdatagd was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gethotelstaticdatagd.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 patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end", "def update\n @protocol = Protocol.find(params[:id])\n\n respond_to do |format|\n if @protocol.update_attributes(params[:protocol])\n flash[:notice] = 'Protocol was successfully updated.'\n format.html { redirect_to(@protocol) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @protocol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end", "def update\n @pug = Pug.find(params[:id])\n\n if @pug.update(pug_params)\n head :no_content\n else\n render json: @pug.errors, status: :unprocessable_entity\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 patch(data, options={})\n @hal_client.patch(href, data, options).tap do\n reset\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!(**args)\n @extension = args[:extension] if args.key?(:extension)\n @request_id = args[:request_id] if args.key?(:request_id)\n end", "def update\n @rubygem = Rubygem.find(params[:id])\n\n if @rubygem.update(rubygem_params)\n head :no_content\n else\n render json: @rubygem.errors, status: :unprocessable_entity\n end\n end", "def update\n @gpsd = Gpsd.find(params[:id])\n\n if @gpsd.update(gpsd_params)\n head :no_content\n else\n render json: @gpsd.errors, status: :unprocessable_entity\n end\n end", "def set_protocol_drug\n @protocol_drug = ProtocolDrug.find(params[:id])\n end", "def update\n @glass = Glass.find(params[:id])\n\n respond_to do |format|\n if @glass.update_attributes(params[:glass])\n format.html { redirect_to @glass, notice: 'Glass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @glass.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @url_pattern = args[:url_pattern] if args.key?(:url_pattern)\n end", "def update!(**args)\n @geometries = args[:geometries] if args.key?(:geometries)\n @id = args[:id] if args.key?(:id)\n @type = args[:type] if args.key?(:type)\n end", "def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end", "def update_resource(kind, data, body, pr)\n\n if body.size > 0\n result = parse_json(body,kind)\n data = result if !OpenNebula.is_error?(result)\n end\n\n resource = case kind\n when \"vdc\" then\n vdc_data=Hash.new\n vdc_id = nil\n data.each{|key,value|\n vdc_data[key.downcase.to_sym]=value if key!=\"id\"\n vdc_id = value if key==\"id\"\n }\n\n # Check parameters\n if !vdc_data[:hosts] || !vdc_id\n return [400, OZones::Error.new(\n \"Error: Couldn't update resource #{kind}. \" +\n \"Need ID and HOSTS to update.\").to_json]\n end\n\n # Check if the referenced Vdc exists\n vdc=OZones::Vdc.get(vdc_id)\n if !vdc\n error = OZones::Error.new(\"Error: Vdc \" +\n \"#{vdc_id} not found, cannot update Vdc.\")\n return [404, error.to_json]\n end\n\n # Get the zone where the Vdc belongs\n zone=OZones::Zones.get(vdc.zones.id)\n if !zone\n error = OZones::Error.new(\"Error: Zone \" +\n \"#{vdc.zones.id} not found, cannot update Vdc.\")\n return [404, error.to_json]\n end\n \n if (!vdc_data[:force] or vdc_data[:force].upcase!=\"YES\") and\n !host_uniqueness?(zone, vdc_data[:hosts], vdc_id.to_i)\n return [403, OZones::Error.new(\n \"Error: Couldn't update resource #{kind}. \" +\n \"One or several hosts belong to a different VDC \"+\n \"and no force option was provided.\").to_json]\n end\n\n rc = @ocaInt.update_vdc_hosts(zone, vdc, vdc_data[:hosts])\n\n if !OpenNebula.is_error?(rc)\n vdc.hosts = vdc_data[:hosts]\n vdc.get_host_acls!(rc)\n\n vdc.save\n\n if vdc.saved?\n return [200, vdc.to_json]\n else\n return [500, OZones::Error.new(\n \"Error: Couldn't update resource #{kind}.\").to_json]\n end\n\n else\n return [500, OZones::Error.new(\n \"Error: Couldn't update resource #{kind.upcase}.\" +\n \" Failed to update ACLs\").to_json]\n end\n else\n error = OZones::Error.new(\n \"Error: #{kind.upcase} resource update not supported\")\n return [404, error.to_json]\n end\n end", "def update!(**args)\n @errors = args[:errors] if args.key?(:errors)\n @etag = args[:etag] if args.key?(:etag)\n @group_id = args[:group_id] if args.key?(:group_id)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @resource = args[:resource] if args.key?(:resource)\n end", "def update\n @gig_request = GigRequest.find(params[:id])\n\n respond_to do |format|\n if @gig_request.update_attributes(params[:gig_request])\n format.html { redirect_to @gig_request, notice: 'Gig request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gig_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @cardinality = args[:cardinality] if args.key?(:cardinality)\n @default_value = args[:default_value] if args.key?(:default_value)\n @json_name = args[:json_name] if args.key?(:json_name)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @number = args[:number] if args.key?(:number)\n @oneof_index = args[:oneof_index] if args.key?(:oneof_index)\n @options = args[:options] if args.key?(:options)\n @packed = args[:packed] if args.key?(:packed)\n @type_url = args[:type_url] if args.key?(:type_url)\n end", "def update(data, params={})\n send_request @opts[:update_path], params, data\n end", "def patch_dataset dataset_id, patched_dataset_gapi\n patch_with_backoff = false\n options = {}\n if patched_dataset_gapi.etag\n options[:header] = { \"If-Match\" => patched_dataset_gapi.etag }\n # The patch with etag operation is considered idempotent\n patch_with_backoff = true\n end\n execute backoff: patch_with_backoff do\n service.patch_dataset @project, dataset_id, patched_dataset_gapi, options: options\n end\n end" ]
[ "0.645087", "0.643234", "0.61955035", "0.61928195", "0.60806614", "0.59464073", "0.59197", "0.59162", "0.59144986", "0.59131646", "0.59094465", "0.5887465", "0.58089113", "0.57955873", "0.57641745", "0.5759859", "0.57338107", "0.5733762", "0.57299155", "0.57292885", "0.57214063", "0.5719087", "0.57088244", "0.5706576", "0.56981915", "0.5685979", "0.5685979", "0.56858873", "0.5675001", "0.56689835", "0.56594133", "0.56594133", "0.5646022", "0.5641396", "0.5641126", "0.5591432", "0.5581966", "0.5577389", "0.5549408", "0.5535042", "0.55294365", "0.5515998", "0.54993093", "0.54993093", "0.54808307", "0.54808307", "0.54751414", "0.54549503", "0.5439669", "0.5439125", "0.5438011", "0.5437016", "0.5436747", "0.5433542", "0.5425133", "0.54067653", "0.53999674", "0.53900945", "0.5384583", "0.5384583", "0.53751916", "0.53679395", "0.5366341", "0.5364654", "0.5364654", "0.5364654", "0.5364654", "0.53481776", "0.5347273", "0.5345623", "0.5345533", "0.5344447", "0.53418136", "0.53408045", "0.534079", "0.53401315", "0.5337924", "0.5336694", "0.5332956", "0.53293854", "0.53238684", "0.53175664", "0.53160214", "0.5315568", "0.5305752", "0.5305195", "0.53047264", "0.52966857", "0.52964765", "0.5292704", "0.5292027", "0.5291555", "0.5280663", "0.5277579", "0.5276454", "0.5273847", "0.52709085", "0.5269635", "0.52680314", "0.5258987" ]
0.6256689
2
DELETE /protocol_drugs/1 DELETE /protocol_drugs/1.json
def destroy @protocol_drug.destroy respond_to do |format| format.html { redirect_to protocol_drugs_url, notice: 'Protocol drug was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n @gethotelstaticdatagd.destroy\n\n respond_to do |format|\n format.html { redirect_to gethotelstaticdatagds_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 delete\n client.delete(\"/#{id}\")\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy\n @dataload_ga = DataloadGa.find(params[:id])\n @dataload_ga.destroy\n\n respond_to do |format|\n format.html { redirect_to dataload_gas_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!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete path\n make_request(path, \"delete\", {})\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete\n request(:delete)\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\n start { |connection| connection.request http :Delete }\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\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 @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 delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def delete\n api_client.delete(url)\n end", "def delete(path)\n RestClient.delete request_base+path\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 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\n delete_from_server single_url\n end", "def destroy\n @grm_grappt = GrmGrappt.find(params[:id])\n @grm_grappt.destroy\n\n respond_to do |format|\n format.html { redirect_to grm_grappts_url }\n format.json { head :no_content }\n end\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def destroy\n @gig_request = GigRequest.find(params[:id])\n @gig_request.destroy\n\n respond_to do |format|\n format.html { redirect_to gig_requests_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 delete(url)\n do_request(\"delete\", url)\n end", "def destroy\n @socio_rg.destroy\n respond_to do |format|\n format.html { redirect_to socio_rgs_url }\n format.json { head :no_content }\n end\n end", "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def delete(payload)\n post_like payload, Net::HTTP::Delete.new(@uri.path)\n end", "def destroy\n @datasource.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @bg_setup = BgSetup.find(params[:id])\n @bg_setup.destroy\n\n respond_to do |format|\n format.html { redirect_to bg_setups_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def destroy\n @green = Green.find(params[:id])\n @green.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffold_greens_url }\n format.json { 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 delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end", "def delete\n client.delete(url)\n @deleted = true\n end", "def destroy\n @redpack = Redpack.find(params[:id])\n @redpack.destroy\n\n respond_to do |format|\n format.html { redirect_to redpacks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @packet.destroy\n respond_to do |format|\n format.html { redirect_to packets_url }\n format.json { head :no_content }\n end\n end", "def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end", "def http_delete(opts={})\n ret=http_delete_low(opts)\n if ret.is_a?(Hash) and ret.has_key?('error') and ret['error']=='Invalid Credentials' then\n\tauthdefault\n\tret=http_delete_low(opts)\n\treturn ret\n else\n\treturn ret\n end\n end", "def api_delete(action, data)\n api_request(action, data, 'DELETE')\n end", "def delete(url, resource_name, options = {})\n build_response(resource_name) do\n connection.delete do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end", "def destroy\n @grm_dog = GrmDog.find(params[:id])\n @grm_dog.destroy\n\n respond_to do |format|\n format.html { redirect_to grm_dogs_url }\n format.json { head :no_content }\n end\n end", "def soccer_delete\n base_delete(params, \"Soccer\")\n end", "def destroy\n @hackplatformrelation = Hackplatformrelation.find(params[:id])\n @hackplatformrelation.destroy\n\n respond_to do |format|\n format.html { redirect_to hackplatformrelations_url }\n format.json { head :ok }\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 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(url, vars={})\n send_request url, vars, 'DELETE'\n end", "def delete\n api(\"Delete\")\n end", "def destroy\n @gl.destroy\n respond_to do |format|\n format.html { redirect_to gls_url }\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 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 @http_request.destroy\n respond_to do |format|\n format.html { redirect_to http_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @http_request.destroy\n respond_to do |format|\n format.html { redirect_to http_requests_url }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n @protocol = Protocol.find(params[:id])\n @protocol.destroy\n\n respond_to do |format|\n format.html { redirect_to(protocols_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to badges_url }\n format.json { head :no_content }\n end\n end", "def delete!\n Recliner.delete(uri)\n end", "def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def destroy\n @sampled_url = SampledUrl.find(params[:id])\n @sampled_url.destroy\n\n respond_to do |format|\n format.html { redirect_to sampled_urls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @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 @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\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 @sub_gtp.destroy\n respond_to do |format|\n format.html { redirect_to sub_gtps_url, notice: 'Sub gtp was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deleteRequest\n\n end", "def delete(resource)\n headers = base_headers.merge('Content-Type' => 'application/json')\n url = \"#{@base_url}/#{resource}\"\n\n @logger.debug(\"DELETE request Url: #{url}\")\n @logger.debug(\"-- Headers: #{headers}\")\n\n x = HTTParty.delete(url, headers: headers)\n puts x.inspect\n x\n end", "def destroy\n @gymnasium = Gymnasium.find(params[:id])\n @gymnasium.destroy\n\n respond_to do |format|\n format.html { redirect_to gymnasia_url }\n format.json { head :no_content }\n end\n end", "def delete\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.delete do |req|\n req.url resource_uri\n end\n if res.success?\n data = JSON.parse(res.body)\n reload\n else\n nil\n end\n end", "def destroy\n @gadget.destroy\n respond_to do |format|\n format.html { redirect_to gadgets_url, notice: 'Gadget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def destroy\n @gnode = Gnode.find(params[:id])\n @gnode.destroy\n\n respond_to do |format|\n format.html { redirect_to gnodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gid2name = Gid2name.find(params[:id])\n @gid2name.destroy\n\n respond_to do |format|\n format.html { redirect_to gid2names_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params={}, options={})\n request(:delete, api_path(path), params, options)\n end", "def destroy\n @lab_device = LabDevice.find(params[:id])\n @lab_device.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_devices_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end", "def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end", "def destroy\n @small_generator = SmallGenerator.find(params[:id])\n @small_generator.destroy\n\n respond_to do |format|\n format.html { redirect_to small_generators_url }\n format.json { head :no_content }\n end\n end", "def delete_api(name)\n url = '/apis/' + name\n payload = {}\n process_kong_request(url, :DELETE, payload)\n end", "def delete(request)\n do_request(request) { |client| client.http_delete }\n end", "def destroy\n @ssd.destroy\n respond_to do |format|\n format.html { redirect_to ssds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gp40.destroy\n respond_to do |format|\n format.html { redirect_to gp40s_url, notice: 'Gp40 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dns_device_assoc = DnsDeviceAssoc.find(params[:id])\n @dns_device_assoc.destroy\n\n respond_to do |format|\n format.html { redirect_to dns_device_assocs_url }\n format.json { head :no_content }\n end\n end", "def deleteFlatpackLink( flatpack_id, gen_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/flatpack/link\",params)\n end", "def destroy\n @htc.destroy\n respond_to do |format|\n format.html { redirect_to htcs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pg_first.destroy\n respond_to do |format|\n format.html { redirect_to pg_firsts_url }\n format.json { head :no_content }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end" ]
[ "0.6857248", "0.6800307", "0.6694651", "0.66367346", "0.6627667", "0.6617208", "0.6617208", "0.6617208", "0.6617208", "0.6590581", "0.6586723", "0.6561991", "0.65597034", "0.65325916", "0.65125406", "0.65041286", "0.6470497", "0.6464604", "0.646328", "0.64567184", "0.64563775", "0.64542645", "0.6438105", "0.6435167", "0.6435167", "0.6428532", "0.64267373", "0.6420233", "0.64143586", "0.64063185", "0.6401679", "0.63882196", "0.6384746", "0.6383226", "0.6378833", "0.6358843", "0.6352711", "0.6326192", "0.6323134", "0.6318887", "0.63187075", "0.63179284", "0.6308017", "0.6305336", "0.6298971", "0.6282232", "0.6276055", "0.6272944", "0.62652665", "0.6259929", "0.62579626", "0.62555635", "0.6254457", "0.6254129", "0.62537104", "0.6253709", "0.6252028", "0.62486947", "0.62396234", "0.62363887", "0.6232374", "0.622933", "0.6219501", "0.6219501", "0.6219253", "0.6219253", "0.6218786", "0.6216946", "0.6208814", "0.62024146", "0.620122", "0.6199992", "0.61928725", "0.61887884", "0.61856073", "0.61856073", "0.61839277", "0.6182145", "0.61807275", "0.61780477", "0.61772704", "0.6177204", "0.6175781", "0.6169579", "0.61666363", "0.61664563", "0.6165652", "0.6164014", "0.61626226", "0.6160595", "0.61587197", "0.61581165", "0.61540437", "0.6153137", "0.61498964", "0.6146349", "0.61452466", "0.6143482", "0.6140502", "0.61395013" ]
0.69589293
0
Use callbacks to share common setup or constraints between actions.
def set_protocol_drug @protocol_drug = ProtocolDrug.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def 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 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 event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def callback_phase\n super\n end", "def advice\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def duas1(action)\n action.call\n action.call\nend", "def _handle_action_missing(*args); end" ]
[ "0.6164095", "0.6046031", "0.5945298", "0.59179014", "0.58890367", "0.58341795", "0.5776118", "0.5700777", "0.5700777", "0.5656277", "0.56218207", "0.5423995", "0.5411516", "0.5411516", "0.5411516", "0.5395004", "0.53783494", "0.53593004", "0.53412604", "0.534078", "0.5332865", "0.53135896", "0.52999926", "0.5297309", "0.5296569", "0.5261449", "0.5247048", "0.52376497", "0.52376497", "0.52376497", "0.52376497", "0.52376497", "0.52323204", "0.52310973", "0.523081", "0.5225785", "0.5219039", "0.52136266", "0.5208033", "0.520763", "0.5177365", "0.5175224", "0.5173357", "0.5166104", "0.5162502", "0.51573396", "0.5154547", "0.5153531", "0.51502854", "0.51436496", "0.5142863", "0.51330835", "0.5115634", "0.5115634", "0.511527", "0.5109693", "0.51076853", "0.5093146", "0.5090683", "0.50829846", "0.50819314", "0.50670373", "0.5055505", "0.5053398", "0.50504035", "0.50504035", "0.5037765", "0.5027292", "0.5024484", "0.50150335", "0.5014069", "0.50022113", "0.5001542", "0.49981874", "0.49915564", "0.49915564", "0.49880967", "0.4982312", "0.49787375", "0.49786067", "0.49687737", "0.49676532", "0.49602765", "0.49565676", "0.49550772", "0.495342", "0.49522525", "0.49463704", "0.49447197", "0.49362713", "0.49328062", "0.49280638", "0.49272856", "0.4927058", "0.49221697", "0.4919526", "0.49185994", "0.49184805", "0.49170163", "0.49168405", "0.49167764" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def protocol_drug_params params.require(:protocol_drug).permit(:dose, :additional_analgesic, :drug_id, :protocol_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def valid_params_request?; end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def 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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def url_whitelist; end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def url_params\n params[:url].permit(:full)\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6979893", "0.6781746", "0.6746611", "0.6742344", "0.6735229", "0.6592651", "0.65027124", "0.6498011", "0.648163", "0.647716", "0.64556813", "0.64386255", "0.63784456", "0.63756156", "0.636574", "0.6319542", "0.63004524", "0.6299559", "0.62925464", "0.62923217", "0.6289894", "0.6289475", "0.62831545", "0.6242381", "0.6240358", "0.6217451", "0.6214354", "0.62098235", "0.61918235", "0.6177287", "0.61755854", "0.61712915", "0.61620486", "0.6151379", "0.61510575", "0.6145169", "0.61207956", "0.6115647", "0.6107701", "0.61030304", "0.60909295", "0.60797", "0.60701567", "0.6062068", "0.60203075", "0.60167485", "0.60125494", "0.6009718", "0.6007027", "0.6007027", "0.6000283", "0.59990394", "0.5996995", "0.59915864", "0.59914654", "0.59912056", "0.5979621", "0.596686", "0.5959418", "0.59585625", "0.59583765", "0.5958032", "0.5952298", "0.5951678", "0.5941885", "0.59378815", "0.59376645", "0.59376645", "0.5933908", "0.59302104", "0.5924862", "0.5923981", "0.59165645", "0.5909916", "0.590986", "0.5908378", "0.5904956", "0.5897421", "0.58970135", "0.5894611", "0.5893914", "0.58927566", "0.5891277", "0.5885355", "0.58825094", "0.58783555", "0.58728755", "0.58686864", "0.5867015", "0.58660764", "0.58659357", "0.5864526", "0.58634263", "0.5861585", "0.5861255", "0.5858771", "0.58579147", "0.5854071", "0.5853147", "0.58498794", "0.58492327" ]
0.0
-1
make this accessible to all view files
def current_user User.find session[:user_id] if user_signed_in? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _view; end", "def view_paths; end", "def view_paths; end", "def view_paths; end", "def view; end", "def view_assigns; end", "def view_assigns; end", "def view_only!\n @view_only = true\n end", "def loc_view\n \n end", "def view\n end", "def view\n @_view\n end", "def after_view_setup\n end", "def view()\n @view\n end", "def add_view\n super\n end", "def rendered_views=(_arg0); end", "def access_control\n \n end", "def inherit_view_paths\n self.class.inherit_view_paths\n end", "def expose; end", "def view_info\n super\n end", "def view_paths\n _view_paths\n end", "def view_paths\n _view_paths\n end", "def show\n enforce_view_permission(@user)\n \n end", "def view_paths=(paths); end", "def public; end", "def public; end", "def doctorView \n end", "def views(name = nil)\n raise NotImplementedError, \"views is an abstract method\"\n end", "def views\n @views\n end", "def access\n render :access\n end", "def include_abingo_views\n\t\tmodule_eval ABingoCampingPlugin::Views.abingo_view_helpers\n\t\tmodule_eval ABingoCampingPlugin::Views.common_abingo_views\n\n\t\tmodule_eval do\n\t\t\tapp_module_name = self.to_s.split(\"::\").first\t\n\t\t\tmab_class_name = \"#{app_module_name}::Mab\"\t\n\t\t\tmab_class = mab_class_name.constantize\n\n#\t\t\tunless mab_class.public_instance_methods.include? 'register' \n#\t\t\t\tmodule_eval ABingoCampingPlugin::Views.register_view\n#\t\t\tend\n\t\tend\n\t\t\n\tend", "def client_access\n super\n end", "def viewer\n admin\n end", "def restitution()\n @view__.restitution\n end", "def protected\n\tend", "def show\n authorize! :view, Var\n end", "def views\n @views\n end", "def give_view_access_to(login)\n give_access_to(:view, login)\n end", "def can_view?(object)\n false\n end", "def copy_views\r\n # view_directory :shared\r\n end", "def enforce_viewing_context_for_show_requests \n end", "def available_views\n %w(index new edit show _list _form)\n end", "def setup_index_view()\n # Perhaps I'm not doing something right...\n # I don't have a single line of duplicated code\n # in those in my get and post calls, so this is \n # difficult to refactor.\nend", "def view_path\n @@view_path\n end", "def rendered_views; end", "def views\n self[:views] ||= Gnash.new\n end", "def view(opts)\n opts = check_params(opts,[:view_names])\n super(opts)\n end", "def run()\n\t\tif Core::DEBUG\n\t\t\traise \"View #{self.class.name} can't be build because run method is not redefined.\"\t\t\n\t\tend\n\tend", "def show\n set_accesory\n end", "def action_view\n action_view = ActionView::Base.new(Rails.configuration.paths['app/views'], {}, ActionController::Base.new)\n action_view.class_eval do\n include Rails.application.routes.url_helpers\n include ApplicationHelper\n\n def protect_against_forgery?\n false\n end\n end\n\n action_view\n end", "def define_view\n \t#puts \"#{controller_name}.define_view:begin view=#{@myparams[:view_id]}\"\n \t# views: liste des vues possibles est utilisee dans la view ruby show\n\t\t@views = View.all\n\t\t# view_id: id de la vue selectionnee est utilisee dans la view ruby show\n\t\t#@myparams[:view_id] = @views.first.id if @myparams[:view_id].nil?\n\t\tif @myparams[:view_id].nil?\n\t\t\tif logged_in?\n\t\t\t@myparams[:view_id] = current_user.get_default_view.id\n\t\t\tend\n\t\tend\n\t\t#puts \"#{controller_name}.define_view:end view=#{@myparams[:view_id]}\"\n\tend", "def source_paths() = [views_path]", "def views\n []\n end", "def views\n []\n end", "def views\n []\n end", "def views\n []\n end", "def view_root\n \"views\"\n end", "def set_common_view_variables\n @instance_name = (GlobalSettings[:company_name].nil? ? '' : 'Instance: '+GlobalSettings[:company_name])\n @user_name = current_user.try(:name) || ''\n end", "def view_flow; end", "def publicize\n @access_control = 'public'\n end", "def visibility; end", "def visibility; end", "def visibility; end", "def visibility; end", "def visibility; end", "def initialize\n @helpers_path = nil\n @views_path = nil\n end", "def view_methods\n @view_methods ||= []\n end", "def view_module\n @view_module ||= Module.new\n end", "def show\n\t\trequire_admin!\n\tend", "def view_renderer; end", "def view_renderer; end", "def accessible\n true \n end", "def protected_method\n end", "def access_info\n super\n end", "def index # Only view\n end", "def index\n authorize! :view, Var\n\n @vars = Var.all\n end", "def view_instance\n # view = if controller.response.template\n # controller.response.template\n # else\n View.new controller, master_helper_module\n # end\n \n # view.extend Extensions::View\n end", "def index\n @yourviews = Yourview.all\n end", "def show\n\t\tnot_found\tunless for_public?\n\tend", "def show\n\t\t#will have template\n\tend", "def set_yourview\n @yourview = Yourview.find(params[:id])\n end", "def initialize(view)\n @view = view\n end", "def admin_index\n return unless (user_is_allowed_to 'view', 'rets_properties') \n render :layout => 'caboose/admin' \n end", "def before_filter; end", "def target_view_path\n super\n end", "def init_views\n @actions = @actions.nil? ? [] : @actions\n @tabs = @tabs.nil? ? [] : @tabs\n end", "def accessibility; end", "def view_instance\n view = ActionView::Base.new(controller.class.view_paths, {}, controller)\n view.extend master_helper_module\n end", "def show\n admin_only do\n end\n end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def show\n admin_only\n end", "def show\n admin_only\n end", "def show\n admin_only\n end" ]
[ "0.71266097", "0.6915637", "0.6915637", "0.6915637", "0.6754148", "0.66057515", "0.66057515", "0.6520682", "0.6515265", "0.6501024", "0.6385135", "0.62490714", "0.62169075", "0.6191492", "0.61852765", "0.61470014", "0.61097497", "0.6105058", "0.60991913", "0.6084089", "0.6084089", "0.6050515", "0.60463023", "0.6044559", "0.6044559", "0.6037445", "0.6034936", "0.6008112", "0.60064006", "0.60056436", "0.59839207", "0.59746015", "0.59671724", "0.5952825", "0.5937368", "0.5937058", "0.59292567", "0.5921518", "0.59044325", "0.58971035", "0.58957297", "0.5893258", "0.58838946", "0.5866646", "0.5834475", "0.58232814", "0.58133066", "0.5795739", "0.5782639", "0.5766535", "0.5766002", "0.57600236", "0.57600236", "0.57600236", "0.57600236", "0.57171446", "0.57141393", "0.57051265", "0.57046485", "0.5704038", "0.5704038", "0.5704038", "0.5704038", "0.5704038", "0.56935954", "0.569181", "0.5690309", "0.56893164", "0.5669125", "0.5669125", "0.5668214", "0.56557626", "0.56458837", "0.5636794", "0.5617884", "0.56172174", "0.56077117", "0.5594686", "0.558548", "0.55837846", "0.55638397", "0.555907", "0.55557275", "0.5552873", "0.5534612", "0.5531094", "0.5529514", "0.55287284", "0.5524452", "0.5524452", "0.5524452", "0.5524452", "0.5524452", "0.5524452", "0.5524452", "0.5524452", "0.5524452", "0.5524452", "0.55243015", "0.55243015", "0.55243015" ]
0.0
-1
yearly play chart data for use with BarCharts from React Recharts library
def yearly_play_chart_data self.yearly_play_data.map do |year, times_played| {name: year, plays: times_played} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getchart()\n # The data for the bar chart\n data0 = [100, 125, 156, 147, 87, 124, 178, 109, 140, 106, 192, 122]\n data1 = [122, 156, 179, 211, 198, 177, 160, 220, 190, 188, 220, 270]\n data2 = [167, 190, 213, 267, 250, 320, 212, 199, 245, 267, 240, 310]\n labels = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sept\", \"Oct\",\n \"Nov\", \"Dec\"]\n\n # Create a XYChart object of size 580 x 280 pixels\n c = ChartDirector::XYChart.new(580, 280)\n\n # Add a title to the chart using 14 pts Arial Bold Italic font\n c.addTitle(\"Product Revenue For Last 3 Years\", \"arialbi.ttf\", 14)\n\n # Set the plot area at (50, 50) and of size 500 x 200. Use two alternative\n # background colors (f8f8f8 and ffffff)\n c.setPlotArea(50, 50, 500, 200, 0xf8f8f8, 0xffffff)\n\n # Add a legend box at (50, 25) using horizontal layout. Use 8pts Arial as font,\n # with transparent background.\n c.addLegend(50, 25, false, \"arial.ttf\", 8).setBackground(\n ChartDirector::Transparent)\n\n # Set the x axis labels\n c.xAxis().setLabels(labels)\n\n # Draw the ticks between label positions (instead of at label positions)\n c.xAxis().setTickOffset(0.5)\n\n # Add a multi-bar layer with 3 data sets\n layer = c.addBarLayer2(ChartDirector::Side)\n layer.addDataSet(data0, 0xff8080, \"Year 2003\")\n layer.addDataSet(data1, 0x80ff80, \"Year 2004\")\n layer.addDataSet(data2, 0x8080ff, \"Year 2005\")\n\n # Set 50% overlap between bars\n layer.setOverlapRatio(0.5)\n\n # Add a title to the y-axis\n c.yAxis().setTitle(\"Revenue (USD in millions)\")\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def chart\n data = case params[:kind]\n when 'number_of_users'\n @title = 'Number of users '\n User.group('DATE_TRUNC(\\'month\\', created_at)').count\n when 'number_of_loves'\n @title = 'Number of Loves'\n ActsAsVotable::Vote.group('DATE_TRUNC(\\'month\\', created_at)').count\n when 'number_of_comments'\n @title = 'Number of comments'\n Comment.unscoped.group('DATE_TRUNC(\\'month\\', created_at)').count\n when 'number_of_shares'\n @title = 'Number of shares'\n Share.group('DATE_TRUNC(\\'month\\', created_at)').count\n when 'monthly_active_users'\n @title = 'Monthly active users'\n votes = ActsAsVotable::Vote.group('DATE_TRUNC(\\'month\\', created_at)').count\n comments = Comment.unscoped.group('DATE_TRUNC(\\'month\\', created_at)').count\n shares = Share.group('DATE_TRUNC(\\'month\\', created_at)').count\n votes\n .merge(comments) { |k, a_value, b_value| a_value + b_value }\n .merge(shares) { |k, a_value, b_value| a_value + b_value }\n when 'joined_last_month'\n @title = 'Joined last month'\n User.group('DATE_TRUNC(\\'day\\', created_at)').where(created_at: Date.today.beginning_of_month..Date.today.end_of_month).count\n else #net_promoter_score\n @title = 'Net promoter score'\n PhoneNumberInvitation.uniq.group('DATE_TRUNC(\\'month\\', created_at)').count(:user_id)\n end\n\n # data manipulation\n @data = []\n prev_key, year = nil, Time.current.year\n data.sort.each do |k ,v|\n k = k.to_date\n if params[:kind] == 'joined_last_month'\n (prev_key.next...k).each{|d| @data << [d.strftime('%d'), 0, \"#{d.to_s(:long)} = 0\"] } if prev_key.present?\n @data << [k.strftime('%d'), v, \"#{k.to_s(:long)} = #{v}\"]\n else\n k = k.beginning_of_month\n (prev_key.next..k.yesterday).select{|d| d.day == 1 }.each{|d| @data << [d.strftime(year == d.year ? '%m' : '%y/%-m'), 0, \"#{d.strftime(\"%B, %Y\")} = 0\"] } if prev_key.present?\n @data << [k.strftime(year == k.year ? '%m' : '%y/%-m'), v, \"#{k.strftime(\"%B, %Y\")} = #{v}\"]\n end\n prev_key = k\n end\n\n render partial: 'chart'\n end", "def generate_top_tracks(year)\n weeklycharts = lastfm.user.get_weekly_chart_list(\"pulleasy\")\n weeklycharts.each do |weekly_chart|\n charts = []\n if weekly_chart[\"from\"] > year.to_time.to_i && weekly_chart[\"to\"] < year.next_year.to_time.to_i\n charts << weekly_chart\n end\n end\nend", "def getchart()\n # The data for the bar chart\n data = [450, 560, 630, 800, 1100, 1350, 1600, 1950, 2300, 2700]\n\n # The labels for the bar chart\n labels = [\"1996\", \"1997\", \"1998\", \"1999\", \"2000\", \"2001\", \"2002\", \"2003\", \"2004\",\n \"2005\"]\n\n # Create a XYChart object of size 600 x 360 pixels\n c = ChartDirector::XYChart.new(600, 360)\n\n # Add a title to the chart using 18pts Times Bold Italic font\n c.addTitle(\"Annual Revenue for Star Tech\", \"timesbi.ttf\", 18)\n\n # Set the plotarea at (60, 40) and of size 500 x 280 pixels. Use a vertical\n # gradient color from light blue (eeeeff) to deep blue (0000cc) as background. Set\n # border and grid lines to white (ffffff).\n c.setPlotArea(60, 40, 500, 280, c.linearGradientColor(60, 40, 60, 280, 0xeeeeff,\n 0x0000cc), -1, 0xffffff, 0xffffff)\n\n # Add a multi-color bar chart layer using the supplied data. Use soft lighting\n # effect with light direction from left.\n c.addBarLayer3(data).setBorderColor(ChartDirector::Transparent,\n ChartDirector::softLighting(ChartDirector::Left))\n\n # Set x axis labels using the given labels\n c.xAxis().setLabels(labels)\n\n # Draw the ticks between label positions (instead of at label positions)\n c.xAxis().setTickOffset(0.5)\n\n # Add a title to the y axis with 10pts Arial Bold font\n c.yAxis().setTitle(\"USD (millions)\", \"arialbd.ttf\", 10)\n\n # Set axis label style to 8pts Arial Bold\n c.xAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis().setLabelStyle(\"arialbd.ttf\", 8)\n\n # Set axis line width to 2 pixels\n c.xAxis().setWidth(2)\n c.yAxis().setWidth(2)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def sample\n chart = Chart.new(title: 'Title', type: :bar)\n draw = chart.draw(color: :green, label: 'Label 1')\n draw.data(position: 'Week 1', value: 20).data(position: 'Week 2', value: 5).data(position: 'Week 3', value: 35)\n draw.store\n draw = chart.draw(color: :red, label: 'Label 2', type: :line, fill: true)\n draw.data(position: 'Week 0', value: 15).data(position: 'Week 2', value: 30)\n draw.store\n chart.render\n end", "def data_requests_year_to_date\n data_requests = @organization.data_requests\n @dataset = @organization.datasets.find_by_param(params[:dataset])\n data_requests = data_requests.joins(:requests).merge(Request.where(dataset: @dataset)) if @dataset\n @year = (params[:year].to_i.positive? ? params[:year].to_i : Time.zone.today.year)\n @chart_title = \"#{\"#{@dataset.slug.upcase} \" if @dataset} Data Requests for #{@year}\"\n @chart_subtitle = @organization.name\n @series = []\n max = 100\n (series, max) = add_average_submitted(data_requests, max)\n @series << series\n (series, max) = add_submitted_data_requests(data_requests, max)\n @series << series\n (series, max) = add_approved_data_requests(data_requests, max)\n @series << series\n\n @x_axis = { categories: Date::ABBR_MONTHNAMES.last(12), title: { text: \"\" } }\n @y_axis = { title: { text: \"Data Requests\" }, max: max }\n end", "def charts\n # Get array of genres and number of movies of each genre.\n genres_and_movies = Genre.joins(:movie).\n select('genre.genre_id, genre.name as name, count(*) as count').\n group('genre.genre_id')\n\n @genre_and_movie_count = Array.new\n genres_and_movies.each do |genre|\n @genre_and_movie_count << [genre.name, genre.count]\n end \n\n # Get array of months and number of wishes in that month.\n wishlist_by_month = Wishlist.all.group_by { |w| w.wis_date.beginning_of_month }\n \n @month_and_wishes = Array.new\n wishlist_by_month.each do |date, wish| \n @month_and_wishes << [date, wish.length]\n end\n\n # Get array of months and number of ratings in that month\n ratings_by_month = Rating.all.group_by { |r| r.time.beginning_of_month }\n \n @month_and_ratings = Array.new\n ratings_by_month.each do |date, ratings| \n @month_and_ratings << [date.strftime('%B %Y'), ratings.length]\n end\n\n end", "def chart_comparison\n pts = params[:portfolios] ||= \"#{Portfolio.first.id}\" # '10, 17, 8, 3, 6, 7, 9' # \"#{Portfolio.first.id}\" \n ports = pts.split(',').map { |p| p.to_i }\n \n data = [ ]\n zero_line = History.where(portfolio_id: Portfolio.first.id, snapshot_date: Date.today.beginning_of_year..Date.today).collect { |h| [ h.snapshot_date.strftime(\"%Y/%m/%d\"), 0 ] } \n data.push ( {name: 'zero', data: zero_line } )\n Portfolio.find(ports).each do |p|\n start_year_total = History.where(portfolio_id: p.id, snapshot_date: Date.today.beginning_of_year..Date.today).first.total\n# start_month_total = History.where(portfolio_id: p.id, snapshot_date: Date.today.beginning_of_month..Date.today.beginning_of_month+2).first.total\n series = History.where(portfolio_id: p.id, snapshot_date: Date.today.beginning_of_year..Date.today).collect { |h| [ h.snapshot_date.strftime(\"%Y/%m/%d\"), ( (h.total / start_year_total) - 1 ) ] } \n data.push ( { name: p.name, data: series } ) \n end\n \n data = [ { name: 'padding', data: [ ] } ]\n Group.all.each do |g|\n series = History.graph_data_comparison(g.name, 'Last 3 Years')[0]\n data.push ( { name: g.name, data: series } ) \n end\n\n render json: data\n end", "def getchart()\n # The data for the line chart\n data0 = [410, 420, 500, 590]\n data1 = [500, 370, 680, 850]\n labels = [\"Q1\", \"Q2\", \"Q3\", \"Q4\"]\n\n # Create a XYChart object of size 600 x 400 pixels\n c = ChartDirector::XYChart.new(600, 400)\n\n # Add a title to the chart using 18 pts Times Bold Italic font\n title = c.addTitle(\"Product Line Global Revenue\", \"timesbi.ttf\", 18)\n\n # Tentatively set the plotarea at (50, 55) and of (chart_width - 100) x\n # (chart_height - 150) pixels in size. Use a vertical gradient color from sky blue\n # (aaccff) t0 light blue (f9f9ff) as background. Set both horizontal and vertical\n # grid lines to dotted semi-transprent black (aa000000).\n plotArea = c.setPlotArea(50, 55, c.getWidth() - 100, c.getHeight() - 150,\n c.linearGradientColor(0, 55, 0, 55 + c.getHeight() - 150, 0xaaccff, 0xf9fcff),\n -1, -1, c.dashLineColor(0xaa000000, ChartDirector::DotLine), -1)\n\n # Set y-axis title using 12 points Arial Bold Italic font, and set its position 10\n # pixels from the axis.\n c.yAxis().setTitle(\"Revenue (USD millions)\", \"arialbi.ttf\", 12)\n c.yAxis().setTitlePos(ChartDirector::Left, 10)\n\n # Set y-axis label style to 10 points Arial Bold and axis color to transparent\n c.yAxis().setLabelStyle(\"arialbd.ttf\", 10)\n c.yAxis().setColors(ChartDirector::Transparent)\n\n # Set y-axis tick density to 30 pixels. ChartDirector auto-scaling will use this\n # as the guideline when putting ticks on the y-axis.\n c.yAxis().setTickDensity(30)\n\n # Add a bar layer to the chart with side layout\n layer = c.addBarLayer2(ChartDirector::Side)\n\n # Add two data sets to the bar layer\n layer.addDataSet(data0, 0xff6600, \"FY 2007\")\n layer.addDataSet(data1, 0x0088ff, \"FY 2008\")\n\n # Use soft lighting effect with light direction from the left\n layer.setBorderColor(ChartDirector::Transparent, ChartDirector::softLighting(\n ChartDirector::Left))\n\n # Set the x axis labels\n c.xAxis().setLabels(labels)\n\n # Convert the labels on the x-axis to a CDMLTable\n table = c.xAxis().makeLabelTable()\n\n # Set the default left/right margins to 5 pixels and top/bottom margins to 3\n # pixels. Set the default font size to 10 points\n cellStyle = table.getStyle()\n cellStyle.setMargin2(5, 5, 4, 3)\n cellStyle.setFontSize(10)\n\n # Set the first row to use Arial Bold font, with a light grey (eeeeee) background.\n firstRowStyle = table.getRowStyle(0)\n firstRowStyle.setFontStyle(\"arialbd.ttf\")\n firstRowStyle.setBackground(0xeeeeee, ChartDirector::LineColor)\n\n #\n # We can add more information to the table. In this sample code, we add the data\n # series and the legend icons to the table.\n #\n\n # Add 3 more rows to the table. Set the background of the 2nd row to light grey\n # (eeeeee).\n table.appendRow()\n table.appendRow().setBackground(0xeeeeee, ChartDirector::LineColor)\n table.appendRow()\n\n # Put the values of the 2 data series in the first 2 rows. Put the percentage\n # differences in the 3rd row.\n 0.upto(data0.length - 1) do |i|\n table.setText(i, 1, (data0[i]).to_s)\n table.setText(i, 2, (data1[i]).to_s)\n\n percentageDiff = 100.0 * (data1[i] - data0[i]) / data0[i]\n\n # Use red or green color depending on whether the difference is positive or\n # negative\n formatString = \"<*color=008800*>+{value|1}%\"\n if percentageDiff < 0\n formatString = \"<*color=cc0000*>{value|1}%\"\n end\n table.setText(i, 3, c.formatValue(percentageDiff, formatString))\n end\n\n # Insert a column on the left for the legend icons using Arial Bold font.\n table.insertCol(0).setFontStyle(\"arialbd.ttf\")\n\n # The top cell is set to transparent, so it is invisible\n table.getCell(0, 0).setBackground(ChartDirector::Transparent,\n ChartDirector::Transparent)\n\n # The next 2 cells are set to the legend icons and names of the 2 data series\n table.setText(0, 1, sprintf(\"%s FY 2007\", layer.getLegendIcon(0)))\n table.setText(0, 2, sprintf(\"%s FY 2008\", layer.getLegendIcon(1)))\n\n # The last cell is set to \"Change\"\n table.setText(0, 3, \"Change\")\n\n # Append a column on the right for the total values.\n table.appendCol()\n\n # Put \"Total\" in the top cell as the heading of this column\n table.setText(table.getColCount() - 1, 0, \"Total\")\n\n # The next two cells are the total of the data series\n total0 = ChartDirector::ArrayMath.new(data0).sum()\n total1 = ChartDirector::ArrayMath.new(data1).sum()\n table.setText(table.getColCount() - 1, 1, total0.to_s)\n table.setText(table.getColCount() - 1, 2, total1.to_s)\n\n # The last cell is the percentage differences of the total\n totalPercentageDiff = (total1 - total0) / total0 * 100\n\n # Use red or green color depending on whether the difference is positive or\n # negative\n totalFormatString = \"<*color=008800*>+{value|1}%\"\n if totalPercentageDiff < 0\n totalFormatString = \"<*color=cc0000*>{value|1}%\"\n end\n table.setText(table.getColCount() - 1, 3, c.formatValue(totalPercentageDiff,\n totalFormatString))\n\n #\n # We now demonstrate how to adjust the plot area positions, to allow space for the\n # newly inserted left and right columns in the table.\n #\n\n # We layout the axis first in order to get the axis metrics (including table\n # metrics)\n c.layoutAxes()\n\n # If the first column is wider than the left y-axis, we need to reserve for some\n # left margin to ensure the first column stays within the chart.\n leftMargin = 0\n if table.getColWidth(0) > c.yAxis().getThickness()\n leftMargin = table.getColWidth(0) - c.yAxis().getThickness()\n end\n\n # Similarly, we need to reserve some right margin for the last column\n rightMargin = table.getColWidth(table.getColCount() - 1)\n\n # Adjust the plot area size, such that the bounding box (inclusive of axes) using\n # the given left and right margin, plus 2 more pixels. Put the plot area 10 pixels\n # below the title and use 2 pixels as the bottom margin. from the left, right and\n # bottom edge, and is just under the legend box.\n c.packPlotArea(leftMargin + 2, title.getHeight() + 10, c.getWidth(\n ) - 3 - rightMargin, c.getHeight() - 3)\n\n # After determining the exact plot area position, we may adjust title position so\n # that it is centered relative to the plot area (instead of the chart)\n title.setPos(plotArea.getLeftX() + (plotArea.getWidth() - title.getWidth()) / 2,\n title.getTopY())\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def getchart()\n # The data for the bar chart\n data0 = [44, 55, 100]\n data1 = [97, 87, 167]\n data2 = [156, 78, 147]\n data3 = [125, 118, 211]\n\n # The labels for the bar chart. The labels contains embedded images as icons.\n labels = [\"<*img=service.png*><*br*>Service\",\n \"<*img=software.png*><*br*>Software\", \"<*img=computer.png*><*br*>Hardware\"]\n\n # Create a XYChart object of size 600 x 350 pixels, using 0xe0e0ff as the\n # background color, 0xccccff as the border color, with 1 pixel 3D border effect.\n c = ChartDirector::XYChart.new(600, 350, 0xe0e0ff, 0xccccff, 1)\n\n # Set directory for loading images to current script directory\n c.setSearchPath(File.dirname(__FILE__))\n\n # Add a title to the chart using 14 points Times Bold Itatic font and light blue\n # (0x9999ff) as the background color\n c.addTitle(\"Business Results 2001 vs 2002\", \"timesbi.ttf\", 14).setBackground(\n 0x9999ff)\n\n # Set the plotarea at (60, 45) and of size 500 x 210 pixels, using white\n # (0xffffff) as the background\n c.setPlotArea(60, 45, 500, 210, 0xffffff)\n\n # Swap the x and y axes to create a horizontal bar chart\n c.swapXY()\n\n # Add a title to the y axis using 11 pt Times Bold Italic as font\n c.yAxis().setTitle(\"Revenue (millions)\", \"timesbi.ttf\", 11)\n\n # Set the labels on the x axis\n c.xAxis().setLabels(labels)\n\n # Disable x-axis ticks by setting the tick length to 0\n c.xAxis().setTickLength(0)\n\n # Add a stacked bar layer to the chart\n layer = c.addBarLayer2(ChartDirector::Stack)\n\n # Add the first two data sets to the chart as a stacked bar group\n layer.addDataGroup(\"2001\")\n layer.addDataSet(data0, 0xaaaaff, \"Local\")\n layer.addDataSet(data1, 0x6666ff, \"International\")\n\n # Add the remaining data sets to the chart as another stacked bar group\n layer.addDataGroup(\"2002\")\n layer.addDataSet(data2, 0xffaaaa, \"Local\")\n layer.addDataSet(data3, 0xff6666, \"International\")\n\n # Set the sub-bar gap to 0, so there is no gap between stacked bars with a group\n layer.setBarGap(0.2, 0)\n\n # Set the bar border to transparent\n layer.setBorderColor(ChartDirector::Transparent)\n\n # Set the aggregate label format\n layer.setAggregateLabelFormat(\"Year {dataGroupName}\\n{value} millions\")\n\n # Set the aggregate label font to 8 point Arial Bold Italic\n layer.setAggregateLabelStyle(\"arialbi.ttf\", 8)\n\n # Reverse 20% space at the right during auto-scaling to allow space for the\n # aggregate bar labels\n c.yAxis().setAutoScale(0.2)\n\n # Add a legend box at (310, 300) using TopCenter alignment, with 2 column grid\n # layout, and use 8 pts Arial Bold Italic as font\n legendBox = c.addLegend2(310, 300, 2, \"arialbi.ttf\", 8)\n legendBox.setAlignment(ChartDirector::TopCenter)\n\n # Set the format of the text displayed in the legend box\n legendBox.setText(\"Year {dataGroupName} {dataSetName} Revenue\")\n\n # Set the background and border of the legend box to transparent\n legendBox.setBackground(ChartDirector::Transparent, ChartDirector::Transparent)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def data\n chart =OpenFlashChart.new\n\n data = get_data\n\n get_converter.convert(chart, data)\n \n if show_y_axis\n y = YAxis.new\n y.set_range(0,(data[:max]*1.2).round,(data[:max]/get_y_axis_labels).round) if data[:max]\n chart.y_axis = y\n end\n\n if show_x_axis\n x = XAxis.new\n x.set_range(0,data[:count] > 1 ? data[:count] - 1 : 1,1) if data[:count]\n if data[:labels]\n labels = []\n if get_x_axis_labels > 0\n step = (data[:labels].size/get_y_axis_labels).to_i\n step = 1 if step == 0\n else\n step = 1\n end\n data[:labels].each_with_index do |l,i|\n if i % step == 0\n labels << l\n else\n labels << \"\"\n end\n end\n x.set_labels(labels)\n end\n chart.x_axis = x\n else\n x = XAxis.new\n x.set_labels([\"\"])\n chart.x_axis = x\n end\n\n unless get_x_legend.nil?\n legend = XLegend.new(get_x_legend)\n legend.set_style('{font-size: 12px}')\n chart.set_x_legend(legend)\n end\n\n unless get_x_legend.nil?\n legend = YLegend.new(get_y_legend)\n legend.set_style('{font-size: 12px}')\n chart.set_y_legend(legend)\n end\n\n chart.set_bg_colour('#ffffff');\n\n chart.to_s\n end", "def users_by_age\n bar_chart @users.group(:credits).count, height: '500px', library: {\n title: {text: 'Users by credits', x: -20},\n yAxis: {\n allowDecimals: false,\n title: {\n text: 'Credits count'\n }\n },\n xAxis: {\n title: {\n text: 'Credit'\n }\n }\n }\n end", "def getchart()\n # The data for the bar chart\n data0 = [100, 125, 245, 147, 67]\n data1 = [85, 156, 179, 211, 123]\n data2 = [97, 87, 56, 267, 157]\n\n # The labels for the bar chart\n labels = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\"]\n\n # Create a XYChart object of size 500 x 320 pixels\n c = ChartDirector::XYChart.new(500, 320)\n\n # Set the plotarea at (100, 40) and of size 280 x 240 pixels\n c.setPlotArea(100, 40, 280, 240)\n\n # Add a legend box at (400, 100)\n c.addLegend(400, 100)\n\n # Add a title to the chart using 14 points Times Bold Itatic font\n c.addTitle(\"Weekday Network Load\", \"timesbi.ttf\", 14)\n\n # Add a title to the y axis. Draw the title upright (font angle = 0)\n c.yAxis().setTitle(\"Average\\nWorkload\\n(MBytes\\nPer Hour)\").setFontAngle(0)\n\n # Set the labels on the x axis\n c.xAxis().setLabels(labels)\n\n # Add a stacked bar layer and set the layer 3D depth to 8 pixels\n layer = c.addBarLayer2(ChartDirector::Stack, 8)\n\n # Add the three data sets to the bar layer\n layer.addDataSet(data0, 0xff8080, \"Server # 1\")\n layer.addDataSet(data1, 0x80ff80, \"Server # 2\")\n layer.addDataSet(data2, 0x8080ff, \"Server # 3\")\n\n # Enable bar label for the whole bar\n layer.setAggregateLabelStyle()\n\n # Enable bar label for each segment of the stacked bar\n layer.setDataLabelStyle()\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def render_chart_data\n data = self.rounds.map do |r|\n { x: map_time_to_num(r.time_of_day), y: MachineRound.find_by(machine_id: self.id, round_id: r.id).data.to_f }\n end\n end", "def getchart()\n # The data for the bar chart\n data0 = [100, 125, 245, 147, 67]\n data1 = [85, 156, 179, 211, 123]\n data2 = [97, 87, 56, 267, 157]\n labels = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\"]\n\n # Create a XYChart object of size 400 x 240 pixels\n c = ChartDirector::XYChart.new(400, 240)\n\n # Add a title to the chart using 10 pt Arial font\n c.addTitle(\" Average Weekday Network Load\", \"\", 10)\n\n # Set the plot area at (50, 25) and of size 320 x 180. Use two alternative\n # background colors (0xffffc0 and 0xffffe0)\n c.setPlotArea(50, 25, 320, 180, 0xffffc0, 0xffffe0)\n\n # Add a legend box at (55, 18) using horizontal layout. Use 8 pt Arial font, with\n # transparent background\n c.addLegend(55, 18, false, \"\", 8).setBackground(ChartDirector::Transparent)\n\n # Add a title to the y-axis\n c.yAxis().setTitle(\"Throughput (MBytes Per Hour)\")\n\n # Reserve 20 pixels at the top of the y-axis for the legend box\n c.yAxis().setTopMargin(20)\n\n # Set the x axis labels\n c.xAxis().setLabels(labels)\n\n # Add a multi-bar layer with 3 data sets and 3 pixels 3D depth\n layer = c.addBarLayer2(ChartDirector::Side, 3)\n layer.addDataSet(data0, 0xff8080, \"Server #1\")\n layer.addDataSet(data1, 0x80ff80, \"Server #2\")\n layer.addDataSet(data2, 0x8080ff, \"Server #3\")\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def play_multi_year_charts\n Current.setting.reset!\n\n Current.setting.api_session_id = @scenario.id\n\n if params[:input] && (input = InputElement.find_by_key(params[:input]))\n Current.setting.last_etm_page = play_url(*input.url_components)\n @interface = Interface.new(*input.url_components)\n end\n\n @interface.variant = Interface::LiteVariant.new\n\n play\n end", "def sub_charts\n @sub_charts\n end", "def historic_stock(year)\n\n data = query_strategy.historic_stock(year)\n\n end", "def stats\n get_charts\n end", "def multi_year_ncont_charts\n parametrised_charts = [all_params.merge(multi_year_ncont_overview)]\n\n [\n [:sources_ids, @sources],\n # TODO: remove once dashboards_companies_mv retired\n [:companies_ids, @companies],\n [:exporters_ids, @exporters],\n [:importers_ids, @importers],\n [:destinations_ids, @destinations]\n ].each do |nodes_ids_param_name, nodes|\n parametrised_charts += charts_per_selected_node(\n nodes_ids_param_name, nodes\n )\n end\n\n charts_per_node_type = @node_types_for_comparisons.map do |node_type|\n multi_year_no_ncont_node_type_view(node_type)\n end\n parametrised_charts += charts_per_node_type.map do |chart|\n all_params.merge(chart)\n end\n\n parametrised_charts\n end", "def getchart()\n # The data for the chart\n dataY0 = [4, 4.5, 5, 5.25, 5.75, 5.25, 5, 4.5, 4, 3, 2.5, 2.5]\n dataX0 = [Time.mktime(1997, 1, 1), Time.mktime(1998, 6, 25), Time.mktime(1999, 9,\n 6), Time.mktime(2000, 2, 6), Time.mktime(2000, 9, 21), Time.mktime(2001, 3, 4\n ), Time.mktime(2001, 6, 8), Time.mktime(2002, 2, 4), Time.mktime(2002, 5, 19),\n Time.mktime(2002, 8, 16), Time.mktime(2002, 12, 1), Time.mktime(2003, 1, 1)]\n\n dataY1 = [7, 6.5, 6, 5, 6.5, 7, 6, 5.5, 5, 4, 3.5, 3.5]\n dataX1 = [Time.mktime(1997, 1, 1), Time.mktime(1997, 7, 1), Time.mktime(1997, 12,\n 1), Time.mktime(1999, 1, 15), Time.mktime(1999, 6, 9), Time.mktime(2000, 3, 3\n ), Time.mktime(2000, 8, 13), Time.mktime(2001, 5, 5), Time.mktime(2001, 9, 16\n ), Time.mktime(2002, 3, 16), Time.mktime(2002, 6, 1), Time.mktime(2003, 1, 1)]\n\n # Create a XYChart object of size 500 x 270 pixels, with a pale blue (e0e0ff)\n # background, black border, 1 pixel 3D border effect and rounded corners\n c = ChartDirector::XYChart.new(600, 300, 0xe0e0ff, 0x000000, 1)\n c.setRoundedFrame()\n\n # Set the plotarea at (55, 60) and of size 520 x 200 pixels, with white (ffffff)\n # background. Set horizontal and vertical grid lines to grey (cccccc).\n c.setPlotArea(50, 60, 525, 200, 0xffffff, -1, -1, 0xcccccc, 0xcccccc)\n\n # Add a legend box at (55, 32) (top of the chart) with horizontal layout. Use 9\n # pts Arial Bold font. Set the background and border color to Transparent.\n c.addLegend(55, 32, false, \"arialbd.ttf\", 9).setBackground(\n ChartDirector::Transparent)\n\n # Add a title box to the chart using 15 pts Times Bold Italic font. The text is\n # white (ffffff) on a deep blue (000088) background, with soft lighting effect\n # from the right side.\n c.addTitle(\"Long Term Interest Rates\", \"timesbi.ttf\", 15, 0xffffff).setBackground(\n 0x000088, -1, ChartDirector::softLighting(ChartDirector::Right))\n\n # Set the y axis label format to display a percentage sign\n c.yAxis().setLabelFormat(\"{value}%\")\n\n # Add a red (ff0000) step line layer to the chart and set the line width to 2\n # pixels\n layer0 = c.addStepLineLayer(dataY0, 0xff0000, \"Country AAA\")\n layer0.setXData(dataX0)\n layer0.setLineWidth(2)\n\n # Add a blue (0000ff) step line layer to the chart and set the line width to 2\n # pixels\n layer1 = c.addStepLineLayer(dataY1, 0x0000ff, \"Country BBB\")\n layer1.setXData(dataX1)\n layer1.setLineWidth(2)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def performance\n # QUOTES\n @quotes_count = Quote.where(created_at: [1.year.ago..Time.zone.now]).group_by_month(:created_at, time_zone: Time.zone).count\n @quotes_one_year_ago = Quote.where(created_at: [2.year.ago..1.year.ago.end_of_month]).group_by_month(:created_at, time_zone: Time.zone).count\n @quotes_two_years_ago = Quote.where(created_at: [3.year.ago..2.year.ago.end_of_month]).group_by_month(:created_at, time_zone: Time.zone).count\n\n @quotes_one_year_ago = align_chartkick_dates(@quotes_one_year_ago, 1)\n @quotes_two_years_ago = align_chartkick_dates(@quotes_two_years_ago, 2)\n\n @quote_dates = [\n {name: Time.now.year, data: @quotes_count},\n {name: 1.year.ago.year, data: @quotes_one_year_ago},\n {name: 2.years.ago.year, data: @quotes_two_years_ago}\n ]\n\n\n # ORDERS\n @orders_count = Order.where(created_at: [1.year.ago..Time.zone.now]).group_by_month(:created_at, time_zone: Time.zone).count\n @orders_one_year_ago = Order.where(created_at: [2.year.ago..1.year.ago.end_of_month]).group_by_month(:created_at, time_zone: Time.zone).count\n @orders_two_years_ago = Order.where(created_at: [3.year.ago..2.year.ago.end_of_month]).group_by_month(:created_at, time_zone: Time.zone).count\n\n @orders_one_year_ago = align_chartkick_dates(@orders_one_year_ago, 1)\n @orders_two_years_ago = align_chartkick_dates(@orders_two_years_ago, 2)\n\n @order_dates = [\n {name: Time.now.year, data: @orders_count},\n {name: 1.year.ago.year, data: @orders_one_year_ago},\n {name: 2.years.ago.year, data: @orders_two_years_ago},\n ]\n\n end", "def overview\n @current_year = Time.zone.today.year\n (current_user.first_billing_date.year..Time.zone.today.year).each do |year|\n add_to_graph(year_start_date(year), year_end_date(year))\n end\n @year_json = {\n title: \"Full Overview\",\n y_title: \"Dollars\",\n categories: (current_user.first_billing_date.year..Time.zone.today.year).to_a,\n series: [\n {\n name: 'Gross Income',\n data: @gross_income,\n color: '#3c763d'\n },\n {\n name: 'Gross Spending',\n data: @gross_spending,\n color: '#a94442'\n },\n {\n name: 'Net Profit',\n data: @net_profit,\n color: '#5cb85c',\n negativeColor: '#d9534f'\n }\n ]\n }\n end", "def getchart()\n # The data for the chart\n data0 = [100, 100, 100, 100, 100]\n data1 = [90, 85, 85, 80, 70]\n data2 = [80, 65, 65, 75, 45]\n\n # The labels for the chart\n labels = [\"Population<*br*><*font=arial.ttf*>6 millions\",\n \"GDP<*br*><*font=arial.ttf*>120 billions\",\n \"Export<*br*><*font=arial.ttf*>25 billions\",\n \"Import<*br*><*font=arial.ttf*>24 billions\",\n \"Investments<*br*><*font=arial.ttf*>20 billions\"]\n\n # Create a PolarChart object of size 480 x 460 pixels. Set background color to\n # silver, with 1 pixel 3D border effect\n c = ChartDirector::PolarChart.new(480, 460, ChartDirector::silverColor(),\n 0x000000, 1)\n\n # Add a title to the chart using 15 pts Times Bold Italic font. The title text is\n # white (ffffff) on a deep green (008000) background\n c.addTitle(\"Economic Growth\", \"timesbi.ttf\", 15, 0xffffff).setBackground(0x008000)\n\n # Set plot area center at (240, 270), with 150 pixels radius\n c.setPlotArea(240, 270, 150)\n\n # Use 1 pixel width semi-transparent black (c0000000) lines as grid lines\n c.setGridColor(0xc0000000, 1, 0xc0000000, 1)\n\n # Add a legend box at top-center of plot area (240, 35) using horizontal layout.\n # Use 10 pts Arial Bold font, with silver background and 1 pixel 3D border effect.\n b = c.addLegend(240, 35, false, \"arialbd.ttf\", 10)\n b.setAlignment(ChartDirector::TopCenter)\n b.setBackground(ChartDirector::silverColor(), ChartDirector::Transparent, 1)\n\n # Add area layers of different colors to represent the data\n c.addAreaLayer(data0, 0xcc8880, \"Year 2004\")\n c.addAreaLayer(data1, 0xffd080, \"Year 1994\")\n c.addAreaLayer(data2, 0xa0bce0, \"Year 1984\")\n\n # Set the labels to the angular axis as spokes.\n c.angularAxis().setLabels(labels)\n\n # Set radial axis from 0 - 100 with a tick every 20 units\n c.radialAxis().setLinearScale(0, 100, 20)\n\n # Just show the radial axis as a grid line. Hide the axis labels by setting the\n # label color to Transparent\n c.radialAxis().setColors(0xc0000000, ChartDirector::Transparent)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def active_charts\n @@active_charts\n end", "def getchart()\n # The data for the chart\n data0 = [42, 49, ChartDirector::NoValue, 38, 64, 56, 29, 41, 44, 57]\n data1 = [65, 75, 47, 34, 42, 49, 73, ChartDirector::NoValue, 90, 69, 66, 78]\n data2 = [ChartDirector::NoValue, ChartDirector::NoValue, 25, 28, 38, 20, 22,\n ChartDirector::NoValue, 25, 33, 30, 24]\n labels = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\",\n \"Nov\", \"Dec\"]\n\n # Create a XYChart object of size 600 x 360 pixels. Set background color to\n # brushed silver, with a 2 pixel 3D border. Use rounded corners.\n c = ChartDirector::XYChart.new(600, 360, ChartDirector::brushedSilverColor(),\n ChartDirector::Transparent, 2)\n c.setRoundedFrame()\n\n # Add a title using 18 pts Times New Roman Bold Italic font. #Set top/bottom\n # margins to 6 pixels.\n title = c.addTitle(\"Product Line Global Revenue\", \"timesbi.ttf\", 18)\n title.setMargin2(0, 0, 6, 6)\n\n # Add a separator line just under the title\n c.addLine(10, title.getHeight(), c.getWidth() - 11, title.getHeight(),\n ChartDirector::LineColor)\n\n # Add a legend box where the top-center is anchored to the horizontal center of\n # the chart, just under the title. Use horizontal layout and 10 points Arial Bold\n # font, and transparent background and border.\n legendBox = c.addLegend(c.getWidth() / 2, title.getHeight(), false, \"arialbd.ttf\",\n 10)\n legendBox.setAlignment(ChartDirector::TopCenter)\n legendBox.setBackground(ChartDirector::Transparent, ChartDirector::Transparent)\n\n # Tentatively set the plotarea at (70, 75) and of 460 x 240 pixels in size. Use\n # transparent border and black (000000) grid lines\n c.setPlotArea(70, 75, 460, 240, -1, -1, ChartDirector::Transparent, 0x000000, -1)\n\n # Set the x axis labels\n c.xAxis().setLabels(labels)\n\n # Show the same scale on the left and right y-axes\n c.syncYAxis()\n\n # Set y-axis tick density to 30 pixels. ChartDirector auto-scaling will use this\n # as the guideline when putting ticks on the y-axis.\n c.yAxis().setTickDensity(30)\n\n # Set all axes to transparent\n c.xAxis().setColors(ChartDirector::Transparent)\n c.yAxis().setColors(ChartDirector::Transparent)\n c.yAxis2().setColors(ChartDirector::Transparent)\n\n # Set the x-axis margins to 15 pixels, so that the horizontal grid lines can\n # extend beyond the leftmost and rightmost vertical grid lines\n c.xAxis().setMargin(15, 15)\n\n # Set axis label style to 8pts Arial Bold\n c.xAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis2().setLabelStyle(\"arialbd.ttf\", 8)\n\n # Add axis title using 10pts Arial Bold Italic font\n c.yAxis().setTitle(\"Revenue in USD millions\", \"arialbi.ttf\", 10)\n c.yAxis2().setTitle(\"Revenue in USD millions\", \"arialbi.ttf\", 10)\n\n # Add the first line. The missing data will be represented as gaps in the line\n # (the default behaviour)\n layer0 = c.addLineLayer2()\n layer0.addDataSet(data0, 0xff0000, \"Quantum Computer\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer0.setLineWidth(3)\n\n # Add the second line. The missing data will be represented by using dash lines to\n # bridge the gap\n layer1 = c.addLineLayer2()\n layer1.addDataSet(data1, 0x00ff00, \"Atom Synthesizer\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer1.setLineWidth(3)\n layer1.setGapColor(c.dashLineColor(0x00ff00))\n\n # Add the third line. The missing data will be ignored - just join the gap with\n # the original line style.\n layer2 = c.addLineLayer2()\n layer2.addDataSet(data2, 0xff6600, \"Proton Cannon\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer2.setLineWidth(3)\n layer2.setGapColor(ChartDirector::SameAsMainColor)\n\n # layout the legend so we can get the height of the legend box\n c.layoutLegend()\n\n # Adjust the plot area size, such that the bounding box (inclusive of axes) is 15\n # pixels from the left edge, just under the legend box, 16 pixels from the right\n # edge, and 25 pixels from the bottom edge.\n c.packPlotArea(15, legendBox.getTopY() + legendBox.getHeight(), c.getWidth() - 16,\n c.getHeight() - 25)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::JPG), :type => \"image/jpeg\",\n :disposition => \"inline\")\n end", "def convertDailyToMonthlyData()\n aggregateData(ChartDirector::ArrayMath.new(@timeStamps).selectStartOfMonth())\n end", "def getchart()\n # The data for the bar chart\n data = [85, 156, 179.5, 211, 123]\n\n # The labels for the bar chart\n labels = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\"]\n\n # The colors for the bar chart\n colors = [0xb8bc9c, 0xa0bdc4, 0x999966, 0x333366, 0xc3c3e6]\n\n # Create a XYChart object of size 300 x 220 pixels. Use golden background color.\n # Use a 2 pixel 3D border.\n c = ChartDirector::XYChart.new(300, 220, ChartDirector::goldColor(), -1, 2)\n\n # Add a title box using 10 point Arial Bold font. Set the background color to\n # metallic blue (9999FF) Use a 1 pixel 3D border.\n c.addTitle(\"Daily Network Load\", \"arialbd.ttf\", 10).setBackground(\n ChartDirector::metalColor(0x9999ff), -1, 1)\n\n # Set the plotarea at (40, 40) and of 240 x 150 pixels in size\n c.setPlotArea(40, 40, 240, 150)\n\n # Add a multi-color bar chart layer using the given data and colors. Use a 1 pixel\n # 3D border for the bars.\n c.addBarLayer3(data, colors).setBorderColor(-1, 1)\n\n # Set the labels on the x axis.\n c.xAxis().setLabels(labels)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def data_for_series\n now_ms = Time.now.to_utc_ms\n data = fetch_commits_for_repo.reduce([]) { |agg, this_commit|\n # Get the commit details\n commit_timestamp, commit_net_lines_added = fetch_stats_for_commit(this_commit.sha)\n\n # Do our math to calculate the net lines added in this commit\n previous_total_lines = agg[-1][1] rescue 0\n commit_total_lines = previous_total_lines + commit_net_lines_added\n \n # Emit a data point from our reduce method\n # Note: Javascript's \"new Date()\" call wants milliseconds since Unix epoch, in UTC\n agg << [ commit_timestamp.to_utc_ms, commit_total_lines ]\n puts agg.inspect\n agg\n }\n \n # If there are no Github commits, make a fake entry so we get something on the chart\n data = [[now_ms, 0]] if data.empty?\n \n # Make the data lie such that there is never a 0 or negative (these interfere with the logarithmic Y-axis)\n data.map! { |x| x[1] = 1 unless x[1] > 0; x }\n data\n end", "def getchart()\n #\n # We use a random number generator to simulate the data from 9:30am to 4:30pm\n # with one data point every 4 minutes. The total number of points during that\n # period is 106. (7 hours x 15 points/hour + 1)\n #\n noOfPoints = 106\n\n # Assume we have not reached the end of the day yet, and only 85 points are\n # available. Create a random table object of 1 col x 85 rows, using 9 as seed.\n rantable = ChartDirector::RanTable.new(9, 1, 85)\n\n # Set the 1st column to start with 1800 and with random delta from -5 to 5.\n rantable.setCol(0, 1800, -5, 5)\n\n # Get the data as the 1st column of the random table\n data = rantable.getCol(0)\n\n # The x-axis labels for the chart\n labels = [\"-\", \"10am\", \"-\", \" \", \"-\", \"12am\", \"-\", \" \", \"-\", \"2pm\", \"-\", \" \", \"-\",\n \"4pm\", \"-\"]\n\n #\n # Now we obtain the data into arrays, we can start to draw the chart using\n # ChartDirector\n #\n\n # Create a XYChart object of size 180 x 180 pixels with a blue background\n # (0x9c9cce)\n c = ChartDirector::XYChart.new(180, 180, 0x9c9cce)\n\n # Add titles to the top and bottom of the chart using 7.5pt Arial font. The text\n # is white 0xffffff on a deep blue 0x31319C background.\n c.addTitle2(ChartDirector::Top, \"STAR TECH INDEX 2003-01-28\", \"arial.ttf\", 7.5,\n 0xffffff, 0x31319c)\n c.addTitle2(ChartDirector::Bottom, \"LATEST STI:1809.41 (+14.51)\", \"arial.ttf\",\n 7.5, 0xffffff, 0x31319c)\n\n # Set the plotarea at (31, 21) and of size 145 x 124 pixels, with a pale yellow\n # (0xffffc8) background.\n c.setPlotArea(31, 21, 145, 124, 0xffffc8)\n\n # Add custom text at (176, 21) (top right corner of plotarea) using 11pt Times\n # Bold Italic font/red (0xc09090) color\n c.addText(176, 21, \"Chart Demo\", \"timesbi.ttf\", 11, 0xc09090).setAlignment(\n ChartDirector::TopRight)\n\n # Use 7.5 pts Arial as the y axis label font\n c.yAxis().setLabelStyle(\"\", 7.5)\n\n # Set the labels on the x axis by spreading the labels evenly between the first\n # point (index = 0) and the last point (index = noOfPoints - 1)\n c.xAxis().setLinearScale(0, noOfPoints - 1, labels)\n\n # Use 7.5 pts Arial as the x axis label font\n c.xAxis().setLabelStyle(\"\", 7.5)\n\n # Add a deep blue (0x000080) line layer to the chart\n c.addLineLayer(data, 0x000080)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def pie_chart_data\n battle = Battle.find(params[:battle_id])\n \n render json: battle.hashtags.map { |h| [h.name, h.get_count_between(before: battle.created_at)] }\n end", "def getchart()\n # 4 data points to represent the cash flow for the Q1 - Q4\n data = [230, -140, 220, 330]\n\n # We want to plot a waterfall chart showing the 4 quarters as well as the total\n labels = [\"1st Quarter\", \"2nd Quarter\", \"3rd Quarter\", \"4th Quarter\", \"Total\"]\n\n # The top side of the bars in a waterfall chart is the accumulated data. We use\n # the ChartDirector ArrayMath utility to accumulate the data. The \"total\" is\n # handled by inserting a zero point at the end before accumulation (after\n # accumulation it will become the total).\n boxTop = ChartDirector::ArrayMath.new(data).insert2(0, 1, data.length).acc(\n ).result()\n\n # The botom side of the bars is just the top side of the previous bar. So we\n # shifted the top side data to obtain the bottom side data.\n boxBottom = ChartDirector::ArrayMath.new(boxTop).shift(1, 0).result()\n\n # The last point (total) is different. Its bottom side is always 0.\n boxBottom[boxBottom.length - 1] = 0\n\n # In this example, we want to use different colors depending on the data is\n # positive or negative.\n posColor = 0x00ff00\n negColor = 0xff0000\n\n # Create a XYChart object of size 500 x 280 pixels. Set background color to light\n # blue (ccccff), with 1 pixel 3D border effect.\n c = ChartDirector::XYChart.new(500, 300, 0xccccff, 0x000000, 1)\n\n # Add a title to the chart using 13 points Arial Bold Itatic font, with white\n # (ffffff) text on a deep blue (0x80) background\n c.addTitle(\"Corporate Cash Flow - Year 2004\", \"arialbi.ttf\", 13, 0xffffff\n ).setBackground(0x000080)\n\n # Set the plotarea at (55, 50) and of size 430 x 215 pixels. Use alternative\n # white/grey background.\n c.setPlotArea(55, 50, 430, 215, 0xffffff, 0xeeeeee)\n\n # Add a legend box at (55, 25) using 8 pts Arial Bold font with horizontal layout,\n # with transparent background and border color.\n b = c.addLegend(55, 25, false, \"arialbd.ttf\", 8)\n b.setBackground(ChartDirector::Transparent, ChartDirector::Transparent)\n\n # Add keys to show the colors for positive and negative cash flows\n b.addKey(\"Positive Cash Flow\", posColor)\n b.addKey(\"Negative Cash Flow\", negColor)\n\n # Set the labels on the x axis using Arial Bold font\n c.xAxis().setLabels(labels).setFontStyle(\"arialbd.ttf\")\n\n # Set the x-axis ticks and grid lines to be between the bars\n c.xAxis().setTickOffset(0.5)\n\n # Use Arial Bold as the y axis label font\n c.yAxis().setLabelStyle(\"arialbd.ttf\")\n\n # Add a title to the y axis\n c.yAxis().setTitle(\"USD (in millions)\")\n\n # Add a box-whisker layer to represent the waterfall bars\n layer = c.addBoxWhiskerLayer(boxTop, boxBottom)\n\n # Color the bars depending on whether it is positive or negative\n 0.upto(boxTop.length - 1) do |i|\n if boxTop[i] >= boxBottom[i]\n layer.setBoxColor(i, posColor)\n else\n layer.setBoxColor(i, negColor)\n end\n end\n\n # Put data labels on the bars to show the cash flow using Arial Bold font\n layer.setDataLabelFormat(\"{={top}-{bottom}}M\")\n layer.setDataLabelStyle(\"arialbd.ttf\").setAlignment(ChartDirector::Center)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def multi_line_chart\n #Group data by month\n users = User.where(:created_at.gt => START_OF_MONTH_FOR_HOME_PAGE_REPORT, :created_at.lte => Date.today, auto_created: false).group_by{|u| u.created_at.strftime(REPORT_DATE_FORMAT)}\n contributions = Transaction.where(:created_at.gt => START_OF_MONTH_FOR_HOME_PAGE_REPORT, :created_at.lte => Date.today, :transaction_type.in => ['royalty_bonus', 'Round']).group_by{|u| u.created_at.strftime(REPORT_DATE_FORMAT)}\n redemptions = Transaction.where(:created_at.gt => START_OF_MONTH_FOR_HOME_PAGE_REPORT, :created_at.lte => Date.today, :transaction_type => 'redeem_points').group_by{|u| u.created_at.strftime(REPORT_DATE_FORMAT)}\n\n @user_trend = []\n @contribution_trend = []\n @redemption_trend = []\n @xAxis = []\n users.map{ |user| @user_trend << user[1].size}\n contributions.map{ |contribution| @contribution_trend << contribution[1].sum(&:points)}\n redemptions.map{ |redemption| @redemption_trend << (redemption[1].sum(&:points).abs/REDEEM['one_dollar_to_points'])}\n \n i = START_MONTH\n while(i >= 0) do\n @xAxis << i.months.ago.beginning_of_month.strftime(REPORT_DATE_FORMAT)\n i = i - 1\n end\n=begin\n #Find the largest xAxis among the three \n if users.keys.size > contributions.keys.size\n @xAxis = users.keys\n if redemptions.keys.size > users.keys.size \n @xAxis = redemptions.keys\n end \n else\n @xAxis = contributions.keys\n if redemptions.keys.size > users.keys.size\n @xAxis = redemptions.keys\n end\n end\n=end\n index = 0\n #Fill in 0 for those don't have any value for that specific month, otherwise the report will show mismatched axis values.\n @xAxis.each{ |value|\n if !users.keys.include?(value)\n @user_trend.insert(index,0)\n end\n if contributions.keys.index(value).blank?\n @contribution_trend.insert(index,0)\n end\n if redemptions.keys.index(value).blank?\n @redemption_trend.insert(index,0)\n end\n index = index + 1\n }\n end", "def data\n month = params[:month].blank? ? '0' : params[:month]\n year = params[:year].blank? ? 0 : params[:year].to_i\n staff_id = get_staff_id\n \n title = 'Hourly Payroll'\n yaxis = 'Total Amount (RM)'\n \n months = I18n.t('date.month_names')\n \n o = Array.new(12) { |x| [months[x + 1], 0] }\n b = Array.new(12) { |x| 0 }\n categories = Array.new(12) { |x| months[x + 1][0..2] }\n \n if year != 0\n listyear = [year]\n title = \"Hourly Payroll for #{year}\"\n \n else\n list = PayRate.select('distinct(year)').all\n listyear = list.collect { |x| x.year }\n end\n \n if month != '0'\n listmonth = month.collect { |x| x.to_i }\n \n else\n list = PayRate.select('distinct(month)').all\n listmonth = list.collect { |x| x.month }\n end\n \n listyear.each do |y|\n listmonth.each do |m|\n filters = { :year => y, :month => m, :staff_id => staff_id }\n total_hours = AttendanceHelper.get_total_hours(filters)\n rate = PayRateHelper.get_pay_rate(filters)\n v = total_hours * rate\n o[m - 1][1] = v\n b[m - 1] += v\n end\n end\n \n c = b.collect { |x| x.round(2) }\n \n @data = { :pie => o, :column => { :data => c, \n :categories => categories, \n :yaxis => yaxis }, \n :title => title }\n \n render :json => @data\n end", "def prepare_charts #:nodoc:\n count = 0\n charts = []\n\n # We sort the charts by row and column but that isn't strictly required.\n #\n rows = @charts.keys.sort\n rows.each do |row|\n cols = @charts[row].keys.sort\n cols.each do |col|\n charts.push(@charts[row][col])\n count += 1\n end\n end\n\n @charts = {}\n @charts_array = charts\n count\n end", "def getYoYTDBooking(dataDict)\n current, prev = 0.0, 0.0\n\n if dataDict.has_key? :prodSer\n queryObj = {\n :username => dataDict[:user],\n \"periods.prod_ser\" => dataDict[:prodSer],\n \"periods.year\" => dataDict[:maxYear],\n \"periods.quarter\" => nil,\n \"periods.month\" => nil,\n \"periods.week\" => nil,\n }\n else\n queryObj = {\n :username => dataDict[:user],\n \"periods.year\" => dataDict[:maxYear],\n \"periods.quarter\" => nil,\n \"periods.month\" => nil,\n \"periods.week\" => nil,\n }\n end # End of If condition to check if the key prodSer is there\n\n currentDoc = dataDict[:coll].find(queryObj)\n currentDoc.each do |doc|\n current = doc[dataDict[:symbol]][:yAxis][0]\n end\n tempTotal = 0.0\n dataDict[:prevMonth].times do |i|\n month = i + 1\n if dataDict.has_key? :prodSer\n queryObj2 = {\n :username => dataDict[:user],\n \"periods.prod_ser\" => dataDict[:prodSer],\n \"periods.year\" => dataDict[:prevYear].to_s,\n \"periods.month\" => month.to_s,\n \"periods.week\" => nil,\n }\n else\n queryObj2 = {\n :username => dataDict[:user],\n \"periods.year\" => dataDict[:prevYear].to_s,\n \"periods.month\" => month.to_s,\n \"periods.week\" => nil,\n }\n end # End of If condition to check if the key prodSer is there\n prevDoc = dataDict[:coll].find(queryObj2)\n prevDoc.each do |doc|\n tempTotal = doc[:tdBooking][:yAxis][0]\n end # End of prevYearDoc iteration\n prev += tempTotal\n end # End of Month iteration\n returnData = {\n :xAxis => [dataDict[:maxYear]],\n :yAxis => [ScalarCalculators.calculateGrowth(current, prev)],\n :current => [current],\n :prev => [prev],\n }\n return returnData\n end", "def drawChart()\n # The moving average periods selected by the user.\n avgPeriod1 = 0\n avgPeriod1 = params[\"movAvg1\"].to_i\n avgPeriod2 = 0\n avgPeriod2 = params[\"movAvg2\"].to_i\n\n if avgPeriod1 < 0\n avgPeriod1 = 0\n elsif avgPeriod1 > 300\n avgPeriod1 = 300\n end\n\n if avgPeriod2 < 0\n avgPeriod2 = 0\n elsif avgPeriod2 > 300\n avgPeriod2 = 300\n end\n\n # We need extra leading data points in order to compute moving averages.\n extraPoints = 20\n if avgPeriod1 > extraPoints\n extraPoints = avgPeriod1\n end\n if avgPeriod2 > extraPoints\n extraPoints = avgPeriod2\n end\n\n # Get the data series to compare with, if any.\n compareKey = (params[\"CompareWith\"] || \"\").strip\n @compareData = nil\n if getData(compareKey, extraPoints)\n @compareData = @closeData\n end\n\n # The data series we want to get.\n tickerKey = (params[\"TickerSymbol\"] || \"\").strip\n if !getData(tickerKey, extraPoints)\n return errMsg(\"Please enter a valid ticker symbol\")\n end\n\n \n\n # Check if there is any valid data\n if extraPoints >= @timeStamps.length\n # No data - just display the no data message.\n return errMsg(\"No data available for the specified time period\")\n end\n\n # In some finance chart presentation style, even if the data for the latest day is\n # not fully available, the axis for the entire day will still be drawn, where no\n # data will appear near the end of the axis.\n # if @resolution < 86400\n # # Add extra points to the axis until it reaches the end of the day. The end of\n # # day is assumed to be 16:00 (it depends on the stock exchange).\n # lastTime = @timeStamps[@timeStamps.length - 1]\n # extraTrailingPoints = ((16 * 3600 - lastTime % 86400) / @resolution).to_i\n # 0.upto(extraTrailingPoints - 1) do |i|\n # @timeStamps.push(lastTime + @resolution * (i + 1))\n # end\n # end\n\n #\n # At this stage, all data are available. We can draw the chart as according to\n # user input.\n #\n\n #\n # Determine the chart size. In this demo, user can select 4 different chart sizes.\n # Default is the large chart size.\n #\n width = 780\n mainHeight = 255\n indicatorHeight = 80\n\n size = params[\"ChartSize\"]\n if size == \"S\"\n # Small chart size\n width = 450\n mainHeight = 160\n indicatorHeight = 60\n elsif size == \"M\"\n # Medium chart size\n width = 620\n mainHeight = 215\n indicatorHeight = 70\n elsif size == \"H\"\n # Huge chart size\n width = 1000\n mainHeight = 320\n indicatorHeight = 90\n end\n\n # Create the chart object using the selected size\n m = ChartDirector::FinanceChart.new(width)\n\n # Set the data into the chart object\n m.setData(@timeStamps, @highData, @lowData, @openData, @closeData, @volData,\n extraPoints)\n #debugger\n #\n # We configure the title of the chart. In this demo chart design, we put the\n # company name as the top line of the title with left alignment.\n #\n m.addPlotAreaTitle(ChartDirector::TopLeft, tickerKey)\n\n # We displays the current date as well as the data resolution on the next line.\n resolutionText = \"\"\n if @resolution == 30 * 86400\n resolutionText = \"Monthly\"\n elsif @resolution == 7 * 86400\n resolutionText = \"Weekly\"\n elsif @resolution == 86400\n resolutionText = \"Daily\"\n elsif @resolution == 900\n resolutionText = \"15-min\"\n end\n\n m.addPlotAreaTitle(ChartDirector::BottomLeft, sprintf(\n \"<*font=arial.ttf,size=8*>%s - %s chart\", m.formatValue(Time.new,\n \"mmm dd, yyyy\"), resolutionText))\n\n # A copyright message at the bottom left corner the title area\n m.addPlotAreaTitle(ChartDirector::BottomRight,\n \"<*font=arial.ttf,size=8*>(c) Advanced Software Engineering\")\n\n #\n # Add the first techical indicator according. In this demo, we draw the first\n # indicator on top of the main chart.\n #\n addIndicator(m, params[\"Indicator1\"], indicatorHeight)\n\n #\n # Add the main chart\n #\n m.addMainChart(mainHeight)\n\n #\n # Set log or linear scale according to user preference\n #\n if params[\"LogScale\"] == \"1\"\n m.setLogScale(true)\n end\n\n #\n # Set axis labels to show data values or percentage change to user preference\n #\n if params[\"PercentageScale\"] == \"1\"\n m.setPercentageAxis()\n end\n\n #\n # Draw any price line the user has selected\n #\n mainType = params[\"ChartType\"]\n if mainType == \"Close\"\n m.addCloseLine(0x000040)\n elsif mainType == \"TP\"\n m.addTypicalPrice(0x000040)\n elsif mainType == \"WC\"\n m.addWeightedClose(0x000040)\n elsif mainType == \"Median\"\n m.addMedianPrice(0x000040)\n end\n\n #\n # Add comparison line if there is data for comparison\n #\n if @compareData != nil\n if @compareData.length > extraPoints\n m.addComparison(@compareData, 0x0000ff, compareKey)\n end\n end\n\n #\n # Add moving average lines.\n #\n addMovingAvg(m, params[\"avgType1\"], avgPeriod1, 0x663300)\n addMovingAvg(m, params[\"avgType2\"], avgPeriod2, 0x9900ff)\n\n #\n # Draw candlesticks or OHLC symbols if the user has selected them.\n #\n if mainType == \"CandleStick\"\n m.addCandleStick(0x33ff33, 0xff3333)\n elsif mainType == \"OHLC\"\n m.addHLOC(0x008800, 0xcc0000)\n end\n\n #\n # Add parabolic SAR if necessary\n #\n if params[\"ParabolicSAR\"] == \"1\"\n m.addParabolicSAR(0.02, 0.02, 0.2, ChartDirector::DiamondShape, 5, 0x008800,\n 0x000000)\n end\n\n #\n # Add price band/channel/envelop to the chart according to user selection\n #\n bandType = params[\"Band\"]\n if bandType == \"BB\"\n m.addBollingerBand(20, 2, 0x9999ff, 0xc06666ff)\n elsif bandType == \"DC\"\n m.addDonchianChannel(20, 0x9999ff, 0xc06666ff)\n elsif bandType == \"Envelop\"\n m.addEnvelop(20, 0.1, 0x9999ff, 0xc06666ff)\n end\n\n #\n # Add volume bars to the main chart if necessary\n #\n if params[\"Volume\"] == \"1\"\n m.addVolBars(indicatorHeight, 0x99ff99, 0xff9999, 0xc0c0c0)\n end\n\n #\n # Add additional indicators as according to user selection.\n #\n addIndicator(m, params[\"Indicator2\"], indicatorHeight)\n addIndicator(m, params[\"Indicator3\"], indicatorHeight)\n addIndicator(m, params[\"Indicator4\"], indicatorHeight)\n\n return m\n end", "def convert_data_gchart(data)\n data.map do |candle|\n [\n candle[0],\n candle[3],\n candle[1],\n candle[4],\n candle[2],\n ]\n end\n end", "def index\n @appfigures = self.appfigures\n @chartboost = self.chartboost\n #@money_spent = 0\n \n \n # @chartboost.sort_by {|day| day['Date']}.each do |key|\n # selected_date = key['Date'].to_s\n # money_spent = key['Money Spent'].scan(/[.0-9]/).join().to_f\n # money_earned = key['Money Earned'].scan(/[.0-9]/).join().to_f\n \n # profit = @appfigures[selected_date]['revenue'].to_f + money_earned - money_spent\n # profit = profit.to_s\n \n # p key['Date'] + ' Revenue: $' + @appfigures[selected_date]['revenue'] + ' Spent: '+ key['Money Spent'] + ' CB Rev: '+ key['Money Earned'] + ' Profit: $' + profit\n #end\n \n @appfigures.sort.each do |date, value|\n puts value['date'] + value['revenue']\n puts @chartboost[2]['Money Spent']\n end\n\n end", "def get_graph_data\n #check for the amount of data the function needs to return, defualt = 3\n @date_scalar = params.has_key?(:num_months) ? params[:num_months] : 3\n #string -> int\n @date_scalar = @date_scalar.to_i\n #make a float copy\n @date_scalar_float = @date_scalar.to_f\n\n #instantiate YQuotes client to get historical data\n yahoo_client = YQuotes::Client.new\n #retrieve the data\n @graph_data = yahoo_client.get_quote(\n @stock.ticker_symbol, { \n #get one data point for each day\n period: 'd', \n #calculate the first date needed based on the amount of data requested\n #24*60*60*365 converts the fractions of a year into seconds\n start_date: (Time.now - (24*60*60*365*(@date_scalar_float/12))).strftime(\"%Y-%m-%d\"), \n #current date\n end_date: Time.now.strftime(\"%Y-%m-%d\")\n })\n\n @low = @graph_data.adj_close.min\n @max = @graph_data.adj_close.max\n #used to see if more data is requested than exists\n #i.e. request 12 months of data for a 3-month old stock \n @overflow = false;\n #figure out how many data points were returned\n @array_size = @graph_data.index.max+1\n @i = 0\n #the number of points that will be displayed on the graph\n num_points = @array_size/150\n start_time = Time.now\n #initialize empty array\n @array_data = Array.new\n #checks for overflow, first case: no overflow \n if (@array_size > (251*(@date_scalar_float/12))-2)\n (@array_size).times do\n if !(num_points == 0)\n #decide whether or not to add it to data set based on number of points desired\n if @i % num_points == 0\n #add to data set that will be used to make graph\n @array_data.push([@graph_data.date[@i], @graph_data.adj_close[@i]])\n end\n #always add the first point\n else\n #add to data set that will be used to make graph\n @array_data.push([@graph_data.date[@i], @graph_data.adj_close[@i]])\n end\n @i += 1\n end\n #overflow\n else\n (@array_size).times do\n if !(num_points == 0)\n if @i % num_points == 0\n @array_data.push([@graph_data.date[@i], @graph_data.adj_close[@i]])\n end\n else\n @array_data.push([@graph_data.date[@i], @graph_data.adj_close[@i]])\n end\n \n @i += 1\n \n end\n #used to display warning\n @overflow = true\n @array_data.push(@overflow)\n end\n\n #convert to a json string for easy parsing in javascript function\n @json_string = @array_data.to_json \n respond_to do |format|\n #for AJAX call to dynamically update graph\n format.json { render json: @array_data, status: :ok }\n format.html { @json_string }\n end\n end", "def graph_data\n\n\t\t# stock data\n\t\t@stock_data = HistoricalStockPrice.where(:stock_id => @stock_object.id).pluck(:last_traded_at, :price)\n\t\t\n\t\t@stock_data.map! { |time, price| [time.to_time.to_i * 1000, price.to_f] }\n\t\t@stock_data.sort_by! { |time, price| time }\n\t\t\n\t\t# puts \"stock data is:\"\n\t\t# @stock_data.each do |time, price|\n\t\t# \tputs \"Time: #{time}, Price: #{price}\"\n\t\t# end\n\n \treturn @stock_data\n \tend", "def index\n x_axis = LogMetric.select(\"date_trunc('minutes', timestamp) as time\").group('time').order('time').pluck(\"date_trunc('minutes', timestamp) as time\")\n labels = LogMetric.distinct.pluck(:log_level)\n\n datasets = []\n\n labels.each do |label|\n color = random_color\n quantities = LogMetric.select('quantity').where(log_level: label).pluck('quantity')\n items = []\n\n\n if quantities.length < x_axis.length then\n diff = x_axis.length - quantities.length\n\n for i in 0...diff\n items.push(0)\n end\n end\n\n items.concat(quantities)\n\n datasets.push(\n label: label,\n borderColor: color,\n backgroundColor: color,\n data: items,\n fill: false\n )\n\n Rails.logger.debug(items)\n end\n\n @data = {\n labels: x_axis,\n datasets: datasets\n }\n\n @options = {\n responsive: true,\n maintainAspectRatio: false,\n tooltips: {\n mode: 'index',\n intersect: false\n },\n hover: {\n mode: 'nearest',\n intersect: true\n },\n scales: {\n xAxes: [{\n display: true,\n scaleLabel: {\n display: true,\n labelString: 'Time'\n }\n }],\n yAxes: [{\n display: true,\n scaleLabel: {\n display: true,\n labelString: 'Quantity'\n }\n }]\n }\n }\n end", "def chart\n case param_context(:chart_type)\n when 'cities' then\n @cities = city_count_data.to_a # build the data here, or pull it from an endpoint in the JS, but not both\n render 'cities_chart'\n when 'countries' then\n @countries = country_count_data.to_a # build the data here, or pull it from an endpoint in the JS, but not both\n render 'countries_chart'\n when 'years' then\n @years = year_count_data.to_a\n render 'years_chart'\n else\n flash[:error] = 'Unknown chart type'\n redirect_to events_path\n end\n end", "def competition_by_year\n \tresult = CompetitionResult.group_by_year(:created_at, format: '%Y').count\n \trender json: [{ name: 'Count', data: result}]\n end", "def create_survey_chart(survey_data)\ndata_table = GoogleVisualr::DataTable.new\ndata_table.new_column('string', 'Personality' )\ndata_table.new_column('number', current_user.first_name)\ndata_table.add_rows(survey_data)\nvaxes = [{format: \"#\", viewWindow: {min: 0}}]\t\noption = { width: \"400\", height: 300, areaOpacity: 0, vAxes: vaxes, title: \"Survey\" }\n@survey_chart = GoogleVisualr::Interactive::BarChart.new(data_table, option)\nend", "def convert_to_chart(data)\n converted = Hash[data.map { |k, v| [k.to_time(:local).to_i * 1000, v] }]\n converted.to_a\n end", "def chart_data\n chart_data = {}\n if @issue_max_date < @basis_date && complete_ev < 100.0\n @ev[@basis_date] = @ev[@ev.keys.max]\n @ac[@basis_date] = @ac[@ac.keys.max]\n end\n chart_data[:planned_value] = convert_to_chart(@pv_actual)\n chart_data[:actual_cost] = convert_to_chart(@ac)\n chart_data[:earned_value] = convert_to_chart(@ev)\n chart_data[:baseline_value] = convert_to_chart(@pv_baseline)\n if @forecast\n bac_top_line = { chart_minimum_date => bac,\n chart_maximum_date => bac }\n chart_data[:bac_top_line] = convert_to_chart(bac_top_line)\n eac_top_line = { chart_minimum_date => eac,\n chart_maximum_date => eac }\n chart_data[:eac_top_line] = convert_to_chart(eac_top_line)\n actual_cost_forecast = { @basis_date => today_ac,\n forecast_finish_date(@basis_hours) => eac }\n chart_data[:actual_cost_forecast] = convert_to_chart(actual_cost_forecast)\n earned_value_forecast = { @basis_date => today_ev,\n forecast_finish_date(@basis_hours) => bac }\n chart_data[:earned_value_forecast] = convert_to_chart(earned_value_forecast)\n end\n chart_data\n end", "def build_chart_line(data)\n accum = 0\n week = 0\n\n # TODO - In Ruby 1.8, hashes do NOT maintain insertion sort order!! Grr... so we have to do a stupid data structure dance...\n arr = []\n data.each { |date, estimate_diff| arr << [date, estimate_diff] }\n arr = arr.sort_by {|x| x.first }\n\n line = []\n arr.each do |point|\n # We display data by the week, only showing completed weeks\n day = get_normalized_day point[0] # date\n puts day\n if day >= (7 * (week + 1))\n line.push [week, accum]\n week = day / 7\n end\n accum += point[1] # estimate\n end\n\n line\n end", "def show\n @chart_data0 = make_chart_data(@progress.company_name,0)\n @chart_data1 = make_chart_data(@progress.company_name,1)\n @chart_data2 = make_chart_data(@progress.company_name,2)\n end", "def set_bar_from_date(symbol, date)\n if(@max_bars[symbol] <= @bar[symbol] + 1)\n return @bar[symbol]\n end\n \n while(@bar[symbol] + 1 < @max_bars[symbol] && get_ex_chart_data(symbol, :time, @bar[symbol] + 1) <= date)\n @bar[symbol] += 1\n end\n @bar[symbol]\n end", "def make_year_stats(months)\n rows = months.map{|month|\n items = Item.all(:conditions => {\n :date => month_range(month),\n :type => [\"Expense\", \"Income\"]\n }).group_by(&:category)\n\n make_row(month, items)\n }\n\n return rows.push make_sum_row(rows)\n end", "def getchart()\n # The data for the chart\n data0 = [90, 60, 85, 75, 55]\n data1 = [60, 80, 70, 80, 85]\n\n # The labels for the chart\n labels = [\"Speed\", \"Reliability\", \"Comfort\", \"Safety\", \"Efficiency\"]\n\n # Create a PolarChart object of size 480 x 380 pixels. Set background color to\n # gold, with 1 pixel 3D border effect\n c = ChartDirector::PolarChart.new(480, 380, ChartDirector::goldColor(), 0x000000,\n 1)\n\n # Add a title to the chart using 15 pts Times Bold Italic font. The title text is\n # white (ffffff) on a deep blue (000080) background\n c.addTitle(\"Space Travel Vehicles Compared\", \"timesbi.ttf\", 15, 0xffffff\n ).setBackground(0x000080)\n\n # Set plot area center at (240, 210), with 150 pixels radius, and a white (ffffff)\n # background.\n c.setPlotArea(240, 210, 150, 0xffffff)\n\n # Add a legend box at top right corner (470, 35) using 10 pts Arial Bold font. Set\n # the background to silver, with 1 pixel 3D border effect.\n b = c.addLegend(470, 35, true, \"arialbd.ttf\", 10)\n b.setAlignment(ChartDirector::TopRight)\n b.setBackground(ChartDirector::silverColor(), ChartDirector::Transparent, 1)\n\n # Add an area layer to the chart using semi-transparent blue (0x806666cc). Add a\n # blue (0x6666cc) line layer using the same data with 3 pixel line width to\n # highlight the border of the area.\n c.addAreaLayer(data0, 0x806666cc, \"Model Saturn\")\n c.addLineLayer(data0, 0x6666cc).setLineWidth(3)\n\n # Add an area layer to the chart using semi-transparent red (0x80cc6666). Add a\n # red (0xcc6666) line layer using the same data with 3 pixel line width to\n # highlight the border of the area.\n c.addAreaLayer(data1, 0x80cc6666, \"Model Jupiter\")\n c.addLineLayer(data1, 0xcc6666).setLineWidth(3)\n\n # Set the labels to the angular axis as spokes.\n c.angularAxis().setLabels(labels)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def performance_chart_data\n chart_data = {}\n new_ev = complement_evm_value @ev\n new_ac = complement_evm_value @ac\n new_pv = complement_evm_value @pv\n performance_min_date = [new_ev.keys.min,\n new_ac.keys.min,\n new_pv.keys.min].max\n performance_max_date = [new_ev.keys.max,\n new_ac.keys.max,\n new_pv.keys.max].min\n spi = {}\n cpi = {}\n cr = {}\n (performance_min_date..performance_max_date).each do |date|\n spi[date] = (new_ev[date] / new_pv[date]).round(2)\n cpi[date] = (new_ev[date] / new_ac[date]).round(2)\n cr[date] = (spi[date] * cpi[date]).round(2)\n end\n chart_data[:spi] = convert_to_chart(spi)\n chart_data[:cpi] = convert_to_chart(cpi)\n chart_data[:cr] = convert_to_chart(cr)\n chart_data\n end", "def change_structure_to_timeseries\n # add 'x' as first element and move mri.chart[:axis][:x][:categories] to mri.chart[:data][:columns] as first column\n x = mri.chart[:axis][:x][:categories]\n x.unshift('x')\n mri.chart[:data][:columns].unshift(x)\n mri.chart[:data][:x] = 'x'\n # set x axis type to timeseries and remove categories\n mri.chart[:axis][:x] = {:type => 'timeseries', :tick => {}}\n # set flag for performance chart\n mri.chart[:miq][:performance_chart] = true\n # this conditions are taken from build_performance_chart_area method from chart_commons.rb\n if mri.db.include?(\"Daily\") || (mri.where_clause && mri.where_clause.include?(\"daily\"))\n # set format for parsing\n mri.chart[:data][:xFormat] = '%m/%d'\n # set format for labels\n mri.chart[:axis][:x][:tick][:format] = '%m/%d'\n elsif mri.extras[:realtime] == true\n mri.chart[:data][:xFormat] = '%H:%M:%S'\n mri.chart[:axis][:x][:tick][:format] = '%H:%M:%S'\n else\n mri.chart[:data][:xFormat] = '%H:%M'\n mri.chart[:axis][:x][:tick][:format] = '%H:%M'\n end\n end", "def stacked_line_chart_data\n battle = Battle.find(params[:battle_id])\n data = []\n\n battle.hashtags.each do |h|\n data << h.get_stacked_evolution_data(from: battle.created_at)\n end\n\n render json: data\n end", "def index\n @bar_graphs = BarGraph.all\n end", "def graph_release_time\n data = Rails.cache.fetch(\"graph_release_time_sprint_#{@sprint.id}\", expires_in: 30.minutes) {\n data = Array.new {Array.new}\n user_stories = @sprint.issues.select(&:done?).sort_by(&:resolutiondate)\n data[0] = user_stories.map.with_index {|issue, index| {x: index, y: issue.key}}\n data[1] = user_stories.map.with_index {|issue, index| {x: index, y: issue.time_in_wip}}\n data[2] = user_stories.map.with_index {|issue, index| {x: index, y: issue.flagged?}}\n data[3] = user_stories.map.with_index {|issue, index| {x: index, y: issue.first_time_pass_rate?}}\n data[4] = user_stories.map.with_index {|issue, index| {x: index, y: issue.bug?}}\n data[5] = user_stories.map.with_index {|issue, index| {x: index, y: issue.resolutiondate.strftime(\"%b %d\")}}\n data[6] = user_stories.map.with_index {|issue, index| {x: index, y: issue.more_than_sprint?}}\n data[7] = user_stories.map.with_index {|issue, index| {x: index, y: issue.time_to_release}}\n data[8] = user_stories.map.with_index {|issue, index| {x: index, y: issue.id}}\n data\n }\n render json: data\n end", "def charts\n @last_month_active_recipe_data = Recipe.recent_recipe_meals(current_user, true)\n @last_month_inactive_recipe_data = Recipe.recent_recipe_meals(current_user, false)\n @difficulty_level_last_month = Recipe.difficulty_level_of_recent_meals(current_user)\n @food_group_data = FoodGroup.recent_food_groups_in_meals(current_user)\n @difficulty_data = Recipe.current_user_difficulty_of_recipes(current_user)\n @ingredient_data = Recipe.ingredients_in_active_recipes(current_user)\n end", "def fbm_impressions\n dates, values = FBMarketingImpression.chart_data(resource.key)\n return LazyHighCharts::HighChart.new('graph') do |f|\n f.chart[:defaultSeriesType] = \"area\"\n f.title({:text => \"Impressions\"})\n f.xAxis(:categories => dates, :labels => {:rotation => -45, :align => 'right', :text => 'Date'})\n f.series(:name => 'Impressions', :type=>\"area\", :data=>values)\n end\n return {}\n end", "def adler_chart(i)\r\n AdlerChart.new self, i\r\n end", "def basic_chart\n \n end", "def agency_chart\n if(params[ :year ].nil?)\n params[ :year ] = '2015'\n else\n # Nothing to do.\n end\n expenses_of_public_agency = HelperController.expenses_year( \n params[ :id ].to_i, params[ :year ] )\n expenses_list = change_type_list_expenses( \n expenses_of_public_agency, params[ :year ] )\n\n respond_to do |format|\n format.json { render json: expenses_list }\n end\n end", "def portfolio_line_chart interval=\"5minute\", opts={span: \"day\"}\n get_portfolio_history get_accounts.first[\"account_number\"], interval, opts\n columns = [ {role: :none, data: ['number', 'X']} ] # add x axis\n\n # each stock has a value and a tooltip\n columns = columns + \n [\n {role: :none, data: ['number', \"Portfolio\"]},\n {role: :tooltip, data: {type: :string, role: :tooltip}}\n ]\n\n rows = []\n @portfolio_history[\"equity_historicals\"].each_with_index do |h,i|\n rows[i] ||= [i+1]\n price = (opts[:span] == \"day\" ? h[\"adjusted_open_equity\"] : h[\"adjusted_close_equity\"]).to_f\n date = h[\"begins_at\"].in_time_zone('EST').strftime '%m/%d/%y %l:%M%P'\n rows[i] = rows[i] + [price, \"$#{price} on #{date}\"]\n end\n \n previous_close_price = @portfolio_history[\"adjusted_previous_close_equity\"].to_f\n previous_close_price = @portfolio_history[\"equity_historicals\"].first[\"adjusted_open_equity\"].to_f if previous_close_price == 0.0\n most_recent_price = @portfolio_history[\"equity_historicals\"].last[\"adjusted_open_equity\"].to_f\n color = most_recent_price > previous_close_price ? ROBINHOOD_GREEN : ROBINHOOD_ORANGE\n options = {\n #title: \"Price chart\",\n hAxis: {\n #title: 'Date',\n ticks: 'none', #rows.map{ |r| r.first },\n gridlines: {color: \"transparent\"}\n },\n vAxis: {\n #title: 'Price',\n gridlines: {color: \"transparent\"}\n },\n focusTarget: :category, # show all tooltips for column on hover,\n #curveType: :function, # curve lines, comment out to disable\n legend: :none,\n chartArea: { width: '90%', height: '75%' },\n series: {\"0\": {color: color}},\n backgroundColor: \"#090d16\"\n }\n \n {columns: columns, rows: rows, options: options}\n end", "def graph\n @data = @category.to_graph_points\n\n @series = [{ values: @data, key: @category.name }]\n\n @title = \"Spending for #{@category.name}\"\n end", "def getchart()\n # The data for the area chart\n data = [3.0, 2.8, 4.0, 5.5, 7.5, 6.8, 5.4, 6.0, 5.0, 6.2, 7.5, 6.5, 7.5, 8.1, 6.0,\n 5.5, 5.3, 3.5, 5.0, 6.6, 5.6, 4.8, 5.2, 6.5, 6.2]\n\n # The labels for the area chart\n labels = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\",\n \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", \"19\", \"20\", \"21\", \"22\", \"23\", \"24\"]\n\n # Create a XYChart object of size 300 x 180 pixels. Set the background to pale\n # yellow (0xffffa0) with a black border (0x0)\n c = ChartDirector::XYChart.new(300, 180, 0xffffa0, 0x000000)\n\n # Set the plotarea at (45, 35) and of size 240 x 120 pixels. Set the background to\n # white (0xffffff). Set both horizontal and vertical grid lines to black (&H0&)\n # dotted lines (pattern code 0x0103)\n c.setPlotArea(45, 35, 240, 120, 0xffffff, -1, -1, c.dashLineColor(0x000000,\n 0x000103), c.dashLineColor(0x000000, 0x000103))\n\n # Add a title to the chart using 10 pts Arial Bold font. Use a 1 x 2 bitmap\n # pattern as the background. Set the border to black (0x0).\n c.addTitle(\"Snow Percipitation (Dec 12)\", \"arialbd.ttf\", 10).setBackground(\n c.patternColor([0xb0b0f0, 0xe0e0ff], 2), 0x000000)\n\n # Add a title to the y axis\n c.yAxis().setTitle(\"mm per hour\")\n\n # Set the labels on the x axis.\n c.xAxis().setLabels(labels)\n\n # Display 1 out of 3 labels on the x-axis.\n c.xAxis().setLabelStep(3)\n\n # Add an area layer to the chart\n layer = c.addAreaLayer()\n\n # Load a snow pattern from an external file \"snow.png\".\n snowPattern = c.patternColor2(File.dirname(__FILE__) + \"/snow.png\")\n\n # Add a data set to the area layer using the snow pattern as the fill color. Use\n # deep blue (0x0000ff) as the area border line color (&H0000ff&)\n layer.addDataSet(data).setDataColor(snowPattern, 0x0000ff)\n\n # Set the line width to 2 pixels to highlight the line\n layer.setLineWidth(2)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def year_array\n return ['x'] +(@earliest_year..@latest_year).to_a\n end", "def liq_chart\n temp =[]\n l_c = LiqChart.new\n liq_secs = securities.select{|s| s.liq_payout > 0.0}.uniq\n liq_secs.each do |liq_sec|\n temp += [[liq_sec.rank, liq_sec.liq_payout]]\n end\n ranks = temp.map{|t| t[0]}.uniq.sort\n pairs = ranks.map{|r| [r, temp.select{|t| t[0] == r}.map{|tt| tt[1]}.sum ]}\n pairs.each do |pair|\n l_c.push pair\n end\n l_c\n end", "def show\n \n @end_at = Date.today\n @start_at = @end_at - 6\n @categories = @start_at.upto(@end_at).to_a\n\n \t#Sales Historyグラフ\n @sales_data = [500, 600, 300, 100, 200, 400, 700,500, 600, 300, 100, 200, 400, 700,100, 200, 400, 700,500, 600, 600, 300, 100, 200,]\n @sales_history = LazyHighCharts::HighChart.new(\"graph\") do |f|\n f.title(:text => \"Sales History\", :align =>\"left\")\n f.chart(:type => \"column\")\n f.xAxis(:categories => @categories)\n f.series(:name => \"Sales\", :data => @sales_data)\n\t end\n\n#Order Historyのグラフ\n @order_data = [80, 60, 30, 10, 40, 50, 90,60, 30, 10, 40, 50, 90,50, 90,60, 30, 10, 40, 50,]\n @order_history = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(text: 'Order History',:align =>\"left\")\n f.xAxis(:categories => @categories)\n f.series(name: 'Order', :data => @order_data)\n end\n\n#Price Historyのグラフ\n @price_data = [80, 60, 30, 10, 40, 50, 90,60, 30, 10, 40, 50, 90,50, 90,60, 30, 10, 40, 50,]\n @price_history = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(text: 'Order History',:align =>\"left\")\n f.xAxis(:categories => @categories)\n f.series(name: 'Order', :data => @price_data)\n end\n \n \n end", "def get_daily_revenue_vs_target_chart_series(number_of_days=60)\n daily_revenue_chart_series = []\n\n # Last 30 Days: Column\n daily_revenue_array = []\n last_x_dates_array = get_last_x_dates_array(number_of_days)\n last_x_dates_array.each do |date|\n difference = get_revenue_by_day(nil, date) - get_daily_revenue_goal_by_month(get_last_sale_date)\n daily_revenue_array.push(difference.round(2))\n end\n daily_revenue_chart_series.push({\n 'name' => 'Last ' + number_of_days.to_s + ' Days', \n 'data' => daily_revenue_array,\n 'type' => 'column',\n 'borderWidth' => 0,\n 'negativeColor' => '#FF6060',\n 'color' => 'green'\n })\n\n # Average For Current Month\n this_month_daily_average_revenue_array = []\n last_x_dates_array.each do |date|\n difference = get_average_daily_revenue_by_month(get_last_sale_date) - get_daily_revenue_goal_by_month(get_last_sale_date)\n this_month_daily_average_revenue_array.push(difference.round(2))\n end\n daily_revenue_chart_series.push({\n 'name' => get_last_sale_date.strftime(\"%b\") + ' Average', \n 'data' => this_month_daily_average_revenue_array,\n 'type' => 'line',\n 'color' => 'black',\n 'borderWidth' => 0,\n 'lineWidth' => 1,\n 'marker' => {\n 'enabled' => false\n }\n })\n\n return daily_revenue_chart_series.to_json\n end", "def display_charts(is_reload)\n @entries.each_with_index do |entry, i|\n break if i == Cfg.max_items\n iter = is_reload ? @lsc.get_iter(i.to_s) : @lsc.append\n iter[COL_RANK] = entry.rank #.to_s\n if @count_type == COUNT_PLAYED\n iter[COL_PLAYED] = entry.played.to_s\n else\n if view_tracks_or_records?\n iter[COL_PLAYED] = entry.played.to_hr_length\n else\n iter[COL_PLAYED] = entry.played.to_day_length\n end\n end\n iter[COL_REF] = entry.ref\n iter[COL_PIX] = entry.pix\n iter[COL_TEXT] = entry.title\n end\n end", "def getArrayYoYDiscount(dataDict)\n\n currentXAxis, tempXAxis = [], []\n currentYAxis, tempYAxis = [], [] \n currentYAxis2, tempYAxis2 = [], [] \n currentYAxis3, tempYAxis3 = [], [] \n if dataDict.has_key? :prodSer\n queryObj = {\n :username => dataDict[:user],\n \"periods.prod_ser\" => dataDict[:prodSer],\n \"periods.year\" => dataDict[:maxYear],\n \"periods.quarter\" => nil,\n \"periods.month\" => nil,\n \"periods.week\" => nil,\n }\n else\n queryObj = {\n :username => dataDict[:user],\n \"periods.year\" => dataDict[:maxYear],\n \"periods.quarter\" => nil,\n \"periods.month\" => nil,\n \"periods.week\" => nil,\n }\n end # End of If condition to check if the key prodSer is there\n currentDoc = dataDict[:coll].find(queryObj)\n currentDoc.each do |doc|\n currentXAxis = doc[dataDict[:symbol]][:xAxis]\n currentYAxis = doc[dataDict[:symbol]][:yAxis]\n currentYAxis2 = doc[dataDict[:symbol]][:yAxis2]\n currentYAxis3 = doc[dataDict[:symbol]][:yAxis3]\n end # End of CurrentDoc iteration\n\n prevXAxis, prevYAxis = sumParallelArrayDiscount(currentXAxis, dataDict)\n\n currentDict = {\n :xAxis => currentXAxis,\n :yAxis => currentYAxis\n }\n prevDict = {\n :xAxis => prevXAxis,\n :yAxis => prevYAxis\n }\n return ArrayCalculators.calculateGrowth(currentDict, prevDict)\n end", "def facet_by_range(arr)\n interval = Date.current.year - LOWER_BOUND_YEAR\n\n arr.select { |a| a[\"key_as_string\"].to_i <= Date.current.year }[\n 0..interval\n ].\n map do |hsh|\n {\n \"id\" => hsh[\"key_as_string\"],\n \"title\" => hsh[\"key_as_string\"],\n \"count\" => hsh[\"doc_count\"],\n }\n end\n end", "def grafico_activitad(vaca,num_dias)\n\n date_actividad = num_dias.days.ago.localtime\n\n actividades_total = vaca.actividades.where(\"registrada >= ? and tipo = ?\", date_actividad,'recorrido') \n n=0\n data_total = [[]]\n data_prom = [[]]\n \n actividades_total.each do |actividad|\n data_total[n] = [actividad.registrada.localtime,actividad.valor]\n act_prom = actividad_promedio_en(actividad.registrada)\n data_prom[n] = [actividad.registrada.localtime,act_prom]\n n = n+1\n end \n \n startPoint = 24.hours.ago.localtime\n if !data_total[0][0].nil? && data_total.size >0 \n startPoint = data_total[0][0].advance(:hours => (-3).to_i).localtime\n end\n startPoint = startPoint.change(:min => 0)\n \n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.options[:chart][:defaultSeriesType] = \"spline\"\n f.options[:chart][:zoomType] = \"x\"\n f.options[:legend][:align] = \"right\"\n f.options[:legend][:verticalAlign] = \"top\"\n f.options[:legend][:floating] = \"true\"\n f.global(:useUTC => 'false')\n\n f.series(:name=>'Actividad Vaca ' + vaca.caravana.to_s, :data => data_total, \n :pointInterval => 3600000,:pointStart => (startPoint.to_i * 1000))\n f.series(:name=>'Actividad Promedio', :data => data_prom, \n :pointInterval => 3600000,:pointStart => (startPoint.to_i * 1000))\n \n f.options[:yAxis][:title] = {text: \"Eventos\"}\n f.options[:xAxis][:maxZoom] = \"14 * 24 * 3600000\"\n f.options[:xAxis][:type] = \"datetime\"\n f.options[:tooltip][:shared] = 'true'\n \n f.title(text: 'Actividad Vaca ' + vaca.caravana.to_s + ' ultimos ' + num_dias.to_s + ' dias') \n end\n\n return @chart\nend", "def logbook_hours_by_month\n # Calls the charts controller to get the results and load the chart\n # asynchronously\n line_chart logbook_hours_by_month_charts_path(:id => params[:id]), library: {\n title: {text: 'Hours by Month', x: -20},\n tooltip: {\n enabled: false,\n },\n yAxis: {\n title: {\n text: 'Hours flown'\n }\n }\n }\n end", "def getYoYBilledCount(dataDict)\n current, prev = 0.0, 0.0\n\n if dataDict.has_key? :prodSer\n queryObj = {\n :username => dataDict[:user],\n \"periods.prod_ser\" => dataDict[:prodSer],\n \"periods.year\" => dataDict[:maxYear],\n \"periods.quarter\" => nil,\n \"periods.month\" => nil,\n \"periods.week\" => nil,\n }\n else\n queryObj = {\n :username => dataDict[:user],\n \"periods.year\" => dataDict[:maxYear],\n \"periods.quarter\" => nil,\n \"periods.month\" => nil,\n \"periods.week\" => nil,\n }\n end # End of If condition to check if the key prodSer is there\n\n currentDoc = dataDict[:coll].find(queryObj)\n currentDoc.each do |doc|\n current = doc[dataDict[:symbol]][:yAxis][0]\n end # End of currentDoc iteration\n matchObj = getPreviousYearMatchObj(dataDict)\n if dataDict[:byName] == 'customer'\n matchObj[:$match][:$and] = [\n {\n \"names.customer.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n @dsObj.groupByCustomers(),\n ]\n else\n matchObj[:$match][:$and] = [\n {\n \"names.partner.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n @dsObj.groupByPartners(),\n ]\n end # End of If condition\n doc = {}\n if !matchObj.nil?\n returnedObj = keyValuePairByAggQryBilled(aggregateQuery, dataDict[:bookingColl], dataDict[:byName])\n doc[dataDict[:symbol]] = {\n :xAxis => returnedObj[:key],\n :yAxis => returnedObj[:value]\n }\n else\n doc[dataDict[:symbol]] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n if !doc[dataDict[:symbol]][:xAxis].empty?\n prev = doc[dataDict[:symbol]][:yAxis][0]\n end\n returnData = {\n :xAxis => [dataDict[:maxYear]],\n :yAxis => [ScalarCalculators.calculateGrowth(current, prev)],\n :current => [current],\n :prev => [prev],\n }\n return returnData\n end", "def charts_data_for(project)\n charts_data = {}\n\n ### chart project hours ### \n\n # time period\n from = project.created_at.to_date\n to = project.due_at.to_date + 1.week\n charts_data[:project_hours_from] = from \n charts_data[:project_hours_to] = to\n\n # prepare data \n charts_data[:project_hours] = groups_total_hours(project.records, from, to, 30) \n\n ### chart tasks span ###\n\n # time period\n from = project.created_at.to_date\n to = project.due_at.to_date + 1.week\n charts_data[:tasks_span_from] = from \n charts_data[:tasks_span_to] = to\n\n # prepare data \n tasks_span = []\n tasks = project.tasks\n tasks.each do |task|\n records = task.records\n #\n # task expected time span from task creation to due\n # task practical time span from first record creation to last record creation\n #\n tasks_span << {task: 'Task '+(task.tag+1).to_s, create: task.created_at.to_date, due: task.due_at.to_date,\n start: records.minimum(\"created_at\").to_date, finish: records.maximum(\"created_at\").to_date}\n end\n\n # add extra data for the whole project\n records = project.records\n tasks_span.unshift({task: 'Project', create: project.created_at.to_date, due: project.due_at.to_date,\n start: records.minimum(\"created_at\").to_date, finish: records.maximum(\"created_at\").to_date})\n\n charts_data[:tasks_span] = tasks_span\n\n ### chart tasks hours ###\n\n # prepare data \n tasks_hours = []\n #\n # at least one task has to be specified on the project creation\n #\n tasks = project.tasks\n tasks.each do |task|\n tasks_hours << {task: task.name, total_hours: task.records.sum(\"hours\")}\n end\n charts_data[:tasks_hours] = tasks_hours\n\n ### chart tasks submission ###\n\n # time period\n from = project.created_at.to_date\n to = project.due_at.to_date + 1.week\n charts_data[:tasks_submission_from] = from \n charts_data[:tasks_submission_to] = to\n\n # prepare data \n tasks_submission = []\n #\n # at least one task has to be specified on the project creation\n #\n tasks = project.tasks\n tasks.each do |task|\n # records (submitted by all team members) are grouped with task\n records = task.records.where(\"records.created_at >= ?\", from)\n records.each do |record|\n tasks_submission << {task: task.name, date: record.created_at.to_date, \n time: record.created_at.strftime(\"%H-%M-%S\"), hours: record.hours}\n end\n end\n charts_data[:tasks_submission] = tasks_submission\n\n charts_data.to_json\n end", "def index\n @blogs = Blog.all.joins(:payment)\n @blogs = @blogs.joins(:category).order(created_at: :desc).page(params[:page]).per(PRE)\n @blog = Blog.new\n\n # (...データベースからのデータ取得処理...)\n # ダミーのデータを用意\n months = Category.pluck(:name)\n product_A_sales = [ 1000, 12000, 13000,\n 1400, 12000, 50000 ]\n # グラフ(チャート)を作成 \n @chart = LazyHighCharts::HighChart.new(\"graph\") do |c|\n c.title(text: \"支出内訳\")\n c.xAxis(categories: months)\n c.yAxis(min:0,title: {text: '円'})\n c.tooltip(valueSuffix: 'millions')\n c.series(name: \"A\", data: product_A_sales)\n # c.series({name: \"A\", y: 1000,name: \"B\", y: 1000})\n c.chart(type: \"bar\")\n end\n end", "def chart_data\n # date_from = (params[:q].nil? or params[:q][:issue_date_gteq].empty?) ? 30.days.ago.to_date : Date.parse(params[:q][:issue_date_gteq])\n # date_to = (params[:q].nil? or params[:q][:issue_date_lteq].empty?) ? Date.current : Date.parse(params[:q][:issue_date_lteq])\n\n # scope = @search.result\n # scope = scope.tagged_with(params[:tags].split(/\\s*,\\s*/)) if params[:tags].present?\n # scope = scope.select('issue_date, sum(gross_amount) as total').where(active: true).group('issue_date')\n\n # build all keys with 0 values for all\n @date_totals = {}\n\n # (date_from..date_to).each do |day|\n # @date_totals[day.to_formatted_s(:db)] = 0\n # end\n\n # scope.each do |inv|\n # @date_totals[inv.issue_date.to_formatted_s(:db)] = inv.total\n # end\n\n render\n end", "def index\n billing_logs = Atmosphere::BillingLog.last_year\n\n @user = Atmosphere::User.find params[:user_id] if params[:user_id]\n billing_logs = billing_logs.where(user: @user) if @user\n\n billing_logs = billing_logs.sum_currency_by_month\n billing_logs = billing_logs.group_by { |x| x[0][0] }\n\n @data_series =\n if billing_logs.present?\n billing_logs.map do |bl_currency|\n {\n name: bl_currency.first,\n data: Atmosphere::BillingLog.month_data_series(bl_currency.second)\n }\n end\n else\n [{\n name: 'No consumption',\n data: [0] * 12\n }]\n end.to_json\n\n render partial: 'atmosphere/admin/funds/billing', format: :html\n end", "def calc_graph_labels_and_series_data\n # Index as we are going to increment \n # it for every iteration\n index_date = @range[:start_date]\n\n (index_date..@range[:end_date]).each do |idate|\n count = impressions\n .where(created_at: ((idate.at_beginning_of_day)..(idate.end_of_day)))\n .length\n @views.push(count)\n @dates.push(idate)\n index_date = index_date + 1.day\n end\n end", "def index\n @rescue_time_charts = RescueTimeChart.all\n end", "def get_years_to_date_collection\n (get_system_asset_starting_year..Date.today.year).to_a\n end", "def last_year_portfolio_performance\n last_year_performance_all_stocks = self.purchased_stocks.reduce([]) do |result, stock|\n result << stock.last_years_performance\n end\n sum_for_each_month(last_year_performance_all_stocks)\n end", "def list\n @multi_year_charts = user_multi_year_charts\n .kept\n .includes(:user)\n .order('created_at DESC')\n .page(params[:page])\n .per(50)\n\n respond_to do |format|\n format.html {render :layout => 'application'}\n end\n end", "def refresh_charts\n if @chart_items.empty?\n @FXMLChart.visible = false\n return\n end\n\n ends = Time.now.to_i * 1000\n starts = ends - @chosen_range\n the_chart = @FXMLChart\n the_chart.visible = true\n\n series_array = []\n\n @chart_items.each do |metric|\n series = xy_chart_series(name: metric.name)\n\n if metric.type == 'SYNTHETIC'\n # metric is a hawkular inventory Metric object\n\n data = compute metric, starts, ends\n\n else\n\n # if there is a metric-id property, use that as the ID, otherwise, use the instance ID itself\n id = \"#{metric.properties['hawkular-metric-id']}\"\n if id.to_s == ''\n puts 'Assuming the metric ID is the same as the inventory ID'\n id = metric.id\n end\n puts \"Using ID [#{id}] for metric [#{metric.name}]\"\n\n ep = ::HawkHelper.metric_endpoint metric\n data = ep.get_data id, buckets: 120, ends: ends, starts: starts\n h_metric_def = ep.get id\n\n puts \"Metric [#{id}] tags: #{h_metric_def.tags}\"\n end\n\n # if our data has holes, check if it is only the first one\n # and if so copy its value from the 2nd\n if data[0]['empty'] && !data[1]['empty']\n previous_value = data[1]['max']\n else\n previous_value = 0\n end\n\n\n data.each do |item|\n next if item.nil?\n\n # If the item is empty, just use the previous value\n # This can happen when there are more buckets than\n # raw data items for a time span (e.g. bucket is 30s long)\n # but we collect only every minute\n # Or when 7 days of data is requested and only 1 is recorded\n if item['empty']\n item['max'] = previous_value\n else\n previous_value = item['max']\n end\n\n\n ts = item['start'] / 1000 # buckets -> start || timestamp for raw\n time = Time.at(ts).to_s\n val = item['max'] # buckets -> avg(?) || value for raw\n series.data.add xy_chart_data time, val\n end\n\n series_array << series\n end\n\n the_chart.data.setAll series_array\n end", "def optimize_chart(data)\n scale = data.count / OPTIMAL_CHART_POINTS\n return data unless scale >= 2\n\n data.each_slice(scale).map do |slice|\n [\n # average time between first and last positions of slice\n slice.first.first + ((slice.last.first - slice.first.first).to_f / 2),\n (slice.map(&:last).sum / slice.count)\n ]\n end\n end", "def load_data_insight_range_months(num_of_month)\n type = num_of_month == Settings.insights.range_year ? 'year' : 'month'\n range_months = (0..(num_of_month - 1)).to_a.reverse\n month_labels = range_months.reduce([]){ |a, e| a << (day_insight_data - e.months).strftime(\"%m月\") }\n gon.push({\n \"current_year_data_#{type}\" => all_data_in_range_months(range_months),\n \"last_year_data_#{type}\" => all_data_in_range_months(range_months, true),\n \"month_labels_#{type}\" => month_labels\n })\n end", "def all\n @charts\n end", "def stats_records_by_year(*args)\n records = stats_records_by_hour(*args)\n slice_stats(records, 0, 4)\n end", "def index\n @schedules = Schedule.where(user_id: current_user).ongoing\n gon.arr_for_chart = my_chart(@schedules)\n end", "def getchart()\n # Some ChartDirector built-in symbols\n symbols = [ChartDirector::CircleShape, ChartDirector::GlassSphereShape,\n ChartDirector::GlassSphere2Shape, ChartDirector::SolidSphereShape,\n ChartDirector::SquareShape, ChartDirector::DiamondShape,\n ChartDirector::TriangleShape, ChartDirector::RightTriangleShape,\n ChartDirector::LeftTriangleShape, ChartDirector::InvertedTriangleShape,\n ChartDirector::StarShape(3), ChartDirector::StarShape(4),\n ChartDirector::StarShape(5), ChartDirector::StarShape(6),\n ChartDirector::StarShape(7), ChartDirector::StarShape(8),\n ChartDirector::StarShape(9), ChartDirector::StarShape(10),\n ChartDirector::PolygonShape(5), ChartDirector::Polygon2Shape(5),\n ChartDirector::PolygonShape(6), ChartDirector::Polygon2Shape(6),\n ChartDirector::CrossShape(0.1), ChartDirector::CrossShape(0.2),\n ChartDirector::CrossShape(0.3), ChartDirector::CrossShape(0.4),\n ChartDirector::CrossShape(0.5), ChartDirector::CrossShape(0.6),\n ChartDirector::CrossShape(0.7), ChartDirector::Cross2Shape(0.1),\n ChartDirector::Cross2Shape(0.2), ChartDirector::Cross2Shape(0.3),\n ChartDirector::Cross2Shape(0.4), ChartDirector::Cross2Shape(0.5),\n ChartDirector::Cross2Shape(0.6), ChartDirector::Cross2Shape(0.7)]\n\n # Create a XYChart object of size 450 x 400 pixels\n c = ChartDirector::XYChart.new(450, 400)\n\n # Set the plotarea at (55, 40) and of size 350 x 300 pixels, with a light grey\n # border (0xc0c0c0). Turn on both horizontal and vertical grid lines with light\n # grey color (0xc0c0c0)\n c.setPlotArea(55, 40, 350, 300, -1, -1, 0xc0c0c0, 0xc0c0c0, -1)\n\n # Add a title to the chart using 18 pts Times Bold Itatic font.\n c.addTitle(\"Built-in Symbols\", \"timesbi.ttf\", 18)\n\n # Set the axes line width to 3 pixels\n c.xAxis().setWidth(3)\n c.yAxis().setWidth(3)\n\n # Ensure the ticks are at least 1 unit part (integer ticks)\n c.xAxis().setMinTickInc(1)\n c.yAxis().setMinTickInc(1)\n\n # Add each symbol as a separate scatter layer.\n 0.upto(symbols.length - 1) do |i|\n c.addScatterLayer([i % 6 + 1], [(i / 6 + 1).to_i], \"\", symbols[i], 15)\n end\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def yaxis\n end", "def getchart()\n # The tasks for the gantt chart\n labels = [\"Market Research\", \"Define Specifications\", \"Overall Archiecture\",\n \"Project Planning\", \"Detail Design\", \"Software Development\", \"Test Plan\",\n \"Testing and QA\", \"User Documentation\"]\n\n # The task index, start date, end date and color for each bar\n taskNo = [0, 0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 8]\n startDate = [Time.mktime(2004, 8, 16), Time.mktime(2004, 10, 4), Time.mktime(2004,\n 8, 30), Time.mktime(2004, 9, 13), Time.mktime(2004, 9, 20), Time.mktime(2004,\n 9, 27), Time.mktime(2004, 10, 4), Time.mktime(2004, 10, 4), Time.mktime(2004,\n 10, 25), Time.mktime(2004, 11, 1), Time.mktime(2004, 10, 18), Time.mktime(\n 2004, 11, 8)]\n endDate = [Time.mktime(2004, 8, 30), Time.mktime(2004, 10, 18), Time.mktime(2004,\n 9, 13), Time.mktime(2004, 9, 27), Time.mktime(2004, 10, 4), Time.mktime(2004,\n 10, 11), Time.mktime(2004, 11, 8), Time.mktime(2004, 10, 18), Time.mktime(\n 2004, 11, 8), Time.mktime(2004, 11, 22), Time.mktime(2004, 11, 1),\n Time.mktime(2004, 11, 22)]\n colors = [0x00cc00, 0x00cc00, 0x00cc00, 0x0000cc, 0x0000cc, 0xcc0000, 0xcc0000,\n 0x0000cc, 0xcc0000, 0xcc0000, 0x00cc00, 0xcc0000]\n\n # Create a XYChart object of size 620 x 325 pixels. Set background color to light\n # red (0xffcccc), with 1 pixel 3D border effect.\n c = ChartDirector::XYChart.new(620, 325, 0xffcccc, 0x000000, 1)\n\n # Add a title to the chart using 15 points Times Bold Itatic font, with white\n # (ffffff) text on a dark red (800000) background\n c.addTitle(\"Mutli-Color Gantt Chart Demo\", \"timesbi.ttf\", 15, 0xffffff\n ).setBackground(0x800000)\n\n # Set the plotarea at (140, 55) and of size 460 x 200 pixels. Use alternative\n # white/grey background. Enable both horizontal and vertical grids by setting\n # their colors to grey (c0c0c0). Set vertical major grid (represents month\n # boundaries) 2 pixels in width\n c.setPlotArea(140, 55, 460, 200, 0xffffff, 0xeeeeee, ChartDirector::LineColor,\n 0xc0c0c0, 0xc0c0c0).setGridWidth(2, 1, 1, 1)\n\n # swap the x and y axes to create a horziontal box-whisker chart\n c.swapXY()\n\n # Set the y-axis scale to be date scale from Aug 16, 2004 to Nov 22, 2004, with\n # ticks every 7 days (1 week)\n c.yAxis().setDateScale(Time.mktime(2004, 8, 16), Time.mktime(2004, 11, 22),\n 86400 * 7)\n\n # Set multi-style axis label formatting. Month labels are in Arial Bold font in\n # \"mmm d\" format. Weekly labels just show the day of month and use minor tick (by\n # using '-' as first character of format string).\n c.yAxis().setMultiFormat(ChartDirector::StartOfMonthFilter(),\n \"<*font=arialbd.ttf*>{value|mmm d}\", ChartDirector::StartOfDayFilter(),\n \"-{value|d}\")\n\n # Set the y-axis to shown on the top (right + swapXY = top)\n c.setYAxisOnRight()\n\n # Set the labels on the x axis\n c.xAxis().setLabels(labels)\n\n # Reverse the x-axis scale so that it points downwards.\n c.xAxis().setReverse()\n\n # Set the horizontal ticks and grid lines to be between the bars\n c.xAxis().setTickOffset(0.5)\n\n # Add some symbols to the chart to represent milestones. The symbols are added\n # using scatter layers. We need to specify the task index, date, name, symbol\n # shape, size and color.\n c.addScatterLayer([1], [Time.mktime(2004, 9, 13)], \"Milestone 1\",\n ChartDirector::Cross2Shape(), 13, 0xffff00)\n c.addScatterLayer([3], [Time.mktime(2004, 10, 4)], \"Milestone 2\",\n ChartDirector::StarShape(5), 15, 0xff00ff)\n c.addScatterLayer([5], [Time.mktime(2004, 11, 8)], \"Milestone 3\",\n ChartDirector::TriangleSymbol, 13, 0xff9933)\n\n # Add a multi-color box-whisker layer to represent the gantt bars\n layer = c.addBoxWhiskerLayer2(startDate, endDate, nil, nil, nil, colors)\n layer.setXData(taskNo)\n layer.setBorderColor(ChartDirector::SameAsMainColor)\n\n # Divide the plot area height ( = 200 in this chart) by the number of tasks to get\n # the height of each slot. Use 80% of that as the bar height.\n layer.setDataWidth((200 * 4 / 5 / (labels.length)).to_i)\n\n # Add a legend box at (140, 265) - bottom of the plot area. Use 8 pts Arial Bold\n # as the font with auto-grid layout. Set the width to the same width as the plot\n # area. Set the backgorund to grey (dddddd).\n legendBox = c.addLegend2(140, 265, ChartDirector::AutoGrid, \"arialbd.ttf\", 8)\n legendBox.setWidth(461)\n legendBox.setBackground(0xdddddd)\n\n # The keys for the scatter layers (milestone symbols) will automatically be added\n # to the legend box. We just need to add keys to show the meanings of the bar\n # colors.\n legendBox.addKey(\"Market Team\", 0x00cc00)\n legendBox.addKey(\"Planning Team\", 0x0000cc)\n legendBox.addKey(\"Development Team\", 0xcc0000)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "def set_gold_chart\n @chart = [[0, 2], [0, 3], [0, 4], [0, 5], [3, 3], [5, 0], [10, 0]]\n end", "def gen_response_version_graph(rating_history, question_used_as_title)\n \n # TODO: sanity check\n \n # based on this example - http://teethgrinder.co.uk/open-flash-chart-2/data-lines-2.php\n # and parts from this example - http://teethgrinder.co.uk/open-flash-chart-2/x-axis-labels-3.php\n title = Title.new(\"#{question_used_as_title}\")\n \n data1 = []\n \n rating_history.keys.sort.each do | item | \n data1 << rating_history[\"#{item}\"]\n end\n \n logger.debug \" /////////////// #{data1.join(\",\")} ///////....\"\n \n line_dot = LineDot.new\n line_dot.width = 4\n line_dot.colour = '#DFC329'\n line_dot.dot_size = 5\n line_dot.values = data1\n\n # Added these lines since the previous tutorial\n tmp = []\n x_labels = XAxisLabels.new\n x_labels.set_vertical()\n rating_history.keys.sort.each do |text|\n tmp << XAxisLabel.new(text, '#0000ff', 10, 'diagonal')\n end\n x_labels.labels = tmp\n\n x = XAxis.new\n x.set_labels(x_labels)\n y = YAxis.new\n y.set_range(0,10,1)\n \n x_legend = XLegend.new(\"2010 Monthly\")\n x_legend.set_style('{font-size: 20px; color: #778877}')\n y_legend = YLegend.new(\"Monthly Average Rating\")\n y_legend.set_style('{font-size: 20px; color: #770077}')\n\n chart =OpenFlashChart.new\n chart.set_title(title)\n chart.set_x_legend(x_legend)\n chart.set_y_legend(y_legend)\n chart.x_axis = x # Added this line since the previous tutorial\n chart.y_axis = y\n\n chart.add_element(line_dot)\n \n return chart\n end", "def user_count_by_month(type)\n result = Hash.new(0)\n time = type\n title_graph = ''\n x_axsis = ''\n case time\n when 'month'\n users = @users.where(:created_at => Time.now.beginning_of_month..Time.now.end_of_month)\n users.group_by{ |m| m.created_at.beginning_of_day}.each do |key, value|\n aux = key.to_s.split('-')\n result[\"#{aux[2].split(' ')[0]}-#{aux[1]}-#{aux[0]}\"] = value.count\n end\n title_graph = 'Usuarios nuevos durante el ultimo mes'\n x_axsis = 'Días'\n when 'year'\n users = @users.where(:created_at => Time.now.beginning_of_year..Time.now.end_of_year)\n users.group_by{ |m| m.created_at.beginning_of_month }.each do |key, value|\n aux = key.to_s.split('-')\n result[\"#{aux[1]}-#{aux[0]}\"] = value.count\n end\n title_graph = 'Usuarios nuevos durante el ultimo año'\n x_axsis = 'Meses'\n else\n users = @users\n users.group_by{ |m| m.created_at.beginning_of_year}.each do |key, value|\n aux = key.to_s.split('-')\n result[\"#{aux[0]}\"] = value.count\n end\n title_graph = 'Usuarios nuevos durante los años'\n x_axsis = 'Años'\n end\n line_chart result.sort, height: '80%', width: '95%', colors: [\"#FFD586\"],\n library: {\n chart: {\n borderColor: '#aaa', borderWidth: 2, type: 'line',backgroundColor: '#FEFEFA',\n style: {\n fontFamily: 'Helvetica Neue'\n }\n },\n title: {\n text: title_graph,\n style: {\n fontWeight: 'bold', fontSize: '14px'\n }\n },\n yAxis: {\n allowDecimals: false,\n title: {\n text: 'Usuarios'\n }\n },\n xAxis: {\n title: {\n text: x_axsis\n }\n }\n }\n end", "def stacked_graph(matches_played, graph_title, filename)\n hash_for_labels = {}\n hash_of_teams = Hash.new { |hash, key| hash[key] = [] }\n matches_played.each_with_index do |(year, _key), idx|\n hash_for_labels[idx] = year\n matches_played[year].each do |team, num|\n hash_of_teams[team].push(num)\n end\n end\n graph = Gruff::StackedBar.new\n graph.title = graph_title\n graph.bar_spacing = 0.5\n\n hash_of_teams.each do |team, matches|\n graph.data(team, matches)\n end\n\n graph.labels = hash_for_labels\n graph.write(filename)\nend", "def index\n @chart = LampStat.where(serial_num: @lamp.product.serial_number)\n .where(date: 7.days.ago..DateTime.now)\n .order(:date)\n\n @list = @chart.reverse_order\n end", "def year_ranking\n ranked_albums = SortCollection.sort_albums('year')\n render json: ranked_albums.sort_by(&:last).reverse[0...5].to_h, status: 200\n end", "def data y_values\n super(Array.new(y_values.to_a.size) { |i| i }, y_values.to_a)\n end" ]
[ "0.64036924", "0.6374439", "0.6243383", "0.62304205", "0.61026794", "0.60294443", "0.5888575", "0.58581614", "0.57543343", "0.5751292", "0.571961", "0.5706173", "0.5690917", "0.5660797", "0.5650061", "0.563823", "0.55949", "0.55937713", "0.55884516", "0.5571072", "0.55633646", "0.5557173", "0.5533552", "0.552164", "0.5503659", "0.5494554", "0.5485983", "0.54765326", "0.54559875", "0.5452781", "0.54490596", "0.5441156", "0.54284376", "0.5422794", "0.54191905", "0.5394693", "0.53307664", "0.53290147", "0.5325381", "0.5324875", "0.5323559", "0.53189284", "0.5315001", "0.5309797", "0.5306136", "0.53060025", "0.5297788", "0.5277629", "0.52566415", "0.5256239", "0.5251434", "0.524699", "0.5237417", "0.52372414", "0.52231103", "0.5222889", "0.5222337", "0.5221623", "0.5206083", "0.52028763", "0.5200497", "0.51965266", "0.5194077", "0.5193768", "0.5183889", "0.5179384", "0.5176096", "0.5174783", "0.51628965", "0.5161434", "0.5160401", "0.51588756", "0.5153671", "0.5144515", "0.51395434", "0.5128554", "0.51163936", "0.5116255", "0.51098424", "0.5108597", "0.5106336", "0.50932044", "0.50884765", "0.5086713", "0.5083996", "0.50751597", "0.5073974", "0.50696826", "0.50662357", "0.50574285", "0.5057353", "0.50573057", "0.50529593", "0.5039308", "0.5038969", "0.50329375", "0.5029458", "0.50230455", "0.5020032", "0.50191057" ]
0.7856646
0
returns an array of [year, times_played] for the year with the highest of occurrences
def calculate_most_common_year self.calculate_plays_by_year.sort_by{ |year, times_played| times_played }.last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_least_common_year\n self.calculate_plays_by_year.select{ |year,times_played| times_played > 0 }.sort_by{ |year, times_played| times_played }.first\n end", "def most_popular_group_per_year\n sql = <<-SQL\n WITH mp AS (\n SELECT show_year,\n guest_group,\n COUNT(id) as group_count\n FROM guest_appearances\n GROUP BY guest_group, show_year)\n SELECT show_year, guest_group, MAX(group_count) as frequency\n FROM mp\n GROUP BY show_year;\n SQL\n DB[:conn].execute(sql).each {|record| puts \"#{record[0]}: #{record[1]}, #{record[2]}.\"}\nend", "def year_with_maximum_population(data)\n memo = {}\n\n data.each do |p1|\n current_birth_year = p1[0]\n next if memo[current_birth_year]\n\n count = 0\n # Person is alive in that year if they were born before the current year\n # and they died after the current year\n data.each do |p2|\n if p2[0] <= current_birth_year && current_birth_year <= p2[1]\n count +=1\n end\n end\n\n memo[current_birth_year] = count\n end\n\n year_of_max = nil\n current_population = 0\n memo.each do |k, v|\n if v > current_population\n current_population = v\n year_of_max = k\n end\n end\n\n year_of_max\nend", "def season_with_most_games\n seasons = @games.group_by { |game| game.season }\n seasons.max_by { |season, games| games.count }.first\n end", "def year_with_maximum_population(data)\n # Get a calenader with unique years\n calendar = data.flatten.uniq.sort\n delta_memo = Hash.new(0)\n\n # Save the delta for each year\n data.each_with_index do |person, i|\n delta_memo[person[0]] += 1\n delta_memo[person[1]] -= 1\n end\n\n # Associate calendar year with delta\n calendar.each_with_index do |year, i|\n calendar[i] = [year, delta_memo[year]]\n end\n\n max_pop_year = calendar[0][0]\n current_population = 0\n max_population = 0\n\n # Running sum of max population\n # Set year on max_population\n calendar.each do |year|\n current_population += year[1]\n\n if current_population > max_population\n max_population = current_population\n max_pop_year = year[0]\n end\n end\n\n max_pop_year\nend", "def most_popular_profession_per_year\n sql = <<-SQL\n WITH mp AS (\n SELECT show_year,\n guest_occupation,\n \tCOUNT(id) as occupation_count\n FROM guest_appearances\n GROUP BY guest_occupation, show_year)\n SELECT show_year, guest_occupation, MAX(occupation_count) as frequency\n FROM mp\n GROUP BY show_year;\n SQL\n DB[:conn].execute(sql).each {|record| puts \"#{record[0]}: #{record[1]}, #{record[2]}.\"}\nend", "def find_most_played_songs\n top_songs_with_play_count_pair = self.lib.songs.reject do |song|\n #this line is describing records it will get rid of\n (!song.metadata.has_key?('play_count')) or (song.metadata['play_count'] == nil)\n end\n\n top_songs_played_sorted = top_songs_with_play_count_pair.sort do |a, b| \n b.metadata['play_count'].to_i <=> a.metadata['play_count'].to_i\n end\n\n top_songs_played = top_songs_played_sorted.first(5)\n song_names_of_top_played = top_songs_played.collect {|song| song.metadata['name']} \n end", "def best_movie(array)\n #variable movie gross will be a new array of all the gross for all the movies\n best_gross = array.map {|movie|\n #converting movie gross into an integer\n movie[:gross].delete('$').split(',').join.to_i\n }\n #variable awesome movie is taking the new array of movie gross and looking for the max grossing movie\n awesome_movie = best_gross.max\n # the highest grossing bond variable is a new array filtering for movies that gross only matches the awesome movie gross\n highest_grossing_bond = array.select {|movie| movie[:gross].delete('$').split(',').join.to_i == awesome_movie}\n # this outputs the array with the has of the worst grossing bond movie\n puts highest_grossing_bond\nend", "def puppy_golden_age(years_array)\n golden_index = []\n for idx in 0...years_array.length\n if years_array[idx].to_i > years_array[idx+1].to_i\n golden_index.push(idx) #Creates an array with index with greatest years between 2 consecutive years\n end\n end\n [golden_index[0], golden_index[(golden_index.length - 1)]]\n end", "def year_with_most_guests\n sql = <<-SQL\n SELECT year FROM guests GROUP BY year\n ORDER BY count(*) DESC LIMIT 1;\n SQL\n DB[:conn].execute(sql)[0][0]\nend", "def sorting(array)\n #variable sorted by release is equal to the array movie data and sorting it by the year of earliest to now\n sorted_by_release = array.sort_by {|year| year[:year]}\n #outputs the array list sorted by release\n puts sorted_by_release\nend", "def yearly_play_chart_data\n self.yearly_play_data.map do |year, times_played|\n {name: year, plays: times_played}\n end\n end", "def highest_player_score\n players.max_by{|player| player.score}.score\n end", "def most_successfull(nth, year, file)\n filepath = File.dirname(__FILE__) + file\n csv_options = {col_sep:',',quote_char:'\"', encoding: \"ISO8859-1\"}\n\n films = []\n date = CSV.foreach(filepath, csv_options) do |row|\n films << { name: row[0], year: row[1].to_i, earnings: row[2].to_i }\n end\n\n\n films_before_year = films.select { |film| film[:year] < year }\n film_before_year_best_sales = films_before_year.sort_by { |film| - film[:earnings]}\n film_most_successfull = film_before_year_best_sales.take(nth)\nend", "def biggest_bust(seasonasstring)\n #get all teams in data\n #find all games played by team in season - given by arg\n #get subset of 95 where p is in season marker\n #count games won in subset on 95 / total games in subset on 95\n #get subset of 85 where r is in season marker\n #count games won in subset on 98 / total games in subset on 98\n #result of line 97 - line 99\n #find highest number\n #return team name of result of line 101\n end", "def most_hits(seasonasstring) # shots in game team stats\n #get a list of all teams that played in that season\n #use above list to sum all shots across all games in season\n #find highest across list\n #return team name as found in 139\n end", "def year_with_most_guests\n sql = <<-SQL\n SELECT show_year, count(id) AS guest_count\n FROM guest_appearances\n GROUP BY show_year\n ORDER BY guest_count DESC\n LIMIT 1;\n SQL\n mg = DB[:conn].execute(sql)[0]\n puts \"#{mg[0]}: #{mg[1]} guests.\"\nend", "def heaviest_rock(rock_array)\n max_rock = 0\n\n rocks.each do |rock|\n max_rock = rock if max_rock < rock \n end\nend", "def most_popular_group_per_year\n sql = <<-SQL\n -- SELECT year, category FROM guests GROUP BY year, category ORDER BY count(category), year DESC\n SELECT DISTINCT year, category, count(category) FROM guests GROUP BY year, category ORDER BY count(category) DESC\n SQL\n DB[:conn].execute(sql)\nend", "def appears_most_times(array)\n hash = {}\n max = 0\n key_max = array[0]\n array.each do |num|\n if hash[num].nil?\n hash[num] = 1\n else\n hash[num] += 1\n end\n if hash[num] > max\n max = hash[num]\n key_max = num\n end\n end\n key_max\nend", "def calculate_line_with_highest_frequency()\n maximo = @analyzers.max_by(&:highest_wf_count)\n @highest_count_across_lines = maximo.highest_wf_count\n @highest_count_words_across_lines = []\n @analyzers.each do |linha|\n if linha.highest_wf_count == @highest_count_across_lines\n @highest_count_words_across_lines << linha\n end\n end\n #puts \"maximo dos maximos: #{@highest_count_across_lines}#{highest_count_words_across_lines.flatten}\"\n #@highest_count_words_across_lines = Array.new\n #@analyzers.each do |analyzed| \n # @highest_count_words_across_lines << analyzed.highest_wf_words\n #end\n end", "def highest_word_score\n Scrabble::Scoring.score(Scrabble::Scoring.highest_score_from(@plays_array))\n end", "def highest_score_from(words) \n all_scores = []\n\n words.each do |word|\n score = score_word(word)\n all_scores << {:word => word, :score => score}\n end\n \n highest_score = all_scores.max_by{|word_with_score| word_with_score[:score]}\n p \"This is one max score: #{highest_score}\"\n \n all_highscores = all_scores.select{|word_with_score| word_with_score[:score] == highest_score[:score]}\n puts \"This is ALL the words that match high score: #{all_highscores}\"\n \n tied_words = []\n all_highscores.each do |hash|\n tied_words << hash[:word]\n end\n\n winning_word = break_ties(tied_words)\n\n puts \"This is our winning word: #{winning_word}\"\n return {:word => winning_word, :score => (highest_score[:score])}\nend", "def most_popular_time(sign_up_times)\n hash = sign_up_times.each_with_object(Hash.new(0)) do |time, new_hash|\n new_hash[time] += 1\n end\n\n hash.max_by{|key, value| value}[0]\nend", "def highest_scoring_visitor\n @teams.max_by { |team| team.average_away_goals }.team_name\n end", "def max_scores\n next_boards.map(&:max_score)\n end", "def mostSteals\n players.max_by do|name, stats|\n stats[:steals]\n end\nend", "def popular_group_by_year\n sql = <<-SQL\n SELECT year, guest_group, MAX(num)\n FROM (\n SELECT year, guest_group, COUNT(*) AS num\n FROM guests\n GROUP BY year, guest_group\n )\n GROUP BY year;\n SQL\n DB[:conn].execute(sql)\nend", "def biggest_surprise(season)\n season = season.to_i\n @teams.max_by{ |team| team.preseason_to_regular_increase[season] }.team_name\n end", "def highest_scoring_word\n Scrabble::Scoring.highest_score_from(@plays_array)\n end", "def sort_by_year(array)\n array.sort! { |a, b| a.year <=> b.year }\n end", "def answer(unsorted_scores, highest_possible_score)\n score_counts = [0] * (highest_possible_score + 1) # array of 0's at indices 0..highest_possible_score\n unsorted_scores.each { |score| score_counts[score] += 1 } # populate score_counts\n sorted_scores = [] # populate the final sorted_scores\n highest_possible_score.downto(0) do |score|\n count = score_counts[score]\n (0...count).each { |time| sorted_scores << score }\n end\n return sorted_scores\nend", "def popular_profession_by_year\n sql = <<-SQL\n SELECT year, google_knowledge_occupation, MAX(num)\n FROM (\n SELECT year, google_knowledge_occupation, COUNT(*) AS num\n FROM guests\n GROUP BY year, google_knowledge_occupation\n )\n GROUP BY year;\n SQL\n DB[:conn].execute(sql)\nend", "def popularity_list\r\n\t\tif @mov_pop_ar_hs.nil?\r\n\t\t\tputs \"data has not been loaded\"\r\n\t\t\treturn[]\r\n\t\telse\r\n\t\t\tmovie_avg_pop={}\r\n\t\t\tcount = 0\r\n\t\t\twhile count < @mov_pop_ar_hs.length\r\n\t\t\t\tmovie_avg_pop[count]=popularity(count)\r\n\t\t\t\tcount = count + 1\r\n\t\t\tend\r\n\t\t\t#sort from highest to lowest\r\n\r\n\t\t\treturn movie_avg_pop.sort_by {|movie, pop| pop}.reverse\r\n\t\tend\r\n\tend", "def calculate_line_with_highest_frequency()\n @highest_count_across_lines = 0\n @highest_count_words_across_lines = []\n for line in @@analyzers\n if line.highest_wf_count >= @highest_count_across_lines\n\n @highest_count_across_lines = line.highest_wf_count\n @highest_count_words_across_lines.push(line)\n \n end\n \n end\n end", "def sort_scores(unsorted_scores, highest_possible_score)\n\n # array of 0s at indices 0..highest_possible_score\n score_counts = [0] * (highest_possible_score+1)\n\n # populate score_counts\n unsorted_scores.each do |score|\n score_counts[score] += 1\n end\n\n # populate the final sorted array\n sorted_scores = []\n\n # for each item in score_counts\n score_counts.each_with_index do |count, score|\n\n # for the number of times the item occurs\n (0...count).each do |time|\n\n # add it to the sorted array\n sorted_scores.push(score)\n end\n end\n\n return sorted_scores\nend", "def date_highest_income_method(rides_array)\n rides_array.max_by { |ride_hash| ride_hash[:cost] }[:date]\nend", "def highest_score\n sort\n all.first.score\n end", "def high_score\n if self.end_date < Date.today\n self.teams.max_by { |team| team.score }.score\n end\n end", "def highestfrequency\r\n #@counts.group_by { |x| x }.map { |element, matches| [ element, matches ] }.to_h\r\n #@counts.each_with_object({}) { |item, memo| memo[item] ||= 0; memo[item] += 1 }\r\n ##@counts.uniq.map { |x| [x, @counts.count(x)] }.to_h\r\n #freq = @counts.inject(Hash.new(0)) { |h,v| h[v] += 1; h }\r\n @counts.max_by { |k,v| v }\r\n end", "def mode (array) \n# creates a hash(tracker) with items as keys and frequencies as values\n tracker = {} \n array.each do |x| \n if tracker.has_key?(x) \n tracker[x] += 1\n else\n tracker[x] = 1\n end \n end \n# finds the highest value (frequency)\n final_values = tracker.values\n highest = 0 \n final_values.each do |x|\n if x > highest\n highest = x\n end \n end\n# adds each key (item) with the highest value to the output array\n output = []\n tracker.each do |key, value|\n if value == highest\n output << key\n end\n end\n return output\nend", "def get_largest_freq(freq_arr)\n\tlargest = freq_arr[0][\"value\"]\n\tfor freq in freq_arr\n\t\tif freq[\"value\"] > largest\n\t\t\tlargest = freq[\"value\"]\n\t\tend\n\tend\n\treturn largest.to_s\nend", "def most_popular_profession_by_year\n sql = <<-SQL\n SELECT year, occupation FROM guests GROUP BY year, occupation ORDER BY count(occupation) DESC\n SQL\n DB[:conn].execute(sql)\nend", "def calculate_line_with_highest_frequency\n @highest_count_across_lines = @analyzers.max_by(&:highest_wf_count).highest_wf_count\n @highest_count_words_across_lines = []\n @analyzers.each do |word|\n @highest_count_words_across_lines << word if word.highest_wf_count == @highest_count_across_lines\n end\n end", "def ordered_year_count\n \tFishCount.for_year(Date.today.year).order(count_date: :desc)\n end", "def sort(unsorted, highest)\n\t# create a hash for each unsorted score\n scores_occurances = {}\n # result array\n sorted_scores = []\n # walk over the unsorted array and add 1 to our hash for each occurance\n unsorted.each do |score| \n \tif(scores_occurances.has_key?(score))\n\t \tscores_occurances[score] += 1\n\t else\n\t \tscores_occurances[score] = 1 \n\t end\n end\n\n (1..highest).each do |int|\n \tif(scores_occurances.has_key?(int))\n scores_occurances[int].times { sorted_scores.push(int) }\n end\n end\n \n sorted_scores\nend", "def teams_with_score_max(a_game)\n teams_with_score_max = {}\n game_teams_with_score_max = a_game.teams_with_score_max(a_game.game_teams)\n game_teams_with_score_max.each do |game_team_with_score_max|\n # find team instance matching game_team instance\n team_with_score_max = @teams[game_team_with_score_max.name.to_sym]\n teams_with_score_max[game_team_with_score_max.name.to_sym] = team_with_score_max\n end\n teams_with_score_max\n end", "def mostPoints\n players.max_by do|name, stats|\n stats[:points]\n end\nend", "def popular_time\n sql = \"SELECT screenings.screen_time FROM screenings\n INNER JOIN tickets ON screenings.id = tickets.screening_id\n WHERE tickets.film_id = $1\"\n values = [@id]\n result = SqlRunner.run(sql,values)\n\n array_of_screen_times = result.map { |row_hash|\n row_hash['screen_time']}\n\n\n screentimes_counts = Hash.new(0)\n for time_str in array_of_screen_times\n screentimes_counts[time_str] += 1\n end\n\n return screentimes_counts.max_by{|k,v| v}[0]\n # frequency_hash = array_of_screen_times.inject(Hash.new(0)) { |h,v| h[v] += 1; h }\n # highest_frequency_pair = frequency_hash.max_by { |v| frequency_hash[v] }\n # return highest_frequency_pair[0]\n end", "def most_points_scored_helper\n point_array = []\n \n game_hash.each do |key, value|\n players = value[:players]\n players.each do |element|\n point_array << element[:point]\n end\n end\n point_array.max\nend", "def mode (array) \n# creates a hash(tracker) with items as keys and frequencies as values\n tracker = {} \n array.each do |x| \n if tracker.has_key?(x) \n tracker[x] += 1\n else\n tracker[x] = 1\n end \n end \n\n# adds each key (item) with the max value to the output array\n output = []\n tracker.each do |key, value|\n if value == tracker.values.max\n output << key\n end\n end\n\n return output\nend", "def highest_score_from(words)\n maximum_score = words.map { |word| score_word(word) }.max\n highest = words.select { |word| score_word(word) == maximum_score }\n if highest.length == 1 \n winning_word = highest.first\n else\n highest_lengths = highest.map {|i| i.length}\n if highest_lengths.any? { |x| x == 10}\n index_of_length_10 = highest_lengths.find_index(10)\n winning_word = highest[index_of_length_10]\n else\n winning_word = highest[highest_lengths.find_index(highest_lengths.min)]\n end \n end\n\n results = Hash.new\n results[:score] = maximum_score\n results[:word] = winning_word \n\n return results\nend", "def biggest_shoe\r\n player_name= []\r\n game_hash.each do |team, data|\r\n data.each do |team_info, value|\r\n if team_info == \"players\".to_sym\r\n obj=value.max_by {|key, value| value[:shoe]}\r\n player_name<< obj.first\r\n end\r\n end\r\n end\r\n player_name.first\r\nend", "def most_popular_venue\n venues = @games.group_by { |game| game.venue}\n venues.max_by { |venue, games| games.count }.first\n end", "def highest_scoring_word\n Scoring.highest_score_from(plays)\n end", "def most_points_scored\n max = nil\n name = nil \n game_hash.each do |team, team_values|\n team_values[:players].each do |player|\n if max == nil || player[:points] > max\n max = player[:points]\n name = player[:player_name]\n end\n end\n end\n name\nend", "def metrics_by_year(program = {})\n metrics = quantity_deliverables(program.deliverables)\n .map(&:metrics)\n .reduce([]) { |array, n| array.concat(n) }\n\n return [] unless metrics.any?\n\n metric_array = []\n year_metrics(metrics).each_pair { |key, value| metric_array << { year: key, metric: value } }\n\n metric_array\n end", "def last_year_portfolio_performance\n last_year_performance_all_stocks = self.purchased_stocks.reduce([]) do |result, stock|\n result << stock.last_years_performance\n end\n sum_for_each_month(last_year_performance_all_stocks)\n end", "def most_points_scored\n big_score_player = player_collection.reduce { |memo, next_player|\n memo[:points] > next_player[:points] ? memo : next_player; \n }\n big_score_player[:player_name];\nend", "def birthdayCakeCandles(ar)\n ar.sort!\n biggest = ar[-1]\n ar.count(biggest)\nend", "def calculate_stats\n # this one gets the anaylyzer\n analyzer_w_most_repeated_word = @analyzers.max_by { |analyzer| analyzer.highest_wf_count }\n #this one gets its highest word count\n @highest_count_across_lines = analyzer_w_most_repeated_word.highest_wf_count\n\n # this one gets all lines that match that highest word count - it will be an array of objects\n # containing one or more objects\n @highest_count_words_across_lines = @analyzers.select { |e| e.highest_wf_count == @highest_count_across_lines }\n\n # return a hash with some useful info\n { top_line: analyzer_w_most_repeated_word, repeat_word_count: @highest_count_across_lines,\n top_line_and_ties: @highest_count_words_across_lines }\n end", "def year_ranking\n ranked_albums = SortCollection.sort_albums('year')\n render json: ranked_albums.sort_by(&:last).reverse[0...5].to_h, status: 200\n end", "def highest_word_score\n \t@scores_array.max\n end", "def birthdayCakeCandles(ar)\n max = ar.max\n count = ar.count{|x| x == max}\nend", "def most_accurate_team(seasonasstring) # shots in game team stats\n #get a list of all teams that played in that season - given by arg\n #use above list to sum all shots across all games in season\n #divide above by goals made across all games in season\n #find highest percentage\n #return team name as found in 127\n end", "def biggest_bust(season)\n season = season.to_i\n @teams.min_by{ |team| team.preseason_to_regular_increase[season] }.team_name\n end", "def artist_years\n self.artists.reduce(0) do |accumulator, artist|\n accumulator += artist.years_active\n end\n end", "def worst_movie(array)\n #variable movie gross will be a new array of all the gross for all the movies\n movie_gross = array.map {|movie|\n #converting movie gross into an integer\n movie[:gross].delete('$').split(',').join.to_i\n }\n #variable bad movie is taking the new array of movie gross and looking for the min grossing movie\n bad_movie = movie_gross.min\n # the worst grossing bond variable is a new array filtering for movies that gross only matches the bad movie gross\n worst_grossing_bond = array.select {|movie| movie[:gross].delete('$').split(',').join.to_i == bad_movie}\n # this outputs the array with the has of the worst grossing bond movie\n puts worst_grossing_bond\nend", "def max\n @raw.max_by(&:score)\n end", "def winningest_team\n @teams.max_by { |team| team.total_win_percentage }.team_name\n end", "def find_highest_earners(input_arr)\n # look through drivers array to find driver hash with greatest\n # total earnings -> apply max_by to the hash of drivers to find\n # the greatest value associated with the [:total_earn] key\n # -> set max_earn_val to the value identified from the returned\n # max_by hash\n max_earn_val = input_arr.max_by { |k| k[:total_earn] }[:total_earn]\n # p max_earn_val\n # handle multiple top earners\n # create an array that selects driver_hash(es) that match the\n # established max earn value\n top_earn_arr = input_arr.select { |k| k[:total_earn] == max_earn_val }\n .map { |h| h[:driver_id] }\n return top_earn_arr\nend", "def buildYearMaxed \n maxYear = data_package.schemas[\"sca_e_projections_by_sd\"][\"maxYear\"]\n\n project.build_year > maxYear ? maxYear : project.build_year\n end", "def biggestShoes\n players.max_by do|name, stats|\n stats[:shoe]\n end\nend", "def most_points_scored\n\tpoints_array = []\n\tgame_hash.each do |location, team_data|\n\t\tteam_data[:players].each do |attribute, data|\t\n\t\t\tdata.each do |type, amount|\n\t\t\t\tif type == :points\n\t\t\t\t\tpoints_array << amount\n\t\t\t\tend \n\t\t\tend\n\t\tend\n\tend\n\tgame_hash.each do |l, data|\n\t\tdata[:players].each do |a, d|\n\t\t\td.each do |t, amt|\n\t\t\t\tif t == :points && points_array.max == amt\n\t\t\t\t\treturn a\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend", "def sorted_scores(unsorted_scores, highest_score)\n score_counts = Array.new(101, 0) # 101 because it has to be inclusive of 100\n\n unsorted_scores.each do |score|\n score_counts[score] += 1\n end\n\n sorted_scores = []\n\n highest_score.downto(0) do |score|\n count = score_counts[score]\n\n count.times do |_time|\n sorted_scores.push(score)\n end\n end\n\n sorted_scores\nend", "def players_with_highest_score\n players.select{|player| player.score >= highest_player_score}\n end", "def season_with_fewest_games\n seasons = @games.group_by { |game| game.season }\n seasons.min_by { |season, games| games.count }.first\n end", "def highest_score\n sorted_all_scores = self.leaderboard_entries.order(score: :DESC)\n sorted_all_scores[0]\n end", "def most_common_nationalities_list\n nationalities_hash = self.players.group_by{\n |player| player.nationality\n }\n count_hash={}\n nationalities_string = nationalities_hash.map do |nationality, players|\n # puts \"Number of players from \" + nationality + \": \" + players.count.to_s\n count_hash[nationality]=players.count\n end\n count_hash.sort_by {|nationality, num| num}.reverse\n end", "def biggest_blowout\n score_difference = games.map { |game| (game.home_goals - game.away_goals).abs}\n score_difference.max\n end", "def highest_scoring_home_team\n @teams.max_by { |team| team.average_home_goals }.team_name\n end", "def most_points_scored\n stat_by_player = collect_stat_by_name(:points)\n player_with_max_stat = find_max_stat_by_player(stat_by_player)\n player_with_max_stat\nend", "def most_steals\r\n result={}\r\n game_hash.each do |k, v|\r\n v.each do| p, d|\r\n if p==:players\r\n d.each do |t, s|\r\n result[t]=s[:steals]\r\n end\r\n end\r\n end\r\n end \r\n result.max_by {|name, steal| steal}[0]\r\nend", "def competition_by_year\n \tresult = CompetitionResult.group_by_year(:created_at, format: '%Y').count\n \trender json: [{ name: 'Count', data: result}]\n end", "def highest_rank(arr)\n #make a unique array so that I am not checking the same number multiple times\n unique = arr.uniq\n res = []\n #check count the instances of each number in the original array and\n #create a hash with the count of instances, and the number.\n unique.each do |n|\n res.push({arr.count(n)=>n})\n end\n # sort by the count and value, and grab the last result as it will be the highest count\n res.sort_by!(&:first)\nreturn res[-1].first[1]\nend", "def most_goals_scored(team_id)\n team_id = team_id.to_i\n goals_per_game = @game_teams.map do |game|\n if game.team_id == team_id\n game.goals\n end\n end\n goals_per_game.compact.max\n end", "def top_winners\n max_val = history.list.values.map { |ary| ary.reduce(:-) }.max\n history.list.select { |_, val| val.reduce(:-) == max_val }.keys\n end", "def player_w_biggest_feet\n all_players[1].max_by { |stats| stats[:shoe] }\n end", "def highest_match_count\n match_count = Hash.new(0)\n\n @hand.each { |dice| match_count[dice] += 1 }\n\n match_count.values.max\n end", "def get_winners\n json = get_json('http://oscars.yipitdata.com/')\n json.results.collect do |films_array|\n find_winner(films_array.films).tap do |winner|\n winner[:year] = films_array.year[0,4]\n end\n end\n end", "def score\n regions.map(&:score).max\n end", "def most_points_scored\n most_points_scored = 0\n player_with_the_most_points_scored = \"\"\n game_hash.each do |team,info|\n info.each do |team_info,team_data|\n if team_data.is_a? (Array) \n if team_info != :colors\n team_data.each do |player_index|\n if most_points_scored == 0 || player_index[:points] > most_points_scored \n most_points_scored = player_index[:points]\n player_with_the_most_points_scored = player_index[:player_name]\n end\n end\n end\n end\n end\n end\n player_with_the_most_points_scored\nend", "def last_year\n record.records.order(:year).last&.year\n end", "def game_info(year, input)\r\n x = get_games(year, input).sort.to_h\r\n\r\n #determine if the team did not exist during the given year\r\n if x == {}\r\n puts \"The #{self.chosen_team_full_name} did not play any games in #{year}.\"\r\n end\r\n\r\n if self.chosen_team_full_name != nil\r\n self.chosen_team_nickname = self.chosen_team_full_name.split(\" \").last\r\n end\r\n\r\n counter = 0\r\n x.each do |key, value|\r\n counter += 1\r\n if value[\"home_team\"] == @chosen_team_full_name && value[\"home_team_score\"] > value[\"visitor_team_score\"]\r\n puts \"#{value[\"date\"]} -- #{value[\"visitor_team\"]}: #{self.chosen_team_nickname} win #{value[\"home_team_score\"]} to #{value[\"visitor_team_score\"]}.\".green\r\n sleep(0.2)\r\n elsif value[\"home_team\"] == @chosen_team_full_name && value[\"home_team_score\"] < value[\"visitor_team_score\"]\r\n puts \"#{value[\"date\"]} -- #{value[\"visitor_team\"]}: #{self.chosen_team_nickname} lose #{value[\"visitor_team_score\"]} to #{value[\"home_team_score\"]}.\".colorize(:red)\r\n sleep(0.2)\r\n elsif value[\"visitor_team\"] == @chosen_team_full_name && value[\"home_team_score\"] > value[\"visitor_team_score\"]\r\n puts \"#{value[\"date\"]} -- @#{value[\"home_team\"]}: #{self.chosen_team_nickname} lose #{value[\"home_team_score\"]} to #{value[\"visitor_team_score\"]}.\".colorize(:red)\r\n sleep(0.2)\r\n elsif value[\"visitor_team\"] == @chosen_team_full_name && value[\"home_team_score\"] < value[\"visitor_team_score\"]\r\n puts \"#{value[\"date\"]} -- @#{value[\"home_team\"]}: #{self.chosen_team_nickname} win #{value[\"visitor_team_score\"]} to #{value[\"home_team_score\"]}.\".colorize(:green)\r\n sleep(0.2)\r\n end\r\n \r\n if counter % 20 == 0\r\n puts \"Type 'n' if you do not want to see more games. Otherwise press 'Enter'\"\r\n input = gets.chomp \r\n\r\n if input == \"n\"\r\n break\r\n end\r\n\r\n end\r\n\r\n end\r\n end", "def get_coding_score(teamArr)\n response = []\n teamArr.each do |x|\n response << @preferences_hash[x][:codingProficiency]\n end\n response.uniq()\n \n return (response.size/5.0)\n #[0.2 - 1.0]\n end", "def highest_scoring_word\n \tScoring.highest_score_from(@words_played)\n end", "def highest_score_from(words)\n highest_score = 0\n winning_words = []\n words.each do |word|\n if score_word(word) > highest_score\n highest_score = score_word(word)\n winning_words.clear << word\n elsif score_word(word) == highest_score\n winning_words << word\n end\n end\n\n # no tie scenario\n if winning_words.count == 1\n return {word: winning_words[0], score: highest_score}\n else \n\n # tie scenario\n winning_words.each do |word|\n # determines whether word is 10 letters long\n if word.length == 10\n return {word: word, score: highest_score}\n end\n end\n # if there is no 10 letter word, find shortest word\n winner = winning_words.min_by do |word|\n word.length\n end \n\n return {word: winner, score: highest_score}\n end \nend", "def mode(array)\n frequency = Hash.new\n array.each do |x|\n array.count(x)\n frequency[x] = array.count(x)\n end\n\n most_frequent = Array.new\n max = frequency.max_by { |x, y| y}\n min = frequency.min_by { |x, y| y}\n if min == max\n frequency.each do |x,y| \n most_frequent = most_frequent.push(x)\n end\n else\n most_frequent[0] = max[0]\n end\n return most_frequent\nend", "def most_steal\n steals_array = []\n \n game_hash.each do |key, value|\n players = value[:players]\n players.each do |element|\n steals_array << element[:steals]\n end\n end\n steals_array.max\nend", "def count_plays(year)\n s = get_shakey[\"William Shakespeare\"]\n .select { |k, v|\n v[\"finished\"] == year\n }.each { |key, val|\n puts val[\"title\"]\n }.count\nend" ]
[ "0.68647105", "0.6307935", "0.6296469", "0.62223", "0.61982477", "0.6165472", "0.6069974", "0.5998808", "0.5993957", "0.595596", "0.59293747", "0.588681", "0.5848773", "0.5830429", "0.58126086", "0.5768919", "0.57469505", "0.5743014", "0.57253355", "0.5717104", "0.5709718", "0.56947607", "0.5670004", "0.56698614", "0.5660406", "0.5653754", "0.56478834", "0.5638419", "0.5638193", "0.5634143", "0.5617328", "0.56132716", "0.560633", "0.55961156", "0.5562874", "0.55546784", "0.5548228", "0.5543179", "0.5540654", "0.5539984", "0.5532334", "0.55298334", "0.55264753", "0.55207336", "0.5513417", "0.5509917", "0.5486266", "0.54823214", "0.5478326", "0.54734004", "0.5471687", "0.54643685", "0.54585755", "0.54568404", "0.5449734", "0.54462177", "0.54343253", "0.54297435", "0.5425237", "0.5422967", "0.54097676", "0.540662", "0.5406292", "0.53944284", "0.53881335", "0.53818184", "0.5377049", "0.53737915", "0.5373012", "0.5369145", "0.536647", "0.5365517", "0.53622884", "0.53545946", "0.5350797", "0.53488785", "0.53466", "0.5338868", "0.53387624", "0.533118", "0.5330212", "0.53209484", "0.5317738", "0.5311533", "0.5310648", "0.5308842", "0.5298185", "0.5295989", "0.5290802", "0.5285264", "0.5284059", "0.5280032", "0.527809", "0.5275444", "0.527366", "0.52691615", "0.5268981", "0.5268927", "0.52575135", "0.5256988" ]
0.80797416
0